Jump to content

How can I change an AV assigned to the player via form/script


littleerve

Recommended Posts

I got it half working, but I think I have a rounding problem, the values slowly drift

(I was just trying int vs float, this is where I got up to)

 

 

Scriptname HPBuff extends activemagiceffect Conditional

Actor Property PlayerRef Auto
ActorValue Property HealthAV Auto


Event OnEffectStart(Actor akCaster, Actor akTarget)
int CurrentHP = PlayerRef.GetValue(HealthAV) as int
int ModHP = (CurrentHP * 0.15) as int
PlayerRef.ModValue(HealthAV, ModHP as int)
EndEvent

Event OnEffectFinish(Actor akCaster, Actor akTarget)
int CurrentHP = PlayerRef.GetValue(HealthAV) as int
int NewHP = ((CurrentHP / 1.15) - CurrentHP) as int
PlayerRef.ModValue(HealthAV, NewHP as int)
EndEvent

Link to comment
Share on other sites

Yeah, I just went back to floats, it works consistently, it just adds a couple of points to the HP pool for some reason, but it's fine now, probably not refined, but it works:

 

Scriptname LegHPInc extends activemagiceffect Conditional

Actor Property PlayerRef Auto
ActorValue Property HealthAV Auto

Event OnEffectStart(Actor akCaster, Actor akTarget)
float CurrentHP = Math.Floor(PlayerRef.GetValue(HealthAV))
float ModHP = Math.Floor(CurrentHP * 0.15)
PlayerRef.ModValue(HealthAV, ModHP)
EndEvent

Event OnEffectFinish(Actor akCaster, Actor akTarget)
float CurrentHP = Math.Ceiling(PlayerRef.GetValue(HealthAV))
float NewHP = Math.Ceiling((CurrentHP / 1.15) - CurrentHP)
PlayerRef.ModValue(HealthAV, NewHP)
EndEvent

 

Now to make more Legendary effects.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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