Author Topic: Need Two Persistence Functions  (Read 788 times)

Legacy_eeriegeek

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #15 on: August 09, 2012, 06:45:31 pm »


               Henesua, do you have ELC and ILR turned off? The lexicon's horse builder guide warns and my experience is that when either of these are enabled, the game engine destroys and recreates a new x3_it_pchide item at the first PC login after a server restart.
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #16 on: August 09, 2012, 07:27:18 pm »


               At this point the module is barren. All the initial scripting does is use Funky's server authentication script to check the PC against the player database. Then the module database is checked to see if the character is new. If new, the player is jumped to a "creation area" where they will be able to buy equipment and tailor their appearance. If not a new character, the player is jumped to the start location.

I have both ELC and ILR turned off and this is what I am experiencing with the PC Hide:

1. It appears on characters that are created new specifically for the Server. According to documentation and the function HorseAddMenu, this should NOT happen unless the PC is pre-existing and therefore lack the Horse Menu feat.

2. Whenever the character is jumped to the new area the PC Hide is "swapped out" twice.

3. Any variables stored on the PC Hide are erased when the player exits the Server. The OnExit says they are there, but when you log in again, the variables are reset to 0. I am using a simple int variable (TRUE or FALSE) to test this which is stored on the PC Hide as "1" in the OnEnter event of the first area (the one you are jumped from). The OnClientLeave event checks the variable and sends the message that its value is "1".

4. Whenever you rest the PC Hide is "swapped out".
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #17 on: August 09, 2012, 07:37:26 pm »


               

eeriegeek wrote...

Henesua, do you have ELC and ILR turned off? The lexicon's horse builder guide warns and my experience is that when either of these are enabled, the game engine destroys and recreates a new x3_it_pchide item at the first PC login after a server restart.

Yes this is what happens with either on. Something to keep in mind especially for the reason that not using ELC = vulnerability to various exploits that cannot be fixed/checked from nwscript.

Failed.Bard wrote...

 Characters exported by the player
from a server vault setting have all the variables stripped from the
items.  I guess to save space in the bic file.
 Characters exported
and saved by script from within the game keep their variables, as should
they when you simply log out, then back in with the same server vault
character.  "Export", in that case, is simply "save".

Not really, you are correct that the character that appears in player's localvault will not have any variables on items, but hitting export character by the player in MP game actually saves character on server vault too which can be exploited easily.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #18 on: August 09, 2012, 07:40:07 pm »


               

Pstemarie wrote...

At this point the module is barren. All the initial scripting does is use Funky's server authentication script to check the PC against the player database. Then the module database is checked to see if the character is new. If new, the player is jumped to a "creation area" where they will be able to buy equipment and tailor their appearance. If not a new character, the player is jumped to the start location.

I have both ELC and ILR turned off and this is what I am experiencing with the PC Hide:

1. It appears on characters that are created new specifically for the Server. According to documentation and the function HorseAddMenu, this should NOT happen unless the PC is pre-existing and therefore lack the Horse Menu feat.

2. Whenever the character is jumped to the new area the PC Hide is "swapped out" twice.

3. Any variables stored on the PC Hide are erased when the player exits the Server. The OnExit says they are there, but when you log in again, the variables are reset to 0. I am using a simple int variable (TRUE or FALSE) to test this which is stored on the PC Hide as "1" in the OnEnter event of the first area (the one you are jumped from). The OnClientLeave event checks the variable and sends the message that its value is "1".

4. Whenever you rest the PC Hide is "swapped out".

This needs further investigation but generally, the horse "system" and scripts are very lame and wrong. I wouldnt be surprised if the skin would be destroyed and recreated by the script. Have you tried to use different item, like the one Im using in my PW starter module?
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #19 on: August 09, 2012, 07:42:44 pm »


               I think lame may be harsh, but wrong fits - especially with the errors that seem to occur. '<img'>

I was able to fix a few things by killing the module - again - and rebuilding it, AFTER deleting the database files and the server vault. I have created a NEW testing character and tested by logging into the Server. Everything seemed to work ok in regards to the PC Hide, EXCEPT resting. When I rested the hide was created on the character (who didn't need it) then was summarily swapped out about a dozen times.

I guess I'm going to have to tear into the horse scripts and see just why this happens. ':crying:'
               
               

               


                     Modifié par Pstemarie, 09 août 2012 - 06:47 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #20 on: August 09, 2012, 07:56:58 pm »


               Well using skin for this works. I have used this before 1.69 with success. Even managed to workaround the issue with ILR/ELC. Maybe would be easier to make this from scratch and not rely to scripting from 1.69.
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #21 on: August 09, 2012, 08:05:23 pm »


               Seems like TheKrit already dealt with this stuff...ty GOD
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #22 on: August 09, 2012, 09:46:04 pm »


               

Pstemarie wrote...

Seems like TheKrit already dealt with this stuff...ty GOD

Hmm really? I have seen from him "Remove PC properties" which is different issue and "Alternate Horse Scripts" which changes *something* but from description I can not say what. At least he doesnt write anything about this particular issue, the only skin related is the stuff from Remove PC properties as the alternate scripts contains this.
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #23 on: August 09, 2012, 10:11:53 pm »


               Yeah, I spoke to soon - not bad stuff, but I've come to the conclusion that the horse system is much more complex - and buggy - than it needs to be. One more thing to rewrite from the ground up for my module...

P.S. I purged horses completely for the time being and wouldn't yanno it - everything (admittedly not much at this point) works so far as it should '^_^'
               
               

               


                     Modifié par Pstemarie, 09 août 2012 - 09:13 .
                     
                  


            

Legacy_Carcerian

  • Hero Member
  • *****
  • Posts: 1655
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #24 on: August 09, 2012, 10:18:14 pm »


               To me, a unique inventory item really seems the best way  to go.

Create a "player tool" that is automatically given to any player who does not already possess one. Make sure it a non-droppable/sellable plot item that is also identified. Then you can read/write all player data to the items "unidentified" description, which will never been seen by players. Just be sure to save the PC after you make a series of  writes.  (or flag them as "unsaved" for a periodic save loop)

That should be fairly bulletproof at far as persistant storage goes. (more so than using a pc hide at least, a scary concept, and also keeps down database bloat)

(Credit for idea goes to Seph K (aka Darkmage), who suggested it as a way to store custom passwords for PW charactes)
               
               

               


                     Modifié par Carcerian, 09 août 2012 - 10:14 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #25 on: August 09, 2012, 10:29:19 pm »


               

Pstemarie wrote...

Yeah, I spoke to soon - not bad stuff, but I've come to the conclusion that the horse system is much more complex - and buggy - than it needs to be. One more thing to rewrite from the ground up for my module...

P.S. I purged horses completely for the time being and wouldn't yanno it - everything (admittedly not much at this point) works so far as it should '^_^'

I mean, The Krit's work on this is not bad, there is no reason why not use it if the module has horses inside. It cant make things worse than they already are 'B)'. I've considered to add this into my pet project but since this is total rewrite I shouldnt take it without permission (its not something like 1line fix that anyone can do based on the knowledge) which I haven't got - The Krit and me aren't big friends.

