Help with script(s) for teleporting with a companion please!

Post » Sat Dec 06, 2014 4:10 pm

I'm having trouble with scripts which are designed to either teleport the player to a new location when the player activates a door/activator, or teleport the player AND a companion to that same new location when triggered.

Teleporting the player alone works fine. It's the companion teleporting that I'm having issues with. Specifically: the companion does teleport to the new cell and appears to have all basic functionality (eg following, fighting). The problem: any attempt to talk to the companion post-teleportation leads to an instant CTD.

I am confident this is not a dialogue greetings issue, and the problem persists across various target cells.

Debugging attempts yielded the following findings:

1: if I lead the companion into a new cell after teleporting, and then talk to them in the new cell, things run fine. (Same holds if I lead them into a new cell and then lead them back into the teleport-to cell).

2: if I save the game with the companion in the teleport-to cell and reload it, I can talk to them fine.

In other words, the insta-crash is guaranteed to happen unless I save and reload or make the companion leave the cell.

Resetting the companion's behaviour via start-stopcombat didn't work.

Here are two scripts which produce the exact results I've described above:

Begin NON_ESSupermaxDoorTEST1short doorstat			; 0 = player outside, 1 = player insideshort stat				; 1 = player (and friends) going inside, 2 = player (and friends) going outsideshort primerIf ( menumode == 1 )	returnendifif ( stat == 1 )																		; going inside	if ( NON_SabrinaFollowing == 1 )											; Sabrina is following		set primer to 0		PlaySound "Dwemer Door Close"		Player->PositionCell, 3686, 2508, 12226, 270, "Esoterica Facility: High Security Prison Complex"		NON_SabrinaCompanion->PositionCell, 3686, 2568, 12226, 270, "Esoterica Facility: High Security Prison Complex"		Set NON_SabrinaFollowing to 1		NON_SabrinaCompanion->AiFollow Player 0 0 0 0;		NON_SabrinaCompanion->StartCombat "Player"					; have tried 'resetting' companion's behaviour via combat - has no effect on problem;		NON_SabrinaCompanion->StopCombat;		NON_SabrinaCompanion->AiFollow Player 0 0 0 0		set doorstat to 1															; player and friend are inside		set stat to 0		return	else																				; Sabrina is not following - send the player through alone - this works fine		set primer to 0		PlaySound "Dwemer Door Close"		Player->PositionCell, 3686, 2508, 12226, 270, "Esoterica Facility: High Security Prison Complex"		set doorstat to 1		set stat to 0																	; player is inside		return	endifendifif ( stat == 2 )	if ( NON_SabrinaFollowing == 1 )											; going outside		set primer to 0		PlaySound "Dwemer Door Close"		Player->PositionCell, 3886, 2508, 12226, 90, "Esoterica Facility: High Security Prison Complex"		NON_SabrinaCompanion->PositionCell, 3886, 2558, 12226, 90, "Esoterica Facility: High Security Prison Complex"	else		set primer to 0		PlaySound "Dwemer Door Close"		set doorstat to 0		Player->PositionCell, 3886, 2508, 12226, 90, "Esoterica Facility: High Security Prison Complex"		set stat to 0		return	endifendifIf ( OnActivate == 1 )	set primer to 1endifif ( primer == 1 )	if ( NON_ESSuperDoorAcc == 1 )											; this is a global which has to be set to be able to use the door		if ( doorstat == 0 )															; player outside, transport into cell			set stat to 1			return		elseif ( doorstat == 1 )													; player inside, transport out of cell			set stat to 2				return		endif	elseif ( NON_ESSuperDoorAcc == 0 )		MessageBox "You will need to speak with the Facility Prison Commander to gain access to the cell."		PlaySound, "SothaSpikes"		return	else		MessageBox "You have already been granted access to a different cell. You may only access one cell at a time."		PlaySound, "SothaSpikes"		Return	endifendifend

That's a fairly simple one which teleports the player and the companion within the same cell (i.e. through to the other side of a door).

Begin NON_ESWarpMournholdfloat Timershort sabwarpshort warpIf ( menumode == 1 )	returnEndifif ( NON_SabrinaFollowing == 1 )							; Sabrina is following	if ( sabwarp == 0 )		FadeOut, 0.5		disableplayercontrols		set sabwarp to 1	ElseIf ( sabwarp == 1 )		set Timer to ( Timer + GetSecondsPassed )		If ( timer > 1 )			PlaySound "mysticism area"			Set NON_ESSwitchStat to 0					; global regarding transport/warping - not relevant			Player->RemoveSpell "NON_ESWard"			Player->PositionCell -49.132 -478.096 -665.157 0 "Mournhold Temple: Reception Area"			NON_SabrinaCompanion->PositionCell -99.132 -478.096 -665.157 0 "Mournhold Temple: Reception Area"			Set NON_SabrinaFollowing to 1			NON_SabrinaCompanion->disable			NON_SabrinaCompanion->enable			set timer to 0			set sabwarp to 2		endif	ElseIf ( sabwarp == 2 ) 		set Timer to ( Timer + GetSecondsPassed )  		if ( Timer > 1 )			NON_SabrinaCompanion->disable			NON_SabrinaCompanion->enable			NON_SabrinaCompanion->AiFollow Player 0 0 0 0			EnablePlayerControls			EnableLevitation			EnableTeleporting			FadeIn, 1.5			Set Timer to 0			set sabwarp to 0			StopScript NON_ESScheduleScript					; irrelevant to the problem			StopScript NON_ESWarpMournhold					; self-terminates		endif	endifElseIf ( warp == 0 )									; just the player being warped	FadeOut, 0.5	disableplayercontrols	set warp to 1ElseIf ( warp == 1 )	set timer to ( timer + getsecondspassed )	if ( timer > 1 )		PlaySound "mysticism hit"		Set NON_ESSwitchStat to 0		Player->RemoveSpell "NON_ESWard"		Player->PositionCell -49.132 -478.096 -665.157 0 "Mournhold Temple: Reception Area"		enableplayercontrols		EnableLevitation		EnableTeleporting		FadeIn, 1.5		set timer to 0		set warp to 0		StopScript NON_ESScheduleScript		StopScript NON_ESWarpMournhold	endifEndifEnd

A more complex one which warps the player from a cell to Mournhold. I think I based this on a script I found in Julan - Ashlander Companion.

Both scripts produce exactly the same problem, and I have no idea how to fix it. Please help me!

User avatar
Jerry Jr. Ortiz
 
Posts: 3457
Joined: Fri Nov 23, 2007 12:39 pm

Post » Sat Dec 06, 2014 5:02 pm

I remember something like this http://wryemusings.com/LCV.html#TechnicalNotes. I think it was because positioning NPCs from a different cell to a cell PC is present would cause that NPC not to load properly leading to crashes the moment you talk to them.

I see that the companion is transported after the player is transported. Try the reverse. First transport the companion then transport the player. Transporting player resets the world, so your already transported NPC would have load properly.

User avatar
Kayleigh Williams
 
Posts: 3397
Joined: Wed Aug 23, 2006 10:41 am


Return to III - Morrowind

cron