ScriptUO

Official ScriptUO EasyUO Scripts => Script Snippets => Topic started by: camotbik on November 05, 2011, 01:16:56 AM

Title: waitfortarget (for spell casting)
Post by: camotbik on November 05, 2011, 01:16:56 AM
Sample of usage
Code: [Select]
Gosub Paralyze
stop
;=====================================================================
;====================================================  PARALYZE ======
;=====================================================================
Sub Paralyze
  if #mana > 25 && #scnt2 > %CoolDown
  {
    finditem #ltargetid G_10
    if #targcurs = 1 && #findcnt > 0
      event macro 22 0
    set %_jindex #jindex < -------------------
    event macro 15 37
    set %CoolDown ( #scnt2 + 25 )
    gosub WaitForTarget 40
    if #ltargetid <> #charid
    {
      finditem #ltargetid G_10
      if #findcnt > 0
        event macro 22 0
    }
  }
return
;=====================================================================
; Gosub WaitForTarget %1 ; %1 = n ms. =========== WAITFORTARGET ======
;=====================================================================
Sub WaitForTarget
  set %Distrupted #false
  set %WaitForTarget ( #scnt2 + %1 )
  repeat
    if #jindex >= %_jindex
    {
      scanjournal %_jindex
      if disturbed IN #journal || recovered IN #journal || reagents IN #journal || mana IN #journal
      {
        set %Distrupted #true
        set %CoolDown #scnt2
      }
      set %_jindex %_jindex + 1
    }
  until #targcurs = 1 || %Distrupted = #true || #scnt2 > %WaitForTarget
return