stop if last target has below 20 HP

Ask for help

Moderators: Murderator+, Murderator

Post Reply
utternoob
Posts: 24
Joined: 2007-11-17 12:39:26

stop if last target has below 20 HP

Post by utternoob »

hello,

i'm making a script where one of my chars will cast magic arrow on my another char. i need my script to STOP casting magic arrow and wait for him to heal up when target's hp reaches lets say 20hp. how do i do that?
korzh
Posts: 220
Joined: 2007-04-26 23:35:15

Re: stop if last target has below 20 HP

Post by korzh »

utternoob wrote:hello,

i'm making a script where one of my chars will cast magic arrow on my another char. i need my script to STOP casting magic arrow and wait for him to heal up when target's hp reaches lets say 20hp. how do i do that?


Try to do something like this:

Code: Select all

sub magicarrow()
  var target = '0x000000' ; serial of the 2nd char
  var mana
  while not uo.dead()
    mana = uo.mana
    uo.cast( 'Magic Arrow', target )
    repeat
      wait( 100 )
    until mana > uo.mana
    if uo.gethp( target ) < 20 then
      while uo.gethp( target ) <> uo.getmaxhp( target )
        wait( 100 )
      wend
    endif
  wend
endsub

Also you can add here reagents and mana check ;)
Post Reply