Stuck after teleport
Moderators: Moderators, Developers
Stuck after teleport
in Openkore 2.0.7 all version SVN r7541
server twRO
my knight、Priest
This issue when I was attacked from the blood to a low when I use Teleport to escape,
ai will get stuck , I try to use ai print command to record the situation and attack are mostly stuck in skill_use
when i use "tele" , Will return to normal
server twRO
my knight、Priest
This issue when I was attacked from the blood to a low when I use Teleport to escape,
ai will get stuck , I try to use ai print command to record the situation and attack are mostly stuck in skill_use
when i use "tele" , Will return to normal
Re: AI get stuck in twRO renewal
i cant sure, but i know what is your problem..
tele is not functioning in twRO.
i tested on free server, the command is no more working.
tele is not functioning in twRO.
i tested on free server, the command is no more working.
Re: AI get stuck in twRO renewal
this problem is teleport after , when confirmation window jump out , my char if try to teleport will be stuck
how to cancel the teleport confirmation window?
how to cancel the teleport confirmation window?
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: AI get stuck in twRO renewal
That happens in original client too?zideaddin wrote:teleport after , when confirmation window jump out , my char if try to teleport will be stuck
Re: AI get stuck in twRO renewal
i don get stuck after teleporting....
but messy ai queue is appeared.
but messy ai queue is appeared.
Re: AI get stuck in twRO renewal
Yes , i use Xkore can seenEternalHarvest wrote:That happens in original client too?zideaddin wrote:teleport after , when confirmation window jump out , my char if try to teleport will be stuck
This problem how to happend ?
1. BOT working
2. BOT need use teleport (etc . hp too low 30% )
3. BOT use Teleport skills , jump out confirmation window
4. BOT happens too many aggressives need teleport
5. confirmation windows need Kore to send packet "Enter" confirmation , but previous confirmation windows need to confirmation already
6. BOT teleport , screen stuck in "confirmation windows" , You must type "tele" to solve or wait other Monster attack you to hp 30%↓ ~
Re: AI get stuck in twRO renewal (teleport)
I'm getting this error aswell on iRO.
It only happens when you use the teleport skill. I checked with Xkore 2 what was happening, and it seems it double casts teleport so you appear in the new place with a dialog box still open. Openkore then tries to continue on but is unable to cast any skills because of the box.
Console output looks like:
And the AI gets stuck on skill_use.
To me it seems its being called twice by two different pieces of code.
Once in Corelogic.pm line 2870:
And is overlapping with line 2706 in Misc.pm:
Then to useTeleport() again in Misc.pm line 2894:
Then to ServerType0.pm line 1456:
With a lot of testing I found if i set ai_teleport_hp to a high number like 5, it pretty much eliminates the problem. So I think the offending code is Corelogic.pm line 2870. Although I'm not sure of how to change the code to solve the error from happening without a high timeout.
It only happens when you use the teleport skill. I checked with Xkore 2 what was happening, and it seems it double casts teleport so you appear in the new place with a dialog box still open. Openkore then tries to continue on but is unable to cast any skills because of the box.
Console output looks like:
Code: Select all
You are casting Teleport on yourself (Delay: 0ms)
----------------- Warp Portal --------------------
# Place Map
--------------------------------------------------
You use Teleport on yourself (Lv: 1)
Monster X (2) hit You when your HP is under 25. Teleporting...
[ 17/ 46] Monster X (2) attacks you (Dmg: 187) (Delay: 576ms)
Monster X (3) uses Blooddrain on Player Y (0) (Dmg: 149) (Delay: 576ms)
Teleporting due to insufficient HP/SP or too many aggressives
Map Change: map.gat (264, 51)
----------------- Warp Portal --------------------
# Place Map
--------------------------------------------------
You use Teleport on yourself (Lv: 1)
To me it seems its being called twice by two different pieces of code.
Once in Corelogic.pm line 2870:
Code: Select all
message T("Teleporting due to insufficient HP/SP or too many aggressives\n"), "teleport";
$ai_v{temp}{clear_aiQueue} = 1 if (useTeleport(1));
$timeout{ai_teleport_hp}{time} = time;
Code: Select all
} elsif ($config{$player->{configPrefix}.'teleportAuto_hp'} && percent_hp($player) <= $config{$player->{configPrefix}.'teleportAuto_hp'}) {
message TF("%s hit %s when %s HP is under %d. Teleporting...\n",
$monster, $player, $player->verb(T('your'), T('its')), $config{$player->{configPrefix}.'teleportAuto_hp'}), "teleport";
$teleport = 1;
...
useTeleport(1, undef, 1) if ($teleport);
Code: Select all
if ($use_lvl == 1) {
Plugins::callHook('teleport_sent', \%args);
$messageSender->sendWarpTele(26, "Random");
return 1;
Code: Select all
sub sendWarpTele { # type: 26=tele, 27=warp
my ($self, $skillID, $map) = @_;
my $msg = pack('v2 Z16', 0x011B, $skillID, stringToBytes($map));
$self->sendToServer($msg);
debug "Sent ". ($skillID == 26 ? "Teleport" : "Open Warp") . "\n", "sendPacket", 2
}
With a lot of testing I found if i set ai_teleport_hp to a high number like 5, it pretty much eliminates the problem. So I think the offending code is Corelogic.pm line 2870. Although I'm not sure of how to change the code to solve the error from happening without a high timeout.
Re: AI get stuck in twRO renewal (teleport)
Hmm. Seems to be the race condition.
Re: AI get stuck in twRO renewal (teleport)
Did some more testing with eharvest's help. Tried to add timeouts to the low HP teleport call in Misc.pm but it didn't help. I think that part of the code wasn't the problem since I can reproduce the error without calling that part. I think the problem code is in CoreLogic.pm:
which ends up calling in Misc.pm:
I can easily reproduce the problem, set a low ai_teleport_hp (0.1->1) and set a low teleportAuto_minAggressives to get it to trigger easily using teleportAuto_useSkill 1. Nine times out of 10 the problem will happen for me. Not sure if its due to latency or postdelays. It seems easy to fix conceptually, just check to make sure the dialog box is closed after a certain short delay, hitting 'Cancel' on the box. Sadly I'm not sure how to do that, theres a bunch of other similar calls in CoreLogic.pm but they all use other timeouts that are uses less frequently and/or have a higher default timeout.
If I set a high ai_teleport_retry and a low ai_teleport_hp teleport seems to not work in time (at least with my small hp pool) and I die most of the time, but if I do the reverse (high HP, low retry) it seems to work well and I haven't seen it bug so far.
Edit: After testing over night, it still does bug with a high ai_teleport_hp, but much less frequently just due to it not spamming teleport as much. It helps the problem but won't solve it. I tried a bunch of things to try and fix it but I'm not familiar enough with the code to make it happen. It seems to me we need to confirm skill use (You use Teleport on yourself (Lv: 1)) and wait for mapChanged in the AI (map_change Recieve/ServerType0.pm) before casting again. It needs to spam like it does now however because of lag and postdelay, but not actually send the skill twice.
Code: Select all
message T("Teleporting due to insufficient HP/SP or too many aggressives\n"), "teleport";
$ai_v{temp}{clear_aiQueue} = 1 if (useTeleport(1));
$timeout{ai_teleport_hp}{time} = time;
Code: Select all
if (!$emergency && $use_lvl == 1) {
Plugins::callHook('teleport_sent', \%args);
$timeout{ai_teleport_retry}{time} = time;
AI::queue('teleport');
return 1;
}
If I set a high ai_teleport_retry and a low ai_teleport_hp teleport seems to not work in time (at least with my small hp pool) and I die most of the time, but if I do the reverse (high HP, low retry) it seems to work well and I haven't seen it bug so far.
Edit: After testing over night, it still does bug with a high ai_teleport_hp, but much less frequently just due to it not spamming teleport as much. It helps the problem but won't solve it. I tried a bunch of things to try and fix it but I'm not familiar enough with the code to make it happen. It seems to me we need to confirm skill use (You use Teleport on yourself (Lv: 1)) and wait for mapChanged in the AI (map_change Recieve/ServerType0.pm) before casting again. It needs to spam like it does now however because of lag and postdelay, but not actually send the skill twice.