Waypoint on lockMap (scratch)

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
d3fc0n
Noob
Noob
Posts: 9
Joined: 04 Apr 2008, 13:34

Waypoint on lockMap (scratch)

#1 Post by d3fc0n »

tested on svn 2.0.6

like the name. just waypoint walking on lockmap.

oh!!, i found parseUltimate in FileParsers. that's great fileparser function !!

all wap files go in waypoints folder. wap name format is mapname.wap like prontera.wap or prt_fild05.wap

wap file format

Code: Select all

[option]
#walkMode [0 = restart mode | 1 = reverse mode]
walkMode 1

[waypoint]
308:262
263:279
218:274
185:268
155:279
125:272
101:250
73:232
53:211
59:180
100:175
146:226
91:206
152:253
176:237
239:247
295:244
319:196
310:137
314:67
232:54
142:47
56:58
73:87
68:146
117:141
138:101
163:127
212:126
140:159
186:184
229:140
270:146
298:172
280:221
262:179
241:163
211:219
lockmapwp.pl

Code: Select all

#########################################################################
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#########################################################################
# Lockmap Waypoint (initial)
# d3fc0n 24/04/2008
#########################################################################

package waypoint;

use strict;
use Plugins;
use AI;
use Globals qw($char %config $conState %field);
use FileParsers qw(processUltimate);
use Log qw(message error);

Plugins::register('waypoint', 'Lockmap Waypoint.', \&on_unload);

my $hooks = Plugins::addHooks(
		['AI_pre', \&AI_pre, undef]
	);

sub on_unload {
	Plugins::delHook($hooks);
}

sub AI_pre {
	return unless ($conState == 5);

	if (AI::isIdle && (!$char->{homunculus} || AI::Homunculus::isIdle()) && $field{name} eq $config{lockMap}) {

		if (-e "waypoints/$field{name}.wap") {
			message "[lockmapwp] $field{name}.wap found.\n", "system";
			my %args;
			processUltimate("waypoints/$field{name}.wap", \%args, {waypoint => 'list'});
			AI::queue('waypoint', \%args);
		}

	} elsif (AI::action eq 'waypoint') {

		if ($field{name} ne $config{lockMap}) {
			AI::dequeue();
			return;
		}

		my $args = AI::args;

		if (!defined ${$args->{option}}{step}) {
			${$args->{option}}{step} = 0;
			${$args->{option}}{mode} = 0;
			message "[lockmapwp] initial waypoint.\n", "system";
		}

		if (!defined ${$args->{waypoint}}[${$args->{option}}{step}]) {

			if (${$args->{option}}{walkMode} eq "0") {
				${$args->{option}}{step} = 0;
				message "[lockmapwp] restart waypoint.\n", "system";

			} else {

				if (${$args->{option}}{mode} == 1) {
					${$args->{option}}{mode} = 0;
					${$args->{option}}{step} = 0;
					message "[lockmapwp] reverse waypoint.\n", "system";

				} else {
					${$args->{option}}{mode} = 1;
					${$args->{option}}{step}--;
					message "[lockmapwp] reverse waypoint.\n", "system";
				}
			}
		}

		my @point = split /:/, ${$args->{waypoint}}[${$args->{option}}{step}];

		if (@point == 2) {
			message "[lockmapwp] routing to $point[0]:$point[1].\n", "system";
			ai_route(
					$field{name},
					$point[0],
					$point[1],
					attackOnRoute => $config{attackAuto},
					maxRouteTime => $config{route_randomWalk_maxRouteTime},
					noMapRoute => 1
				);

			if (${$args->{option}}{mode} == 0) {
				${$args->{option}}{step}++;

			} else {
				${$args->{option}}{step}--;
			}
		}
	}
}

return 1;
sorry, still so buggy T T. fixme plz
sorry for my eng. i'm just another thailander.

iamanoob
Plain Yogurt
Plain Yogurt
Posts: 82
Joined: 04 Apr 2008, 09:49

Re: Waypoint on lockMap (scratch)

#2 Post by iamanoob »

Code: Select all

main::ai_route($map, $x, $y,
attackOnRoute => 2,
noSitAuto => 1,
notifyUponArrival => 1
);
if on gef_fild00 (right of geffen)
and my lockMap is geffen
could waypoint plugin just be set this way

Code: Select all

$map = $config{'lockMap'};
main::ai_route($map, $x, $y,
attackOnRoute => 2,
noSitAuto => 1,
notifyUponArrival => 1
);
ive done this with the wayPoint plugin
wp 119 101 geffen
and
wp geffen

(im also curious about that sub
parseUltimate XD)
Image
DARKest Ninja

neo
Noob
Noob
Posts: 4
Joined: 11 May 2008, 11:35
Noob?: Yes

Re: Waypoint on lockMap (scratch)

#3 Post by neo »

