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 
 
What to store...what to store
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
fgetce



Joined: 04 Jun 2006
Posts: 23

PostPosted: Tue Jun 06, 2006 0:00    Post subject: What to store...what to store Reply with quote

Starting the tables structure soon and was wondering what does the community consider to be the most important data store is?

The things I was thinking to store would be:

Character Attributes (but not modifier because they should be dynamic)

Character Hitpoints (what their hitpoint were when they logged out or at least what they were before the server crashed)

Character Equipment (would like an opinion on the importance of this one)

Quests (track the ones they have but have not done and the ones they have and have completed)

Journals (information they character gains)

Location (character location for later login)

Vendor Inventory (Will use Gryphyn's vendor system)

Housing (who owns what)

Storage (Bank storage of gold and items)

What do you track in the DB? What is important data to store and what can be left up to the whim of the game?


Anyway just looking for helpful ideas. I am also wondering where the persistent quest journal for the nwnx is? I saw the one on nwvault but that uses the Bioware DB standard.
Back to top
View user's profile Send private message
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Tue Jun 06, 2006 10:13    Post subject: Re: What to store...what to store Reply with quote

fgetce wrote:
Character Attributes (but not modifier because they should be dynamic)

Dont understand why you would want to store that at all. It already is *persistent*. But you should store feat uses and spell uses.
fgetce wrote:
Character Hitpoints (what their hitpoint were when they logged out or at least what they were before the server crashed)

Yes. Since per-BioWare-NwN it dosn't store HPs when entering (which means that you can relog when on 1 hp and get full HP again) you should certainly store HPs.
fgetce wrote:
Character Equipment (would like an opinion on the importance of this one)

Already is "stored", but good idea to call a ExportSingleCharcter() now and then, so if the server crashes people will still have a fairly new "backup".
fgetce wrote:
Quests (track the ones they have but have not done and the ones they have and have completed)

Depends on the quest. On our PW we track some quests (mainly the ones with major awards), and some can be redone every server reset.
fgetce wrote:
Journals (information they character gains)

Good idea, although on our PW we use the journals for the server rules instead.
fgetce wrote:
Location (character location for later login)

Only usable after server reset, but yes. Is a good idea, depending on your module. If you have a starting area with rules signs or whatever you should at least force people to go there after reset.
fgetce wrote:
Vendor Inventory (Will use Gryphyn's vendor system)

Dont know that one.
fgetce wrote:
Housing (who owns what)

Must! Must be persistent! Who wants to buy a house that after next server reset is not your anymore?
fgetce wrote:
Storage (Bank storage of gold and items)

Of course! What's the idea of storage if you loose your stuff after server reset?
fgetce wrote:
I am also wondering where the persistent quest journal for the nwnx is? I saw the one on nwvault but that uses the Bioware DB standard.

I think it's Knats journal thing that you are refering too... I dont think it exists using NWNx2, might be someone else made it though, dont know. Shouldn't be too difficult to change Knats to use NWNx2 though.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
fgetce



Joined: 04 Jun 2006
Posts: 23

PostPosted: Tue Jun 06, 2006 20:32    Post subject: Reply with quote

So instead of storing character attributes store Feats and spells? Are you refering to spells incase a unscrupulous user casts all their spells and relogs to regain them all without resting?

What would be the importance of storing Feats?

Would calling ExportSingleCharacter() once an hour be fine? How about every 15 minutes so there are about 4 exports within an hour? Should this be on a heartbeat script (I hate heartbeat scripts) or can the nwserver manage exports?

Some quests will be stored permanently, which are story driven and have specific rewards. Other quests that are repeatable are stored temporarily. Temp ones are usually stored until you complete it then they are removed so you could start it up again. The collect the bandit scalps is one such quest.

I will look over knat's global and make the changes to use nwnx2.

Housing will be a challenge to determine what needs storage. Anyone know of a good existing system out there? I looked over hunters persistent housing and SLATES system on the nwvault, but not sure which is the better system. Has any one had success with either of these?

The project is moving along fine.
Back to top
View user's profile Send private message
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Wed Jun 07, 2006 12:43    Post subject: Reply with quote

fgetce wrote:
So instead of storing character attributes store Feats and spells? Are you refering to spells incase a unscrupulous user casts all their spells and relogs to regain them all without resting?

Exactly.
fgetce wrote:
What would be the importance of storing Feats?

Same as spells. Turn undead (for an example), relog and you have them all again. We store them anyway.
fgetce wrote:
Would calling ExportSingleCharacter() once an hour be fine? How about every 15 minutes so there are about 4 exports within an hour? Should this be on a heartbeat script (I hate heartbeat scripts) or can the nwserver manage exports?

This really depends on how stable your server is. Our server is so stable that we just made it possible for players to "save character" from an item so that they can save their char after getting a lot of xp or items or whatever.
fgetce wrote:
Housing will be a challenge to determine what needs storage. Anyone know of a good existing system out there? I looked over hunters persistent housing and SLATES system on the nwvault, but not sure which is the better system. Has any one had success with either of these?

We're using HunterAPs housing, it's working very nice. It dosnt use NwNx2 though, but that could be changed. I suggest using HunterAPs for sure.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
fgetce



Joined: 04 Jun 2006
Posts: 23

PostPosted: Tue Jun 13, 2006 16:36    Post subject: Me again Reply with quote

I understand the storing the hitpoints when they log out and when they log in I can apply magical damage to reduce their full hit points to where they were when they left the game.

Character has max 55 hitpoints and logs out with 21 hit points. When they relog in 21 hours later, they will have full hit points so I take the db record of 21 hit points for that character, subtract it from 55 which gives me 34 and than apply 34 magical damage to the max 55 hit points to set them to 21 hit points where they were when they logged out (or something like that). Not sure if their is a better solution.

However, I am having trouble understanding how to track and apply feats used. Anyone have an example of how they track feat use and apply that when the pc logs back in?
Back to top
View user's profile Send private message
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Thu Jun 15, 2006 10:56    Post subject: Reply with quote

I use an include file made by EPOlson for Hitpoints/Feats & Spell uses. My version is heavily modified though. If you head over to The Neverwinter Nights Vault and find EPOlson's "PWHelper", you can fish out an include file called "pw_inc_anticheat", which does all that stuff.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
fgetce



Joined: 04 Jun 2006
Posts: 23

PostPosted: Thu Jun 15, 2006 18:26    Post subject: Reply with quote

Thanks. I got it and will sort through it later.

Do you know of other helpful scripts on nwvault?

I have many files and scripts from there but it can be difficult finding what you need.

Things I am looking for include setting up a campsite, cooking food on a campfire (both meat and fish). I also am looking for a good fishing mod. I have DHFishing version 2 but I would have to edit it for my needs as the fish included with it do not fit well with the campaign world of forgotten realms. Everything else I believe I have covered like persistent storage, player housing, crafting (using CNR), Knat's Persistent journal system (set to use nwnx2).

Thanks again.
Back to top
View user's profile Send private message
Grim



Joined: 04 Jan 2005
Posts: 12

PostPosted: Mon Jun 26, 2006 23:33    Post subject: Reply with quote

Don't know if you'd still need this, but I did a conversion of Knat's system to use NWNX2.

http://nwvault.ign.com/View.php?view=scripts.Detail&id=2443
_________________
Grim Havoc
Systems guy for Mists of the Mordri
(now private)
Back to top
View user's profile Send private message Yahoo Messenger
fgetce



Joined: 04 Jun 2006
Posts: 23

PostPosted: Tue Jun 27, 2006 16:40    Post subject: Reply with quote

Grim wrote:
Don't know if you'd still need this, but I did a conversion of Knat's system to use NWNX2.

http://nwvault.ign.com/View.php?view=scripts.Detail&id=2443



Thanks. I was doing the conversions myself, plus I was adding a few extra columns for my needs. This will help.

What are the opinions of the HCR paks?
Back to top
View user's profile Send private message
fgetce



Joined: 04 Jun 2006
Posts: 23

PostPosted: Thu Aug 24, 2006 17:10    Post subject: Reply with quote

Grim wrote:
Don't know if you'd still need this, but I did a conversion of Knat's system to use NWNX2.

http://nwvault.ign.com/View.php?view=scripts.Detail&id=2443


Hey Grim, is it also possible to store a short description of the quests and have them auto populate into the players quest journal?

Basically if they take the quest "Rescue Joe Blow Sixpack", I also want to store in their quest log "I must rescue Joe Blow Sixpack from the brigands in the Cloakwood Forest.", complete with the dates and stuff. So when they log back in they will have the review their quest log to see what quests they have open and give them a short description of what they mustdo. Sort of like EQ2. You have the quest name and a short description of what you must do.
Back to top
View user's profile Send private message
fgetce



Joined: 04 Jun 2006
Posts: 23

PostPosted: Thu Aug 24, 2006 17:21    Post subject: Never mind, I got it. Reply with quote

Never mind Grim, I figured it out. You can create the journal entry through the journal editor and link it to the Plot ID through NWNX2.


I do have a question on player locations.

What function do you use to get the players current position in the game? Is it X:Y:Z coords?

How should it be stored? As a string? Int? I assumed string.

Thanks for the help. I owe alot to the people who came before me.
Back to top
View user's profile Send private message
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Thu Aug 24, 2006 21:32    Post subject: Reply with quote

Code:

#include "aps_include"


 SetPersistentLocation(oPC, "sVarName", GetLocation(oPC));

Mr. Green
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Thu Aug 24, 2006 21:58    Post subject: Re: Never mind, I got it. Reply with quote

fgetce wrote:
I do have a question on player locations.

What function do you use to get the players current position in the game? Is it X:Y:Z coords?
location lLoc = GetLocation(oPC);
fgetce wrote:
How should it be stored? As a string? Int? I assumed string.
string sLoc = APSLocationToString(lLoc); //see aps_include.nss
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
fgetce



Joined: 04 Jun 2006
Posts: 23

PostPosted: Sun Sep 03, 2006 21:41    Post subject: Need some trouble shooting Reply with quote

Here is my onclientexit code inside of main()

Code:

//Get the PC.
    object oPC = GetExitingObject();

    //For now, if it's a DM, kick out.
    if(GetIsDM(oPC) || GetIsDMPossessed(oPC))
    {
        return;
    }

    // PC Name
    string sTag = GetName(oPC);
    // PC Player Name
    string sPlayer = GetLocalString(oPC,"PLAYERNAME");
    //String to build the SQL query.
    string sSQL;
    // get char level
    int iLevel = GetLevelByPosition(1,oPC)
        + GetLevelByPosition(2,oPC)
        + GetLevelByPosition(3,oPC);

    // get char hitpoints
    int hp = GetCurrentHitPoints(oPC);

    // get char xyz location
    //location pcLocation = GetLocation(oPC);

    string pcLoc = APSLocationToString(GetLocation(oPC));

    int index;
    int iLev;

    // get char spells
    string sSpells;
    for(index = 0; index < 622; index++)
    {
        iLev = GetHasSpell(index, oPC);
        if (iLev > 0)
        sSpells += "S" + IntToString(index) + "=" + IntToString(iLev) + ";";
    }
    // get char feats
    string sFeats;
    for(index = 0; index < 480; index++)
    {
        iLev = GetHasFeat(index, oPC);
    if (iLev > 0)
        sFeats += "F" + IntToString(index) + "=" + IntToString(iLev) + ";";
    }

    // temp SQL return string
    string sTemp;

    // get all players that match Exiting PC Name &
    // are not logged out (according to DB)
    sSQL = "SELECT player FROM players WHERE tag='" + sTag + "' AND timein<>0;";
    SQLExecDirect(sSQL);

    setPCArray(sTag);
    // step through list of returned PCs that are logged in
    // & match against list of matching PCs in game
    // if returned PC does not match any PCs in game then this
    // PC needs to be logged out (they no longer exist in game)
    while(SQLFetch()!=SQL_ERROR)
    {
        // DO NOT STOP WHEN 1 IS FOUND!!!
        // need to set all open accounts that are
        // currently not logged in to a timein of 0
        sTemp = SQLDecodeSpecialChars(SQLGetData(1));

        if(!matchTags(sTag, sTemp))
        {
            // log out PC
            sPlayer = sTemp;
            sSQL = "UPDATE players SET "
                + "totaltime=UNIX_TIMESTAMP()-timein+totaltime, "
                + "timein=0, "
                + "pclevel=" + IntToString(iLevel)
                + ", pchitpoints=" + IntToString(hp)
                + ", pcfeats='" + sFeats
                + "', pcspells='" + sSpells
                + "', pclocation='" + pcLoc
                + "' WHERE player='" + sPlayer
                + "' AND tag='" + sTag + "';";
            SQLExecDirect(sSQL);
        }
    }


Everything is working except the persistent location. I can go into mySQL and see everything else that it writes to the DB but the pclocation is always blank. I do not know what step I am missing or what logical bug there is within the code or how I am calling for the location.

Does anyone else see the trouble?

My database table architecture is as follows:
Code:

+--------------+-------------+------+-----+------------+-------+
| Field        | Type        | Null | Key | Default    | Extra |
+--------------+-------------+------+-----+------------+-------+
| player       | varchar(64) | NO   | PRI | NULL       |       |
| tag          | varchar(64) | NO   | PRI | NULL       |       |
| pubkey       | varchar(8)  | NO   |     | NULL       |       |
| ip           | varchar(32) | NO   |     | NULL       |       |
| pcreputation | smallint(4) | NO   |     | 1          |       |
| pclevel      | int(11)     | NO   |     | 1          |       |
| pchitpoints  | int(11)     | NO   |     | 1          |       |
| pcfeats      | text        | NO   |     | NULL       |       |
| pcspells     | text        | NO   |     | NULL       |       |
| pclocation   | text        | NO   |     | NULL       |       |
| creationdate | date        | NO   |     | 0000-00-00 |       |
| laston       | date        | NO   |     | 0000-00-00 |       |
| isdead       | tinyint(4)  | NO   |     | 0          |       |
| indebt       | tinyint(4)  | NO   |     | 0          |       |
| timein       | int(11)     | NO   |     | 0          |       |
| totaltime    | int(4)      | NO   |     | 0          |       |
| deathcount   | int(11)     | NO   |     | 0          |       |
| pcdeathcount | int(11)     | NO   |     | 0          |       |
| pckillcount  | int(11)     | NO   |     | 0          |       |
+--------------+-------------+------+-----+------------+-------+
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Mon Sep 04, 2006 3:20    Post subject: Reply with quote

IIRC, you can't store location info across resets, because the way they are asigned shiftes. You have to reconstruct it via area tags, and vectors, or something along those lines. There are many threads in the Bioware forums about this, should you need more details.
Funky
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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