Is there a way to have an event based on your Hitpoints ??

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

RDPidb
a lesser mummy
a lesser mummy
Posts: 69
Joined: Mon Dec 15, 2003 1:14 am

Is there a way to have an event based on your Hitpoints ??

Post by RDPidb » Sat Feb 28, 2004 12:47 pm

What i want to do is stop what im doing and call a FiegnDeath sub if my HP drop below a certain level while im kiting a MOB. (People like to train me for some reason)

Is there a way to have some kind of "event" based on your HP.

or do i have to constantly check my HP in every single sub I drop into in the macro...

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Sat Feb 28, 2004 12:49 pm

Use a timer and in the event of the timer check your hp:

Code: Select all

/declare myhptimer timer
/varset myhptimer 2s

Sub Event_Timer
   /if @Param0=="myhptimer" {
      /if n $char(hp,pct)<10 {
         /call FiegnDeath
      }
   }
/return

RDPidb
a lesser mummy
a lesser mummy
Posts: 69
Joined: Mon Dec 15, 2003 1:14 am

Post by RDPidb » Sun Feb 29, 2004 12:14 pm

*edit*
I think I get it, so the Event is triggered by the timer every 2 seconds.

do I declare the event like:
#event Timer timer

or ... ?

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Mon Mar 01, 2004 2:30 am

You don't need to declare an event based on a timer, you only need to put in your sub main the declaration of the timer and assign it a value

Code: Select all

/declare myhptimer timer
/varset myhptimer 2s
then you need to put in the macro an Event_Timer that will exec your code every time the myhptimer go to zero (it is a countdown to zero from the value you have set it, in this exemple 2 secs).

Code: Select all

Sub Event_Timer
/if @Param0=="myhptimer" {
   /if n $char(hp,pct)<10 {
      /call FiegnDeath
      /varset myhptimer 2s
   }
}
/return
The check on the Param0

Code: Select all

/if @Param0=="myhptimer" {
is there because you can have more than a timer and you need to know which one have reached zero. Just remember to put

Code: Select all

/doevents
/delay 0
along your code, you will reach the event_timer only if and when you check for the events (with /doevents).
Hope this will help you.