littleerve Posted October 28, 2017 Share Posted October 28, 2017 I'm going nuts trying to figure this out. If I add to a vaActorValue on an object mod, it seems to apply to that item and not the player, how can I change an Actor Value on the player via a form/script? Link to comment Share on other sites More sharing options...
littleerve Posted October 28, 2017 Author Share Posted October 28, 2017 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 ConditionalActor Property PlayerRef AutoActorValue Property HealthAV AutoEvent 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)EndEventEvent 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 More sharing options...
JonathanOstrus Posted October 29, 2017 Share Posted October 29, 2017 Well the values are supposed to be floats, and there's known rounding issues when converting floats to ints and back. I'm not clear what you saw by "drift"? Can you elaborate? Link to comment Share on other sites More sharing options...
littleerve Posted October 30, 2017 Author Share Posted October 30, 2017 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 ConditionalActor Property PlayerRef AutoActorValue Property HealthAV AutoEvent OnEffectStart(Actor akCaster, Actor akTarget) float CurrentHP = Math.Floor(PlayerRef.GetValue(HealthAV)) float ModHP = Math.Floor(CurrentHP * 0.15) PlayerRef.ModValue(HealthAV, ModHP)EndEventEvent 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 More sharing options...
shavkacagarikia Posted October 30, 2017 Share Posted October 30, 2017 Using script is not a good way to modify actor values. For your case you should make a new enchantemt, then add value modifier type magic effect there which will modify needed avif by needed magnitude Link to comment Share on other sites More sharing options...
Recommended Posts