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 
 
NWNx Performance question
Goto page Previous  1, 2
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Darelius



Joined: 08 Dec 2008
Posts: 8

PostPosted: Fri Dec 19, 2008 14:50    Post subject: Reply with quote

Hmm, because the table with the "monster" kills contain all information about the character, also death statistic and quest progreess are saved there.

I used the "standard" configuration of NWNx.

Only the expiration date (equal as timestamp) is not neccessary, but i kept it so far.

In the Standard Configuration, there is Player, Character, Key and Value and there i have all i need Wink, its the same as in your example.

Only epiration you exchanged against other stuf, i never need, against updated.

So "monster" is at me sometimes a monster, sometimes others.

In case of monsters, the "Tag" of the Monster stands there in case of Death statistics, ther ist death, respawn and xploss.
Also there are several entrys for Quests and some server-specific Data relevant for the character.

For example en entry "plane" with the number of the plane the character is in, normally 0 before start and 1 in first plane Wink

When the Player has other characters, these are also in this table, one table for each player.
The Player specific summary is also in it.
That means, all monsters, that player killed with all characters together,
There is no "player" or "character", becouse i used object GetModule() for it, so there is no "player" and the "character" is the name of the module.

So the arrangement of the database is okay for me...

To successfully identify the players and characters, every Player has a specific ID as each character has.
The Player ID is neccessary for the table.
So Player 1 has its own table player_1 the player 2 has player_2 and so on.
This ID runs up for each player registering on the server.
So when there are 5 players on, id 3, 57, 229, 32 and 24, every player use its own table.

I decide to make a table each player, because its easier to remove an entire table instead of searching an extreme long table, when its neccessary to delete a player...

I tested the script for identifying player and character and it works.

During testing i have such tables:
chars
death
monstercounter
planes
players
player_1
vzde

chars and players contains the ID of the character and player.
The ID for the characters is for the counting of all existing characters on the server,
player_[x] are the player specific tables.
death contains the server gloal death statiscics, maybe this table merges with another later.
monstercounter counts the server global monsterkills
planes contains the information about the planes in the server (for example, first plane is the fire plane and later more will appear.
vzde are for some other module-specific datas.

So the database work so far very good.
I think, later the some databases will edit for sorting reasons, some will merge, but that i have to see, when the first plane is nearly ready and there is a possibility to look, what amount of datas came up than.

I bet, an npc database will be neccessary, too and some other but i make each database, when i need them.

(this means, that im still on contructing the module and there is no npc so far and the script system is not ready, but wehn, i made it with database together in cooperation but not before i am on the npcs.)

To save the monstercounter, i use "GetKiller()" so far.

This is the script for the monstercounter
Code:

// Monstercounter
// Read Local Int and add +1 than write local and in db
object oPC=oKiller;
object oM=GetModule();
object oK=OBJECT_SELF;
string sMonster=GetTag(oK);
string sTable=GetLocalString(oPC,"playertable");
int iMonsterPlayer=1+GetLocalInt(oPC,"player_"+sMonster);
int iMonsterCharacter=1+GetLocalInt(oPC,sMonster);
int iMonsterModule=1+GetLocalInt(oM,sMonster);
SetPersistentInt(oPC,sMonster,iMonsterCharacter,0,sTable);
SetPersistentInt(oM,sMonster,iMonsterPlayer,0,sTable);
SetPersistentInt(oM,sMonster,iMonsterModule,0,"monstercounter");
SetLocalInt(oM,sMonster,iMonsterPlayer);
SetLocalInt(oPC,sMonster,iMonsterPlayer);
SetLocalInt(oM,sMonster,iMonsterModule);

It reads the local variables, set it one up and stores tham in the db and the local.
(the player_db is the name of the table for the players database, identified OnClientEnter for him)

Okay, all theory, because i am not at the step for monsters right now Wink


...DX
_________________
Darelius, Keeper of the Elements
Back to top
View user's profile Send private message
Disco



Joined: 06 Dec 2006
Posts: 152

PostPosted: Mon Dec 22, 2008 12:30    Post subject: Reply with quote

I have my doubts, but then again: it's your server, not mine.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Goto page Previous  1, 2
Page 2 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