Edit: 4th Version. Changes in red fix error messages (and Lax cursing at you). MoveToMob and obstacle avoidance routine are still not working correctly.
Code: Select all
#Event Casting "You begin casting"
#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"
#Event Gate "Gates"
sub Attack
/declare MyXLOC float outer
/declare MyYLOC float outer
/declare ObstacleCount int outer
/echo Fighting a level ${Target.Level} ${Target.Name}
/face fast nolook
/call MoveToMob
:CloserAF
/if (!${Target.ID}) /goto :EndAF
/doevents
[color=red]/if (${Target.ID})[/color] /call AttackRoutine
/goto :CloserAF
:EndAF
/attack off
/popup TARGET DEAD
/keypress forward
/keypress back
/return
sub AttackRoutine
/attack on
/doevents
/if (${Target.Distance}>10) {
/keypress forward hold
/timed 1 /keypress forward
}
/if (${Target.Distance}<10) {
/keypress back hold
/timed 1 /keypress back
}
/if (${Target.Distance}>15) /call MoveToMob
[color=red]/if (${Target.ID})[/color] /face nolook fast
/doevents
/if ((${Target.Distance}<11)&&(${Me.AbilityReady["Bash"]})) /doability "Bash"
/if ((${Target.Distance}<11)&&(${Me.AbilityReady["Kick"]})) /doability "Kick"
/if ((${Target.Distance}<11)&&(${Me.AbilityReady["Disarm"]})) /doability "Disarm"
/return
sub MoveToMob
/attack off
/varset MyXLOC ${Me.X}
/varset MyYLOC ${Me.Y}
/varset ObstacleCount 0
/doevents
/keypress forward hold
:Movementloop
/varcalc ObstacleCount ${ObstacleCount}+1
/if (${Target.ID}) {
/face nolook
/if (${Target.Distance}<=15) {
/face nolook
/keypress forward
/return
}
/if (${ObstacleCount}>=10) {
/call CheckObstacle
/goto :Movementloop
}
/if (${Target.Distance}>15) /goto :MovementLoop
}
/return
sub CheckObstacle
/if ((${MyXLOC}==${Me.X})&&(${MyYLOC}==${Me.Y})) /call HitObstacle
/varset MyXLOC ${Me.X}
/varset MyYLOC ${Me.Y}
/varset ObstacleCount 0
/return
sub HitObstacle
/keypress forward
/keypress back hold
/delay 3
/keypress back
/if (${Math.Rand[2]}) {
/keypress strafe_right hold
} else {
/keypress strafe_left hold
}
/delay 5
/keypress strafe_right
/keypress strafe_left
/keypress forward hold
/return
sub Event_Enraged
/if (${Target.ID}) {
:EnrageDelay
/if (${Target.CurrentHPs}<11) {
/attack off
/doevents
/goto :EnrageDelay
}
}
/return
sub Event_Offrage
/if (${Target.ID}&&(${Target.CurrentHPs}<11)) {
/attack on
}
/return
sub Event_Casting
:checkcast
/delay 1
/if (${Me.Casting.ID}) /goto :checkcast
/return
sub Event_Gate
/keypress forward
/keypress back
/attack off
/popup GATED!
/endmacro
/return

