dargon01 Posted July 4, 2016 Share Posted July 4, 2016 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 EndifEndEvent 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 More sharing options...
Pokepunch Posted July 4, 2016 Share Posted July 4, 2016 If you need to do something when the player kills an actor you can use the OnKill event. Link to comment Share on other sites More sharing options...
KataPUMB Posted July 4, 2016 Share Posted July 4, 2016 (edited) 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 July 4, 2016 by KataPUMB Link to comment Share on other sites More sharing options...
dargon01 Posted July 4, 2016 Author Share Posted July 4, 2016 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") EndIfEndEvent I already tried OnEffectStart() doesn't work too Link to comment Share on other sites More sharing options...
dargon01 Posted July 4, 2016 Author Share Posted July 4, 2016 Btw I'm putting this effect in a enchantment so that I can apply it on a gun mod Link to comment Share on other sites More sharing options...
Pokepunch Posted July 4, 2016 Share Posted July 4, 2016 How are you attaching the script? Link to comment Share on other sites More sharing options...
dargon01 Posted July 4, 2016 Author Share Posted July 4, 2016 then I make an enchantment and in the weapon mod I attach the enchantment Link to comment Share on other sites More sharing options...
dargon01 Posted July 4, 2016 Author Share Posted July 4, 2016 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 EndifEndEvent without the condition GetDead = 0, it counts 1-hit killbut the problem is if I shoot the dead corpse I still get the effect Link to comment Share on other sites More sharing options...
Pokepunch Posted July 4, 2016 Share Posted July 4, 2016 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 More sharing options...
dargon01 Posted July 4, 2016 Author Share Posted July 4, 2016 Nope doesn't work either do you think I need to check some flags? Link to comment Share on other sites More sharing options...
Recommended Posts