Mob behavior when no one is in the zone

Post Reply
bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Mob behavior when no one is in the zone

Post by bluesolarflare » Tue Feb 13, 2018 7:56 pm

Quick question,

When a player is not in the zone, do mobs despawn or stop roaming? I have a time based script that functions based on mob roaming behavior but I notice that if no one is in the zone, the behavior doesn't log (I have the LUA print code to the console).

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: Mob behavior when no one is in the zone

Post by TeoTwawki » Tue Feb 13, 2018 9:21 pm

Zones kinda freeze in time when empty then when a player occupies it again the first tick of the clock will sorta jump things forward to the present. This is normal and intended.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Mob behavior when no one is in the zone

Post by bluesolarflare » Wed Feb 14, 2018 4:11 am

Is there a way to prevent this from occuring in a specific zone? Looking into campaign like battles where fights can continue and have an outcome while no one is in the zone.

Edit: Nevermind figured it out. I added the "&& m_zoneID != 95" part in the code in zone.cpp to not "freeze" the timer in West Sarutabaruta {S}:

Code: Select all


void CZone::DecreaseZoneCounter(CCharEntity* PChar)
{
    m_zoneEntities->DecreaseZoneCounter(PChar);

    if (ZoneTimer && m_zoneEntities->CharListEmpty() && m_zoneID != 95)
    {
        ZoneTimer->m_type = CTaskMgr::TASK_REMOVE;
        ZoneTimer = nullptr;
       
        m_zoneEntities->HealAllMobs();
    }
    else
    {
        m_zoneEntities->DespawnPC(PChar);
    }

    CharZoneOut(PChar);
}
My question is if there are any side effects? I have this particular zone running on its own instance.

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: Mob behavior when no one is in the zone

Post by TeoTwawki » Wed Feb 14, 2018 5:51 pm

Probably safe if you don't mind the extra processing and resources it uses to stay running 24/7
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

Post Reply