Openkore.com

OpenKore Forums
It is currently 20 Jun 2018, 07:03

All times are UTC - 5 hours [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: NEED HELP: runFromMVP Plugins
PostPosted: 10 May 2008, 12:00 
Offline
Human
Human
User avatar

Joined: 23 Apr 2008, 10:11
Posts: 30
Location: Indonesia TANAH AIRKU
What i think when i made this plugins was to be able to avoid MVPs without disconnecting.

The logic of this program is:
    Found MVPs!
    Run to opposite direction from where the monsters are
    If the monster is closing in (chasing us), disconnect immediately.

Code:
############### Advanced Avoid ##############
# The way to avoid monster without relog.
#
# Use by changing <teleport> parameter in
# mon_control.txt to 4 (Run before relog)

package runAway;

use Plugins;
use Globals;
use Log qw(warning);
use Network::Send;
use Utils;

Plugins::register('runAway', 'run from dangerous monsters', \&unload);
my $hook = Plugins::addHook('AI_pre', \&avoidMonster);

sub unload {
   Plugins::delHook('AI_pre', $hook);
}

my $dist_x;
my $dist_y;

sub avoidMonster {
   foreach (@monstersID) {
      next unless $_;
      if (Misc::mon_control($monsters{$_}{name},$monsters{$_}{nameID})->{teleport_auto} == 4) {
         AI::clear(qw/move route mapRoute/);
         $dist_x = $char->{pos_to}{x} - $monsters{$_}{pos_to}{x};
         $dist_y = $char->{pos_to}{y} - $monsters{$_}{pos_to}{y};
         if ($dist_x < 8 && $dist_x > -8 && $dist_y < 8 && $dist_y > -8) {
            warning "runAway - Monster too close!\n","plugins";
            warning "Disconnecting for $timeout{ai_mon_control}{'timeout'} secs to avoid $monsters{$_}{name}\n";
               Misc::relog($timeout{ai_mon_control}{'timeout'});
         } else {
            warning "runAway - Run from monster $monsters{$_}{name}! ($monsters{$_}{pos_to}{x},$monsters{$_}{pos_to}{y})\n","plugins";
            Misc::manualMove($dist_x,$dist_y);
         }
         
      }
   }
}
1;


But i can't make this work. Can anyone submit a fix to this plugins? Your help is much appreciated.

Regards!


Top
 Profile  
 
 Post subject: Re: NEED HELP: runFromMVP Plugins
PostPosted: 13 May 2008, 22:36 
Offline
Developers
Developers
User avatar

Joined: 04 Apr 2008, 09:50
Posts: 109
For the range code ... how about you shorten the code like this?

Code:
if (inRange(distance($char->{pos_to}, $monsters{$_}{pos_to}), "1..8"))




p.s: Just suggesting ^^

_________________
An Overall Macro Plugins Diffs Proposal


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group