Jokerine Posted November 24, 2015 Share Posted November 24, 2015 Hello, everybody! I have a little question for you this morning: is it possible to use percentages when using ModAV in a script? To clarify, someone requested a mod for NV to imitate the rads effect from FO4, which lowers your health depending on how high your rads level is. According to Wikia, you lose 1% of health every 10 rads. So I was thinking a little quest script with something along the lines of "PlayerREF.ModActorValue Health XX" would probably do the trick, with maybe a timer. Or maybe I could mess with the rads effect directly instead, dunno. I could just make it so you lose one point of health, but that just isn't the same... So, anybody knows if it's possible to use percentages, like with GetHealthPercentage? I couldn't see anything in the GECK wiki about it. Then again I literally just woke up and haven't had any coffee yet, haha :sleep: Please let me know! Thank you :) Link to comment Share on other sites More sharing options...
Belthan Posted November 24, 2015 Share Posted November 24, 2015 Don't know of a way to directly modav by a percentage, but you could calculate it, e.g. SHORT CurrentRads SHORT LastRadCheck SHORT RadChange SHORT MaxHealth SHORT HealthChange SHORT CumulativeDebuff if CumulativeDebuff == 0 ; Permanent AV changes not only when player levels up, ; but also when we debuff health for rad effect. ; So, only update max health when the debuff is zero. set MaxHealth to PlayerREF.GetPermanentActorValue Health endif set CurrentRads to PlayerREF.getav RadiationRads set RadChange to CurrentRads - LastRadCheck if RadChange != 0 set LastRadCheck to CurrentRads set HealthChange to ((RadChange / -1000) * MaxHealth) PlayerREF.modav Health HealthChange set CumulativeDebuff to CumulativeDebuff + HealthChange endifFull disclosure: this is entirely theoretical and untested. EDIT: If the player has low health and high rads the first time this script runs, it could instantly kill them. Probably a good idea to have the ability to toggle the feature on and off, and warn the player about the dangers before they activate it. Link to comment Share on other sites More sharing options...
Jokerine Posted November 24, 2015 Author Share Posted November 24, 2015 (edited) Cool beans on a stick, thank you, Belthan! I'll mess with this tomorrow or the day after and see how it fares. You rock! :wub: Edited November 24, 2015 by Jokerine Link to comment Share on other sites More sharing options...
Recommended Posts