waitForParty -- Don't get separeted! by Chontrad

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
bahng
Noob
Noob
Posts: 6
Joined: 03 Oct 2008, 19:50
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#51 Post by bahng »

It'd be really cool if someone code it so the master sits and wait only when the slave is in another map. Still an awesome plugin though. THanks

go2hell
Noob
Noob
Posts: 3
Joined: 08 Oct 2008, 04:36
Noob?: No

Re: waitForParty -- Don't get separeted! by Chontrad

#52 Post by go2hell »

I did a small modification to the plugin and I hope someone will find it usefull.

Basically, I have 2 pairs of hunter and priest. What I wanted to do was following:

Priest 1 will support Hunter 1 and Priest 2 will support Hunter 2. And I want the hunters to wait for their respective supports. So I added small code in the plugin and specified their respective priest on the hunters config.

Hunter 1 config

Code: Select all

follow_wait 1
follow_wait_inLockOnly 1
follow_wait_timeOut 30
follow_wait_PartyMemberOnly Priest1

Hunter 2 config

Code: Select all

follow_wait 1
follow_wait_inLockOnly 1
follow_wait_timeOut 30
follow_wait_PartyMemberOnly Priest2
Modified WaitForParty

Code: Select all


###########################
# Name of Plugin: waitParty.pl
# Version: 1.0 (9/05/2008)
# Version of Openkore Required: OpenKore  2.0.5.1

package waitParty;

use Plugins;
use Globals;
use Log qw(message error warning debug);

our $findParty;
our $temp;
my %Timecount;

Plugins::register('waitParty', 'Wait and come back for party', \&unload, \&unload);
my $hooks = Plugins::addHooks(   ['actor_player_add', \&waitForOthers, undef],
            ['actor_player_remove', \&waitForOthers, undef],
            ['party_share', \&waitForOthers, undef],
            ['party_move', \&waitForOthers, undef],
            ['AI_pre', \&waitForOthers, undef],
            ['actor_action_sit', \&waitForOthers, undef],
            ['actor_action_stand', \&waitForOthers, undef]);

sub unload { 
	Plugins::delHooks($hooks);
}

sub waitForOthers {
	return unless $config{'follow_wait'};
	return unless defined @partyUsersID;

	#return if bot isn't at lockmap
	return if (($config{'follow_wait_inLockOnly'} > 0) && ($field{name} ne $config{lockMap}));

	my $actor;
	foreach (@partyUsersID) {
		next if $_ eq $accountID;
		next if $_ eq "";
		$actor = $playersList->getByID($_);
		
		next if ($char->{'party'}{'users'}{$_}{'name'} eq $config{'follow_wait_noPartyMember'});
		
[b]		next if ($char->{'party'}{'users'}{$_}{'name'} ne $config{'follow_wait_PartyMemberOnly'});
[/b]		
		if(!$actor && $char->{'party'}{'users'}{$_}{'online'}) {
			my %party;

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

			if ($party{map} ne $field{name} || $party{x} == 0 || $party{y} == 0) {
				delete $party{x};
				delete $party{y};
			}

			return unless ($party{map} ne $field{name} || exists $party{x});

			if ($Timecount{start} eq ''){
				$Timecount{start} = time;
			}
			$Timecount{current} = time;

			$Timecount{toreset} = $config{'follow_wait_timeOut'};
			if ($Timecount{toreset} eq '') {
				$Timecount{toreset} = 30;
			}
			$Timecount{after} = $Timecount{start} + $Timecount{toreset};
			if ($Timecount{current} >= $Timecount{after}){
				$Timecount{start} = time;
			}

			if (($Timecount{current} >= $Timecount{after})
				&& ((exists $ai_v{party} && AI::distance(\%party, $ai_v{party}) > 15)
				|| $party{map} != $ai_v{party}{map}
				|| (AI::timeOut($ai_v{party}{time}, 15) && AI::distance(\%party, $char->{pos_to}) > $config{followDistanceMax}))) {
			
	            $ai_v{party}{x} = $party{x};
	            $ai_v{party}{y} = $party{y};
	            $ai_v{party}{map} = $party{map};
	            $ai_v{party}{time} = time;

	            warning "Party is far way.\n", "waitParty";

	            if ($ai_v{party}{map} ne $field{name}) {
					message "Searching party: $ai_v{party}{map}\n", , "follow";
	            } elsif (AI::distance(\%party, $char->{pos_to}) > $config{followDistanceMax} ) {
					message "Searching party: $ai_v{party}{map} ($ai_v{party}{x},$ai_v{party}{y})\n", "follow";
	            } else {
					return;
	            }
	            AI::clear("move", "route", "mapRoute");
	            AI::ai_route($ai_v{party}{map}, $ai_v{party}{x}, $ai_v{party}{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};
	            }
	        }
	        $findParty = 1;
	        return;
	    } elsif ($findParty && ($actor = $playersList->getByID($_))) {
	        warning "Party Found.\n", "waitParty";
	        $findParty = 0;
	        AI::clear("move", "route");
	    } elsif ($findParty) {
	        warning "Party is offline.\n", "waitParty";
	        $findParty = 0;
	        return;
	    }
	}
}
1;
Please take note that they all belong to a single party. In theory, though 4 bot will share experience but they can kill more monsters so they will level-up faster

Suggestions are welcome

