enderalse/source/scripts/playerhorsescript.psc

46 lines
1.1 KiB
Plaintext

Scriptname PlayerHorseScript extends ReferenceAlias
Event OnDeath(Actor akKiller)
MySelf = GetActorReference()
_00E_HorseOwned.SetValue(0)
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.GetRef().SetFactionOwner(StablesFaction)
EndIf
EndEvent
Event OnPlayerLoadGame()
If (_00E_HorseOwned.GetValue() as Int) > 0
String sHorseName = (GetOwningQuest() as _00E_NQ06_Functions).sHorseName
if sHorseName != ""
(GetReference() as Actor).GetActorBase().SetName(sHorseName)
endif
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