logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Good Schema

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
kender



Joined: 16 Mar 2005
Posts: 3

PostPosted: Wed Mar 16, 2005 12:02    Post subject: Good Schema Reply with quote

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
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Wed Mar 16, 2005 23:56    Post subject: Reply with quote

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
View user's profile Send private message
kender



Joined: 16 Mar 2005
Posts: 3

PostPosted: Thu Mar 17, 2005 0:29    Post subject: Reply with quote

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
View user's profile Send private message
Kosmous



Joined: 10 Jan 2005
Posts: 44

PostPosted: Thu Mar 17, 2005 3:01    Post subject: Reply with quote

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
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Thu Mar 17, 2005 18:33    Post subject: Reply with quote

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
View user's profile Send private message
Mergon



Joined: 30 Jan 2005
Posts: 3
Location: Ottawa, Canada

PostPosted: Sat Mar 19, 2005 4:10    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group