Jump to content

Followers Stop Receiving Events


Fredas

Recommended Posts

Unusual situation that I have no chance of solving myself.  Here's my scenario:

 

I've set up a Spell (type: Ability, Constant Effect) with a Spell Effect (Constant Effect).  The Spell Effect is running some scripts.  I have things set up so that I can AddSpell() to the player and any number of NPCs, so the scripts tied to the Spell Effect will run on each of the actors.  Everything works like a charm.

 

But when I load a save, something very inexplicable happens: On NPCs, the scripts stop receiving events.  Registered events, OnPlayerLoadGame, everything.  The scripts themselves still run, so anything they were doing during the save gets completed when I load the save.  The player's scripts still receive events.  And the spell itself is still present on all of the NPCs and the player.  That's the only difference: the NPC's scripts stop receiving events.

 

Nothing in any of my scripts is responsible for this behavior (easy to test by delaying everything on game load), and in any event I have never heard of a function that disables script events selectively like this.  (And incidentally I am using SKSE 1.7.)

 

Why is this happening?

 

Link to comment

OnPlayerLoadGame is only sent to the player actor

Registered events should work if the NPC is in the same location as the player.

 

Okay, that is new info, and does explain some of the phenomena.  What are my options, then?  Take the following script:

Scriptname Testing extends activemagiceffect
 
actor target
 
event OnEffectStart(actor akTarget, actor caster)
   target = akTarget
   RegisterForModEvent("D_event", "DEvent")
endEvent
 
event OnPlayerLoadGame()
   RegisterForModEvent("D_event", "DEvent")
   utility.wait(5.0)
   debug.notification(target.GetBaseObject().GetName() + "'s OnPlayerLoadGame event still works")
endEvent
 
Event DEvent()
   debug.notification(target.GetBaseObject().GetName() + "'s D_event still works")
endEvent
You've explained why the OnPlayerLoadGame() message isn't popping for NPCs.  What about mod events I've registered for?  I have read that these have to be re-registered each time the game is loaded, and this would appear to be the case, as the only actor that still gets the DEvent() message is the player (presumably because the event is being re-registered in OnPlayerLoadGame()).  What can I do to ensure that events remain registered for non-player actors running this script?
 
Link to comment

From my own experience there is no need to register these mod events each game load. I'm relying on this for a mod I'm working on so I really hope it works as I'm thinking. At least for vanilla NPCs.

 

The only time I saw the registering not triggering was using a custom follower that I summoned via console (player.placeatme). Not sure if it was because the console thing (and thus I think he was a temporary reference), or because it was not vanilla.

EDIT: I did a couple of tests with another custom character, and I think it doesn't work for temporary references:

- Summoning the NPC using player.placeatme, the register function works, and the custom event is triggered. When you load a game, the registration is lost

- Not using player.placeatme: custom events in magic effects work after loading a game, without having to register another time.

Link to comment

From my own experience there is no need to register these mod events each game load. I'm relying on this for a mod I'm working on so I really hope it works as I'm thinking. At least for vanilla NPCs.

 [...]

- Summoning the NPC using player.placeatme, the register function works, and the custom event is triggered. When you load a game, the registration is lost

- Not using player.placeatme: custom events in magic effects work after loading a game, without having to register another time.

 

I've had time to wrestle with this problem.  The short of it is that ActiveMagicEffect is fubared in various ways that have to be worked around.  In my case, I determined that registered events disappear when loading a game, or even leaving the actor's proximity.  I worked up a "solution" which was a dubious combination of RegisterForSingleUpdate (to force RegisterForModEvent after game load) and proximity checks (to literally remove and re-apply the spell when relevant).

 

Right now I'm in the process of migrating all that work to ReferenceAliases because I've been assured that most of the headaches will go away if I do.  The downside to this approach is the loss of my tidy system which theoretically had no upper limit.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use