Determining when the player changes cells

Post » Thu Jun 21, 2012 10:38 am

The method I'm currently using to check if the player has changed cells is this:

I have a quest script running that updates periodically. On update it checks the players current cell with GetParentCell and checks that against a saved variable that stores the last update check's GetParentCell. (variable only gets set if the current cell is found to be different)

My question is this: Is there a better way to do this? Requiring a background script for this seems lame.

Why isn't there a OnCellChange event?

The wiki lists two (maybe useful?) events but offers absolutely no useful information on their use...http://www.creationkit.com/OnDetachedFromCell_-_ObjectReference and http://www.creationkit.com/OnAttachedToCell_-_ObjectReference.

I made a simple script to try to test them but neither fire.

Event OnAttachedToCell()    Debug.MessageBox("Cell Attached?")EndEventEvent OnDetachedFromCell()    Debug.MessageBox("Cell Detached?")EndEvent
User avatar
Schel[Anne]FTL
 
Posts: 3384
Joined: Thu Nov 16, 2006 6:53 pm

Post » Thu Jun 21, 2012 8:15 am

http://www.creationkit.com/OnLocationChange_-_Actor will work on a Player alias
User avatar
Josh Lozier
 
Posts: 3490
Joined: Tue Nov 27, 2007 5:20 pm

Post » Thu Jun 21, 2012 3:37 pm

There's http://www.creationkit.com/OnLocationChange_-_Actor, but I realize that's not the same thing. http://www.creationkit.com/OnCellLoad_-_ObjectReference will fire when entering a cell that was not loaded into memory. So it will fire if you first enter the cell, and if you move a couple cells away then come back.

Both events are in a script running the player, of course.
User avatar
neen
 
Posts: 3517
Joined: Sun Nov 26, 2006 1:19 pm

Post » Thu Jun 21, 2012 7:52 pm

what is the difference between locations and cells? I'm really only interested in cell changes that require load screens, so interiors -> exteriors and vice versa, and fast travel

Edit: From my 5 minutes of testing, I think that should do the trick ;P. Thanks guys.
User avatar
Kelly Osbourne Kelly
 
Posts: 3426
Joined: Sun Nov 05, 2006 6:56 pm

Post » Thu Jun 21, 2012 8:55 pm

The wiki lists two (maybe useful?) events but offers absolutely no useful information on their use...http://www.creationkit.com/OnDetachedFromCell_-_ObjectReference and http://www.creationkit.com/OnAttachedToCell_-_ObjectReference.

I made a simple script to try to test them but neither fire.

Event OnAttachedToCell()	Debug.MessageBox("Cell Attached?")EndEventEvent OnDetachedFromCell()	Debug.MessageBox("Cell Detached?")EndEvent
That doesn't work because the player is always in an attached cell.

I believe OnLocationChange won't work either, because it only fires when a reference moves in or out of a Location object.

Edit: nvm Took to long to type.
User avatar
Shannon Lockwood
 
Posts: 3373
Joined: Wed Aug 08, 2007 12:38 pm

Post » Thu Jun 21, 2012 12:31 pm

That doesn't work because the player is always in an attached cell.

So that would work if, for instance, an object reference moved into the players cell from an unloaded cell?
User avatar
Alan Cutler
 
Posts: 3163
Joined: Sun Jul 01, 2007 9:59 am

Post » Thu Jun 21, 2012 10:56 am

Curious about this too. What event can you use to run stuff when a load screen occurs?
User avatar
Ian White
 
Posts: 3476
Joined: Thu Jul 19, 2007 8:08 pm

Post » Thu Jun 21, 2012 4:10 pm

OnLocationChange works but not specifically on load screens. It fires when you change cells in the over world as well.

I slapped it on a magic effect and gave it to the player in an ability and ran around riverwood for a few minutes. It seems to do what I was looking for.
User avatar
mimi_lys
 
Posts: 3514
Joined: Mon Apr 09, 2007 11:17 am


Return to V - Skyrim