openkore icon indicating copy to clipboard operation
openkore copied to clipboard

OpenKore cannot teleport through an NPC if it is behind a wall

Open ya4ept opened this issue 3 years ago • 12 comments

------------------ Openkore Issues Template ------------------

  • Openkore version git: last
  • Server: RMS Renewal Test Server
  • Bug Report / Feature Request: OpenKore cannot teleport through an NPC if it is behind a wall
  • Summary: we have the following portal-NPC: new_1-4 100 29 moc_ruins 155 44 0 c c c c c r0 c c c c r1 r0 r0 r0 r1 r1 c c r0 c r0 c r0 c r1 c c r0 c r1 c r1 c r1 c c r2 c r2 c r2 c r0 c r2 c r2 c r0 c r1 c c c c c c c c c c r0 c c c c c c c c OpenKore cannot calculate the path from new_1-4 to moc_ruins openkore cannot calculate the path from location 1 to location 2 because the NPC is hiding behind the table: image

Use this macro to check for defect:

macro test {
	do c @warp new_1-4 100 19
	pause 3
	do debug 2
	do move moc_ruins 155 44
	do debug 0
}

console logs:

macro test
Map Change: new_1-4.gat (100, 19)
Warped.
NPC Exists: Final Tester#nv1 (100, 29) (ID 110014979) - (0)
Config 'debug' set to 2 (was 0)
Saving control\config.txt...
AI: macro sitAuto sitting | 3
Calculating route to: Morocc Ruins(moc_ruins): 155, 44
You on route to: Morocc Ruins(moc_ruins): 155, 44
CalcMapRoute - initialized.
CalcMapRoute failed.
Cannot calculate a route from new_1-4 (100,19) to moc_ruins (155,44)
Config 'debug' set to 0 (was 2)

ya4ept avatar Jul 01 '21 00:07 ya4ept

It is a old issue, it also can't teleport in mosk fields https://forums.openkore.com/viewtopic.php?t=14631 Bot can't talk to unreachable npcs

alisonrag avatar Jul 01 '21 14:07 alisonrag

https://forums.openkore.com/viewtopic.php?p=54026#p54026

alisonrag avatar Jul 01 '21 14:07 alisonrag

One more problematic place.

macro test {
	do c @warp monk_test 260  125
	pause 3
	do debug 2
	do move monk_test 314 134
	do debug 0
}

The portal is outside the map border

image

ya4ept avatar Jul 04 '21 14:07 ya4ept

maybe add a flag in portals.txt and in config keys related to npc ?

alisonrag avatar Jul 04 '21 19:07 alisonrag

This behavior should be automatic for all NPCs. OpenKore should build a route to the NPC if there is a free cell within "clientSight 15"

ya4ept avatar Jul 05 '21 07:07 ya4ept

This behavior should be automatic for all NPCs. OpenKore should build a route to the NPC if there is a free cell within "clientSight 15"

so auto walk to the npc closest cell in range of clientSight

alisonrag avatar Jul 05 '21 17:07 alisonrag

me, long time ago :

  • if npc exist on the screen, why move closer?
  • why 10 blocks?

c4c1n6kr3m1 avatar Jul 07 '21 00:07 c4c1n6kr3m1

me, long time ago :

  • if npc exist on the screen, why move closer?
  • why 10 blocks?

Portals are also npcs, so need to move closer

alisonrag avatar Jul 07 '21 01:07 alisonrag

portals ; npcs , they use different code inside MapRoute.pm my old openkore change this line } elsif (distance($self->{actor}{pos_to}, $self->{mapSolution}[0]{pos}) <= $dist) { to something like this } elsif ((distance($self->{actor}{pos_to}, $self->{mapSolution}[0]{pos}) <= $dist) || (List::MoreUtils::any { $_->{pos}{x} == $self->{mapSolution}[0]{pos}{x} && $_->{pos}{y} == $self->{mapSolution}[0]{pos}{y} } @{$::npcsList->getItems})) {

than change the 10 blocks spot to random spots

c4c1n6kr3m1 avatar Jul 11 '21 20:07 c4c1n6kr3m1

for portal outside map ... editing the field is easier?

c4c1n6kr3m1 avatar Jul 11 '21 20:07 c4c1n6kr3m1

add to portals: mosk_fild02 198 53 moscovia 140 54 c r0

macro:

macro test {
	do c @warp mosk_fild02 202 58
	pause 3
	do debug 2
	do move moscovia
	do debug 0
}

alisonrag avatar Jul 26 '21 21:07 alisonrag

Change this in src/Task/Route.pm: from: my $closest_dest = $field->closestWalkableSpot(\%dest, 1); to: my $closest_dest = $field->closestWalkableSpot(\%dest, 10);

results: Novice Grounds: image

Monk Test: image

Moscovia: image

alisonrag avatar Jul 26 '21 22:07 alisonrag