Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Making a WNPC wait until Level functions are executed (https://forums.graalonline.com/forums/showthread.php?t=134258281)

DustyPorViva 03-06-2010 08:02 PM

Making a WNPC wait until Level functions are executed
 
Is there a way to make a function in a WNPC(say, onPlayerenters()) wait until the same function in the level is called before continuing? For example I have a scripted map that relies on default map being disabled. However on servers like UN with extensive level scripts running all the time and some enabling the default map, depending on circumstance and lag, the level function is called after the WNPC map's, thus reenabling the default map after my script has disabled it.

This is what I tried:
PHP Code:

function onPlayerenters() {
  
disablemap();
  
waitfor(level,"onPlayerEnters",5);
  
player.chat "test";
  
disablemap();


But that doesn't seem to work. Any ideas?

fowlplay4 03-06-2010 08:34 PM

Something like this should work fine.

PHP Code:

function onPlayerEnters() {
  
disablemap();
  
this.scheduleevent(0.1"DisableMap""");
}
function 
onDisableMap() {
  
disablemap();


Poor UN and it's endless amount of legacy scripts :(

DustyPorViva 03-06-2010 09:00 PM

I get the feeling that would simply do a .1 delay... that's not really going to work. Depending on lag sometimes even 5 second delays aren't good enough to counter the problem.

12171217 03-07-2010 12:18 AM

Ping (triggerserver) the client when he enters the level, then when the server responds (triggerclient), everything should be set to go, that way you circumvent the lag time.


All times are GMT +2. The time now is 11:10 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.