Author Topic: Does the DM client mess with item local variables?  (Read 809 times)

Legacy_BCH

  • Full Member
  • ***
  • Posts: 160
  • Karma: +0/-0
Does the DM client mess with item local variables?
« on: December 20, 2010, 12:58:02 pm »


               I've been having troubles with some scripted items in my game.  Lots of very similar items, some of which work, some of which don't.  The one thing that seems to be common across all the malfunctioning items is that they use local variables to store information for their scripts.

For example, I have an item that, when activated, creates a "red arrow" placeable at the PC's feet.  Very simple.  I scripted this item so that it looks for the placeable's resref in a local string.  That way, I can use this same item to place a wide range of placeables by changing the resref stored locally.

This item works just fine when I test in single-player, on my server in multi-player, using the DM client, all fine.

Then, when I store copies of this item on my DM character, save that character, and log back into him the next time my VPnP group plays, those items don't work.  The local variables are gone.

Is it the simple act of saving an item in the DM's inventory that deletes local variables?

Or is something else happening that I haven't figured out yet?

Anyone seen this behavior before?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #1 on: December 20, 2010, 01:36:27 pm »


               You DM never gets saved to the DM vault.  If you are storing the items on the DM and exporting him, He is getting saved to your local vault..  You DM when you reenter the game is getting loaded from the DM vault.  



I guess you can find the save of your DM character from the local vaule and move him to the DM vault.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #2 on: December 20, 2010, 03:32:49 pm »


               After thinking about this, Why dont you just save the Item with the vars out to the NWN DB.  Then all you would need to do is reload the item when you want to use it.  



It is basicly what nat did for his DB system.
               
               

               
            

Legacy_BCH

  • Full Member
  • ***
  • Posts: 160
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #3 on: December 20, 2010, 03:58:32 pm »


               

Lightfoot8 wrote...

You DM never gets saved to the DM
vault. If you are storing the items on the DM and exporting him, He is
getting saved to your local vault.. You DM when you reenter the game is
getting loaded from the DM vault.

I guess you can find the save of your DM character from the local vaule and move him to the DM vault.


I'm saving my DM character to my own PC, and loading him from there.  The
items are still in his inventory, so I think it has to be the same
character.  The server runs on another machine, but I can check the
vaults there, and none of my DM characters are being saved there.

Or did I misunderstand you?

Lightfoot8 wrote...

After thinking about this, Why dont you just save the Item with the vars out to the NWN DB.  Then all you would need to do is reload the item when you want to use it.  

It is basicly what nat did for his DB system.


If I save the variables out to the database, then each item has to have a unique identifier.  With the system I'm using, I can have 10 copies of the same resref with 10 different local variables.

And my system works, so long as I spawn the items directly into the module or place them there at design time.

The only time I see it not working is when I'm taking these items out of a saved DM character's inventory, but I wanted to get a reality check on that before I give up looking for a cause.
               
               

               


                     Modifié par BCH, 20 décembre 2010 - 03:58 .
                     
                  


            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #4 on: December 20, 2010, 05:50:09 pm »


               You are saving your char from a copy of the module run on your machine, then loading your dm to another copy of the module on the server machine? If so then mayhap the variables are not stored on the items, in the server copy?
               
               

               


                     Modifié par Baragg, 20 décembre 2010 - 05:51 .
                     
                  


            

Legacy_BCH

  • Full Member
  • ***
  • Posts: 160
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #5 on: December 20, 2010, 10:46:54 pm »


               

Baragg wrote...

You are saving your char from a copy of the module run on your machine, then loading your dm to another copy of the module on the server machine? If so then mayhap the variables are not stored on the items, in the server copy?


Actually, no.  Because I'm running a VPnP (Virtual Paper and Pencil) game, not a Persistant World, I have the luxury of shutting down my server when we're not playing.

So, the module stays on one machine, and that's where I run the server.  My players' characters are all in the servervault here.

My PC is where I keep all my characters and DM characters.

So I'm really sure that I'm using the same copy of my DM character each time.  You can see why these disappearing variables are so puzzling to me. 
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #6 on: December 20, 2010, 11:12:22 pm »


               I think this is right as when he logs in with the DM Client into the server it brings his DM Avatar from his dmvault which does not store local variables.

Only the servervault is accessed by his database I would suspect which in turn is why his copy to a pc moved from the dm vault to the server vault did not work.

I would also venture a guess if you checked local vault then it would work fine.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #7 on: December 21, 2010, 12:05:45 am »


               Item variables on DM Clients are not stored, unfortunately. You CAN, however, get around this by putting the item in a container, which ensures that the vars are stored (you still have to export). We use this trick to preserve the FKY_CHAT_INSTANT var on our command targeters, which keeps them as instant-use items.

Funky
               
               

               


                     Modifié par FunkySwerve, 21 décembre 2010 - 12:06 .
                     
                  


            

Legacy_BCH

  • Full Member
  • ***
  • Posts: 160
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #8 on: December 21, 2010, 02:56:41 am »


               TSMDuide, I'm only about 50% sure I know what you're saying, but I will definitely try storing a variable on an item in the inventory of a DM character on my server's DMVault, so see if that changes anything.

FunkySwerve, what you are talking about sounds awfully familiar...  I think I recall being frustrated long ago by a problem where I was trying to store multiple variables on an item in the database, and I eventually had to store the variables on an item in a character's inventory then store the entire character to the database to make it work, or some such strange maneuver.

Thanks, all, for the help!
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Does the DM client mess with item local variables?
« Reply #9 on: December 21, 2010, 05:11:24 am »


               

BCH wrote...

TSMDuide, I'm only about 50% sure I know what you're saying, but I will definitely try storing a variable on an item in the inventory of a DM character on my server's DMVault, so see if that changes anything.

It won't. The solution I gave you is the only fix - storing the variable on an item, and putting the item in a container.

Funky