![]() |
NPCs sleeping
I need to wake up the NPCs in a certain level where noone is in (It's a gmap).
Is there any possible way to do this? |
PHP Code:
|
What you mean? You want a timeout to keep going when no one is in the level?
Or if you know the npc id you can do trigger( "update", "");? |
Quote:
|
Quote:
[Edit: or a way to wake it up using a script] |
PHP Code:
|
I know that. When noone is in the level, the NPCs sleep. They don't do anything. The timeout stops, etc.
|
Do it serverside?
|
Quote:
|
The npc timeout is not stopped when players leave. Eventually you have set the serveroptions so that the npcserver is sleeping when no player is online?
|
Quote:
PHP Code:
|
Add this to serveroptions:
PHP Code:
|
Let me try to clear this up ...
The NPC-Server has just been rebooted. None of the levels are loaded. I want the NPCs to be loaded before a player enters. I have a setlevel2, but before that I want to wake the level's NPCs. WAKENPCS(); sleep( 1 ); setlevel2( ... ); |
Quote:
If you want to wake up an NPC from another level, getnpc (or I guess now findnpc) should do the trick. |
Quote:
HTML Code:
npcs[testnpc(this.x, this.y)].trigger("activateNPC", ""); |
Ok so its about local level npcs ? Levels are not loaded when there is no player, so if you want to have npcs always awake it is best to use putnpc2s.
Another way is to let some dbnpc/putnpc2 do findareanpcs() on the area that you want to have alive, but that would be more a hack than a solution. You can also use special gmap options in your case: LOADFULLMAP will load the full gmap and not deactive map parts, although it will slow down the start of the server. LOADATSTART levelnames,... LOADATSTARTEND will load the specified levels at the npcserver start, then you just need to use some timeout (and eventually findareanpcs() from time to time) to prevent the level from unloading. |
Quote:
|
Quote:
NPC Code:/clearnpcs battleground.gmap |
Quote:
|
What is findareanpcs()?
Wiki tells me nothing. |
Quote:
findareanpcs(float x, float y, float width float height) object Returns an array of all npcs within the specified area. |
Quote:
|
Quote:
|
*bump*
What's wrong with this? PHP Code:
|
HTML Code:
function onCreated() |
That code didn't work ... It didn't wake all of the npcs in a gmap. It woke the ones in the level it warped to, not the whole gmap ... or maybe it was the players that woke the ones in the level.
|
On a side note, players.size() would be the GS2 version of playerscount.
|
Quote:
Also, check if it's finding any NPCs. EG echo(temp.foundNPC);, what would this produce? |
| All times are GMT +2. The time now is 06:21 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.