Jump to content
  • 0
Vastard

mob unit hp% check

Question

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?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.