Code: Select all
|-------------------------------------------------------------------
|-- blazza.mac
|-- Many thanks to all the support the MQ community has given me
|-------------------------------------------------------------------
|-- This Macro will pull.
|-- Edit the AgroMob Sub for different ways of pulling. I use incite.
|-------------------------------------------------------------------
#turbo
Sub Main
|-------------------------------
|
| GLOBALS
|
|-------------------------------
/declare HOME_ANCHOR_Y global
/declare HOME_ANCHOR_X global
/declare CurrentMob global
/declare CurrentMob_Class global
/declare CurrentMob_class global
/declare LowLvl global
/declare HighLvl global
/declare MobID array
/declare CountID global
/declare Count global
/declare ForInc global
/declare DropOut global
/declare InPrimaryRange global
/declare Xcur global
/declare Ycur global
/declare AbortPull global
/declare InHomeRange global
/declare LostAgro global
/declare AssistCalled global
/varset HOME_ANCHOR_Y -440
/varset HOME_ANCHOR_X -1367
|-------------------------------
| START MAIN LOOP
|-------------------------------
/varset LowLvl 1
/varset HighLvl 10
|/call RunToPull
/call SearchForSpawn
/call CheckForSingle
/call RunToMob
|/call CheckForRoute
/call AgroMob
|/call RunToNearestRoute
/call RouteHome
/call KillThisThing
/call CleanUp
/return
|-------------------------------
| SUB SEARCH FOR SPAWN!
|-------------------------------
Sub SearchForSpawn
/varset CurrentMob $Searchspawn(npc,range:@LowLvl:@HighLvl,radius:1000)
/if n CurrentMob>0 {
/call SetupPull
/call CheckForSingle
/call ShouldIPull
}
/return
|------------------------------
| SUB SETUP PULL
|------------------------------
Sub SetupPull
/varset AbortPull 0
/return
|------------------------------
| SUB CHECK FOR SINGLE
|------------------------------
Sub CheckForSingle
/varset Count 0
/alert clear 1
/varset CountID $searchspawn(npc,loc:$spawn(@CurrentMob,x):$spawn(@CurrentMob,y),radius:200)
/if n @CountID>0 {
/varset MobID(@Count) @CountID
/varadd Count 1
/alert add 1 id @CountID
}
:CheckMore
/varset CountID $searchspawn(npc,loc:$spawn(@CurrentMob,x):$spawn(@CurrentMob,y),radius:200,noalert:1)
/if n @CountID>0 {
/varset MobID(@Count) @CountID
/varadd Count 1
/alert add 1 id @CountID
/goto :CheckMore
}
/for ForInc 0 to $calc(@Count-1)
/echo Mob number @ForInc has ID @MobID(@ForInc)
/next ForInc
/alert clear 1
/return
|-------------------------------
| Sub Should I pull
|-------------------------------
Sub ShouldIPull
:PullCheck
/call CheckForSingle
/if n @Count==0 {
/varset CurrentMob $Searchspawn(npc,range:@LowLvl:@HighLvl,radius:1000)
/delay 50
/call CheckForSingle
/goto :PullCheck
}
/if n @Count>1 {
/varset CurrentMob $Searchspawn(npc,range:@LowLvl:@HighLvl,radius:1000)
/delay 50
/call CheckForSingle
/goto :PullCheck
}
/return
|-------------------------------
| SUB RUN TO MOB
|-------------------------------
Sub RunToMob
/if n $spawn(@CurrentMob,distance)>20 {
/face id @CurrentMob
/sendkey down up
/varset InPrimaryRange 0
} else {
/goto :SkipRun
}
:MovementLoop
/face id @CurrentMob
/varset Xcur $char(x)
/varset Ycur $char(y)
/call CheckDurringRun
/delay 5
/if n @AbortPull==1 {
/call AbortPull
}
/if n $spawn(@CurrentMob,distance)<100 {
/sendkey down up
/varset InPrimaryRange 1
}
/if @Xcur==$char(x) /if @Ycur==$char(y) {
/call Obstacle
}
/if n @InPrimaryRange==0 {
/goto :MovementLoop
}
:SkipRun
/sendkey up up
/return
|-----------------------------------
| Sub Check Durring Run
|-----------------------------------
Sub CheckDurringRun
/varset Count 0
/alert clear 1
/varset CountID $searchspawn(npc,radius:200)
/if n @CountID>0 {
/varset MobID(@Count) @CountID
/varadd Count 1
/alert add 1 id @CountID
}
:CheckMore
/varset CountID $searchspawn(npc,radius:200,noalert:1)
/if n @CountID>0 {
/varset MobID(@Count) @CountID
/varadd Count 1
/alert add 1 id @CountID
/goto :CheckMore
}
/echo @Count
/if (n @Count>0 && n @MobID(0)==@CurrentSpawn) /varset AbortPull 1
/if n @Count>1 /varset AbortPull 1
/for ForInc 0 to $calc(@Count-1)
/echo RUNNING Mob number @ForInc has ID @MobID(@ForInc)
/next ForInc
/alert clear 1
/return
|-----------------------------------
| Sub Check For Route
|-----------------------------------
Sub CheckForRoute
|TODO Add code to check for closest Advpath point to run back to camp.
/return
|-----------------------------------
| Sub Run To Nearest Route
|-----------------------------------
Sub RunToNearestRoute
|TODO Run to Advpath point to start path home.
/return
|----------------------------------
| Sub Route Home
|----------------------------------
Sub RouteHome
|TODO Advpath Call for Route noted in other subs.
|CURRENT CODE --- Bypasses Advpath Code and runs straight home.
|Sub RunHome
/face loc @HOME_ANCHOR_Y,@HOME_ANCHOR_X
/varset InHomeRange 0
/if n $distance(@HOME_ANCHOR_Y,@HOME_ANCHOR_X)>20 {
/sendkey down up
} else {
/goto :SkipRun
}
:MovementLoop
/face fast loc @HOME_ANCHOR_Y,@HOME_ANCHOR_X
/varset Xcur $char(x)
/varset Ycur $char(y)
/call CheckDurringRun
/if n @AbortPull==1 {
/call AbortPull
}
/if n $distance(@HOME_ANCHOR_Y,@HOME_ANCHOR_X)<40 {
/sendkey up up
/varset InHomeRange 1
}
/delay 4
/if n @Xcur==$char(x) /if @Ycur==$char(y) {
/call Obstacle
}
/if n @InHomeRange==0 {
/goto :MovementLoop
}
:SkipRun
/sendkey up up
|Following Code Checks for Single, And calls chatout to send spawnID to enchanter.
/call CheckForSingle
/if n @Count>1 {
/call PassID
}
/target id @CurrentMob
:MobLoop
/delay 1
/if n $distance($spawn(@CurrentMob,y):$spawn(@CurrentMob,x)>20 /goto :MobLoop
/return
|--------------------------------------
| Sub Pass ID
|--------------------------------------
Sub PassID
/for ForInc 0 to $calc(@Count-1)
/echo Mob number @ForInc has ID @MobID(@ForInc)
/next ForInc
/echo SENT TO CHANTER
/return
|-------------------------------------
| Sub Kill This Thing
|-------------------------------------
| TODO Add Obst. Avoidance
|-------------------------------------
Sub KillThisThing
:Wait
/delay 1
/face
/if n $target(distance)>20 /goto :Wait
/g --- %t --- Is my target. Wait for assist.
/attack on
/disc Incite
:CombatLoop
/face fast
/if n $target(distance)>9 /press up
/if n $target(distance)<4 /press down
/if n $char(ability,"Kick")>0 {
/if n $target(distance)<12 {
/doability "Kick"
}
}
/doevents
/if (n $target(hp,pct)<91 && n @AssistCalled==0) {
/varset AssistCalled 1
/g Assist me on --- %t ---
}
/if n @LostAgro==1 {
/doability "Taunt"
/doevents
}
/if n $target(id)==@CurrentMob {
/goto :CombatLoop
}
/varset CurrentMob 0
/g Good job all! Tell me when RFP!
/echo Complete
/return
|---------------------------
| Sub Agro Mob
|---------------------------
Sub AgroMob
/target id @CurrentMob
/echo AgroMobSubCalled
/delay 10
/call CheckForSingle
/if n Count=<1 {
/disc Incite
/return
}
/return
|-----------------------------
| Sub Obstacle
|-----------------------------
sub Obstacle
| We appear to be stuck so try and backup and strafe sideways
/sendkey up up
/sendkey down down
/delay 2
/sendkey up down
/sendkey down ctrl
/if n $rand(99)>50 {
/sendkey down right
} else {
/sendkey down left
}
/delay 3
/sendkey up right
/sendkey up left
/sendkey up ctrl
/sendkey down up
/return
|----------------------------
| Sub CleanUp
|----------------------------
Sub CleanUp
/zapvars
/attack off
/plugin MQ2ChatWnd unload
/plugin MQ2ChatWnd
/call Main
/return
|----------------------------
| Sub AbortPull
|----------------------------
Sub AbortPull
/call RouteHome
/delay 50
/call Main
/return

