Aller au contenu

Photo

Need Two Persistence Functions


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

#1
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
I've just begun using databases for my module to add some persistence and have run into a stone wall regarding two "required" functions.

I need a function that can store remaining spell uses in the database for each character when they leave the server.
I also need a function that can store remaining feat uses in the database for each character when they leave the server.

I am using the Bioware Database with Knat's NBDE installed.

The feat storing fucntions I tried -  and scrapped - was generating TOO MANY OPERATIONS error. The spell one seemed to work.

I'm sure someone out there has done this, hopefully without NWNX - which I just don't comprehend.

#2
Shadooow

Shadooow
  • Members
  • 4 468 messages
http://nwvault.ign.c....Detail&id=3835

though, it might cause TMI as well - at least it did in my testing with custom spells, easy to fix if you delay each 200 hundred spell ids by milisecond

could be done same way with feats

anyway - found out that the spell uses issue didnt come from the Restore Spell Uses On Login ini option so I returned to that - this issue seems to be linux only engine related.

The remarks with metamagic still applies.

#3
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
This is what I'm currently doing. Spells store fine, feats cause TMI - even with delay.

#4
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
After playing around some with the Restore Spell Uses On Login ini option I decided to omit the procedure completely as its not needed for what I'm trying to achieve. It also appears that this .ini setting restores feat uses on login as well (at least it did for summon familiar)...

#5
Shadooow

Shadooow
  • Members
  • 4 468 messages
well feat uses were persistent before 1.69 and this ini option already - I thought you have some other reason to store them

#6
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
No, I am a major NOOB when it comes to multi-player - although I'm learning fast. I've always made stuff with SP then just brought my LAN group in to play it - never a need for henchmen doing it that way. Now they want something more akin to a PW.

I've been doing a lot of reading on MP and I'm simply blown away that the Server Settings in nwnplayer.ini don't have more info available. What is out there tends to be repetitious and only offers minimal information...

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


#7
Shadooow

Shadooow
  • Members
  • 4 468 messages
okay - still you need to make persistent death and track hitpoints

see this: http://nwvault.ign.c....Detail&id=6161

btw you know that local variables stored to the item persist server reset? Useful for storing PC-only info so you dont have to write everything into database.

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


#8
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Got that module, thanks for the link though. Persistant HP is no problem, but I was having great difficulties with items. I know everyone says that local variables stored on them are persistant, yet mine kept being wiped clean - even if the character was exported then reloaded into the module.

When I put in debug strings to list out values on what was being stored all the functions were logging the correct values. However, on reload it was if the variables never existed. :blink:

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


#9
Shadooow

Shadooow
  • Members
  • 4 468 messages
is this localvault?

#10
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Server vault. I have been testing only with the standalone server or going through multiplayer.

#11
eeriegeek

eeriegeek
  • Members
  • 47 messages
Hey Pstemarie, Storage on an inventory item is normally very reliable with servervault characters, a lot of PW's depend on it, but also make sure you're not using a stackable item for your variable storage. Stackables have known issues with losing information if they get re-stacked. Also, make sure there is only 1 item in the inventory with the tag of your persistent item, otherwise you may find a different one when the inventory is reorganized. The most common way I see this done is with a single Misc Small, non-droppable item, with a a tag & resref of something like "pw_token".

Modifié par eeriegeek, 09 août 2012 - 02:49 .


#12
henesua

henesua
  • Members
  • 3 863 messages
eeriegeek, the best item to use in that case is the pcskin.

i have noticed that sometimes the variables are not stored. BUT if you export the character there should be no problem. something to do some testing on....

Modifié par henesua, 09 août 2012 - 04:51 .


#13
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Yeah, the PC skin is pretty much useless. The functions that check for it appear to be majorly borked, replacing it or unequipping it when they shouldn't. As far as storing variables - totally useless. I tried for four days to build persistence around that item and had to abandon it in favor of a database.

#14
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
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".

#15
henesua

henesua
  • Members
  • 3 863 messages
Pstemarie, I've noticed some bugginess but nothing to indicate to me that the PC Skin is useless. Its held up substantially in testing. My incident of error is extremely low. For example, only one PC on my server has had a problem with 1 variable over the course of 12 sessions. I've had about 60 characters (not counting my own test characters) go through arnheim counting the testing phase.

So yes, this is a small sample, but the level of error is very very small, and may be a fault of my own rather than the PC skin.

Modifié par henesua, 09 août 2012 - 05:18 .


#16
eeriegeek

eeriegeek
  • Members
  • 47 messages
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.

#17
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
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".

#18
Shadooow

Shadooow
  • Members
  • 4 468 messages

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.

#19
Shadooow

Shadooow
  • Members
  • 4 468 messages

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?

#20
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
I think lame may be harsh, but wrong fits - especially with the errors that seem to occur. :P

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 .


#21
Shadooow

Shadooow
  • Members
  • 4 468 messages
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.

#22
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Seems like TheKrit already dealt with this stuff...ty GOD

#23
Shadooow

Shadooow
  • Members
  • 4 468 messages

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.

#24
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
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 .


#25
Carcerian

Carcerian
  • Members
  • 1 108 messages
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 .