enderalse/source/scripts/_00e_greetingtriggerscript.psc

42 lines
950 B
Plaintext
Raw Normal View History

Scriptname _00E_GreetingTriggerScript extends ObjectReference
ActorBase Property GreeterBase Auto
Topic Property GreetingDialogueTopic Auto
Faction Property GreetingFaction Auto
Actor Property PlayerRef Auto
Actor akGreeter
Bool bGreetingCocked
Event OnTriggerEnter(ObjectReference triggerRef)
If triggerRef != PlayerRef || bGreetingCocked
Return
EndIf
bGreetingCocked = True
Utility.Wait(1.0)
akGreeter = Game.FindClosestReferenceOfTypeFromRef(GreeterBase, PlayerRef, 1024.0) as Actor
If akGreeter
akGreeter.AddToFaction(GreetingFaction)
akGreeter.Say(GreetingDialogueTopic)
EndIf
RegisterForSingleUpdate(5.0)
EndEvent
Event OnUpdate()
If akGreeter
; Force remove akGreeter from GreetingFaction, it's too late to make a sale pitch.
akGreeter.RemoveFromFaction(GreetingFaction)
akGreeter = None
EndIf
If PlayerRef.IsInInterior() == False
bGreetingCocked = False
Else
RegisterForSingleUpdate(2.0)
EndIf
EndEvent