ScriptName _amm_AirshipTriggerScript Extends ObjectReference

; PROPERTIES

Actor Property acPlayer Auto
ObjectReference[] Property orArrivalMarkers Auto
ObjectReference[] Property orDisableMarkers Auto
GlobalVariable Property gvDestination Auto
GlobalVariable Property gvDeparture Auto
GlobalVariable Property gvGameDaysPassed Auto

Int iDest
Int iDepart

Event OnTriggerEnter(ObjectReference akActionRef)

	; Trigger only activated by the player and if a destination has been chosen
	iDest = gvDestination.GetValue() As Int
	iDepart = gvDeparture.GetValue() As Int
	
	If (akActionRef == acPlayer && iDest != 99)
		; Fast travel to the new destination
		orDisableMarkers[iDest].Enable()
		Game.FastTravel(orArrivalMarkers[iDest])
		Utility.Wait(1)
		; Disable airship, talking activator and markers at departure site
		orDisableMarkers[iDepart].Disable()
		gvDeparture.SetValue(iDest)
		gvDestination.SetValue(99)
	EndIf

EndEvent
