Moderator: MacroQuest Developers
Code: Select all
| - NewLevel.mac -
| Semi-intelligent lowbie melee leveling macro for the newbie areas
|
| Modified by Valerian to include looting and an alert list for "guard" types.
|
| 1. Selects the closest target
| 2. Chases it around swinging (flee to guards if under 30% HP)
| 3. If <50% HP, run to nearest guard
| 4. If mob is killed in combat, attempt to target it's corpse and loot it.
| 5. Sit until >80% HP
| Repeat...
|
| OPTIONAL: 2 parms to determine what level mobs you wish to fight.
|
| NOTE: Included event to stop the macro when you zone, but it's not always
| triggered _before_ you zone. Still, any measure of safety from the
| zone-with-macro-running-and-lose-everything-bug is good.
|
#include routines.mac
#event attacked YOU for
#event loading "LOADING"
#define inbattle v40
#define resting v41
Sub Main
/if n $p0>0 /if n $p1>0 {
/varset v91 $p0
/varset v92 $p1
}
/varset v93 0
/varset v80 0
/alert clear 1
/alert add 1 wolf
/alert add 1 bear
/alert add 1 cat
/alert add 1 lion
/alert add 1 snake
/alert add 1 goblin
/alert add 1 bat
/alert add 1 spider
/alert add 1 scarab
/alert add 1 skeleton
/alert add 1 skunk
/alert add 1 rat
| /alert add 1 bandit
/alert add 1 wasp
/alert add 1 orc
/alert add 1 pawn
/alert clear 9
/alert add 9 guard
/alert add 9 bouncer
:Autokill
/stand
/call SelectTarget
/if "$target()"=="FALSE" /goto :WaitASec
/if "$target(type)"=="NPC" /call AttackAndFollow
:WaitASec
/call Rest
/goto :AutoKill
/return
Sub SelectTarget
/press esc
/for v81 1 to 5
/if "$target()"=="TRUE" /return
/delay 5
/doevents
/next v81
/if n v91>0 /if n v91>0 {
/varset v11 $v91
/varset v12 $v92
} /else {
/varcalc v11 $char(level)*2/3-1
/varcalc v12 $char(level)*7/10+1
}
/echo Attempting to target mob from level $v11 to $v12
/target npc range $v11 $v12 alert 1 nopcnear 100
/return
Sub AttackAndFollow
/varset inbattle 1
/varset v90 $target(id)
/echo Going after $target(name) -- Lvl $target(level)...
/face nopredict fast
/attack on
/varset t0 5m
:CloserAF
/if "$target(id)"!="$v90" /goto :EndAF
/if n $target(distance)>14 /call AutoRun 1
/if n $target(distance)<16 /call AutoRun 0
/if n $target(distance)<5 /call AutoRun 0
/if n $target(distance)<5 /call BackPedal 1
/if n $target(distance)>6 /if n $target(distance)<15 {
/call AutoRun 0
/call BackPedal 0
}
/if n $t0==0 /press esc
/if n $char(hp,pct)<30 /press esc
/face nopredict fast
/doevents
/if n $target(level)>$v12 /if "$target(type)=="NPC" {
/echo Attacking higher level NPC! Retreating...
/attack off
/varset v93 1
}
/if n $char(ability,"Bash")>0 /doability "Bash"
/if n $char(ability,"Slam")>0 /doability "Slam"
/if n $char(ability,"Flying Kick")>0 /doability "Flying Kick"
/if n $char(ability,"Begging")>0 {
/attack off
/doability "Begging"
/attack on
}
/if n $char(ability,"Bash")>0 /doability "Bash"
/if n $char(ability,"Taunt")>0 /doability "Taunt"
/if n $char(ability,"Sense Heading")>0 /doability "Sense Heading"
/goto :CloserAF
:EndAF
/call AutoRun 0
/call BackPedal 0
/if $combat!="TRUE" {
/target corpse id $v90
/delay 1s
/if "$target()"!="FALSE" /call autoloot
}
/press esc
/attack off
/varset inbattle 0
/return
Sub Rest
/if n $char(hp,pct)>50 /if n $v93==0 /goto :DontMove
/varset v93 0
/varset resting 1
/target npc alert 9
/sendkey down up
:CloserRest
/face nopredict fast
/doevents
/if n $char(hp,pct)<80 /if n $target(distance)>15 /goto :CloserRest
/sendkey up up
/press esc
:DontMove
/if n $char(hp,pct)>80 /return
/sit
/if n $char(ability,"Sense Heading")>0 /doability "Sense Heading"
:KeepResting
/if "$target()"!="FALSE" /goto :doneresting
/doevents
/if n $char(hp,pct)<80 /goto :KeepResting
:doneresting
/varset resting 0
/stand
/return
Sub Event_Death
/mqlog You died ;(
/return
Sub Event_SkillUp
/mqlog Your '$p0' went up: $p1
/return
Sub Event_Level
/mqlog Ding, level $p1!
/shout Ding, level $p1!
/return
Sub Event_attacked
/if n $inbattle==0 /if n $resting==0 {
/target npc $arg(1,$p0)
/call AttackAndFollow
}
/return
Sub Event_loading
/endmacro
/return
sub autoloot
/if n $target(distance)>=75 /goto :continue
/stand
/echo Looting $target(name)
/face fast
/if n $target(distance)<15 /goto :CloseEnough
/sendkey down up
/varset t0 3m
:CloserAL
/if $t0==0 /goto :continue
/face fast
/if n $target(distance)>14 /if n $t0>0 /goto :CloserAL
:CloseEnough
/sendkey up up
/loot
/Delay 10
/varset t0 10s
/for v10 0 to 9
:waitforitem0
/if $cursor()==true /goto :waitforitem0
/click left corpse $v10
:waitforitem1
/if $t0==0 /goto :continue
/doevents
/if $cursor()!=true /goto :waitforitem1
/varset t0 5s
/if "$cursor(name)"=="NULL" /goto :continue
/if "$target(name)"~~$char(name) /click left auto
| /if n $cursor(weight)>5 /click left destroy
/if n $cursor(value)<10 /click left destroy
/if $cursor(nodrop)==true /click left destroy
/if $cursor()==true /echo looted $cursor(name). it has a value of $cursor(value).
/if n $cursor(value)>9 /click left auto
/next v10
:continue
/cleanup
/return