Script Error question

Post » Wed Jun 20, 2012 11:24 pm

I'm trying to make a script that I can basically just attach to every actor, and then they'll be damaged by weapons according to their keywords (I'm setting the actual damage on every weapon in the game to 0). So this is what I'm attaching to the actor:

Scriptname d20damaged extends ActorKeyword Property d2damager autoKeyword Property d4damager autoKeyword Property d6damager autoKeyword Property d8damager autoKeyword Property d10damager autoKeyword Property d12damager autoEvent OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile)  if akWeapon.HasKeyword(d2damager) ==1  int d2random = Utility.randomint(1,2) *-1   (self as actor).ModAV("health", d2random)  endif  if akWeapon.HasKeyword(d4damager) ==1  int d4random = Utility.randomint(1,4) *-1   (self as actor).ModAV("health", d4random)  endif  if akWeapon.HasKeyword(d6damager) ==1  int d6random = Utility.randomint(1,6) *-1   (self as actor).ModAV("health", d6random)  endif  if akWeapon.HasKeyword(d8damager) ==1  int d8random = Utility.randomint(1,8) *-1   (self as actor).ModAV("health", d8random)  endif  if akWeapon.HasKeyword(d10damager) ==1  int d10random = Utility.randomint(1,10) *-1   (self as actor).ModAV("health", d10random)  endif  if akWeapon.HasKeyword(d12damager) ==1  int d12random = Utility.randomint(1,12) *-1   (self as actor).ModAV("health", d12random)  endifEndEvent

and this is the error it throws that I don't know what it is/what to do about it

Starting 1 compile threads for 1 files...Compiling "d20damaged"...c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\d20damaged.psc(11,1): the parameter types of function onhit in the empty state on script d20damaged do not match the parent script objectreferenceNo output generated for d20damaged, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on d20damaged

Thoughts?
User avatar
Alessandra Botham
 
Posts: 3440
Joined: Mon Nov 13, 2006 6:27 pm

Post » Wed Jun 20, 2012 6:17 pm

Nvm, found out I had the OnHit copied from the wrong page of the wiki.
User avatar
Romy Welsch
 
Posts: 3329
Joined: Wed Apr 25, 2007 10:36 pm

Post » Wed Jun 20, 2012 7:39 pm

Hmmm. It's working, but unfortunately the "health bar" that enemies display never actually goes down, it stays at 100% until the enemy suddenly dies. Here's the modified script:

Scriptname d20damaged extends ActorKeyword Property d2damager autoKeyword Property d4damager autoKeyword Property d6damager autoKeyword Property d8damager autoKeyword Property d10damager autoKeyword Property d12damager autoEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)  if akSource.HasKeyword(d2damager) ==1  int d2random = Utility.randomint(1,2) *-1   (self as actor).ModAV("health", d2random)  endif  if akSource.HasKeyword(d4damager) ==1  int d4random = Utility.randomint(1,4) *-1   (self as actor).ModAV("health", d4random)  endif  if akSource.HasKeyword(d6damager) ==1  int d6random = Utility.randomint(1,6) *-1   (self as actor).ModAV("health", d6random)  endif  if akSource.HasKeyword(d8damager) ==1  int d8random = Utility.randomint(1,8) *-1   (self as actor).ModAV("health", d8random)  endif  if akSource.HasKeyword(d10damager) ==1  int d10random = Utility.randomint(1,10) *-1   (self as actor).ModAV("health", d10random)  endif  if akSource.HasKeyword(d12damager) ==1  int d12random = Utility.randomint(1,12) *-1   (self as actor).ModAV("health", d12random)  endifEndEvent
User avatar
ijohnnny
 
Posts: 3412
Joined: Sun Oct 22, 2006 12:15 am

Post » Wed Jun 20, 2012 10:47 pm

Fixed, used DamageAV in place of ModAV and got rid of the *-1
User avatar
Chris Jones
 
Posts: 3435
Joined: Wed May 09, 2007 3:11 am

Post » Wed Jun 20, 2012 7:07 pm

I thought that the damage in Torment was based on X rolls of Y sided dice?
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Wed Jun 20, 2012 7:56 am

You may find this function useful in your project:

int function RollDice(int Number, int type) global ; Return the result of rolling number Dice with type sides each.; example: If Number = 3, and Type = 6, that is a roll of 3D6 in standard RPG notation.    int count=0    int Value=http://forums.bethsoft.com/topic/1362920-script-error-question/0    while count < Number        Value += RandomInt(1,type)        count += 1    endwhile    return Valueendfunction
User avatar
Emzy Baby!
 
Posts: 3416
Joined: Wed Oct 18, 2006 5:02 pm


Return to V - Skyrim