mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-05 19:32:25 +00:00
Updated Perl EVENT_HP (markdown)
parent
fb6ef2412e
commit
b88ea5f864
@ -1,4 +1,5 @@
|
||||
EVENT_HP
|
||||
EVENT_HP is triggered when an NPC's hit points reach the percent specified by [quest::setnexthpevent()](https://github.com/EQEmu/Server/wiki/Perl-Quest-setnexthpevent). This event is often used for dialogue, spawning adds, or depopping the NPC.
|
||||
|
||||
### Exports
|
||||
**Name**|**Type**|**Description**
|
||||
:-----|:-----|:-----
|
||||
@ -16,4 +17,55 @@ sub EVENT_HP {
|
||||
}
|
||||
```
|
||||
|
||||
### Triggered
|
||||
|
||||
* When an NPC's health reaches the specified percentage.
|
||||
|
||||
### Examples
|
||||
|
||||
* In this example, the NPC would depop when its health reaches 50 percent.
|
||||
|
||||
```perl
|
||||
sub EVENT_SPAWN {
|
||||
#:: Set the threshold (by percent) to trigger the HP Event - 50 percent
|
||||
quest::setnexthpevent(50);
|
||||
}
|
||||
|
||||
sub EVENT_HP {
|
||||
#:: Once the NPC's health reaches the percentage specified, depop
|
||||
if ($hpevent == 50) {
|
||||
quest::depop();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* In this example, we will spawn adds at our first HP event trigger, and set the threshold for the next HP event
|
||||
* At the second HP event trigger, we will spawn more adds
|
||||
|
||||
```perl
|
||||
sub EVENT_SPAWN {
|
||||
#:: Set the threshold (by percent) to trigger the first HP Event - 50 percent
|
||||
quest::setnexthpevent(50);
|
||||
}
|
||||
|
||||
sub EVENT_HP {
|
||||
#:: Use numeric comparison to match the percentage specified - 50 percent
|
||||
if ($hpevent == 50) {
|
||||
#:: Spawn two A_Mangled_Vegerog adds at the NPC's current location
|
||||
quest::spawn2(218023,0,0,$x,$y,$z,$h);
|
||||
quest::spawn2(218023,0,0,$x,$y,$z,$h);
|
||||
#:: Set the threshold (by percent) to trigger the next HP Event - 15 percent
|
||||
quest::setnexthpevent(15);
|
||||
}
|
||||
#:: Use numeric comparison to match the percentage specified - 15 percent
|
||||
if ($hpevent == 15) {
|
||||
#:: Spawn four A_Mangled_Vegerog adds at the NPC's current location
|
||||
quest::spawn2(218023,0,0,$x,$y,$z,$h);
|
||||
quest::spawn2(218023,0,0,$x,$y,$z,$h);
|
||||
quest::spawn2(218023,0,0,$x,$y,$z,$h);
|
||||
quest::spawn2(218023,0,0,$x,$y,$z,$h);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Generated On 2018-01-15T22:07:30-08:00
|
||||
Loading…
x
Reference in New Issue
Block a user