Jump to content

CHXRaupy

Member
  • Posts

    2
  • Joined

  • Last visited

  • Feedback

    0%

About CHXRaupy

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

CHXRaupy's Achievements

Enthusiast

Enthusiast (6/16)

  • First Post
  • Dedicated
  • Reacting Well
  • Week One Done
  • One Month Later

Recent Badges

3

Reputation

  1. #ifdef ENABLE_SHIP_DEFENSE auto CHARACTER::IsInShipDefenseDungeon() const -> bool { return m_Dungeon && m_Dungeon->GetIndex() == ConstMap::DungShipDefense; } #endif I checked for the dungeon ptr on the mobs, bcs this is a very reliable identification if they are in that dungeon. When they spawn, they immediately get the ptr. auto CDungeon::SpawnMob(const ConstDungeon::MobSpawn* spawn, bool tryRarity) -> LPCHARACTER { auto* map = CSectreeManager::instance().GetMap(m_MapIndex); if (!map) return nullptr; auto rotation = spawn->dir; if (!spawn->degrees) { rotation ? rotation = (spawn->dir - 1) * 45 : rotation = -1; } auto* mob = CCharacterManager::instance().SpawnMob( spawn->vnum, m_MapIndex, map->m_setting.baseX + spawn->x * 100, map->m_setting.baseY + spawn->y * 100, 0, spawn->motion, rotation, true, false, nullptr, "", tryRarity ); if (!mob) return nullptr; mob->SetDungeon(this); ProcessSpawnEvent(mob); if (!spawn->key.empty()) m_UniqueMobs.emplace(spawn->key, mob); return mob; } And when they die (get destroyed) it is being set to nullptr. So you have a very solid identification method over the lifespan of the mobs if they need the state machine skip or not. If you would check for the Mast and in a few months you dont think about it anymore and spawn one maybe on a non dungeon map, it would lead to unnecessary server load. I guess there are also other ways you can do the check e.g. with the private map index of the mob, I think you can check which function Owsap has written for the identification of the dungeon mobs and use his one.
  2. This is intended behavior. As soon as there are no PCs in a sectree area the game stops the state machine for the other entities inside. I think usually there is no reason for them to act, bcs no player observes them. However in the special case of Ship Defense rejoining this produces the issue you are talking about. -> Players can just abuse the missing battle state and totally skip the first time limited wave without receiving any mast damage. When i wrote that dungeon I skipped the state machine stop for monsters that are inside of that dungeon, which solved the issue. Feel free to test if this is also appropriate for the dungeon routine of yours. void SECTREE::DecreasePC() { LPSECTREE_LIST::iterator it_tree = m_neighbor_list.begin(); while (it_tree != m_neighbor_list.end()) { LPSECTREE tree = *it_tree++; if (--tree->m_iPCCount <= 0) { if (tree->m_iPCCount < 0) { sys_err("tree pc count lower than zero (value %d coord %d %d)", tree->m_iPCCount, tree->m_id.coord.x, tree->m_id.coord.y); tree->m_iPCCount = 0; } ENTITY_SET::iterator it_entity = tree->m_set_entity.begin(); while (it_entity != tree->m_set_entity.end()) { LPENTITY pkEnt = *(it_entity++); if (pkEnt->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) pkEnt; #ifdef ENABLE_SHIP_DEFENSE if (ch->IsInShipDefenseDungeon()) continue; #endif ch->StopStateMachine(); } } } } }
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.