Darktrooper117 Posted July 10, 2016 Share Posted July 10, 2016 I'm working on an Auto-RadAway script, but I've hit a snag. I based my code on my already successful Auto-Hydration script, which is included as a component. Below is a segment of my code. Believe me when I say the rest of the code won't fit within a reasonably sized post, as this script does far more than manage radiation. (The rest of the code not shown is confirmed to function as intended) If (SuitOperator.GetValue(Rads) >= RadDanger) ;If (OperatorRadLevel >= RadDanger) If(!RadAwayCooldown && (SuitOperator.GetItemCount(RadAway) > 0)) If (SuitOperator.GetValue(HC_ThirstEffect) <= Dehydrated) SuitOperator.EquipItem(RadAway) RadAwayCooldown = true StartTimer(CooldownRadAway, RadAwayID) ImmunityDown = true StartTimer(ImmuneSystemDown, ImmunityDownID) EndIf EndIf EndIf Where Rads is an ActorValue just like HC_ThirstEffect, RadDanger is a float just like Dehydrated, and SuitOperator is the actor wearing the armor piece in question. I've already confirmed that the timers and equipitems all work and that my If statements are properly formatted (though I may have messed up and EndIf during the copy to here). When I run a Auto-Hydrate script, it works perfectly fine, so I can only assume there's something wrong with the Rads or where I am getting them from, though I took the format from conversation triggers in the Creation Kit. Link to comment Share on other sites More sharing options...
scrivener07 Posted July 10, 2016 Share Posted July 10, 2016 Nothing about your snippet jumps out at me like it wouldnt function. What details am I missing that has you convinced the problem is within your posted snippet? I understand the need to keep things brief but if your code is to large to reasonably be posted, then thats an indication your script is too large and does too many things (of course exceptions to every rule). You should at least mention the extending script type and post the entire method and body. Other things you should explore are your papyrus logs for errors in case you forgot to fill a property or attach a script in the CK. Creating your own trace logs is also very useful in tracking down issues. Link to comment Share on other sites More sharing options...
Darktrooper117 Posted July 10, 2016 Author Share Posted July 10, 2016 I just figured out what I did wrong. I forgot to start the timer for the Rad check in the OnEffectStart area, so that automatic diagnostic wasn't running at all. Going to check now in game. Link to comment Share on other sites More sharing options...
Darktrooper117 Posted July 10, 2016 Author Share Posted July 10, 2016 It finally works! The entire thing works! Here's the whole script: https://www.dropbox.com/s/9jlxf6qhj1q6d2w/PA_AutoDocScript.psc?dl=0 Link to comment Share on other sites More sharing options...
scrivener07 Posted July 10, 2016 Share Posted July 10, 2016 Nice power armor mod. Is this for a medic kind of variant? I see some room for improvement on the script side though. You are constantly polling for radiation, health, and addiction changes. There are already events for catching these changes directly like OnRadiationDamage, OnMagicEffectApply, and OnHit. If its not broke then dont fix it I guess. Link to comment Share on other sites More sharing options...
Darktrooper117 Posted July 11, 2016 Author Share Posted July 11, 2016 Nice! I was wondering what would let me properly trigger Antibiotics! I'll put those to good use! Link to comment Share on other sites More sharing options...
Recommended Posts