Patch to support backstab positioning

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Locked
Message
Author
fallen
Noob
Noob
Posts: 7
Joined: 06 Apr 2008, 09:01
Noob?: Yes
Location: near respawn at Prontera

Patch to support backstab positioning

#1 Post by fallen »

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: Select all

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: Select all

--- 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 :)
Image

h4rry84
Moderators
Moderators
Posts: 234
Joined: 04 Apr 2008, 09:30
Noob?: Yes
Location: My House
Contact:

Re: Patch to support backstab positioning

#2 Post by h4rry84 »

it could be more optimized *_*

sli
Perl Monk
Perl Monk
Posts: 811
Joined: 04 Apr 2008, 17:26
Noob?: No

Re: Patch to support backstab positioning

#3 Post by sli »

Wow, yeah, a shitload.
cs : ee : realist

kali
OpenKore Monk
OpenKore Monk
Posts: 474
Joined: 04 Apr 2008, 10:10

Re: Patch to support backstab positioning

#4 Post by kali »

Beware of premature optimization :)

Let's give this a few days, then have it committed.
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.

Contrast
Noob
Noob
Posts: 2
Joined: 14 Sep 2008, 12:37
Noob?: No

Re: Patch to support backstab positioning

#5 Post by Contrast »

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?

idiomm
Noob
Noob
Posts: 1
Joined: 27 Jun 2009, 03:49
Noob?: Yes

Re: Patch to support backstab positioning

#6 Post by idiomm »

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..

M4rk1nhu
Noob
Noob
Posts: 3
Joined: 09 Sep 2009, 20:12
Noob?: Yes

Re: Patch to support backstab positioning

#7 Post by M4rk1nhu »

please, help me, qhere i put this 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(),

drane
Noob
Noob
Posts: 1
Joined: 09 Mar 2013, 05:27
Noob?: No

Re: Patch to support backstab positioning

#8 Post by drane »

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

Kornfred
Noob
Noob
Posts: 7
Joined: 19 Aug 2012, 18:13
Noob?: Yes

Re: Patch to support backstab positioning

#9 Post by Kornfred »

M4rk1nhu wrote:please, help me, qhere i put this 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(),
id like to know that too....

Locked