I was using skin long time without issues, but then since Ive toggled ILR on, I switched to MySQL - also because of safety reasons. Lets say, that player loses the skin, either due to the exploit or bug - now all the info like craft skill rank, monster kills will be gone completely...

However, I created a slighly more efficient solution using new table (player, name, value) and more reliable player identifier - player's tag which holds ID on my server.
               
               

               


                     Modifié par ShaDoOoW, 09 août 2012 - 09:34 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #26 on: August 09, 2012, 10:39:26 pm »


               

eeriegeek wrote...

 ...Stackables have known issues with losing information if they get re-stacked....


Just to expand the explaination on why stacked items can lose locals. 

A Stack of items is a single instance in the game.  Reguardless of wether it is a stack of one item or a stack of 100 items it is a single instance.   When a stack of items is split, A new instance is created and all locals are intact.   The porblem ocures when the items get added to a stack.   When a item gets added to a stack it simply gets destroyed with it stack count getting added to the other instance of the item.   


Say we have a stack of arrows and split them in half.   Stack 1 and stack 2.   If we added a local to stack 2 and then added the stack back to stack 1. stack one would not have the local because it got destroyed along with stack 2.  if however, stack 1 was added to stack 2, the local would still exsist.   basicly adding the local to every item in the stack.  ( Really there is just one instance of the item with a stack count for how many items there are. ) 

 
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #27 on: August 10, 2012, 12:50:34 am »


               Yeah I think the item database is the way to go, as I have been using that for years with no problems.  Keeps track of location, curses, contracts, things of that nature.
For horses I devised my own method which is essentially a short cut.  You can buy items that call particular types of horses, normal horse, war horse, or special horses, like a nightmare.  In this way you can have different mounts if you qualify to use them based on the restrictions on the item. Level, class, alighnment, etc...
I made a rather poor demo of the method and someone posted it up on You Tube.
  

I've made some improvements to the horse method since then.  For instance you don't have to dismiss your horse if it died, you you have an Inn or another designated area, where the variable on your horse item is reset and you can call another horse.  I could delineating the method, which is mainly a convenience to the player, and fewer headaches for DM's, but there's not much point unless people want to use it.  The feedback I have gotten though has been all positive.  I know what is meant the horse scripts being a bit convoluted.  I probably spent a month or so trying to get it all working, with various condtional sitiuations, that must be addressed. 
 
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #28 on: August 10, 2012, 03:04:25 am »


               I'm going to have to look into the difference between the PCSkin and any other item in the inventory. There shouldn't be any difference. They are both items. The advantage of the skin is that it doesn't show up in the inventory. I dislike seeing widgets and data objects in inventory - even "invisible" ones. Life has enough clutter.

I am using Krits improvements to PC Skin. Perhaps that is why I have practically no issues. I'll look into it further when I get time, and post a bug free solution.

Anyway, good luck to you in this, Pstemarie. Solving the data side of things can be tricky. Especially when you are doing session based play like I believe you are. Its actually fairly complex when compared to a PW. My solution was to carve up the data into pieces.

I use the DB for somethings related to the story arc. Another DB for character specific things that transcend story arc. And variables set on the skin in case the same character is going to be played on a similar module but different computer - which may not have the DB moved along with it. Tricky stuff. I still don't believe my system really works. But its better  for me than NWNX would have been. I wouldn't want to train any other person who would host my module on how to set up NWNX etc....
               
               

               
            

Legacy_ShadowM

  • Hero Member
  • *****
  • Posts: 1373
  • Karma: +0/-0
Need Two Persistence Functions
« Reply #29 on: August 10, 2012, 03:58:20 am »


               Just some info. with inventory items for saving information to the item, it must be inside a bag. This is if you going to export the local vault character like for a single player game over multiple modules. Skin are better for server vault games IMO. Just make sure that the scripts/setting are not destroying the skin and creating a new one. I have also found that some data(if you referring to it in a conversation will not update until the skin is un-equipped and re-equipped)  My HR base is set for both if you need something to look over Pstemarie