Openkore.com
http://forums.openkore.com/

Patch to support backstab positioning
http://forums.openkore.com/viewtopic.php?f=58&t=5342
Page 1 of 1

Author:  fallen [ 11 Mar 2009, 17:21 ]
Post subject:  Patch to support backstab positioning

I created this patch that adds the check "fromBehind" to attackSkillSlot, allowing rogues to more effectively backstab monsters.

It's not 100% perfect (even on the client, I cant manage to land backstabs all the time :P), but works all right for me.

Here is the example config:
Code:
attackSkillSlot Back Step {
        lvl 10             
        dist 2.5
        fromBehind 1
        aggressives <= 2
        sp > 30%       
        maxAttempts 3
        timeout 0
        disabled 0
        target_timeout 0
        inLockOnly 1   
        monsters Porcellio, Mummy, Skel Archer, Skel Soldier,Golem, Verit, Dragon Fly, Hunter Fly, Hill Wind, Stem Worm
}


And here is the patch (against latest SVN):

Code:
--- Attack.pm.orig      2009-03-11 19:15:49.000000000 -0300
+++ Attack.pm   2009-03-11 19:15:58.000000000 -0300
@@ -592,8 +590,49 @@
                        my $slot = $args->{attackMethod}{skillSlot};
                        delete $args->{attackMethod};

                        ai_setSuspend(0);