I would like to ask how to make it work?
I tried but it seems can't work.
I place lockmapwp.pl into my plugin folder & when start kore, it got load the lockmapwp.pl but the problem is..
the mapname.wap. I've tried to put inside control folder. Openkore root/waypoints & also plugin/waypoints but it won't work...
any help please?
thanks!

franknozly
Noob
Noob
Posts: 4
Joined: 06 Jan 2009, 09:50
Noob?: Yes

Re: Waypoint on lockMap (scratch)

#4 Post by franknozly »

That plugin is awesome. Also wanted to mention route_randomWalk_maxRouteTime in config.txt should be set higher if you have large distance between waypoints.. because you'll start going to the next waypoint if it takes longer than that timeout.

There is this one undesired effect though... If you try to use the command sit, it should suspend ai and sit. However, when using this plugin, it just goes to the next waypoint instantly. Gotta turn off the AI just to stop moving.

st4rgaze
Noob
Noob
Posts: 1
Joined: 05 Feb 2009, 13:06
Noob?: No

Re: Waypoint on lockMap (scratch)

#5 Post by st4rgaze »

nice share..but my bot cant do autostorage with this plugin..
any solutions?
thnx...

OzuNa
Noob
Noob
Posts: 5
Joined: 29 Nov 2011, 02:55
Noob?: No

Re: Waypoint on lockMap (scratch)

#6 Post by OzuNa »

Hello.

Well.. I got a problem with this pluggin. lockmapwp.pl
This pluggin is GREAT but after some achievement, I don't know why it doesn't work anymore.
The pluggin throw this error at the Start of OpenKore.

Image

Does someone has found a way to make it work again? I really appreciate it!
Thanks in Advance.

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: Waypoint on lockMap (scratch)

#7 Post by sofax222 »

OzuNa wrote:Hello.

Well.. I got a problem with this pluggin. lockmapwp.pl
This pluggin is GREAT but after some achievement, I don't know why it doesn't work anymore.
The pluggin throw this error at the Start of OpenKore.

Image

Does someone has found a way to make it work again? I really appreciate it!
Thanks in Advance.
You cloud try this new one:

Code: Select all

#########################################################################
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#########################################################################
# Lockmap Waypoint (initial)
# d3fc0n 24/04/2008
#########################################################################

package waypoint;

use strict;
use Plugins;
use AI;
use Globals qw($char %config $conState $field);
use FileParsers qw(processUltimate);
use Log qw(message error);

Plugins::register('waypoint', 'Lockmap Waypoint.', \&on_unload);

my $hooks = Plugins::addHooks(
	['AI_pre', \&AI_pre, undef]
);

sub on_unload {
	Plugins::delHook($hooks);
}

sub AI_pre {
	return unless ($conState == 5);

	if ($field) {
		if (AI::isIdle && (!$char->{homunculus} || AI::Homunculus::isIdle()) && $field->baseName eq $config{lockMap}) {

			if (-e "waypoints/$field->baseName.wap") {
				message "[lockmapwp] $field->baseName.wap found.\n", "system";
				my %args;
				processUltimate("waypoints/$field->baseName.wap", \%args, {waypoint => 'list'});
				AI::queue('waypoint', \%args);
			}

		} elsif (AI::action eq 'waypoint') {

			if ($field->baseName ne $config{lockMap}) {
				AI::dequeue();
				return;
			}

			my $args = AI::args;

			if (!defined ${$args->{option}}{step}) {
				${$args->{option}}{step} = 0;
				${$args->{option}}{mode} = 0;
				message "[lockmapwp] initial waypoint.\n", "system";
			}

			if (!defined ${$args->{waypoint}}[${$args->{option}}{step}]) {

				if (${$args->{option}}{walkMode} eq "0") {
					${$args->{option}}{step} = 0;
					message "[lockmapwp] restart waypoint.\n", "system";

				} else {

					if (${$args->{option}}{mode} == 1) {
						${$args->{option}}{mode} = 0;
						${$args->{option}}{step} = 0;
						message "[lockmapwp] reverse waypoint.\n", "system";

					} else {
						${$args->{option}}{mode} = 1;
						${$args->{option}}{step}--;
						message "[lockmapwp] reverse waypoint.\n", "system";
					}
				}
			}

			my @point = split /:/, ${$args->{waypoint}}[${$args->{option}}{step}];

			if (@point == 2) {
				message "[lockmapwp] routing to $point[0]:$point[1].\n", "system";
				ai_route(
					$field->baseName,
					$point[0],
					$point[1],
					attackOnRoute => $config{attackAuto},
					maxRouteTime => $config{route_randomWalk_maxRouteTime},
					noMapRoute => 1
				);

				if (${$args->{option}}{mode} == 0) {
					${$args->{option}}{step}++;
		
				} else {
					${$args->{option}}{step}--;
				}
			}
		}
	}
}

return 1;
But I think this is not a best solution.
There is a better (at least I think) in http://forums.openkore.com/viewtopic.php?f=34&t=13558
In this "better" solution, you need to modify the src/AI/CoreLogic.pm file !

Post Reply