But since I'm not really familiar with Perl nor OpenKore's interior design, I do hope that someone will point me in the right direction with this one.
What I want to do: I'm trying to add a short delay after Kore dropped a target to avoid kill-stealing (or possibly before) in an attempt to make it look more human. Currently, it's like INSTANTLY choosing a new path/target respectively whenever this occurs, rendering it quite suspicious in a somewhat crowded map. Now, there's two ways that I can imagine how this should "look":
a) Kore continues moving towards its former target, probably even starting to attack in case it's been very close, before "recognizing" that the monster has been tagged by another player and dropping target / routing properly.
b) Kore continues moving towards the already dismissed target and continues its pathing without going zig-zag because it's already following the precalculated path again.
Out of those two, the second one is likely to be harder to implement, so I was going with option "a". I figured that I simply needed to delay the execution of the "dropping target/ignoring monster" part for like a second or so before everything could continue as usual.
So what I got is this
Code: Select all
sub dropTargetWhileMoving {
my $ID = AI::args->{attackID};
message T("Dropping target - you will not kill steal others\n");
$char->sendAttackStop;
$monsters{$ID}{ignore} = 1;
# Right now, the queue is either
# move, route, attack
# -or-
# route, attack
AI::dequeue;
AI::dequeue;
AI::dequeue if (AI::action eq "attack");
if ($config{teleportAuto_dropTargetKS}) {
message T("Teleport due to dropping attack target\n");
useTeleport(1);
}
}
Code: Select all
# Drop target if it's already attacked by someone else
message T("Dropping target - you will not kill steal others\n"), "ai_attack";
$char->sendMove(@{$realMyPos}{qw(x y)});
AI::dequeue;
if ($config{teleportAuto_dropTargetKS}) {
message T("Teleport due to dropping attack target\n"), "teleport";
useTeleport(1);
}
I was thinking of adding either timeOut(<n>) or perhaps ai_clientSuspend(<n>) into those two subroutines.
However, I figured that the latter would probably look even worse (full AI suspension, oh yeah) when dropping a target, and also I'm not sure whether or not there are better ways to do it than simply adding a timeOut. I couldn't find anything when browsing through the src files.
It's also possible that there's a way to do this already, in which case I'd appreciate a hint. Thanks in advance!