Jump to content

A script for damaging whichever actor kills another actor.


antstubell

Recommended Posts

So I'm using this script to damage the player when my exploding rat... explodes.

 

Explosion PROPERTY MyBang auto ; explosion like fire attronach to show damage
GlobalVariable Property SkBang Auto
Message PROPERTY MyMSG auto

EVENT OnDying(Actor akKiller)
IF (akKiller == Game.GetPlayer())
myF_Action(akKiller)
ENDIF
ENDEVENT


FUNCTION myF_Action(Actor player)
;--------------------------------
self.PlaceAtMe(MyBang) ; exlosion near of skeever corpse
player.DamageActorValue("Health", 50) ; let the player damage by 50 hit points
If SkBang.GetValue() == 0
MyMSG.show()
SkBang.SetValue(1)
Endif
ENDFUNCTION

 

 

But other NPCs who kill the exploding rat take no damage. Is this script able to be modified to damage any NPC who kills a rat or is a new script needed?

If a new script is needed I honestly don't know how to script it so that the explosion appears on the rat and damages the NPC.

 

EDIT: Spell checker - femmage is a word?

Edited by antstubell
Link to comment
Share on other sites

If this script is on the rat or an alias pointing to the rat just remove the condition check that akKiller be equal to the player. Run the function regardless of who kills the rat. i.e.

 

 

Explosion PROPERTY MyBang auto ; explosion like fire attronach to show damage
GlobalVariable Property SkBang Auto
Message PROPERTY MyMSG auto

EVENT OnDying(Actor akKiller)
  IF akKiller
    myF_Action(akKiller)
  ENDIF
ENDEVENT

FUNCTION myF_Action(Actor myKiller)
;--------------------------------
  self.PlaceAtMe(MyBang) ; exlosion near of skeever corpse
  myKiller.DamageActorValue("Health", 50) ; let the killer be damaged by 50 hit points
  If SkBang.GetValue() == 0
    MyMSG.show()
    SkBang.SetValue(1)
  Endif
ENDFUNCTION

 

 

Link to comment
Share on other sites

You don't need to use a script at all for this, i think you have fall into a "Only With Scripts Logic".


Use only the explosion:

1) Make a unique explosion ID, and then just modify its "Force" and "Damage".

OR

2) With the same unique explosion ID create a destruction "Enchantment" and assign it to the explosion, this way you have control of the damage that the "Enchantment" / explosion can or cannot be applied to.

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...