View Single Post
Old 30.10.2005, 18:19   #17
kvoxi
Архивный участник
 
Join Date: Oct 2005
Posts: 102
Default

I suggest two way to set VALUES into DB. Per-PC and per-NPC.
Per PC:
There is "Quest" table in "lin2world" database. In this table is writed down quest data per each PC. Every PC have 16 sets of variables q,s,j.
q - quest number
s - state
j - journal
SetMemo(CSharedCreatureData *PC,int q) - add new set to "quest" table
RemoveMemo(CSharedCreatureData* PC,int q) - clear the set of variables
SetMemoState(CSharedCreatureData* PC,int q,int s) - set s for q
SetJournal(CSharedCreatureData* PC,int q,int j) - set j for q
First set of vars (q=255,s,j) is used by server (i dont know for which purposes). You may use other 15 sets for per-PC data storing (don`t forget about quests )
Per NPC (more difficult :
There is "npc_boss" table in "lin2world" database. In this table is writed down information about npcs:
alive - =0 or =1
hp,mp,pos_x,pos_y,pos_z - HP,MP,POS current values
time_low,time_high - ? (death_time and other)
i0 - extra variable
Look at npcpos.txt. NPC description may include
"dbname=[<NPC_db_name>] dbsaving={parameters}" parameters.
This parameters is allowed only for npcpos.txt.
When server start, it read npcpos.txt and create NPCs. If "dbsaving" parameter is exist, server load alive,hp,mp,pos_x,pos_y,pos_z,time_low,time_high,i 0 values from "npc_boss" table (select * from npc_boss where npc_db_name=@NPC_db_name).
What is the i0 variable? This is the db_value variable in CSharedCreatureData structure (offset 1892). How to use:
1) void CNPC::SetDBValue(CSharedCreatureData* c,int Value) - set i0 and myself.sm.db_value value
2) myself.sm.db_value - read this value.
If you need to save not per-PC or per-NPC, you may create new NPCs (as many as u need) and use i0 & SetDBValue() method.
How get CSharedCreatureData* pointer of any NPC from any NPC in ai-script? I will share later this info .
--
sorry 4my english. Learn russian lang!
kvoxi is offline