Follow Slave Detect Wrong Map Name to find Master

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

Moderators: Moderators, Developers

Message
Author
Mr_M
Noob
Noob
Posts: 10
Joined: 31 Mar 2011, 22:35
Noob?: No

Follow Slave Detect Wrong Map Name to find Master

#1 Post by Mr_M »

I try to go castle dungeon with using master bot and slave bot at town (yuno).
Then i try enter castle yuno schg_cas05 at Master bot, but the slave detect Master bot at
schg_cas01.
I type in console "Party" in slave bot, and comfirm the list of map for Master bot is schg_cas05 but which when "Calculating route to find master: schg_cas01" is running?

madnoh
Plain Yogurt
Plain Yogurt
Posts: 55
Joined: 09 Sep 2011, 18:04
Noob?: Yes
Location: Malaysia

Re: Follow Slave Detect Wrong Map Name to find Master

#2 Post by madnoh »

Mr_M wrote:I try to go castle dungeon with using master bot and slave bot at town (yuno).
Then i try enter castle yuno schg_cas05 at Master bot, but the slave detect Master bot at
schg_cas01.
I type in console "Party" in slave bot, and comfirm the list of map for Master bot is schg_cas05 but which when "Calculating route to find master: schg_cas01" is running?

Try This Bro:

follow 1
followTarget <<< Put Master name Char Here
followEmotion 1
followEmotion_distance 4
followFaceDirection 0
followDistanceMax 1
followDistanceMin 1
followLostStep 12
followSitAuto
followBot 1

itemsTakeAuto 2
itemsTakeAuto_party 0
itemsGatherAuto 2
itemsMaxWeight 49
itemsMaxWeight_sellOrStore 48
itemsMaxNum_sellOrStore 99
cartMaxWeight 7900
itemsTakeAuto_new 0


lockMap ra_fild12 << make sure u master and u slave same map
lockMap_x
lockMap_y
lockMap_randX
lockMap_randY


my english is bad .. sorry hope this can help u

Mr_M
Noob
Noob
Posts: 10
Joined: 31 Mar 2011, 22:35
Noob?: No

Re: Follow Slave Detect Wrong Map Name to find Master

#3 Post by Mr_M »

Thanks for propose solution, but the main bug still exist.
I have look into the src code, i think the bug come from map_aliase function that when detect Masterbot at different map. Slave bot will pass map_aliase name to itself instead pass the actual map name.
I try to modify the source on AI.pm to get actual solution.
Need some guide on this source code.
scr\AI.pm

Code: Select all

sub ai_partyfollow {
	# we have to enable re-calc of route based on master's possition regulary, even when it is
	# on route and move, otherwise we have finaly moved to the possition and found that the master
	# already teleported to another side of the map.

	# This however will give problem on few seq such as storageAuto as 'move' and 'route' might
	# be triggered to move to the NPC

	my %master;
	$master{id} = main::findPartyUserID($config{followTarget});
	if ($master{id} ne "" && !AI::inQueue("storageAuto","storageGet","sellAuto","buyAuto")) {

		$master{x} = $char->{party}{users}{$master{id}}{pos}{x};
		$master{y} = $char->{party}{users}{$master{id}}{pos}{y};
		($master{map}) = $char->{party}{users}{$master{id}}{map} =~ /([\s\S]*)\.gat/;

		if ($master{map} ne $field->name || $master{x} == 0 || $master{y} == 0) { # Compare including InstanceID
			delete $master{x};
			delete $master{y};
		}

		return unless ($master{map} ne $field->name || exists $master{x}); # Compare including InstanceID

		# Compare map names including InstanceID
		if ((exists $ai_v{master} && distance(\%master, $ai_v{master}) > 15)
			|| $master{map} != $ai_v{master}{map}
			|| (timeOut($ai_v{master}{time}, 15) && distance(\%master, $char->{pos_to}) > $config{followDistanceMax})) {

			$ai_v{master}{x} = $master{x};
			$ai_v{master}{y} = $master{y};
			$ai_v{master}{map} = $master{map};
			($ai_v{master}{map_name}, undef) = Field::nameToBaseName(undef, $master{map}); # Hack to clean up InstanceID
			$ai_v{master}{time} = time;

			if ($ai_v{master}{map} ne $field->name) {
				message TF("Calculating route to find master: %s\n", $ai_v{master}{map}), "follow";
			} elsif (distance(\%master, $char->{pos_to}) > $config{followDistanceMax} ) {
				message TF("Calculating route to find master: %s (%s,%s)\n", $ai_v{master}{map_name}, $ai_v{master}{x}, $ai_v{master}{y}), "follow";
			} else {
				return;
			}

			AI::clear("move", "route", "mapRoute");
			ai_route($ai_v{master}{map_name}, $ai_v{master}{x}, $ai_v{master}{y}, distFromGoal => $config{followDistanceMin});

			my $followIndex = AI::findAction("follow");
			if (defined $followIndex) {
				$ai_seq_args[$followIndex]{ai_follow_lost_end}{timeout} = $timeout{ai_follow_lost_end}{timeout};
			}
		}
	}
}
I have change the value at this line

Code: Select all

			if ($ai_v{master}{map} ne $field->name) {
				message TF("Calculating route to find master: %s\n", $ai_v{master}{map_name}), "follow";
to

Code: Select all

			if ($ai_v{master}{map} ne $field->name) {
				message TF("Calculating route to find master: %s\n", $ai_v{master}{map}), "follow";
then it display correct map to route, but why it still route to alliase map instead actual map?

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

Re: Follow Slave Detect Wrong Map Name to find Master

#4 Post by EternalHarvest »

Aliases and instances support is buggy, maybe it's because of that.

Mr_M
Noob
Noob
Posts: 10
Joined: 31 Mar 2011, 22:35
Noob?: No

Re: Follow Slave Detect Wrong Map Name to find Master

#5 Post by Mr_M »

EternalHarvest wrote:Aliases and instances support is buggy, maybe it's because of that.
Yup, agree with that.
Would it be nice if sub ai_partyfollow will split into 3 type of route condition?
1st normal map routing
2nd Alliase map routing
3rd Instance map routing

Somehow i am not good in writing the code, but i hope to get help on writing this.

Locked