Update to EVENT_PROXIMITY_SAY

TurmoilToad
2019-01-07 15:43:33 -05:00
parent e8a08d0859
commit bea1cefa9e
+9 -10
@@ -1154,7 +1154,7 @@ sub EVENT_POPUPRESPONSE {
- When the client enters a mob's proximity and uses the appropriate text trigger supplied beneath this event. - When the client enters a mob's proximity and uses the appropriate text trigger supplied beneath this event.
Note that you must set quest::enable_proximity_say() and quest::set_proximity(). Note that you must enable quest::set_proximity().
### Example ### Example
@@ -1162,19 +1162,18 @@ Note that you must set quest::enable_proximity_say() and quest::set_proximity().
```perl ```perl
sub EVENT_SPAWN { sub EVENT_SPAWN {
#:: Set the proximity bounds around the NPC on spawn, 30 units across #:: Grab the NPC's location
$x = $npc->GetX(); $x = $npc->GetX();
$y = $npc->GetY(); $y = $npc->GetY();
quest::set_proximity($x-15,$x+15,$y-15,$y+15); $z = $npc->GetZ();
#:: Enable the NPC for proximity say #:: Enable proximity 30 units across, 30 units high, and turn on proximity say
quest::enable_proximity_say(); quest::set_proximity($x-15, $x+15, $y-15, $y+15, $z-15, $z+15, 1);
} }
sub EVENT_SAY { sub EVENT_PROXIMITY_SAY {
#:: Match say message for "hail", /i for case insensitive #:: Match say message for "hail", /i for case insensitive
if ($text=~/hail/i) { if ($text=~/hail/i) {
#:: Attack whoever hailed the NPC quest::say("Hello, $name!");
quest::attack($name);
} }
} }
``` ```