eleglas Posted April 7, 2009 Share Posted April 7, 2009 I have been trying to make a script that will cause nanobots (armor) to reset my health to 100% if my health falls below 50%. But, I want it to keep a track on my health and reset it if the condition above is met, however it won't reset my health unless I unequip it and then equip it again. Here is my code: SCN ResetHealth2 Ref GetHealth Begin ScriptEffectStart Set GetHealth to player.gethealthpercentage If GetHealth <= 50 Player.Resethealth Endif END Any help would be great. Thanks Link to comment Share on other sites More sharing options...
TGBlank Posted April 7, 2009 Share Posted April 7, 2009 Change scripteffectstart with scripteffectupdateUse a [codebox ] next time you want to post code. Link to comment Share on other sites More sharing options...
Cipscis Posted April 7, 2009 Share Posted April 7, 2009 Why are you using a "ref" variable to hold a regular value? These variables should be used to store FormIDs, "int" variables should be used to store integer values, and "float" variables should be used to store floating point values. That said, you really don't need to use a variable to store the result of "player.GetHealthPercentage" anyway, as you can place this directly in your condition:if player.GetHealthPercentage < 0.5You'll want to note that GetHealthPercentage returns a value between 0 and 1, as opposed to returning a value between 0 and 100. Cipscis Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.