I'm having a problem with my client and clientr variables resetting (or something) when I reconnect. I have a couple examples of this. One is with quests (right now quest progress is held as a client var. Might hold it on the serverside later or just encrypt.) The second is our stat system, player stats determine what sorts of items the character can equip (i.e you can put 10 points in swords and have some swords to choose from to equip). Those stats are held in clientr vars.
Here's a snippet of the quest sytem:
PHP Code:
function onActionClientside( cmd , p1 , p2 ) {
switch ( cmd ) {
case "UpdateQuestProgress":
for ( temp.i=0; temp.i<client.quests_all.size(); temp.i++ )
if ( client.quests_all[i][0] == p1 ) client.quests_all[i][1] += p2;
break;
}
}
Quest info is held like..
var = { {"questname",progress},{"questname",progress} };
That's used for when the player does something that affects quest progress, I can tell the system to update the progress. And it works fine, I send some quest progress and it updates it properly and everything. When I reconnect, though, all of the quest progress is lost and the float values of the client vars are set to zero.
This is what happens in the stat system. I'll have, for example, 20 mastery points in swords. I can keep adding to swords and it'll work fine. Then when I reconnect, again, it seems that the vars are reset. Because when I add into swords again, if I add 5 more mastery points into swords I'll end up with 5, instead of 25.
I have a MUD sys with which I can store this sort of stuff, right now I'm only using it to hold item information, but if it came to it I guess I could use that, I just prefer not having to revamp so much. Any ideas?