You can use getareanpcs(float, float, float, float) and loop through and find the NPC by a unique id or joined class even.
Baddies find other baddies, I.e:
PHP Code:
// Loop through NPCs in a 64x64 square around the npc.
for (temp.n: getareanpcs(this.x - 32, this.y - 32, 64, 64)) {
// Check if NPC is part of the Baddy class
if (temp.n.joinedclasses.index("baddy") >= 0) {
// Add NPC to Baddies Array for Further Processing
temp.baddies.add(temp.n);
}
}
for (temp.baddy: temp.baddies) {
echo("Baddy Found: " @ temp.baddy.nick);
}
When you have the NPC object, you can simply send triggers or call public functions. I.e:
PHP Code:
// Loop through NPCs in a 64x64 square around the npc.
for (temp.n: getareanpcs(this.x - 32, this.y - 32, 64, 64)) {
temp.n.trigger("Found", "");
}
then in the other NPCs:
PHP Code:
function onFound() {
echo("Found: " @ this.nick);
}