topaz icon indicating copy to clipboard operation
topaz copied to clipboard

Random black screen chance when warping to next floor in CoP Holla/Dem/Mea

Open Flam9 opened this issue 5 years ago • 3 comments

I have:

  • [x] searched existing issues (https://github.com/topaz-next/topaz/issues) to see if the issue has already been opened
  • [x] checked the commit log to see if the issue has been resolved since my server was last updated

Additional Information (Steps to reproduce/Expected behavior) :

Some comments from Discord:

The issue only arises when people go through the teleporter at roughly the same time. If players wait for the previous player to go through most of the cs, there's usually no issue with the regular cs On Era, one of the staff swapped the CS to a white flash and now you can throw a whole alliance through the teleporter. (https://discord.com/channels/785766425829572608/785766425829572612/794218658900738070)

I think it was determined multiple events occurring while in teleporter transit by someone killing a mob at same time Running onmobdeath on that player while in cs (https://discord.com/channels/785766425829572608/785766425829572612/794220484128014336)

Flam9 avatar Dec 31 '20 17:12 Flam9

We also have a similar issue with the toau44 Alexander fight that we skipped around, events don't like being interrupted...

zach2good avatar Dec 31 '20 17:12 zach2good

While working on something else, I noticed this in luautils::OnMobEngaged:

        if (PTarget->objtype == TYPE_PC)
        {
            ((CCharEntity*)PTarget)->m_event.reset();
            ((CCharEntity*)PTarget)->m_event.Target = PMob;
            ((CCharEntity*)PTarget)->m_event.Script.insert(0, filename);
        }

If attacked, your current event is overwritten. Useful information for later

zach2good avatar Jan 01 '21 07:01 zach2good

While working on something else, I noticed this in luautils::OnMobEngaged:

        if (PTarget->objtype == TYPE_PC)
        {
            ((CCharEntity*)PTarget)->m_event.reset();
            ((CCharEntity*)PTarget)->m_event.Target = PMob;
            ((CCharEntity*)PTarget)->m_event.Script.insert(0, filename);
        }

If attacked, your current event is overwritten. Useful information for later

Good find! My guess is that m_event.reset() also cancels synths and the like, which is the correct behavior normally:

Start synth https://github.com/topaz-next/topaz/blob/eb273bb3e7bbd70fddc0a69090f30166ae711610/src/map/utils/synthutils.cpp#L866 which sets an event id https://github.com/topaz-next/topaz/blob/b63cb1f7b610fe81524cac0b4d4b055b6af57b65/src/map/packets/char_update.cpp#L72


Some other notes and relevant files

event_t definition https://github.com/topaz-next/topaz/blob/954ac1bc852f916a796abdb5346c9956301d4b87/src/map/entities/charentity.h#L53-L71

Dem Memory Streams List https://github.com/topaz-next/topaz/blob/9e5e8a9459e822a4071561bdb012471bcd8f61f9/scripts/zones/Promyvion-Dem/IDs.lua#L43-L61

Memory Stream and Recepticle behavior (starts an event) https://github.com/topaz-next/topaz/blob/9e5e8a9459e822a4071561bdb012471bcd8f61f9/scripts/globals/promyvion.lua#L135

Flam9 avatar Jan 02 '21 18:01 Flam9