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 
 
Double JumpTo???
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Grim



Joined: 04 Jan 2005
Posts: 12

PostPosted: Sat Jan 29, 2005 1:31    Post subject: Double JumpTo??? Reply with quote

I'm hoping someone here has encountered something like this and can tell me what I'm missing.

I have a table where I am storing the last bindstone tag a player has used. On enter I check to see if the server has been reset and if so, I use that database stored tag to send the player to the last bindstone they used. Here is my OnEnter code:

Code:
#include "mom_base_include"

void main()
{

     object oPC = GetEnteringObject();

     ClientEnterInitStats(oPC);
     string pcDeathStatus = RetrievePCState(oPC);

     if (!GetIsDM(oPC))
     {

       if (pcDeathStatus == "D")
         {
              SendPCBindpoint(oPC);
              UpdateServerResetFlagPC(oPC);
              DelayCommand(2.5, PopUpDeathGUIPanel(oPC,TRUE, TRUE, 66487));
         }
       else if (pcDeathStatus != "D")
         {
            int iServerReset = GetServerResetFlag(oPC);
            if (iServerReset == 1)
              {
               SendPCBindpoint(oPC);
               UpdateServerResetFlagPC(oPC);
              }
         }
     }
}


I've rewritten SendPCBindpoint several different ways. The only way I can get the jump to work is to make the call twice, like this:

Code:
void SendPCBindpoint(object oCreature)
{
  if(GetIsPC(oCreature))
  {
    string  strBindpoint = dhGetPlayerBindpoint(oCreature);  // returns tag from database, works
    object oSpawnPoint = GetObjectByTag(strBindpoint);
    AssignCommand(oCreature,JumpToLocation(GetLocation(oSpawnPoint)));
    AssignCommand(oCreature,JumpToLocation(GetLocation(oSpawnPoint)));
  }
}


But the result of this is that the player sees the bindstone area begin to load, then it loads the default start area, then it finally goes back and loads the bindstone area.

If I try this:
Code:
void SendPCBindpoint(object oCreature)
{
  if(GetIsPC(oCreature))
  {
    string  strBindpoint = dhGetPlayerBindpoint(oCreature);  // returns tag from database, works
    object oSpawnPoint = GetObjectByTag(strBindpoint);
    AssignCommand(oCreature, ClearAllActions());
    AssignCommand(oCreature,JumpToLocation(GetLocation(oSpawnPoint)));
  }
}

The player sees the bindstone area begin to load, but then the default start area loads.

It seems that there is some jump to the default start area that is happening regardless and my double call somehow gets stacked on that. I thought using ClearAllActions would fix it, but no luck.

Any ideas?
_________________
Grim Havoc
Systems guy for Mists of the Mordri
(now private)
Back to top
View user's profile Send private message Yahoo Messenger
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Sat Jan 29, 2005 1:47    Post subject: Reply with quote