+                       my $monsterLooking=$target->{look}{body};
+                       if ($config{'attackSkillSlot_'.$slot.'_fromBehind'} && $monsterLooking ) {
+                               my %behind;
+                               if ($monsterLooking eq 0 || $monsterLooking eq 8) {
+                                       $behind{x}=$target->{pos_to}{x} ;
+                                       $behind{y}=$target->{pos_to}{y} - 1;
+                               }       
+                               elsif ($monsterLooking eq 1) {
+                                       $behind{x}=$target->{pos_to}{x} + 1 ;
+                                       $behind{y}=$target->{pos_to}{y} - 1;
+                               }
+                               elsif ($monsterLooking eq 2) {
+                                       $behind{x}=$target->{pos_to}{x} + 1 ;
+                                       $behind{y}=$target->{pos_to}{y};
+                               }       
+                               elsif ($monsterLooking eq 3) {
+                                       $behind{x}=$target->{pos_to}{x} + 1;
+                                       $behind{y}=$target->{pos_to}{y} + 1;
+                               }
+                               elsif ($monsterLooking eq 4) { 
+                                       $behind{x}=$target->{pos_to}{x} ;
+                                       $behind{y}=$target->{pos_to}{y} + 1;
+                               }
+                               elsif ($monsterLooking eq 5) {
+                                       $behind{x}=$target->{pos_to}{x} - 1;
+                                       $behind{y}=$target->{pos_to}{y} + 1;
+                               }       
+                               elsif ($monsterLooking eq 6) {
+                                       $behind{x}=$target->{pos_to}{x} - 1;
+                                       $behind{y}=$target->{pos_to}{y} ;
+                               }
+                               elsif ($monsterLooking eq 7) {
+                                       $behind{x}=$target->{pos_to}{x} - 1;
+                                       $behind{y}=$target->{pos_to}{y} - 1;
+                               }       
+                               
+       
+                               message "Trying to move behind target ($target->{pos_to}{x},$target->{pos_to}{y} looking $directions_lut{$monsterLooking}) - ($
behind{x},$behind{y})\n";
+                               $messageSender->sendMove($behind{x}, $behind{y});
+
+                       }               
                        my $skill = new Skill(name => lc($config{"attackSkillSlot_$slot"}));
                        if (!ai_getSkillUseType($skill->getHandle())) {
                                ai_skillUse(
                                        $skill->getHandle(),


Hope it makes it's way into the mainstream codebase :)

Author:  h4rry84 [ 11 Mar 2009, 21:29 ]
Post subject:  Re: Patch to support backstab positioning

it could be more optimized *_*

Author:  sli [ 11 Mar 2009, 21:31 ]
Post subject:  Re: Patch to support backstab positioning

Wow, yeah, a shitload.

Author:  kali [ 11 Mar 2009, 22:06 ]
Post subject:  Re: Patch to support backstab positioning

Beware of premature optimization :)

Let's give this a few days, then have it committed.

Author:  Contrast [ 21 Jun 2009, 12:07 ]
Post subject:  Re: Patch to support backstab positioning

Are you still working on it? Cause I'd love to use BackStab to level :o

Do i simply have to paste this in Attack.pm?

Author:  idiomm [ 27 Jun 2009, 04:25 ]
Post subject:  Re: Patch to support backstab positioning

im really a noob an if its okay could you start the code from the Hiding Skill to Back Stab?? Please... or could you explain further..

Author:  M4rk1nhu [ 09 Sep 2009, 20:14 ]
Post subject:  Re: Patch to support backstab positioning

please, help me, qhere i put this code?
Quote:
--- Attack.pm.orig 2009-03-11 19:15:49.000000000 -0300
+++ Attack.pm 2009-03-11 19:15:58.000000000 -0300
@@ -592,8 +590,49 @@
my $slot = $args->{attackMethod}{skillSlot};
delete $args->{attackMethod};

ai_setSuspend(0);
+ my $monsterLooking=$target->{look}{body};
+ if ($config{'attackSkillSlot_'.$slot.'_fromBehind'} && $monsterLooking ) {
+ my %behind;
+ if ($monsterLooking eq 0 || $monsterLooking eq 8) {
+ $behind{x}=$target->{pos_to}{x} ;
+ $behind{y}=$target->{pos_to}{y} - 1;
+ }
+ elsif ($monsterLooking eq 1) {
+ $behind{x}=$target->{pos_to}{x} + 1 ;
+ $behind{y}=$target->{pos_to}{y} - 1;
+ }
+ elsif ($monsterLooking eq 2) {
+ $behind{x}=$target->{pos_to}{x} + 1 ;
+ $behind{y}=$target->{pos_to}{y};
+ }
+ elsif ($monsterLooking eq 3) {
+ $behind{x}=$target->{pos_to}{x} + 1;
+ $behind{y}=$target->{pos_to}{y} + 1;
+ }
+ elsif ($monsterLooking eq 4) {
+ $behind{x}=$target->{pos_to}{x} ;
+ $behind{y}=$target->{pos_to}{y} + 1;
+ }
+ elsif ($monsterLooking eq 5) {
+ $behind{x}=$target->{pos_to}{x} - 1;
+ $behind{y}=$target->{pos_to}{y} + 1;
+ }
+ elsif ($monsterLooking eq 6) {
+ $behind{x}=$target->{pos_to}{x} - 1;
+ $behind{y}=$target->{pos_to}{y} ;
+ }
+ elsif ($monsterLooking eq 7) {
+ $behind{x}=$target->{pos_to}{x} - 1;
+ $behind{y}=$target->{pos_to}{y} - 1;
+ }
+
+
+ message "Trying to move behind target ($target->{pos_to}{x},$target->{pos_to}{y} looking $directions_lut{$monsterLooking}) - ($
behind{x},$behind{y})\n";
+ $messageSender->sendMove($behind{x}, $behind{y});
+
+ }
my $skill = new Skill(name => lc($config{"attackSkillSlot_$slot"}));
if (!ai_getSkillUseType($skill->getHandle())) {
ai_skillUse(
$skill->getHandle(),

Author:  drane [ 09 Mar 2013, 05:56 ]
Post subject:  Re: Patch to support backstab positioning

If for some reason the target is standing right up against a wall, just stand inside of them, it works fine.

Author:  Kornfred [ 25 Nov 2013, 00:19 ]
Post subject:  Re: Patch to support backstab positioning

M4rk1nhu wrote:
please, help me, qhere i put this code?
Quote:
--- Attack.pm.orig 2009-03-11 19:15:49.000000000 -0300
+++ Attack.pm 2009-03-11 19:15:58.000000000 -0300
@@ -592,8 +590,49 @@
my $slot = $args->{attackMethod}{skillSlot};
delete $args->{attackMethod};

ai_setSuspend(0);
+ my $monsterLooking=$target->{look}{body};
+ if ($config{'attackSkillSlot_'.$slot.'_fromBehind'} && $monsterLooking ) {
+ my %behind;
+ if ($monsterLooking eq 0 || $monsterLooking eq 8) {
+ $behind{x}=$target->{pos_to}{x} ;
+ $behind{y}=$target->{pos_to}{y} - 1;
+ }
+ elsif ($monsterLooking eq 1) {
+ $behind{x}=$target->{pos_to}{x} + 1 ;
+ $behind{y}=$target->{pos_to}{y} - 1;
+ }
+ elsif ($monsterLooking eq 2) {
+ $behind{x}=$target->{pos_to}{x} + 1 ;
+ $behind{y}=$target->{pos_to}{y};
+ }
+ elsif ($monsterLooking eq 3) {
+ $behind{x}=$target->{pos_to}{x} + 1;
+ $behind{y}=$target->{pos_to}{y} + 1;
+ }
+ elsif ($monsterLooking eq 4) {
+ $behind{x}=$target->{pos_to}{x} ;
+ $behind{y}=$target->{pos_to}{y} + 1;
+ }
+ elsif ($monsterLooking eq 5) {
+ $behind{x}=$target->{pos_to}{x} - 1;
+ $behind{y}=$target->{pos_to}{y} + 1;
+ }
+ elsif ($monsterLooking eq 6) {
+ $behind{x}=$target->{pos_to}{x} - 1;
+ $behind{y}=$target->{pos_to}{y} ;
+ }
+ elsif ($monsterLooking eq 7) {
+ $behind{x}=$target->{pos_to}{x} - 1;
+ $behind{y}=$target->{pos_to}{y} - 1;
+ }
+
+
+ message "Trying to move behind target ($target->{pos_to}{x},$target->{pos_to}{y} looking $directions_lut{$monsterLooking}) - ($
behind{x},$behind{y})\n";
+ $messageSender->sendMove($behind{x}, $behind{y});
+
+ }
my $skill = new Skill(name => lc($config{"attackSkillSlot_$slot"}));
if (!ai_getSkillUseType($skill->getHandle())) {
ai_skillUse(
$skill->getHandle(),


id like to know that too....

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/