Jump to content

scripting assistance


bioshards

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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