Aller au contenu

Photo

Local Variables Resetting?


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
EzRemake

EzRemake
  • Members
  • 118 messages
In my single player module I've been storing variables on an item with the tag Storage.

Everything works in the module, setting variables to the item, and calling them from the item all work, but these variables get lost after starting a new game with a previous character version.

For instance, I make a generic floor trigger that does

void main()
{
object oPC = GetEnteringObject();
object oStorage = GetItemPossessedBy(oPC, "Storage");

if(GetLocalInt(oStorage, "Is1") != 1){
    SetLocalInt(oStorage, "Is1", 1);
    }
}

And a separate trigger that

void main()
{
object oPC = GetEnteringObject();
object oStorage = GetItemPossessedBy(oPC, "Storage");

if(GetLocalInt(oStorage, "Is1") == 1){
    FloatingTextStringOnCreature("dfgdsgdsgdgdgdsgdgdg", oPC);
    }
}

And they both work, but if I go save character, and then new game and reload the module with the saved character the variables are all reset.

Whats going on here?

#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
Local variables aren't saved to the character in a local vault environment. Try running the mod as a multiplayer game using a server vault character and see if it saves then.

#3
EzRemake

EzRemake
  • Members
  • 118 messages
I've tried running the module on a LAN server using server vault, and it seems to work in that environment, but definitely not in the single player environment. My guess is it has something to do with a copy of a character being made without the variables being copied over?

#4
EzRemake

EzRemake
  • Members
  • 118 messages
So is there any reason to store variables to an item if the mod is going to be strictly single player?

I'm guessing the only reason the OC stored variables on an item would be for the load module function for chapter switches - which I assume keeps the variables?

#5
EzRemake

EzRemake
  • Members
  • 118 messages
Sorry for the double posting, seem to be getting some delays

Modifié par EzRemake, 09 octobre 2012 - 01:04 .


#6
ShadowM

ShadowM
  • Members
  • 768 messages
For variables on a item to be exported with an exported character the item has to be inside a bag. :) hope that helps.

#7
EzRemake

EzRemake
  • Members
  • 118 messages
Thanks ShadowM, I'll keep that in mind when it comes time for play testing. It's annoying to have to start from scratch every time you want to test something new