Jump to content

Problem with one-hit kill


Recommended Posts

So the problem is the mod works fine when it takes more than 1 hit to kill the npc, but when I One-hit kill something the script doesn't seem to apply. Here's the script

 

Scriptname NUHealthRec extends activemagiceffect
Int Property RandomV Auto Const
ActorValue Property HP Auto Const
Event OnEffectFinish(actor akTarget, actor akCaster)
if akTarget.IsDead() == 1
Int roll = utility.RandomInt(1, 100)
If (roll <= RandomV)
Float temp9 = 9999 as Float
akCaster.RestoreValue(HP, temp9)
Debug.MessageBox("Full HP")
EndIf
Endif
EndEvent
Have any ideas on why that happens? BTW this script is supposed to refill player's HP when something is killed.
P.s: sorry for my English.
Link to comment
Share on other sites

Gess the problem is that the event is not being registered if you one shot an actor because OnEffectFinish() does not have time to be aplied. Try using OnEffectStart()

Edited by KataPUMB
Link to comment
Share on other sites

the Onkill Event doesn't seem to work

Scriptname NUHealthRec extends activemagiceffect
Int Property RandomV Auto Const
ActorValue Property HP Auto Const
Event OnKill(actor akVictim)
Int roll = utility.RandomInt(1, 100)
If (roll <= RandomV)
Float temp9 = 9999 as Float
Game.GetPlayer().RestoreValue(HP, temp9)
Debug.MessageBox("Full HP")
EndIf
EndEvent
I already tried OnEffectStart() doesn't work too
Link to comment
Share on other sites

It seems that If I use this script:

Scriptname NUHealthRec extends activemagiceffect
Int Property RandomV Auto Const
ActorValue Property HP Auto Const
Event OnEffectFinish(actor akTarget, actor akCaster)
if akTarget.IsDead() == 1
Int roll = utility.RandomInt(1, 100)
If (roll <= RandomV)
Float temp9 = 9999 as Float
akCaster.RestoreValue(HP, temp9)
Debug.MessageBox("Full HP")
EndIf
Endif
EndEvent
without the condition GetDead = 0, it counts 1-hit kill
but the problem is if I shoot the dead corpse I still get the effect
Link to comment
Share on other sites

Try this:

Scriptname NUHealthRec extends activemagiceffect
 
Int Property RandomV Auto Const
 
ActorValue Property HP Auto Const

Event OnDeath(Actor akKiller)
	Int roll = utility.RandomInt(1, 100)
	If (roll <= RandomV)
		Float temp9 = 9999 as Float
		akKiller.RestoreValue(HP, temp9)
		Debug.MessageBox("Full HP")
	EndIf
EndEvent 

Now that I know the script is being applied to the target I can see that instead of OnKill you should use OnDeath.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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