Scriptname FCMMaidArmedScript extends Actor  

WEAPON Property BoundBow  Auto  

WEAPON Property BoundBattleAxe  Auto  

Ammo Property boundArrow  Auto  

GlobalVariable Property ArmedFlag  Auto

Location Property HomeLocation Auto

Bool Function TryAddBoundWeapons()
        ArmedFlag.SetValue(1)
    If(HasBoundWeapons())
        return False
    Else
        AddItem(BoundBow, 1)
        AddItem(BoundBattleAxe, 1)
        AddItem(BoundArrow, 1)
        return True
    EndIf
EndFunction

Bool Function TryRemoveBoundWeapons()
    ArmedFlag.SetValue(0)
    If(HasBoundWeapons())
        RemoveItem(BoundBow, 1)
        RemoveItem(BoundBattleAxe, 1)
        RemoveItem(BoundArrow, 1)
        return True
    Else
        return False
    EndIf
EndFunction

Bool Function HasBoundWeapons()
    return GetItemCount(BoundBow)
EndFunction

Function SetIsArmed(Bool b)
    if(b)
        TryAddBoundWeapons()
    else
        TryRemoveBoundWeapons()
    endif
EndFunction

Event OnLocationChange(Location oldLoc, Location newLoc)
    If(newLoc == HomeLocation)
        SetIsArmed(False)
    EndIf
EndEvent