View previous topic :: View next topic |
Author |
Message |
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Sat Aug 20, 2005 1:10 Post subject: persistent location bug |
|
|
If i change location where are Players saved, then they starting in starting location.
I saved all players every 3minutes or when they using log-out item.
my saveing script:
Code: | void SavePlayer(object oPC)
{
//zjisti lokaci kde hrac prave je
location lLocation = GetLocation(oPC);
//definuje objekt na ktery se hracova pozice ulozi
//k tomu potrebuje zjistit hracovo ID
//zjisti id hrace
int i = GetPersistentInt(oPC,"sh_opc_id");
//konvertuje x na "x"
string s = IntToString(i);
//definuje tag logout svitku
string xtag = "sh_logout_";
//definuje tag logout svitku konkretniho hrace
string tTag = xtag+s;
//konecne dostavame predmet na ktery ulozime hracovu pozici
object o = GetObjectByTag(tTag);
//zjisti maximum zivotu hrace
int max = GetMaxHitPoints(oPC);
//zjisi kolik zivotu ma hrac prave ted
int ted = GetCurrentHitPoints(oPC);
//vypocita zraneni ktere hrac utrpel
int zbytek = max-ted;
//ulozi zraneni do databaze
SetPersistentInt(oPC,"sh_zivoty",zbytek);
//ulozi lokaci do databaze
SetPersistentLocation(o, "ulozena_lokace", lLocation);
} |
my loading script:
Code: | void LoadPlayer(object oPC)
{
//definuje objekt na ktery se hracova pozice ulozi
//k tomu potrebuje zjistit hracovo ID
//zjisti id hrace
int i = GetPersistentInt(oPC,"sh_opc_id");
//konvertuje x na "x"
string s = IntToString(i);
//definuje tag logout svitku
string xtag = "sh_logout_";
//definuje tag logout svitku konkretniho hrace
string tTag = xtag+s;
//konecne dostavame predmet na ktery ulozime hracovu pozici
object o = GetObjectByTag(tTag);
//promenna zjistujici hracovu ulozenou pozici
location lLocation = GetPersistentLocation(o,"ulozena_lokace");
//vypsani textu
SendMessageToPC(oPC, "Přesun na uloženou pozici.");
//teleportuje hrace na ulozenou lokaci
AssignCommand(oPC, ActionJumpToLocation(lLocation));
//promenna ktera vytahne z databaze zda je hrac mrtvy nebo ne
int mrtvy = GetPersistentInt(oPC,"sh_jemrtvy");
//pokud byl pred restartem hrac mrtvy znovu ho script zabije
if (mrtvy==1)
{
//efekt smrti
effect Smrt = EffectDeath(FALSE, TRUE);
//zabije hrace
ApplyEffectToObject(1,Smrt,oPC,1.0);
}
} |
thx for help |
|
Back to top |
|
|
Primogenitor
Joined: 08 Jan 2005 Posts: 88
|
Posted: Sun Aug 21, 2005 12:19 Post subject: |
|
|
ActionJumpToLocation doesnt work in an module OnEnter script. Either put it in the OnEnter of the first area, or the OnEnter of a trigger around the starting location. |
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Sun Aug 21, 2005 15:07 Post subject: |
|
|
Primogenitor wrote: | ActionJumpToLocation doesnt work in an module OnEnter script. Either put it in the OnEnter of the first area, or the OnEnter of a trigger around the starting location. |
this is include script for script in onenter in starting area |
|
Back to top |
|
|
|
|
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
|