diff --git a/src/strategy/actions/BattleGroundJoinAction.cpp b/src/strategy/actions/BattleGroundJoinAction.cpp index 6ab94f7c..cfd552b4 100644 --- a/src/strategy/actions/BattleGroundJoinAction.cpp +++ b/src/strategy/actions/BattleGroundJoinAction.cpp @@ -977,8 +977,10 @@ bool BGStatusAction::Execute(Event event) bot->GetSession()->HandleBattleFieldPortOpcode(packet); botAI->ResetStrategies(false); - // if this is first bot into BG they can lose bg strat - botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT); + if (!bot->GetBattleground()) { + // first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly, set bg for "bg strategy check" to fix that + botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT); + } context->GetValue("bg role")->Set(urand(0, 9)); PositionMap& posMap = context->GetValue("position")->Get(); PositionInfo pos = context->GetValue("position")->Get()["bg objective"]; @@ -1085,8 +1087,10 @@ bool BGStatusAction::Execute(Event event) bot->GetSession()->HandleBattleFieldPortOpcode(packet); botAI->ResetStrategies(false); - // if this is first bot into BG they can lose bg strat - botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT); + if (!bot->GetBattleground()) { + // first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly, set bg for "bg strategy check" to fix that + botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT); + } context->GetValue("bg role")->Set(urand(0, 9)); PositionMap& posMap = context->GetValue("position")->Get(); PositionInfo pos = context->GetValue("position")->Get()["bg objective"]; diff --git a/src/strategy/actions/BattleGroundTactics.cpp b/src/strategy/actions/BattleGroundTactics.cpp index c7dadfc4..7d8eaadc 100644 --- a/src/strategy/actions/BattleGroundTactics.cpp +++ b/src/strategy/actions/BattleGroundTactics.cpp @@ -2609,7 +2609,7 @@ bool BGTactics::Execute(Event event) if (bg->isArena()) { - // can't use this in arena - it will crash server wehen vPaths/vFlagIds are used uninitialized + // can't use this in arena - no vPaths/vFlagIds (will crash server) botAI->ResetStrategies(); return false; } @@ -2656,6 +2656,9 @@ bool BGTactics::Execute(Event event) break; } default: + // can't use this in this BG - no vPaths/vFlagIds (will crash server) + botAI->ResetStrategies(); + return false; break; }