diff --git a/dScripts/NjMonastryBossInstance.cpp b/dScripts/NjMonastryBossInstance.cpp index faf92edd..17c4b296 100644 --- a/dScripts/NjMonastryBossInstance.cpp +++ b/dScripts/NjMonastryBossInstance.cpp @@ -47,9 +47,8 @@ void NjMonastryBossInstance::OnStartup(Entity *self) { void NjMonastryBossInstance::OnPlayerLoaded(Entity *self, Entity *player) { ActivityTimerStop(self, WaitingForPlayersTimer); - // Join the player in the activity and charge for joining + // Join the player in the activity UpdatePlayer(self, player->GetObjectID()); - TakeActivityCost(self, player->GetObjectID()); // Buff the player auto* destroyableComponent = player->GetComponent(); @@ -59,23 +58,22 @@ void NjMonastryBossInstance::OnPlayerLoaded(Entity *self, Entity *player) { destroyableComponent->SetImagination((int32_t) destroyableComponent->GetMaxImagination()); } - // Track the player ID + // Add player ID to instance auto totalPlayersLoaded = self->GetVar>(TotalPlayersLoadedVariable); - if (totalPlayersLoaded.empty() || std::find(totalPlayersLoaded.begin(), totalPlayersLoaded.end(), player->GetObjectID()) != totalPlayersLoaded.end()) { - totalPlayersLoaded.push_back(player->GetObjectID()); - } + totalPlayersLoaded.push_back(player->GetObjectID()); // Properly position the player self->SetVar>(TotalPlayersLoadedVariable, totalPlayersLoaded); - TeleportPlayer(player, totalPlayersLoaded.size()); + // This was always spawning all players at position one before and other values cause players to be invisible. + TeleportPlayer(player, 1); // Large teams face a tougher challenge - if (totalPlayersLoaded.size() > 2) + if (totalPlayersLoaded.size() >= 3) self->SetVar(LargeTeamVariable, true); // Start the game if all players in the team have loaded auto* team = TeamManager::Instance()->GetTeam(player->GetObjectID()); - if (team == nullptr || totalPlayersLoaded.size() >= team->members.size()) { + if (team == nullptr || totalPlayersLoaded.size() == team->members.size()) { StartFight(self); return; } @@ -93,6 +91,7 @@ void NjMonastryBossInstance::OnPlayerLoaded(Entity *self, Entity *player) { void NjMonastryBossInstance::OnPlayerExit(Entity *self, Entity *player) { UpdatePlayer(self, player->GetObjectID(), true); + //TODO: Add functionality to dynamically turn off the large team variable when enough players leave. GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PlayerLeft", 0, 0, player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS); }