With the frequency that we use that client search quest code, I think it would make a good addition to the source if we could figure out the best way to handle it in the code for quests. I was thinking of making a new sub event similar to timers, and you would call it in a similar way. Then, it would just do a for loop on anything matching that client search name.
Code:
sub EVENT_SPAWN {
quest::clientsearch("nearby");
}
sub EVENT_CLIENT_SEARCH {
if ($clientsearch eq "nearby");
// Do some distance checks and do something else to them
}
}
Something like that.
Or, maybe just add a way to easily make a list of all clients or all NPCs in a zone. Maybe something that would look through the entity list and make a new list of whatever you are looking for. I think that would cut down the overhead of doing a FOR loop to 2000 every time. Then, it would also be nice to have a way to pull the top entity ID from the zone so instead of setting it to 2000, it could be set to whatever the actual top ID number is.
Getting a bit off topic here though. Thinking about making a new post in the features requests about it. It would be very useful if we could come up with a way to handle this easily. There are just too many uses for being able to find any client in a zone at random, or by distance, or whatever you specify. I just don't know the best way to handle it yet to start coding it.