View Single Post
  #1  
Old 04-20-2009, 02:31 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default Event_proximity_say

Following discussion in another thread, I added a new EVENT_PROXIMITY_SAY.

Example quest:
Code:
sub EVENT_SPAWN {
   $x = $npc->GetX();
   $y = $npc->GetY();
   quest::set_proximity($x - 500, $x + 500, $y - 500, $y + 500);
}

sub EVENT_PROXIMITY_SAY {

        if($text=~/hate bixby/i) {
                quest::shout("So $name hates me huh ? I'll show you!");
                quest::attack($name);
        }
}
The way it works is this. When you call quest::set_proximity, the code checks to see if the NPC also has an EVENT_PROXIMITY_SAY. If it does, it sets a flag in the proximity entry, and also sets a global flag to indicate that EVENT_PROXIMITY_SAY is in use for this instance of this zone.

When a client says something and has nothing targetted, if the global flag is set, the proximities are run through, looking for one that is associated with an NPC that has an EVENT_PROXIMITY_SAY and for which the client is within the proximity.

I'm unsure as to whether the EVENT_PROXIMITY_SAY should be called even if the player has something targetted. You quest writers let me know and I can change it if required.
Reply With Quote