Skip to content

GetEffect should return true after the player has teleported

If the player uses teleportation magic, GetEffect should return true only after the player has been teleported.

The following is a simplified version of the follower teleportation script used in The Underground. Note that player->GetPos gets called in the same frame as player->GetEffect. In Morrowind.exe this will return the location after teleporting, in OpenMW it returns the location before teleporting.

Begin telep

short state
float pos

If ( player->GetEffect sEffectRecall == 1 )
	set state to 1
ElseIf ( player->GetEffect sEffectDivineIntervention == 1 )
	set state to 1
ElseIf ( player->GetEffect sEffectAlmsiviIntervention == 1 )
	set state to 1
EndIf

if ( state )
	if ( GetInterior )
		MessageBox "Nope"
	else
		PositionCell 0 0 0 0 "Ashlands Region"
		disable
		set pos to ( player->GetPos X )
		setPos X pos
		set pos to ( player->GetPos Y )
		setPos Y pos
		set pos to ( player->GetPos Z )
		setPos Z pos
		AiWander 0 0 0
		enable
		AiFollow player 0 0 0 0
	endif
	set state to 0
endif

End