ABVXYzackattack Posted July 19, 2011 Share Posted July 19, 2011 Hey I'm working on an idea for a new Medic Power Armor idea. The part of the script I'm having trouble with is this part: If Player.GetHealthPercentage <= 0.25 set injured to 1 endif If Injured == 1 && timer == 0 player.additem ZStimpak 1 1player.equipitem ZStimpak 0 1 set timer to (timer + GetSecondsPassed) endif if timer >= 20 && injured == 1 set timer to 0 endif If player.gethealthpercentage > 0.25 && equipped == 1 set injured to 0 endif This should, when your health is at or bellow 25%, inject you with a stimpak once every 20 seconds, however not informing you that it did. However, it keeps infinitely making the sound of the injection of the stimpak, causing the game to run incredibly slowly and laggy. What shoulld I fix? The second one is quite simple, but a very odd result: scn ZPsychoRemoteScript Begin ScriptEffectStart player.additem ZPsycho 1 1player.equipitem ZPsycho 0 1player.additem ZPsychoRemote 1 1showmessage ZPsychoMessage End This simply re-adds the Psycho Injector into your inventory after using, while applying the normal effects of Psycho. However, for some reason, upon using it, the entire game exits out, without even informing me that something went wrong, or that it stopepd responding. WTF is up with this one too??? Link to comment Share on other sites More sharing options...
rickerhk Posted July 20, 2011 Share Posted July 20, 2011 If Player.GetHealthPercentage <= 0.25 set injured to 1 else set injured to 0 endif if timer <= 0 If Injured == 1 player.additem ZStimpak 1 1 player.equipitem ZStimpak 0 1 set timer to 20 endif else set timer to (timer - GetSecondsPassed) endif Not sure about your second problem. The script looks ok to me. Link to comment Share on other sites More sharing options...
ABVXYzackattack Posted July 20, 2011 Author Share Posted July 20, 2011 Hey I looked over your script, and it worked just fine, except the sound file still exists. I think I have a solution:Every day, it will supply you with a counter that allows you to only use 10 stims a day. So like every 24 hours, you can use 10 stims. Here's what it looks like: If Player.GetHealthPercentage <= 0.25 set injured to 1 set day to GetDayofWeekelse set injured to 0endif if timer <= 0 If Injured == 1 && StimSupply >= 0 player.additem ZStimpak 1 1 player.equipitem ZStimpak 0 1 set timer to 20 set StimSupply to (StimSupply - 1) endifelse set timer to (timer - GetSecondsPassed)endif if Day != GetDayofWeek set StimSupply to 10 endif Does this look alright? Link to comment Share on other sites More sharing options...
rickerhk Posted July 21, 2011 Share Posted July 21, 2011 I don't know why the stimpak sound would be repeating - but health gain doesn't? Maybe a bug. Try equipping without the 0 1 flags. Is ZStimpak an exact copy of StimPak? Maybe a workaround would be to use cios and playsound.You can use two variables CurrentDay and PreviousDay to track when a day has changed. set Currentday to GetDayofWeek If Player.GetHealthPercentage <= 0.25 set injured to 1 else set injured to 0 endif if timer <= 0 If Injured == 1 && StimSupply >= 0 player.cios ZStimpak player.PlaySound NPCHumanUsingStimpak set timer to 20 set StimSupply to (StimSupply - 1) endif else set timer to (timer - GetSecondsPassed) endif if PreviousDay != CurrentDay set StimSupply to 10 set PreviousDay to CurrentDay endif Link to comment Share on other sites More sharing options...
stevie70 Posted July 21, 2011 Share Posted July 21, 2011 I don't know why the stimpak sound would be repeating - but health gain doesn't? Maybe a bug. just to start with the simplest guess, i'd suggest checking if the stimpack-equipping-sound has accidentially been set to "loop" Link to comment Share on other sites More sharing options...
Recommended Posts