Page 1 of 1

stop if last target has below 20 HP

Posted: 2008-03-11 10:53:43
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?

Re: stop if last target has below 20 HP

Posted: 2008-03-12 14:50:58
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 ;)