mob unit hp% check

Vastard

New member
Messages
2
Points
0
Hello, I am new on the scripting thing and have a question:

Is there a way to make an unit mob do an especific action at certain amount of hp.

Example I can make a unit mob move to an especific location [ unitwalk(.GID, 150, 150); ], is there a way to do that but when the unit mob reach 50%hp?

 
Hercules currently doesn't trigger events when a mob is hit by an attack, only on-death events. Although I think there's a plugin that has OnNPCAttacked or something like that, but triggering an event on every hit would badly affect performance... A workaround could be to spawn a mob with the monster() command, retrieve its ID and then setting a npc timer that checks every second the UDT_HP of the monster and if (HP <= (MaxHP / 2)) you use unitwalk on it. The NPC should also check the death event in case an attack is powerful enough to kill it

 
A less complicated approach would be to create a new mob in the mob db with half of its normal HP and on the death event you would respawn it and move it to the new location

 
Yeah maybe I have to do that second one. Thaks meko. I will try the two option to see what I like more.

 
Back
Top