Features:
* sticks/faces mob and uses combat abilities automatically
* avoids enrage damage
* spellcaster auto-interrupt
Code: Select all
| OgreBash v1.3 [mq2data version] by Bollox (Apr 21 2004)
|-----------------------------------------------------------------------------
|
| Ogre warrior stick to target, auto kick/slam/taunt/disarm.
| Credits to GrimJack, Lasher et. al. for various sections of code.
| Mad props to ml2517 for FindEvtNPC code! :)
|
| Features:
|
| * Focuses on target mob by either facing it or following it as it moves
| around
| * Interrupts enemy spellcasts
| * Pauses attack while target is enraged
|
| Usage:
|
| /macro ogrebash <focus> <aggro> <strategy>
|
| Options:
|
| <focus>
| stick Sticks to your target and follows it. Will automatically
| walk up to target if within @EngageRange.
| face Faces target.
|
| <aggro>
| taunt Use Taunt ability as fast as refresh allows.
| notaunt Do not use Taunt ability.
| duel Allows macro to run while targeting a player.
|
| <strategy>
| fast Use optimal combat abilities as fast as refresh allows.
| learn Use lowest skill combat abilities as fast as refresh allows.
| (e.g. if kick skill < bash skill, kick instead of bash)
| Uses disarm as fast as refresh allows.
| interrupt Waits for target to cast before using kick/bash/slam.
| Uses disarm as fast as refresh allows.
| passive Do not use any combat abilities.
|
| Examples:
|
| Follow target, taunting and kicking/bashing as fast as abilities refresh
| /macro autoattack stick taunt fast
|
| Follow target, taunting and interrupting target's spellcasting
| /macro autoattack stick taunt interrupt
|
| Face target and attack only, no bash/kick/disarm
| /macro autoattack face notaunt passive
|
| Face player in a duel, no taunting (looks odd to non-MQ players) and use
| all other abilities. <duel> allows macro to run while targeting other
| players -- the ability to attack players is otherwise disabled because
| it's useless and cumbersome in any other situation.
| /macro face duel fast
|
| Version History:
|
| 1.3 (Apr 21 2004) Revised to comply with MQ2Data.
| 1.2 (Apr 8 2004) Removed class-based caster interruption because some
| high level mobs that are not typically casters will cast spells.
| 1.1 (Mar 4 2004) Original code
|
| TO DO:
| * implement attack distance adjustments based on desired aggro level
| (i.e. farther from target = less aggro) and data from ${Target.MaxRange}
| * implement attack from behind to avoid riposte damage
| * address ${Me.AbilityReady[slam]} nonfunctionality
|
#turbo
#Event NoHit "You cannot hit your target from here!"
#Event OnRage "has become ENRAGED"
#Event OffRage "is no longer enraged"
#Event Casting "begins to cast a spell"
#Event InterruptCast "casting is interrupted!"
Sub Main(Focus,Aggro,Abilities)
/zapvars
/doevents flush
/declare tempvar global
/declare EngageRange global
/declare Interrupt global
/declare RangeMax global
/declare RangeMin global
/declare TargetCastTimer timer
/declare FastRange global
/declare CombatType global
/declare EnrageVar global
/varset CombatType @Aggro
/varset EngageRange 40
/varset EnrageVar 0
/varset Interrupt 0
/varset TargetCastTimer 0s
/varset RangeMax 12
/varset RangeMin 10
/varset FastRange 14
| Make sure syntax is correct.
/if (${String["@Focus"].NotEqual["stick"]}) {
/if (${String["@Focus"].NotEqual["face"]}) {
/call Usage @Focus
}
}
/if (${String["@Aggro"].NotEqual["taunt"]}) {
/if (${String["@Aggro"].NotEqual["notaunt"]}) {
/if (${String["@Aggro"].NotEqual["duel"]}) {
/call Usage @Aggro
}
}
}
/if (${String["@Abilities"].NotEqual["fast"]}) {
/if (${String["@Abilities"].NotEqual["interrupt"]}) {
/if (${String["@Abilities"].NotEqual["passive"]}) {
/if (${String["@Abilities"].NotEqual["learn"]}) {
/call Usage @Abilities
}
}
}
}
| Make sure your target is valid.
/if (${Target.ID}<1) {
/echo No target.
/endmacro
} else /if (${Target.ID}==${Me.ID}) {
/echo You can't attack yourself!
/endmacro
} else /if (${String["${Target.Type}"].Equal["PC"]}) {
/if (${String["@Aggro"].NotEqual["duel"]}) {
/echo You cannot attack other players.
/endmacro
}
}
| Set range based on desired aggro level. (i.e. further==less)
| Make sure you are standing. Using /face while sitting is bad, m'kay?
/if (${String["${Me.State}"].Equal["SIT"]}) /stand
/attack on
/face fast
:CombatLoop
/if (${String["@Focus"].Equal["stick"]}) {
/if (${Target.Distance}<@EngageRange) {
/call MoveToMob
/face fast
}
} else {
/face fast
}
| Manage taunt level.
/if (${String["@Aggro"].Equal["taunt"]}) {
/call TauntIt
}
/call DisarmIt
| Combat ability usage.
/if (@EnrageVar==0) {
/if (${String["@Abilities"].Equal["fast"]}) {
/if (${Me.Skill[kick]}<${Me.Skill[bash]}) {
/call SlamIt
} else {
/call KickIt
}
} else /if (${String["@Abilities"].Equal["learn"]}) {
/if (${Me.Skill[kick]}>${Me.Skill[bash]}) {
/call SlamIt
} else {
/call KickIt
}
}
}
| Attempt to interrupt target spellcasts.
/if (${String["@Abilities"].Equal["interrupt"]}) {
/if (@Interrupt==0) {
/doevents Casting
} else /if (@Interrupt==1) {
/if (@TargetCastTimer==0) {
/echo You have failed to interrupt ${Target.CleanName}'s spellcast.
/varset Interrupt 0
} else /if (@TargetCastTimer>0) {
/call SlamIt
/doevents InterruptCast
}
}
}
| Avoid taking damage from enrage.
/doevents OnRage
/doevents OffRage
| Attack until target dies or is released. (e.g. pressing ESC to clear)
/if (${Target.ID}>0) /goto :CombatLoop
/attack off
/keypress up
/endmacro
| =====================
| S U B R O U T I N E S
| =====================
Sub DisarmIt
/if (${Me.AbilityReady[disarm]}) {
/if (${Target.ID}>0) {
/face fast
/doability "Disarm"
}
}
/return
Sub Fastmove
:fastmoveloop
/if (${Target.ID}<1) {
/keypress up
/if (${Me.Combat}) {
/attack off
/return
}
}
/face fast
/if (${Target.Distance}>@FastRange) {
/keypress up hold
}
/if (${Target.Distance}<=@FastRange) {
/keypress up
/return
}
/goto :fastmoveloop
/return
Sub FindEvtNPC(MsgText,SrchRadius,EvtText)
/declare MobName local
/declare MobID local
/declare LastID local
/declare PositionText local
/varset PositionText ${String[@MsgText].Find[@EvtText]}
/varset MobName ${String[@MsgText].Mid[1,@PositionText]}
/if (${String["@MobName"].Right[1].Equal[" "]} ) {
/varset MobName ${String[@MobName].Left[ ${Math.Calc[ ${String[@MobName].Length}-1 ]} ]}
}
/if (${String["@MobName"].Right[1].Equal["'"]} ) {
/varset MobName ${String[@MobName].Left[ ${Math.Calc[ ${String[@MobName].Length}-1 ]} ]}
}
/varset MobID 0
/varset LastID 0
/if (${Target.ID}) {
/if (${String["@CombatType"].Equal["duel"]}) {
/varset MobID ${NearestSpawn["@MobName" radius @SrchRadius].ID}
} else {
/varset MobID ${NearestSpawn["@MobName" npc radius @SrchRadius].ID}
}
:GetID
/if (@MobID!=0) {
/varset LastID @MobID
/if (${Target.ID}==@MobID) {
/return FOUND
} else {
/varset MobID ${NearestSpawn["@MobName" npc id @LastID radius @SrchRadius next].ID}
/if (@LastID==@MobID) /return NOTFOUND
/goto :GetID
}
}
}
/return NOTFOUND
Sub KickIt
|
| ${Me.AbilityReady} currently bugged!
|/if ${Me.AbilityReady[kick]}==TRUE {
/if (${Target.ID}>0) {
/face fast
/doability "Kick"
/return 1
}
|}
/return 0
Sub MoveToMob
/face fast
/if (${Target.Distance}>=@FastRange) /call Fastmove
/if (${Target.Distance}>@RangeMax) {
/keypress up
}
/if (${Target.Distance}<@RangeMin) {
/keypress down
}
/return
Sub SlamIt
|
| ${Me.Ability[slam]} is currently bugged!
|
|/if ${Me.AbilityReady[bash]}==TRUE {
/if (${Target.ID}>0) {
/face fast
/doability "Slam"
/return 1
}
|}
/return 0
Sub TauntIt
/if (${Me.AbilityReady[taunt]}) {
/if (${Target.ID}>0) {
/face fast
/doability "Taunt"
/return 1
}
}
/return 0
Sub Usage(Argument)
/echo @Argument is not a valid option.
/echo Usage:
/echo /macro autoattack <stick|face> <taunt|notaunt> <fast|interrupt|passive>
/endmacro
/return
| ===========
| E V E N T S
| ===========
Sub Event_Casting(CastingText)
/if (${Target.ID}) {
/call FindEvtNPC "@CastingText" 200 "begins to cast a spell"
/if (${String["${Macro.Return}"].Equal["FOUND"]}) {
/varset TargetCastTimer 3s
/varset Interrupt 1
}
}
/return
Sub Event_InterruptCast(InterruptCastText)
/if (${Target.ID}) {
/call FindEvtNPC "@InterruptCastText" 200 "'s casting is interrupted"
/if (${String["${Macro.Return}"].Equal["FOUND"]}) {
/echo You have interrupted ${Target.CleanName}'s spellcast!
/varset Interrupt 0
/varset TargetCastTimer 0s
}
}
/return
Sub Event_NoHit
|/echo GET BACK INTO POSITION!
/return
Sub Event_OffRage(OffRageText)
/if (${Target.ID}) {
/call FindEvtNPC "@OffRageText" 200 "is no longer enraged"
/if (${String["${Macro.Return}"].Equal["FOUND"]}) {
/varset EnrageVar 0
/echo ${Target.CleanName} is no longer enraged, ATTACKING.
/attack on
}
}
/return
Sub Event_OnRage(OnRageText)
/if (${Target.ID}) {
/call FindEvtNPC "@OnRageText" 200 "has become ENRAGED"
/if (${String["${Macro.Return}"].Equal["FOUND"]}) {
/varset EnrageVar 1
/echo ${Target.CleanName} is ENRAGED! Suspending attack.
/attack off
}
}
/return

