View Single Post
  #10  
Old 07-20-2009, 06:25 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by cbk1994 View Post
There's an annoying delay between the time the onActionPlayerOnline function in the Control-NPC is called and when the classes are joined. That, or the level NPCs are called first (onPlayerEnters).

The problem is that this kind of thing happens in level NPCs that have an onPlayerEnters() function:



This is the onActionPlayerOnline function.

PHP Code:
function onActionPlayerOnline() {
  if (! (
player.account in serveroptions.staff.tokenize(","))) {
    
player.addWeapon("Temp/Server Warp");
    return; 
// goodbye, global news team
  
}
  
  
clientr.serversideReady false;
  
  
player.join("player_itemfunctions");
  
player.join("player");
  
player.join("player_staff");
  
player.join("player_hpfunctions");
  
  
player.loadPlayer();

As you can see, the player class is being joined almost at once.

I think that the server should wait up to five seconds for onActionPlayerOnline to complete and for all of the classes to join, and then trigger onPlayerEnters to level NPCs. This could also be extended to weapons so that they are not called before their items and such have been loaded.
Hmm you can't put the loadPlayer() stuff in the onCreated() class of the last joined class? I do this on Rudora and it works fine, since onCreated() is called in the class when it is joined to the player.
__________________
Skyld
Reply With Quote