SetOnFastTravelEventHandler

From GECK
Jump to: navigation, search


A function added by the JIP NVSE Plugin.

Description

Sets/removes the specified UDF Script as a handler that will be invoked in the event the player fast-travels to a Map Marker. When invoked, the script is passed with a single argument: the Marker reference traveled to, which may or may not be an actual Map Marker base object (hardcoded form ID 10).

Syntax

[help]
SetOnFastTravelEventHandler handlerScript:ref setORremove:1/0

Example

SetOnFastTravelEventHandler OnPCFastTravelUDF 1

Sets the OnPCFastTravelUDF script as a handler.

SetOnFastTravelEventHandler OnPCFastTravelUDF 0

Removes the OnPCFastTravelUDF script as a handler.

Handler Script

This skeleton handler script illustrates how to retrieve what would be the real Map Marker reference that the player clicked in the Pip-Boy map, in the event it has a linked marker where the player is set to appear:

scn	OnPCFastTravelUDF

ref	rMapMarkerRef
ref	rMapMarkerReal
array_var	aMapMarkerLinks

begin Function {rMapMarkerRef}

if rMapMarkerRef.GetBaseObject != MapMarker ;the marker we get sent to is not the real marker from the Pip-Boy
	aMapMarkerLinks = rMapMarkerRef.GetLinkedChildren
	eval (ar_Size aMapMarkerLinks) > 0 && (rMapMarkerReal = aMapMarkerLinks[0]) ;assumes the first or only reference linked to this marker is the real map marker we traveled to.
else
	rMapMarkerReal = rMapMarkerRef
endif

end

See Also