moopdog Posted December 2, 2016 Author Share Posted December 2, 2016 I ain't done yet. You showed some initiative here. Scriptname ft_CommandScript extends activemagiceffect Spell property MonitorAbility Auto Int MoralityValue Event OnEffectStart(Actor akTarget, Actor akCaster) MoralityValue = akTarget.GetActorValue("Morality") akTarget.AddSpell(MonitorAbility) akTarget.SetDoingFavor() akTarget.SetActorValue("Morality", 0) Event OnEffectFinish(Actor akTarget, Actor akCaster) ;Debug.Notification("Morality is now " + akTarget.GetActorValue("Morality")) akTarget.RemoveSpell(MonitorAbility) akTarget.SetActorValue("Morality", MoralityValue) akTarget.SetDoingFavor(false) EndEvent Aaaaaand that's a double-wrap. Appending "as int" to the "MoralityValue = akTarget.GetActorValue("Morality")" causes the script to work perfectly and look quite clean as well. Scriptname ft_CommandScript extends activemagiceffect Spell property MonitorAbility Auto Int MoralityValue Event OnEffectStart(Actor akTarget, Actor akCaster) MoralityValue = akTarget.GetActorValue("Morality") as int ;Debug.Notification("Morality was " + MoralityValue) akTarget.AddSpell(MonitorAbility) akTarget.SetDoingFavor() akTarget.SetActorValue("Morality", 0) ;Debug.Notification("Morality is now " + akTarget.GetActorValue("Morality")) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget.RemoveSpell(MonitorAbility) akTarget.SetActorValue("Morality", MoralityValue) ;Debug.Notification("Morality is now " + akTarget.GetActorValue("Morality")) akTarget.SetDoingFavor(false) EndEvent When not commented out, all the debug.notifications behave as expected, and there's nothing going wrong with any other part of the script, either. Highest kudos to you. I appreciate your help very much. Link to comment Share on other sites More sharing options...
Masterofnet Posted December 2, 2016 Share Posted December 2, 2016 Interesting. You needed to put ( as int ) to get it to fill MoralityValue. You may not need the MonitorAbility. You should be able to put the first script with this one. Keep up the good work! :devil: Link to comment Share on other sites More sharing options...
Recommended Posts