geographer.pl error

All resolved question will be found here. It is recommended that you browse / search through this section first and see if your question has been answered before

Moderators: Moderators, Documentation Writers

Message
Author
kulafu
Noob
Noob
Posts: 2
Joined: 22 Jun 2010, 21:28
Noob?: No

geographer.pl error

#1 Post by kulafu »

would like to ask the devs for help about the geographer plugin. TIA!

Code: Select all

#------------------------------------------------------------
# Geographer plugin - OpenKore Team
#
# Prohibit attacking a geographer:
# + healed by another one
# + situated too close to another one
# Stop attacking monsters under above circumstances
# (prohibit to attack means setting up null damage from kore
# and 1 damage from player (from kore's id))
#------------------------------------------------------------

package geographer;

use strict;
use Globals;
use Log;
use Misc;
use Plugins;
use Utils;

Plugins::register("geographer", "Reaction on two close geographers", \&Unload);
my $hooks = Plugins::addHooks(
	["AI_pre",\&positionReact, undef],
	["packet/skill_cast", \&healReact, undef],
	["packet/skill_used_no_damage", \&healReact, undef]);

sub positionReact {
	foreach (@monstersID) {
		my $monster = $monsters{$_};
		if ($monster->{type} == 1368 && !$monster->{dmgFromPlayer}) {
			foreach my $mobCopy (@monstersID) {
				my $monsterCopy = $monsters{$mobCopy};
				if ($monsterCopy->{type} == 1368) {
					if ($monster->{ID} ne $monsterCopy->{ID}) {
					  	if (distance($monster->{pos},$monsterCopy->{pos}) <= 10) {
							prohibitAttacking($monster);
							prohibitAttacking($monsterCopy);
							last;
						}
					}
				}
			}
		}
	}
}
sub healReact {
# After cast, not before
	my $monsterS = $monsters{@_[1]->{sourceID}};
	my $monsterO = $monsters{@_[1]->{targetID}};
	if(!$monsterO
	  || @_[1]->{skillID} != 28
	  || $monsterO->{type} != 1368) {
		return;
	}
	prohibitAttacking($monsterO);
	if ($monsterS->{type} == 1368) {
		prohibitAttacking($monsterS);
	}
}
sub prohibitAttacking {
	undef @_[0]->{dmgFromYou};
	undef @_[0]->{missedFromYou};
	@_[0]->{dmgFromPlayer}{$char->{ID}} = 1;
	if (AI::action eq "attack" && AI::args()->{ID} eq @_[0]->{ID}) {
		AI::dequeue;
		stopAttack();
	}
}
sub Unload {
	Plugins::delHooks($hooks);
}
1;
and here's the errors.txt

Code: Select all

Undefined subroutine &geographer::stopAttack called at /plugins/geographer.pl line 66.
Stack trace:
Undefined subroutine &geographer::stopAttack called at /plugins/geographer.pl line 66.
 at /plugins/geographer.pl line 66
	geographer::prohibitAttacking('Actor::Monster=HASH(0x4985624)') called at /plugins/geographer.pl line 37
	geographer::positionReact('AI_pre', undef, undef) called at src/Plugins.pm line 431
	Plugins::callHook('AI_pre') called at src/AI/CoreLogic.pm line 112
	AI::CoreLogic::iterate() called at src/functions.pl line 736
	main::mainLoop_initialized() called at src/functions.pl line 69
	main::mainLoop() called at src/Interface.pm line 75
	Interface::mainLoop('Interface::Console::Win32=HASH(0x126f8bc)') called at openkore.pl line 97
	main::__start() called at start.pl line 129

Died at this line:
  		AI::dequeue;
 		stopAttack();
  	}

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

Re: geographer.pl error

#2 Post by EternalHarvest »

Code: Select all

-stopAttack();
+$char->stopAttack;

kulafu
Noob
Noob
Posts: 2
Joined: 22 Jun 2010, 21:28
Noob?: No

Re: geographer.pl error

#3 Post by kulafu »

Thank you so much sir EternalHarvest for the fast reply. Can't wait to test it. Thanks again. God Bless!

Locked