I'd try to move that code from the ClientEnter of the module to the OnEnter script of the default starting area. It could simply be, that during the ClientEnter of the module, the PC isn't completely valid for a Jump, yet. Another Way would be a DelayCommanc(2.0f,... for the Jump. I prefer the area OnEnter though, since it doesn't depend too much on the client's connection speed.
Back to top
View user's profile Send private message
Grim



Joined: 04 Jan 2005
Posts: 12

PostPosted: Sat Jan 29, 2005 2:07    Post subject: Reply with quote

I tried the delay command to see if that would get me there but still nothing. I may push have to push it out to the area enter event, but maybe someone has some other ideas? In testing I'm running all of this on my local machine so I would think the delay would have gotten me some kind of fix.

Any other suggestions?
_________________
Grim Havoc
Systems guy for Mists of the Mordri
(now private)
Back to top
View user's profile Send private message Yahoo Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Sat Jan 29, 2005 3:03    Post subject: Reply with quote

Funny you should have run into this, as even though I have an on area enter script done for the players coming in following a reload or crash, I have always had the same issue if they came back dead, always in the start area. However, We solved the issue of jumping a player to a DB stored location WAYYYYYYYYY back... and yes, you need to put any calls for onenter into the start area as a seperate script calling the jumptolocation, doesn't need a delay then, and of course any other scripting you use. I personally have all sorts of area enter/exit scripts for various reasons.. it's the way to go Smile

Makz.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Grim



Joined: 04 Jan 2005
Posts: 12

PostPosted: Sat Jan 29, 2005 9:06    Post subject: Reply with quote

Thanks for the feed back Makz (yet again Smile ). I had planned on creating empty base area on enter and exit scripts to serve as place holders because I could see that down the road we might have various things we would want to handle there even though nothing came immediately to mind. Guess I've found the first practical reason to do so. Thanks to everyone.
_________________
Grim Havoc
Systems guy for Mists of the Mordri
(now private)
Back to top
View user's profile Send private message Yahoo Messenger
Asmodae



Joined: 07 Jan 2005
Posts: 55

PostPosted: Mon Jan 31, 2005 11:12    Post subject: Reply with quote

what about this...
Code:

void SendPCBindpoint(object oCreature)
{
  if(GetIsPC(oCreature))
  {
      string  strBindpoint = dhGetPlayerBindpoint(oCreature);  // returns tag from database, works
      object oSpawnPoint = GetObjectByTag(strBindpoint);
      object oArea = GetArea(oCreature); // get the area the creature is in
      if(GetIsObjectValid(oArea)==TRUE) // if the area is valid, jump
      {
        AssignCommand(oCreature,JumpToLocation(GetLocation(oSpawnPoint)));
        AssignCommand(oCreature,JumpToLocation(GetLocation(oSpawnPoint)));
      }
      else // the area isn't valid (the pc is still logging in) so wait.
         DelayCommand (0.5,SendPCBindpoint(oCreature));
  }
}


This just checks to make sure the pc is in a real area (the startpoint) before jumping. This helps keep all your code in one place, and it works great. I like keeping things that happen OnClientEnter, in that event. Smile
_________________
Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Mon Jan 31, 2005 16:53    Post subject: Reply with quote

Asmodae, looks good! Smile now to see if that solves players coming back dead to start point, if this works, I owe you something I am sure Very Happy.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Asmodae



Joined: 07 Jan 2005
Posts: 55

PostPosted: Mon Jan 31, 2005 17:25    Post subject: Reply with quote

The original idea isn't mine, but I've tweaked it for our uses, so I figured others might make use of it as well. Oh, I didn't look at the internal jump code closely when I posted earlier, you shouldn't need the second jump to location entry.

I also do a fade to black when the client enters, and clear it at the end of the area jump, so they don't see the start area at all, just maybe a double load screen.

You mention coming back in dead? I've not had that issue, but more than likely there's a conflict in whatever code that checks a pc's health or death state when they log back in. I've had things not process correctly due to changes in event order or trying to get a value at the wrong time (so its null rather than a real value).
_________________
Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Mon Jan 31, 2005 19:39    Post subject: Reply with quote

Asmodae, this is the issue, player leaves server dead, whether he just did, or last time, server reloads due to crash or normal scheduled event, enters server dead, as they should, it checks the DB, but, instead of going to the DB location, which was stored on death, I checked this, they always end up back at the start point. Note again, this is ONLY on a reload, if they die, log off, and come back, they always will be dead at where they died. I tried a number of ways around this, and I haven't tried your way of checking for DB on enter yet, thoughts?

Thanks in advance.

Makz.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Baldorcete



Joined: 05 Jan 2005
Posts: 6

PostPosted: Mon Jan 31, 2005 20:17    Post subject: Reply with quote

Sorry I don't have my scripts at hand, but you must make sure that you restore the health state of the PC after the jump is completed. If not, a dead PC will not jump to the location. So, another check to make sure the area is correct is in place, and maybe playing with the action queue.
Back to top
View user's profile Send private message
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Mon Jan 31, 2005 20:45    Post subject: Reply with quote

Ahh haaa... he says..

Baldorcete wrote:
Sorry I don't have my scripts at hand, but you must make sure that you restore the health state of the PC after the jump is completed. If not, a dead PC will not jump to the location. So, another check to make sure the area is correct is in place, and maybe playing with the action queue.


Ok, so. at the moment, I check their health status ( if below 0 ) on entry, that is done off the On Client Enter script, then, when they enter the start area, which you have no choice about, it then checks for the last location, and tries to jump them, so, stay with me here, because I am not a scripter, I am just trying to fix something because we didn't understand this aspect of NWN, if we go, check location in start area enter script, jump them, then check the health status it should sort it out?

Thank you again for any help, long standing annoying thing.

Makz.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Asmodae



Joined: 07 Jan 2005
Posts: 55

PostPosted: Mon Jan 31, 2005 21:10    Post subject: Reply with quote

Well it happens like this: you have to wait for the pc to be in an area to jump, and it turns out you can't jump a dead pc (thanks to Baldorcete for that insight).

This problem was solved in the code that I use so I never ran into it, but I'll sumarize it here.

Code:

// restore health
void Pass2(object oPC)
{
  // do your restore health code here.
}


Code:

// restore location
void Pass1(object oPC)
{
   if (GetIsValid(GetArea(oPC)))
   {
      // do the jump here
      pass2(oPC); // now start the next item in sequence
   }
   else
     DelayCommand(0.5,Pass1(oPC));
}


Code:

void main()
{
  do your must have setup here, in the main function
  pass1(GetEnteringObject());
}



This code is a very simplified version of what came with the NWN-FF package to handle on enter stuff (credit) which is what I started out with. I've stripped almost everything else out of the package that doesn't have to do with DB access, but this little bit solved a lot of our on entry problems, which is good 'cause who likes recreating the wheel. Smile

Hope that helps, or gives you a direction to take off in.
_________________
Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com


Last edited by Asmodae on Mon Jan 31, 2005 22:22; edited 1 time in total
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Mon Jan 31, 2005 21:43    Post subject: Reply with quote

Confused Ok, I am a little confused now, or maybe I didn't make myself clear enough... I'll try again.

Player dies, logs off, server has been reloaded since, they come back on, they are dead, that is GOOD, jump player to location, doesn't work, they land dead ( should be dead) at start point.

Now, what I *THINK* I am seeing here, is this, if I check location first from the DB, then jump them with locatin from DB, then check their health from DB, and if it is dead, kill them... will that do it?

Thanks again,

Makz.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Asmodae



Joined: 07 Jan 2005
Posts: 55

PostPosted: Mon Jan 31, 2005 22:10    Post subject: Reply with quote

yep, you nailed it.

After a server reset, its completely up to you to reset the PC's condition, as the server doesn't remember it anymore. So you have to kill the PC, but you can't do that untill after you relocate them. So the one function waits untill you can relocate properly, and once that's done calls the next one, which restores the PC's health.
_________________
Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Mon Jan 31, 2005 22:41    Post subject: Reply with quote

*Bows* thank you, I shall give that a whirl and report back, I am fairly confident I have this down now Smile
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
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 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