can't warp through npc with 'move' command

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderators: Moderators, Developers

Message
Author
ever_boy_
Developers
Developers
Posts: 308
Joined: 06 Jul 2012, 13:44
Noob?: No

can't warp through npc with 'move' command

#1 Post by ever_boy_ »

When trying to move from aldebaran(or any other available place) to 'bat_room 169 223' (KVM chatroom - blue), the bot will move all the way to 'bat_room 165 166' (right in front of the npc), and even though the npc which is meant to warp the bot into the chat room is visible through 'nl', the bot won't talk to him, nor show any error message. Nothing happens.

However, if I manually move to 'bat_room 165 170' (which is a few cells closer to the npc than 165 166), and then do 'move bat_room 169 223', the bot will talk to the npc, as it is meant to do, since he's the one to warp him to its destination, as specified in portals.txt.

Making it short:

'move bat_room 169 223' makes the bot stop at a distance so far that he won't talk to the npc. BUT, standing at this same position, you can talk and warp yourself into the room using 'talknpc' command. This makes me think there's nothing wrong with npc/talknpc/char.

I was wondering if there is any way to set the distance/coordinates at which the bot stops before talking to the npc at 164 178, which is the one to warp him into the chatroom. Any thoughts?
Don't know if this is relevant, but the npc's coordinates (164 178) are unreacheble.

I know I could easily solve this with a 1-line macro, but I was looking for a better solution.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: can't warp through npc with 'move' command

#2 Post by EternalHarvest »

Code: Select all

Task::Route->getRoute(\@solution, $field, $self->{actor}{pos_to}, $self->{mapSolution}[0]{pos})
in Task::MapRoute returns route to the closest walkable point near a NPC, and then it routes to 10 distance from that closest walkable point.

Then, before talking with NPC, it checks again if we're at 10 distance:

Code: Select all

distance($self->{actor}{pos_to}, $self->{mapSolution}[0]{pos}) <= 10
which could not be true if NPC is in unreachable area.

It should be changed to decrease distFromGoal in

Code: Select all

my $task = new Task::Route()
depending on how far away last point in route solution is from real NPC location.

Something like that:

Code: Select all

--- src/Task/MapRoute.pm	(revision 8196)
+++ src/Task/MapRoute.pm	(working copy)
@@ -208,7 +208,7 @@
 				x => $self->{mapSolution}[0]{pos}{x},
 				y => $self->{mapSolution}[0]{pos}{y},
 				maxTime => $self->{maxTime},
-				distFromGoal => 10,
+				distFromGoal => 10 - distance($self->{mapSolution}[0]{pos}, $solution[-1]),
 				avoidWalls => $self->{avoidWalls},
 				solution => \@solution
 			);

ever_boy_
Developers
Developers
Posts: 308
Joined: 06 Jul 2012, 13:44
Noob?: No

Re: can't warp through npc with 'move' command

#3 Post by ever_boy_ »

thank you so much. it worked perfectly. should it be commited?

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: can't warp through npc with 'move' command

#4 Post by EternalHarvest »

Test what will happen with negative distFromGoal and commit if everything is fine.

Locked