-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
This command is supposed to respawn dead npcs in the sector but I fail to understand the logic, it seems to search for active npcs in the sector and check the dead flag but it doesn't make sense, if the npc is dead you can't find it because it doesn't exists.
The function should search for spawn points and trigger them.
`void CSector::RespawnDeadNPCs()
{
ADDTOCALLSTACK("CSector::RespawnDeadNPCs");
// skip sectors in unsupported maps
if ( !g_MapList.IsMapSupported(m_map) )
return;
// Respawn dead NPCs
size_t sizeStart = m_Chars_Active.GetContentCount();
for (size_t i = 0; i < sizeStart; )
{
CChar* pChar = static_cast <CChar*>(m_Chars_Active.GetContentIndex(i));
if (!pChar->m_pNPC || !pChar->m_ptHome.IsValidPoint() || !pChar->IsStatFlag(STATF_DEAD))
{
++i;
continue;
}
// Restock them with npc stuff.
pChar->NPC_LoadScript(true);
// Res them back to their "home".
ushort uiDist = pChar->m_pNPC->m_Home_Dist_Wander;
pChar->MoveNear( pChar->m_ptHome, uiDist );
pChar->NPC_CreateTrigger(); //Removed from NPC_LoadScript() and triggered after char placement
pChar->Spell_Resurrection();
size_t sizeCur = m_Chars_Active.GetContentCount();
ASSERT(sizeCur != sizeStart);
sizeStart = sizeCur;
}
}`
Metadata
Metadata
Assignees
Labels
No labels