Skip to content

Add a config to control slave attack range independently from followDistanceMax #4202

@ragnarokoffline

Description

@ragnarokoffline

Describe the solution you'd like

Currently, the slave uses followDistanceMax to control how far it will attack monsters from the master position, as seen in Misc.pm:

openkore/src/Misc.pm

Lines 3225 to 3247 in a995176

# 8. It must be within $followDistanceMax of MasterPos, if we have a master.
if ($realMasterPos) {
my $masterPosNow;
if ($master_moving) {
my $totalTime = $timeSinceMasterMoved + $time_actor_to_get_to_spot;
my $master_CurrentStep = calcStepsWalkedFromTimeAndSolution($master_solution, $masterSpeed, $totalTime);
$masterPosNow = $master_solution->[$master_CurrentStep];
} else {
$masterPosNow = $realMasterPos;
}
if ($spot->{x} == $masterPosNow->{x} && $spot->{y} == $masterPosNow->{y}) {
$meeting_rejections{same_as_master}++;
next;
}
if (blockDistance($spot, $masterPosNow) > $followDistanceMax) {
$meeting_rejections{too_far_from_master}++;
next;
}
if (blockDistance($targetPosInStep, $masterPosNow) > $followDistanceMax) {
$meeting_rejections{target_too_far_from_master}++;
next;
}
}

Problem:
When followDistanceMax is set to 1, this causes two issues:

  1. The check only happens once at the time the master starts attacking the monster and the distance between master and monster exceeds followDistanceMax. The slave won't attack the monster even when the monster is moving inside range. In my testing, the slave eventually attacks, but it took around 10 seconds after the master's first hit.

  2. When both the monster (e.g. Cruiser) and the master (e.g. Archer) are ranged attackers and the distance between them exceeds followDistanceMax, the slave never attacks the monster even after waiting 30 seconds. Only when the master and monster distance comes within followDistanceMax does the slave start attacking.

Proposed Solution:
Add a new config option followAttackDistance <range> to control slave attack range independently from follow behavior.

  • If followAttackDistance 0, the slave falls back to using followDistanceMax

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions