Updated Perl EVENT_AGGRO_SAY (markdown)

TurmoilToad 2018-02-14 13:11:27 -05:00
parent 08f89977c8
commit c4d76f47b3

@ -1,4 +1,5 @@
EVENT_AGGRO_SAY EVENT_AGGRO_SAY is triggered when an NPC is in combat, a player has that NPC targeted, and says something. This is not a widely used function, as this particular scenario did not exist in EQ. You can use this function for easy statistics or information from a test NPC during a fight--perhaps consider the training dummy NPCs in The Arena.
### Exports ### Exports
**Name**|**Type**|**Description** **Name**|**Type**|**Description**
:-----|:-----|:----- :-----|:-----|:-----
@ -14,4 +15,32 @@ sub EVENT_AGGRO_SAY {
} }
``` ```
### Triggered
* When a player says something to a targeted, aggro NPC.
### Example
* In this example, the NPC will respond to a player saying "hate" while in combat and will report back the amount of hate generated and damage dealt to the NPC by the player.
```perl
sub EVENT_AGGRO_SAY {
#:: Match the say message like "hate", the "i" is for case-insensitive.
if ($text=~/hate/i) {
#:: create an array of entities on the NPC's hate list including the entity name, hate and damage
my @hatelist = $npc->GetHateList();
foreach $ent (@hatelist) {
my $h_ent = $ent->GetEnt();
my $h_dmg = $ent->GetDamage();
my $h_hate = $ent->GetHate();
#:: Report the hate and damage
if ($h_ent) {
my $h_ent_name = $h_ent->GetCleanName();
quest::say("$h_ent_name is on my hate list with $h_hate hate and $h_dmg damage.");
}
}
}
}
```
Generated On 2018-01-15T22:07:30-08:00 Generated On 2018-01-15T22:07:30-08:00