View previous topic :: View next topic |
Author |
Message |
kender
Joined: 16 Mar 2005 Posts: 3
|
Posted: Wed Mar 16, 2005 12:02 Post subject: Good Schema |
|
|
I'm trying to come up with a system for storing information about a character in the DB. I can't seem to come up with a good candidate for the unique identifier.
I believe most ppl use account name & character name concatted together. The problem with this is the potential for the character to make multiple characters w/ the same name, and have the data loaded for all of them. I'd concidered using an autoincrement field, but I have no way (none I can think of at anyrate) of saving that id with the characters file.
Any suggestions on how I can get some sort of unique ID saved with the character?
Thx again |
|
Back to top |
|
|
Acrodania
Joined: 02 Jan 2005 Posts: 208
|
Posted: Wed Mar 16, 2005 23:56 Post subject: |
|
|
When a new PC logs into my mod I create a random number between 1 and 10,000,000 then verify it is unique in the database. Then I save that variable onto the non-droppable emote wand in the PC's inventory. That number is now used to look up all character data in the database (since I have been altering names via scripting).
I also save the name of the BIC file in the database and associate it with that number in case something gets screwed up later...... |
|
Back to top |
|
|
kender
Joined: 16 Mar 2005 Posts: 3
|
Posted: Thu Mar 17, 2005 0:29 Post subject: |
|
|
So all the local ints on objects are persistant (over server restarts, etc). Even though local ints on players are not?
Also, I have noticed that by default PC's don't have a creature armor, and if I create one, and have the player equip it, it will go away when they exit. Is this standard behavior, or am I doing something wrong?
Thanks |
|
Back to top |
|
|
Kosmous
Joined: 10 Jan 2005 Posts: 44
|
Posted: Thu Mar 17, 2005 3:01 Post subject: |
|
|
creature skins on players are deleted OnEnter NOT OnExit and only if ELC is on (i think). You gotta create it everytime u log on. BTW, dont bother deleteing the skin through a script after ur done with it. Last time i tried it, the server will crash. |
|
Back to top |
|
|
Acrodania
Joined: 02 Jan 2005 Posts: 208
|
Posted: Thu Mar 17, 2005 18:33 Post subject: |
|
|
Correct, variables set on items inside a PC's inventory are persistent through logins, resets, etc. They also move between modules and servers without issues. Variables set on PCs are NOT persistent in any way.
PC Skins, Claws, etc are deleted on login and a new one has to be put back in the player's inventory. Then all variables, skills, feats, etc have to be reloaded onto it. |
|
Back to top |
|
|
Mergon
Joined: 30 Jan 2005 Posts: 3 Location: Ottawa, Canada
|
Posted: Sat Mar 19, 2005 4:10 Post subject: |
|
|
Acrodania wrote: | When a new PC logs into my mod I create a random number between 1 and 10,000,000 then verify it is unique in the database. Then I save that variable onto the non-droppable emote wand in the PC's inventory. That number is now used to look up all character data in the database (since I have been altering names via scripting).
I also save the name of the BIC file in the database and associate it with that number in case something gets screwed up later...... |
Instead of generating a random number, I just check for a persistent int (UserID) on the PC, if it isn't greater than 1, I get the current MaxUserID off the module, increment it by one, then update it to the module and to the pc. Each PC then has a unique Userid that is never repeated. _________________ Watch your back, conserver your ammo, and never cut a deal with a dragon |
|
Back to top |
|
|
|