Talk:IsPlayerMovingIntoNewSpace

From the CreationKit Wiki
Jump to navigation Jump to search

I thought that combining this condition with kuertee's approach to checking Condition Functions from papyrus might have made it possible to detect whenever the player changes locations through a load screen (since there's no other reliable way to do this), so I tested it out.

Unfortunately, the ability I made, which I conditioned to IsPlayerMovingIntoNewSpace == 1 never triggered. I am guessing maybe because abilities are not checked during the load screen process. (I'm not sure where exactly this condition would be used that the game would be checking it..) Egocarib (talk) 2014-04-23T11:37:28 (EDT)


As far as my tests went, this ability is a rather tricky one. Since it only returns 1 when the loading screen is on, I suppose that as you said, magic effects won't ever trigger if they don't make condition checks during them. Where it does seem to work is in packages. So a way to make use of this would be similar to your method to check for cell change, only that you'd use an invisible actor instead of an object, and instead of placing the script on a spell, you'd put it in a package fragment running this condition.

Apart from that, maybe another workaround can be used with quest targets or scenes... --Darkitow (talk) 2015-01-24T22:26:13 (EST)

Exact methodologies[edit source]

I managed to piece together a fairly reliable method from the above comments. This system should fire after any loading screen the player passes through. I haven't yet tested whether it gets tripped by loading a save game after it has initialized.

Warning: This method must be combined with Detect Player Cell Change (Without_Polling): when the player changes cells without changing worldspaces, the IPMINS sentinel described below must be moved to the player to keep it loaded. The script below will need to be modified to achieve this; if I find time, I'll try to merge both methods and offer a full description on setup.

Setup[edit source]

Create a male actor base of the dunMiddenEmptyRace Race. This race assigns an empty skeleton (Effects\FXEmptyObject.nif) to male bodies, resulting in invisible and non-solid actors, so it'll be perfect for this task.

Create an AI Package with a single condition: S IsPlayerMovingIntoNewSpace NONE == 1.00. Give this Package a Papyrus script fragment that calls OnPlayerLoadingScreen() on the script below (on whatever object you attach the script to), and then assign the AI package to your actor base.

Apply something like the below script to whatever needs to listen for load screens. You should probably use your own scriptname.

Scriptname IPMINSListener extends Quest
{Activated when the player passes through a loading screen. This script is powered by an invisible 
non-solid actor whose AI Package notifies us when a load screen occurs; this only works if the actor 
is loaded, so the actor must be kept with the player.}

Actor Property PlayerRef Auto
{Auto-fill.}

ActorBase Property pkSentinelBase Auto
{Must be an "IPMINS Sentinel" actor base -- an invisible non-solid actor with an AI package that listens for IsPlayerMovingIntoNewSpace and calls our function.}

Actor Property pkSentinel Auto Hidden

Event OnPlayerLoadingScreen()
{Event called manually by our sentinel actor's AI package.}
   CallSomeFunction() ; THIS IS WHERE YOU'D NOTIFY YOUR MOD THAT A LOAD SCREEN HAS TAKEN PLACE
   ;
   ; Prep for next load screen.
   ;
   pkSentinel.MoveTo(PlayerRef, 0.0, 0.0, 256.0)
EndEvent

Event OnInit()
   pkSentinel = PlayerRef.PlaceActorAtMe(pkSentinelBase)
   pkSentinel.MoveTo(PlayerRef, 0.0, 0.0, 256.0)
EndEvent

Details[edit source]

  • This seems to work for extremely brief loading screens.
  • This only works if the sentinel Actor is loaded, as Skyrim doesn't evaluate packages for distant unloaded NPCs.
  • That's why the actor needs an invisible non-solid race: we need to constantly keep it near the player.
    • Most races don't work for this purpose: InvisibleRace is humanoid and the wisp races have collision. Bethesda's empty race (and anything based on it) should work just fine, and it does in my tests.
  • We move the actor above the player because moving it underneath the player can cause the player to slide to one side, even though the actor is non-solid.