It's not 100% perfect (even on the client, I cant manage to land backstabs all the time ), 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
}
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(),