Jump to content

Fix for OnLocationChange with player ReferenceAlias


Recommended Posts

OnLocationChange is not triggering for me when it's in a ReferenceAlias script put on a ref alias filled by the player. A google search tells me others have experienced this problem. Is there any fix for it?

Link to comment
Share on other sites

I use this event heavily in multiple mods and I have never had this issue. The mod I am currently working on absolutely requires that this event fire every single time and I've never seen it fail.

 

Sorry, I know that's not a solution, but maybe we can figure out what the difference is between our uses.

 

Here is one script:

event OnLocationChange(location akOldLoc, location akNewLoc)

	if(akOldLoc.isSameLocation(akNewLoc, LocTypeHold) == false)
		LFGWerewolf.SetCurrentLocation(akNewLoc)
	endif
endEvent

And here is the other one that I use:

Scriptname LFGDefaultSetStageOnLocationChange extends ReferenceAlias  
{Sets a stage if the alias changes location, with optional keyword.}

keyword property KeywordFilter = none auto
{If a keyword is used, will check if locations share parent with this keyword.}

bool property IgnoreChildren = false auto
{If checked the script will not fire when moving TO a child FROM a parent,
but will fire when moving the other direction.}

int property StageToSet = -1 auto
{Stage to set. If left unmodified or set to less than 0, quest will stop.}

event OnLocationChange(location akOldLoc, location akNewLoc)
	if(KeywordFilter)
		if(akOldLoc.isSameLocation(akNewLoc, KeywordFilter) == false)
			if(StageToSet < 0)
				GetOwningQuest().stop()
			else
				GetOwningQuest().setstage(StageToSet)
			endif
		endif
	else
		if(IgnoreChildren == false || akOldLoc.isChild(akNewLoc) == false)
			if(StageToSet < 0)
				GetOwningQuest().stop()
			else
				GetOwningQuest().setstage(StageToSet)
			endif
		endif
	endif


endEvent

Link to comment
Share on other sites

Well, huh, now I wonder. I assumed that the location change (in this case changing to Riverwood) would happen at the same time as the game said I discovered Riverwood. Maybe that's not the case. The clean save I use for testing starts just outside. I'll look into it. Thanks for the idea.

 

 

Update:

 

That seems to have been the problem. I was already there.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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