EQ2 Bot - Suggested code change for MT movement

When you are the MT and you detect incoming mobs and need to run to them FASTMOVE causes you to run where they were when you found them then readjust move to where they are when you got where they were. Hehe makes you bounce like a ping-pong ball for a few secs. My idea was for the MT and only the MT charge the mob itself so keep checking for it's position relative to your own. To implement this make the changes below and you charge the target stop on a dime and kick his butt!

In the CheckPosition function find the line that calls FASTMOVE and replace it as below:

Code:
 ;;
;; kkester1963 11/17/09
;; if we are the main tank we don't want to run to where the target was but where the target IS
;; so we will fastmove "charge" the actor not a fixed X,Z.  Otherwise for the tagalongs fastmove
;; is the correct way to go.
;; 
if ${MainTank}
{
call MainTankCharge ${TID}
}
else
{
    call FastMove ${destpoint.X} ${destpoint.Z} 2
}


Then add the function:

function MainTankCharge(uint TargetID)
{
    variable float xDist
    variable float SavDist = ${Math.Distance[${Me.X},${Me.Z},${Actor[${TargetID}].X},${Actor[${TargetID}].Z}]}
    variable int xTimer

    Debug:Echo["Charging ${Actor[${TargetID}].Name!"]
    
    IsMoving:Set[TRUE]

    if ${Me.ToActor.InCombatMode}
    {
        if ${NoAutoMovementInCombat}
        {
            IsMoving:Set[FALSE]
            return "NOAUTOMOVEMENTINCOMBAT"
        }

        if (!${Actor[${TargetID}](exists)} || ${Actor[${TargetID}].IsDead})
        {
            IsMoving:Set[FALSE]
            return "TARGETDEAD"
        }
    }

    face ${Actor[${TargetID}].X} ${Actor[${TargetID}].Z}

    press -release ${forward}
    wait 1
    press -hold ${forward}

    xTimer:Set[${Script.RunningTime}]
    do
    {
        ;if we appear to be stuck strafe to get loose
        xDist:Set[${Math.Distance[${Me.X},${Me.Z},${Actor[${TargetID}].X},${Actor[${TargetID}].Z}]}]
        if ${Math.Calc[${SavDist}-${xDist}]} < 0.8
        {
            if (${Script.RunningTime}-${xTimer}) > 500
            {
                ;Debug:Echo["We are stuck strafing to get loose"]
                press -hold ${strafeleft}
                wait 8
                press -release ${strafeleft}

                if ${Math.Calc[${SavDist}-${xDist}]} < 0.8
                {
                    press -hold ${straferight}
                    wait 8
                    press -release ${straferight}
                }

                xDist:Set[${Math.Distance[${Me.X},${Me.Z},${Actor[${TargetID}].X},${Actor[${TargetID}].Z}]}]
                if ${Math.Calc[${SavDist}-${xDist}]} > 0.8
                {
                    continue
                }

                isstuck:Set[TRUE]
                if !${pulling}
                {
                    press -release ${forward}
                    wait 20 !${Me.IsMoving}
                }

                IsMoving:Set[FALSE]
                return "STUCK"
            }
        }
        else
        {
            xTimer:Set[${Script.RunningTime}]
            SavDist:Set[${Math.Distance[${Me.X},${Me.Z},${Actor[${TargetID}].X},${Actor[${TargetID}].Z}]}]
            ;Debug:Echo["Target distance: ${SavDist}"]
        }
        face ${Actor[${TargetID}].X} ${Actor[${TargetID}].Z}
    }
    while ${Math.Distance[${Me.X},${Me.Z},${Actor[${TargetID}].X},${Actor[${TargetID}].Z}]} > 2

    ;Debug:Echo["We should be in his face now! ${Math.Distance[${Me.X},${Me.Z},${Actor[${TargetID}].X},${Actor[${TargetID}].Z}]}"]
    
    press -release ${forward}
    wait 20 !${Me.IsMoving}

    IsMoving:Set[FALSE]
    return "SUCCESS"
}
 
Last edited by a moderator:

Valerian

