Jump to content

Reference aliases getting cleared


Recommended Posts

So I got a little bit of free time, and I decided to play around in the CK again.  I put together a little quest in which the reference aliases are forced to 'NONE' to start, and then eventually filled with a spell later using placeAtMe() and forceRefTo().  Yes, I know that placeAtMe() can cause save game bloat, but I'm being careful to delete them when done.  That's why I'm using reference aliases to track them.  :)

 

Everything works great - until I exit and restart Skyrim.  When I reload the game, all of the reference aliases are set to 'NONE' again.  This is from checking with showquestvars from the console.  I also checked before shutting the game down, and the aliases are getting filled properly.  If I just save the game and reload - without quitting the game - everything works fine.  It's only if I shut down the game and start it again.  I looked over my code, and I have logging turned on with trace statements in my code.  There's a log statement in every function.  It appears that none of my code runs on startup, which is correct, because I'm using events for everything.  So I don't see how my code could be causing the aliases to get cleared.  showquestvars also reports that the quest is running properly. If I understand reference aliases correctly, this shouldn't be happening.  Even the player alias, which is specifically forced to the player, is getting cleared.

 

Here's how I have things set up.  The player casts a spell, which creates the actor using placeAtMe(), and then forces the actor into a reference alias using forceRefTo().  The reference aliases have scripts and AI packages on them.  If there are no empty aliases, the spell fails and no actor is created.

 

Using another spell, the player can select one of the actors, and through an onActivate() event, the player can select a furniture object.  Once both a furniture object is selected and an actor is selected, the furniture object gets forced into a corresponding reference alias, so that actor uses that furniture object.  So I select the actor who is in *actor* slot 6, and then select a furniture object, and the script forces the furniture object into *furniture* slot 6.  Actor slot 6 has an AI package on it to use whatever furniture is in furniture slot 6.  If an actor dies, the reference is deleted via delete() in the onDeath() event.

 

This works great - except that when I exit the game and reload, all of the aliases are cleared.  I've created a script that reassigns the actors based on tokens in the actor's inventory when the game is reloaded, but this is a kludge and doesn't work for the furniture objects (they're getting cleared, too). It also runs in an update loop, which I was trying to avoid to keep papyrus load minimal. I don't want to take out the reference alias mechanism, because that's how I keep from getting save game bloat from placeAtMe().

 

Does anyone have any insight?

 

 

Link to comment

Well, thanks for the reply and for thinking it through, but if it's going to be complex to fix, I don't want you to spend your time trying to fix something I don't intend to release anyway.  I'm really just playing around and trying to learn the CK a little better.  I was hoping it was something simple that could be fixed easily.

Link to comment
  • 2 weeks later...
  • 2 weeks later...

I figured it out.  I was using too many reference aliases for a single NPC.

 

For my NPC companion I'm making, I only need ONE reference alias.  As soon as I resorted to using a single alias for my companion, I've had no problems with aliases getting randomly cleared.

 

I was basically using reference aliases the wrong way.

 

1. make a single reference alias

2. choose unique actor

3. attach a script that does a debug.messagebox("hi") on the onint() event.

4. start new game

 

When you see the "hi" messagebox, you know the alias has been filled properly AUTOMATICALLY, which is the way it was intended to be.

There is no need to use forcerefto that I can see.

 

If you need to use multiple packages for this NPC, add multiple packages to the reference alias, then apply conditions to each package, like GetStage = 500, For another package getstage = 600, etc.

 

Often times you can use packages for one time use by creating a scene.

 

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