Jump to content

MoveTo w/XMarkerHeading no longer working in cities.


HerrBaron

Recommended Posts

I'm the author of the Skyrim Adventurer's Tent

 

And I have a problem with something that has been working and now no longer does. When the player summons the tent, I move a tent shell, 2 cots, an activator, a trigger and an xmarker heading to the location of an explosion. The trigger serves as a "door" to allow the player and his followers into the tent cell. There is a corresponding trigger inside the cell which serves as an exit. This exit trigger moves player and followers to the exit marker moved as mentioned above.

 

The issue I'm having is that while exiting the tent cell (a MoveTo(ExitMarker) call) works fine outside a city, but now no longer works if the tent is set up inside a city, where it used to. My question is this: What, given the code listed below, would prevent an XMarkerHeading from moving to its correct place when moved to a location inside a city, when it moves fine outside a city?

 

The code which does the moving of the tent and its' parts lives in a quest with priority 60; here's that code:

 

ScriptName ADVObjectWithChildren Extends ObjectReference


;------------------
; Imports
;------------------
Import ADVLinkedChildObject
Import Utility.
.
.

Bool Function Move( ObjectReference WhereTo )

if ( ADVLogName != "" )
	Debug.TraceUser (ADVLogName, "Entering ADVObjectWithChildren.Move" )
	Debug.TraceUser( ADVLogName, "We have " + m_MyQuestScript.kwChildren.Length  + "children." )
EndIf

Disable( False )
MoveTo( WhereTo, 0, 0, -40.6236, True )

Wait(0.2)

int i = 0

While( i < m_MyQuestScript.kwChildren.Length )

	ADVLinkedChildObject oChild = GetLinkedRef( m_MyQuestScript.kwChildren[i] ) as ADVLinkedChildObject

	if ( oChild )
		oChild.MoveToParent( Self )
	EndIf

	i += 1

EndWhile

TravelMarker.Disable()
TravelMarker.MoveTo( ExitMarker )
TravelMarker.Enable()
TravelMarker.AddToMap( True )

; This Enables all the child objects, too, as we are the the enable parent to each of them.
Enable( abFadeIn = false )

if ( ADVLogName != "" )
	Debug.TraceUser ( ADVLogName, "Leaving ADVObjectWithChildren.Move" )
EndIf

return( True )

EndFunction

 

And in ADVLinkedChildObject: (The XMarkerHeading used as the exit marker is one of these linked child objects)

 


Bool Function MoveToParent( ADVObjectWithChildren orParent )

if ( orParent.ADVLogName != "" )
	Debug.TraceUser( orParent.ADVLogName, "Entering ADVLinkedChildObject.MoveToParent")
	Debug.TraceUser (orParent.ADVLogName, \
		"\tSelf start: X = " + X + ", Y = " + Y + ", Z = " + Z )
EndIf

MoveTo( orParent, -1 * m_fParentOffsetX, -1 * m_fParentOffsetY, abs(m_fParentOffsetZ), True )
SetAngle( GetAngleX(), GetAngleY(), orParent.GetAngleZ() + m_fRotAngleZ )

if ( orParent.ADVLogName != "" )
	Debug.TraceUser ( orParent.ADVLogName, \
	"\tSelf Moved: X = " + X + ", Y = " + Y + ", Z = " + Z + \
	", Distance = " + GetDistance( orParent ) )

EndIf

if ( orParent.ADVLogName != "" )
	Debug.TraceUser( orParent.ADVLogName, "Leaving ADVLinkedChildObject.MoveToParent" )
EndIf

EndFunction

 

 

This all works, apparently even in cities, as the TraceUser calls are telling me. Entering the tent works fine, again even in cities. The problem arises when leaving the tent; the PC ends up falling through empty space, and the game crashes.It's as though the XMarkerHeading used to mark the exit location isn't being moved, although it says that it is.

 

Here's the Exit Trigger script:

 


Scriptname ADVExitTriggerScript extends ObjectReference

ObjectReference Property ExitMarker  Auto

Quest Property ourQuest  Auto
Quest Property ADVNPCMoverQuest  Auto


Event OnTriggerEnter ( ObjectReference akActionRef )

ADVTentQuestScript MyQuestScript = ourQuest as ADVTentQuestScript
ADVNPCMoverQuestScript Mover = ADVNPCMoverQuest as ADVNPCMoverQuestScript
Bool bIsPlayer = False

if( MyQuestScript.ADVLogName != "" )
	Debug.TraceUser( MyQuestScript.ADVLogName, "Entering OnTriggerEnter" )
EndIf

if ( akActionRef == Game.GetPlayer() )

	akActionRef.MoveTo( ExitMarker )

;			Utility.Wait(0.25)

	Mover.MoveFollowers( Mover.DirectionOut )
	Game.RequestAutoSave()

Else
	if ( Mover.IsAllowedToMove( (akActionRef as Actor), Mover.DirectionOut ) )
		Mover.MoveNPC( akActionRef as Actor, Mover.DirectionOut )
	EndIf
EndIf

if( MyQuestScript.ADVLogName != "" )
	Debug.TraceUser( MyQuestScript.ADVLogName, "Leaving OnTriggerEnter" )
EndIf

EndEvent

 

Link to comment
Share on other sites

Update: The XMarkerHeading IS moving when setting up the tent, inside a city and out; the tent's mapmarker is moved to this XMarkerHeading, and it's updating properly on the map.

 

Why would a Game.GetPlayer().MoveTo(ExitMarker) fail when the XMarkerHeading is inside a city, but succeed when the marker is outside a city? Anyone? Really hoping for some guidance from the maestros, here...

 

Thanks,

-HB

Link to comment
Share on other sites

I wanted to throw in a whole bunch of links, but I can't find the threads I got the info from...

 

Some weeks ago, I read a couple threads where people mentioned a problem with teleporting from a custom home or some other world space into a city. The problem only occurred when teleporting to cities, and not when teleporting to the Tamriel world space.

 

I believe that the source of the problem was an overabundance of weapon racks, book shelves, and mannequins in the home or world space. Having so many scripts firing off at once somehow caused the destination cell to not be finished loading when it was in a city world space.

 

The solution found for this was to have the player go through two load screens (eg teleport to Tamriel or some dummy cell first, then to the real destination). Of course, you could always try reducing the amount of scripted items in your cell.

Link to comment
Share on other sites

I wanted to throw in a whole bunch of links, but I can't find the threads I got the info from...

 

Some weeks ago, I read a couple threads where people mentioned a problem with teleporting from a custom home or some other world space into a city. The problem only occurred when teleporting to cities, and not when teleporting to the Tamriel world space.

 

I believe that the source of the problem was an overabundance of weapon racks, book shelves, and mannequins in the home or world space. Having so many scripts firing off at once somehow caused the destination cell to not be finished loading when it was in a city world space.

 

The solution found for this was to have the player go through two load screens (eg teleport to Tamriel or some dummy cell first, then to the real destination). Of course, you could always try reducing the amount of scripted items in your cell.

 

What a great reply, fg109! I hadn't seen any of those posts you mentioned. I've been tearing out my hair trying to figure out what I changed in code to make the moveto stop working. Many thanks!

 

 

-HB

 

 

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...