diff --git a/changelog.txt b/changelog.txt index c73fca6db..8deecf26b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -20,6 +20,10 @@ Uleat: Added command 'profanity' (aliased 'prof') -- Quest failures and limited social interactions may alienate players if they become inhibiting -- System commands are allowed to be processed before redaction occurs in the 'say' channel - A longer list requires more clock cycles to process - so, try to keep them to the most offensible occurrences +Uleat: Fix for bots ceasing combat when their 'follow me' mob dies + - Bots will revert to their client leash owner (bot owner or client group leader) when their FollowID() mob is no longer valid + - Combat will no longer be interrupted in these cases + - Does not apply to bot owner death... == 1/26/2019 == Uleat: Fix for class Bot not honoring NPCType data reference diff --git a/zone/bot.cpp b/zone/bot.cpp index 4b493d9bd..d7e330f6e 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -2248,10 +2248,9 @@ void Bot::AI_Process() { Client* bot_owner = (GetBotOwner() && GetBotOwner()->IsClient() ? GetBotOwner()->CastToClient() : nullptr); Group* bot_group = GetGroup(); - Mob* follow_mob = entity_list.GetMob(GetFollowID()); - + // Primary reasons for not processing AI - if (!bot_owner || !bot_group || !follow_mob || !IsAIControlled()) + if (!bot_owner || !bot_group || !IsAIControlled()) return; if (bot_owner->IsDead()) { @@ -2261,11 +2260,18 @@ void Bot::AI_Process() { return; } - // We also need a leash owner (subset of primary AI criteria) + // We also need a leash owner and follow mob (subset of primary AI criteria) Client* leash_owner = (bot_group->GetLeader() && bot_group->GetLeader()->IsClient() ? bot_group->GetLeader()->CastToClient() : bot_owner); if (!leash_owner) return; + Mob* follow_mob = entity_list.GetMob(GetFollowID()); + + if (!follow_mob) { + follow_mob = leash_owner; + SetFollowID(leash_owner->GetID()); + } + // Berserk updates should occur if primary AI criteria are met if (GetClass() == WARRIOR || GetClass() == BERSERKER) { if (!berserk && GetHP() > 0 && GetHPRatio() < 30.0f) {