Jump to content

[LE] Moving an item stolen by commanded actor to the player's inventory


moopdog

Recommended Posts

 

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

  • Recently Browsing   0 members

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