Author Topic: Local Variables Resetting?  (Read 329 times)

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Local Variables Resetting?
« on: October 09, 2012, 01:50:29 am »


               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?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Local Variables Resetting?
« Reply #1 on: October 09, 2012, 01:59:38 am »


               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.
               
               

               
            

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Local Variables Resetting?
« Reply #2 on: October 09, 2012, 02:00:06 am »


               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?
               
               

               
            

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Local Variables Resetting?
« Reply #3 on: October 09, 2012, 02:03:22 am »


               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?
               
               

               
            

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Local Variables Resetting?
« Reply #4 on: October 09, 2012, 02:04:13 am »


               Sorry for the double posting, seem to be getting some delays
               
               

               


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


            

Legacy_ShadowM

  • Hero Member
  • *****
  • Posts: 1373
  • Karma: +0/-0
Local Variables Resetting?
« Reply #5 on: October 09, 2012, 02:45:51 am »


               For variables on a item to be exported with an exported character the item has to be inside a bag. '<img'> hope that helps.
               
               

               
            

Legacy_EzRemake

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Local Variables Resetting?
« Reply #6 on: October 09, 2012, 03:23:31 am »


               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