ISX Specialist
Code:
;; if we are the main tank we don't want to run to where the target was but where the target IS
;; so we will fastmove "charge" the actor not a fixed X,Z.  Otherwise for the tagalongs fastmove
;; is the correct way to go.
technically, we want to move to where the mob is going to be, based on our speed, and the mob's speed and heading. Think intercept course.
 
Intercept course

I agree if we projected the speed and path of the mob it would be ideal. However in my usage it seems (especially at high speed 85% and faster run speeds) we go significantly past the mob then have to turn around and run back.

The destination calc is supposed to generate a leading position? If so then I missed something and will look again. Perhaps a simple tweak in relative run speeds would achieve the same end. =)

The code above constantly adjusts to the mob's trajectory and stops on them at least for now. I'll keep looking, my apologies if I'm missing something in settings.
 

Valerian

ISX Specialist
Prediction would be overkill, honestly.

I slightly cleaned up your code, and if I get no objections I'll likely go ahead and commit this change to eq2bot.

Code:
;;
;; kkester1963 11/17/09
;; if we are the main tank we don't want to run to where the target was but where the target IS
;; so we will fastmove "charge" the actor not a fixed X,Z.  Otherwise for the tagalongs fastmove
;; is the correct way to go.
;; 
if ${MainTank}
{
	call MainTankCharge ${TID}
}
else
{
	call FastMove ${destpoint.X} ${destpoint.Z} 2
}
and
Code:
function MainTankCharge(uint TargetID)
{
	variable float xDist
	variable float SavDist = ${Actor[${TargetID}].Distance2D}
	variable int xTimer

	Debug:Echo["Charging ${Actor[${TargetID}].Name!"]


	if ${Me.ToActor.InCombatMode}
	{
		if ${NoAutoMovementInCombat}
		{
			return "NOAUTOMOVEMENTINCOMBAT"
		}

		if (!${Actor[${TargetID}](exists)} || ${Actor[${TargetID}].IsDead})
		{
			return "TARGETDEAD"
		}
	}
	IsMoving:Set[TRUE]

	Actor[${TargetID}]:DoFace

	press -release ${forward}
	wait 1
	press -hold ${forward}

	xTimer:Set[${Script.RunningTime}]
	do
	{
		;if we appear to be stuck strafe to get loose
		xDist:Set[${Actor[${TargetID}].Distance2D}]
		if ${Math.Calc[${SavDist}-${xDist}]} < 0.8
		{
			if (${Script.RunningTime}-${xTimer}) > 500
			{
				;Debug:Echo["We are stuck strafing to get loose"]
				press -hold ${strafeleft}
				wait 8
				press -release ${strafeleft}

				if ${Math.Calc[${SavDist}-${xDist}]} < 0.8
				{
					press -hold ${straferight}
					wait 8
					press -release ${straferight}
				}

				xDist:Set[${Actor[${TargetID}].Distance2D}]
				if ${Math.Calc[${SavDist}-${xDist}]} > 0.8
				{
					continue
				}

				isstuck:Set[TRUE]
				if !${pulling}
				{
					press -release ${forward}
					wait 20 !${Me.IsMoving}
				}

				IsMoving:Set[FALSE]
				return "STUCK"
			}
		}
		else
		{
			xTimer:Set[${Script.RunningTime}]
			SavDist:Set[${Actor[${TargetID}].Distance2D}]
			;Debug:Echo["Target distance: ${SavDist}"]
		}
		Actor[${TargetID}]:DoFace
	}
	while ${Actor[${TargetID}].Distance2D} > 2

	;Debug:Echo["We should be in his face now! ${Actor[${TargetID}].Distance2D}"]
	
	press -release ${forward}
	wait 20 !${Me.IsMoving}

	IsMoving:Set[FALSE]
	return "SUCCESS"
}
 

Rooster

Active Member
I've noticed that Scouts set to "Engage Melee" do the same thing. They run to where the mob was when it was pulled, not where it is now.

While you're in there, would be great to update that for any toon set to move close to the mob and melee, not just for the tanking toon, if possible.
 
Top Bottom