Code: Select all
#Event Hitme "hits YOU for "
#Event Engage "ENGAGE"
#turbo 90
Sub Main
/declare RangeLong global
/declare RangeMax global
/declare RangeMin global
/declare FastRange global
/declare MyXLOC global
/declare MyYLOC global
/declare ObstCount global
/declare doengage global
/declare TargetDead global
/varset doengage 0
/varset RangeMax 7
/varset RangeMin 3
/varset FastRange 12
/varset ObstCount 0
:Wait
/varset TargetDead 0
/assist XXXXXX
/delay 5
/if "$target() "=="FALSE" {
/target XXXXXX
/face nopredict
/goto :Wait
}
/if "$target(type)"!="NPC" {
/face nopredict
/goto :Wait
}
/tell XXXXX I have %t as my target
/stand
:attackcall
/doevents
/if n @doengage==1 {
/goto :Attack
} else {
/goto :attackcall
}
/goto :Wait
:attack
/tell XXXXXX attacking %t
/call MoveToMob
/call CombatSub
/call ResetSub
/doability "Feign Death"
/goto :Wait
/return
Sub Event_Engage
/varset doengage 1
/return
Sub Event_Hitme
/attack off
/doability "Feign Death"
/delay 1s
/stand
/attack on
/return
Sub MoveToMob
/face fast
/if n $target(distance)>=@FastRange /call Fastmove
/if n $target(distance)>=@RangeMax {
/press up
/press up
/press up
/press up
}
/if n $target(distance)<@RangeMin {
/press down
}
/return
Sub Fastmove
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstCount 0
:fastmoveloop
/if $target()=="FALSE" {
/sendkey up up
/if $combat=="TRUE" {
/attack off
/return
}
}
/face fast
/if n $target(distance)>@FastRange {
/sendkey down up
}
/if n $target(distance)<=@FastRange {
/sendkey up up
/return
}
/varadd ObstCount 1
/if n @ObstCount>=3 {
/call CheckObst
}
/goto :fastmoveloop
/return
sub CombatSub
/attack on
:combatloop
/echo target speed is $target(speed)
/doevents
/face fast
/doability "Flying Kick"
/echo before move $target(distance)
/call MoveToMob
/echo after move $target(distance)
/face fast
/if n $target(id)==0 {
/varset TargetDead 1
/tell XXXXXX Target is dead
}
/if n @TargetDead!=1 /goto :combatloop
/sendkey up up
/delay 2s
/return
sub CheckObst
/if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) /call HitObst 5
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstCount 0
/return
sub HitObst
/sendkey up up
/sendkey down down
/if n $rand(99)>50 {
/delay 3s
/sendkey up down
/sendkey down Right
/delay @Param0
/sendkey up Right
/sendkey down up
/delay 3s
/sendkey up up
} else {
/delay 3s
/sendkey up down
/sendkey down left
/delay @Param0
/sendkey up left
/sendkey down up
/delay 3s
/sendkey up up
}
/sendkey up down
/sendkey up Right
/sendkey up Left
/sendkey down up
/return
sub ResetSub
/sendkey up up
/press esc
/press esc
/press esc
/press esc
/press alt
/press shift
/press ctrl
/varset doengage 0
/varset ObstCount 0
/delay 1s
/return
1. Would removing the obstacle checks improve the speed of the combat function?
2. Would cleaning out all unneeded lines in the combat script improve distance check performance?
3. Is there a way to set the speed of my char to that of the mob once I am in combat range?
4. Is all this not going to help since Imp dealing with the delay of information from server to client? (pets track real well)
5. Would a different turbo setting help?
Anyways the script works well enough as is to use, but would be a great script if there was a way to /stick (daoc command?) to a mob with much more reliability.
-Sparky421
