Scriptname FCMSummonMaidScript extends activemagiceffect  

ObjectReference Property pMaidRef  Auto  
Bool Property pIsSpectral Auto
Bool Property pIsArmed Auto
Keyword Property pSummonMaidMagicKeyword Auto

Event OnEffectStart(actor akTarget, actor akCaster)
    (pMaidRef as FCMSpectralMaidScript).SetIsSpectral(pIsSpectral)
    (pMaidRef as FCMMaidArmedScript).SetIsArmed(pIsArmed)
    (pMaidRef as FCMConjurableMaidScript).TryConjure()
EndEvent


Event OnEffectFinish(actor akTarget, actor akCaster)
    if (Game.GetPlayer().hasMagicEffectWithKeyword(pSummonMaidMagicKeyword))
        Debug.Trace("Player still have return magic effect")
    else
        Debug.Trace("Start Returning")
         (pMaidRef as FCMConjurableMaidScript).TryReturn()
    endif 
endEvent