Scriptname PlayerHorseScript extends ReferenceAlias  

Event OnDeath(Actor akKiller)
	MySelf = GetActorReference()
	_00E_HorseOwned.SetValue(0 as float)
EndEvent

Event OnUnload()
	If MySelf.IsDead()
		; disable the dead horse if it is unloaded
		MySelf.Disable()
		MySelf.Delete()
		(GetOwningQuest() as _00E_NQ06_Functions).sHorseName = ""
		; added a new horse that can be bought at the stables
		Myself = StablesPosition.PlaceActorAtMe(LvlHorseSaddled)
		Alias_HorseRef.ForceRefTo(MySelf)
		Alias_HorseRef.GetReference().SetFactionOwner(StablesFaction)
	EndIf
EndEvent

Actor Property MySelf  Auto  

ObjectReference Property StablesPosition  Auto  

ActorBase Property LvlHorseSaddled  Auto  

ReferenceAlias Property Alias_HorseRef  Auto  

Faction Property StablesFaction  Auto  

GlobalVariable Property _00E_HorseOwned  Auto