Jump to content

[NV] ModAV percentage?


Jokerine

Recommended Posts

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

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
endif

Full 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

  • Recently Browsing   0 members

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