Mucilon
Cybernatic Entity
Cybernatic Entity
Posts: 249
Joined: 04 Apr 2008, 13:15
Noob?: Yes
Location: Brazil

Re: waitForParty -- Don't get separeted! by Chontrad

#53 Post by Mucilon »

OK, it seems to work...
Thanks for the contribution go2hell!
As soon as someone else test it without bugs, I'll change the first post.
Just for the record, this new option implemented by go2hell has the same limitation as the follow_wait_noPartyMember, where it supports just one name.

bahng
Please test this version, it has the modifications you asked for...
Don't need to add anything to the config.txt.
Please post your tests.

[The extension pl has been deactivated and can no longer be displayed.]


bahng
Noob
Noob
Posts: 6
Joined: 03 Oct 2008, 19:50
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#54 Post by bahng »

Doesn't seem to work at all. The master bot doesn't wait for the slave or anything. Not even in the same map.

Mucilon
Cybernatic Entity
Cybernatic Entity
Posts: 249
Joined: 04 Apr 2008, 13:15
Noob?: Yes
Location: Brazil

Re: waitForParty -- Don't get separeted! by Chontrad

#55 Post by Mucilon »

The master would wait for the slave just when they were at different maps. Doesn't this happen?

Rumata
Noob
Noob
Posts: 9
Joined: 09 Apr 2008, 17:22
Noob?: No
Location: Russia
Contact:

Re: waitForParty -- Don't get separeted! by Chontrad

#56 Post by Rumata »

if follow_wait_inLockOnly 0, and master is in town and do auto-sell-buy, often appears problems, may be usefull for all:

follow_wait_notInTown 1

Code: Select all

return if (($config{'follow_wait_notInTown'} > 0) && ($cities_lut{$field{name}.'.rsw'}));
if ($MANYquestions) {
brain enable 1;
} else {DIE!!!}

gillian
Noob
Noob
Posts: 1
Joined: 16 Oct 2008, 04:23
Noob?: No

Re: waitForParty -- Don't get separeted! by Chontrad

#57 Post by gillian »

Love this plugin, but then everytime the master loses the slave, and finds the slave, the previous ai route is cleared. This is no problem if you are using a random route, but if you are using way points then this will reset the bot's way points (as it does not remember the bot's last way point/position).

How could we make the master stand and wait for the slave, and instead of back-tracking to find slave? Of course, stand but still have attack/pickup AI.

Thanks.

go2hell
Noob
Noob
Posts: 3
Joined: 08 Oct 2008, 04:36
Noob?: No

Re: waitForParty -- Don't get separeted! by Chontrad

#58 Post by go2hell »

I've been using this plugin for a long time now, and Its great! I just wish I know how to implement the following:

1. Include a time-out, after a certain amount of time, master bot will go look for its slave (given that the slave is online and on the same map).

I have a number of instance where in the Priest bot died because the master (a hunter bot) got separated and the priest is being attacked by a long range monster. The hunter is merrily waiting for the priest to arrive, and yet the priest cant move cause its being hit by monster(s). Eventually, its dies =(

Code:
- After a certain amount of time and the priest is not near the hunter, Save original master (may be following another char)
- Change to follow the priest
- Move and find the priest
- When the priest if found, revert to original master (while killing any monster attacking the priest )
- get back to business and level up =)
(please see P.S. below for follow_bot comment)

2. Staging area.

I wish the hunter will wait for the a priest BEFORE going into an aggressive filled map. There are a few instance where my hunter died while waiting for the priest to get into the lockmap

Code:
- move to staging area (like the lockmap setting).
- wait for the priest
- when the priest catches up, move into the lockmap
- Level up! =)

3. Alternate lockmap

I wish that my hunter or priest will go to a safe(r) map if one of them is offline.

Code
- if slave is offlline, change to alternate lockmap
- if slave is online, change to original lockmap


4. Group storage

I wish that if my hunter or priest will do storage at the same time. I hate it when the hunter save its item into its kafra and the priest just watches. When they return to the lockmap the priest will go overweight and leave my poor hunter in an aggressive map.

Code:
- If overweight and in city, pm slave to do storage.
- Both will do storage and go back to lockmap to level up.


P.S.
- Is it just me? or the follow_bot setting does not really work? (Added the masters' name in the authorization file)
- Base on documentation, recover status should make the monsters change target. But the priest bot cant use it as attackskill, any idea?

micram
Noob
Noob
Posts: 7
Joined: 06 Apr 2008, 19:58

Re: waitForParty -- Don't get separeted! by Chontrad

#59 Post by micram »

no comment...because it is 100% working with my bot and the master wait his party and they are waiting each other /no1 thank you! nice plugins!

Ni4-Spawn
Noob
Noob
Posts: 4
Joined: 08 Dec 2008, 10:15
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#60 Post by Ni4-Spawn »

Mucilon. Oi meu amigo, tudo bem ?

Well i have a question. Is there any kind of way that i can cange some part of this plugin, so when the master go find the missed follower bot, he still attacks monsters in the patch of finding his follower bot ?

I men, sometimes im in the same place with my full suport bot, and he dies. When he dies, there is a huge mob. But i can kill it, and with this plugin, the master bot stop doing everything, just to make a route to his follower bot.

I would like him to find the follower bot, but in his path keeping attacking monster.

Is that possible ?

Post Reply