Jump to content

Recommended Posts

Posted

You need to be more specific. Is this just a check for how much HP the actor currently has left, or do you want to consider how much damage the actor has lost over time?

Posted (edited)

ref Wearer

ref rMe

float fHealthPercent

float fTimer

 

Begin OnAdd

 

let Wearer := GetContainer

let rMe := GetSelf ; * if that doesn't work, use the name of the hat

 

End

 

Begin GameMode

 

let fTimer += GetSecondsPassed

if fTimer < 1 ; * run at most once per second

return

endif

let fTimer := 0

 

let fHealthPercent := (Wearer.GetAV "Health") / Wearer.GetBaseHealth

 

if fHealthPercent < 0.4

Wearer.Drop rMe

endif

 

End

Edited by Hemingway308
Posted

Haha, yeah thats justified, I actually had a mistake in the that code (forgot the 'let fTimer := 0'). If you do the timer that way it will work though, the mistake is not incrementing a float- either they use an int or just check GetSecondsPassed (which returns something like 0.05). Use that (edited) code and it will work though. ;)

 

If you skip the timer then a game mode block (except quests) will run every frame, so 30-120 times per second. So, a waste of resources. Also, that script will run when the hat is not equipped, if you want to stop that, use IsEquipped (new nvse), or Wearer.GetEquipped MyHat.

Posted
Is there a way i can check if its equiped? My character keeps dropping the hats even when the hat isnt equiped, its also very strange seeing my character dropping 20 hats for no reason like sonic dropping rings
  • Recently Browsing   0 members

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