vmangos/core

๐Ÿ› [Bug] Conditions 2434 and 2435 cause errors in console

FlagFlayer opened this issue ยท 10 comments

๐Ÿ› Bug report

Conditions were added here:

-- Magistrate Henry Maleb Alive
INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (2434, 20, 2276, 300, 0, 0, 2);
INSERT INTO `generic_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES
(243513, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243514, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243515, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243516, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243517, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243518, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243519, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243520, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243521, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243522, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243523, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243524, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243525, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk'),
(243526, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 634, 635, 0, 0, 0, 0, 0, 2434, 'Shadowy Assassin - Talk');
-- Magistrate Henry Maleb Dead
INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (2435, 20, 2276, 300, 1, 0, 2);
INSERT INTO `generic_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES
(243513, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243514, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243515, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243516, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243517, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243518, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243519, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243520, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243521, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243522, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243523, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243524, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243525, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk'),
(243526, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 630, 631, 632, 0, 0, 0, 0, 0, 2435, 'Shadowy Assassin - Talk');

Could this be changed to use CONDITION_IS_ALIVE (type 46)? The comments suggest this is what the conditions are supposed to check.

Expected behavior

Steps to reproduce

  1. ...
  2. Profit

Version & Environment

Client Version:

Commit Hash:

OS Client:
OS Server:

Crashlog

  • None

What is the error?

2024-09-25 10:04:13 CONDITION 2434 type 20 used with bad parameters, called from script action, used with target: , map 0, source
2024-09-25 10:04:13 CONDITION 2435 type 20 used with bad parameters, called from script action, used with target: , map 0, source

This happens because the creature the script ran on has already despawned.

If this is intended behaviour then it should be coded such that it doesn't spit out an error I'd presume

If we remove the error then you wont know wtf happened when something actually breaks and doesn't work as intended.

It is intended for the script system to print an error in console if the targets the script is supposed to run on are not found. But that does not necessary mean anything has gone wrong. In this case the creatures have despawned after death, this is what is supposed to happen, so the error does not indicate any mistake.

Why would script run for creatures that are despawned in the first place? What is triggering this script, and is it correct for it to be triggered at all under these circumstances?

They were not despawned when the script started. They despawned later. The scripts run on the Map, not on the creatures, they merely target the creatures.

I believe for this condition type it should automatically return false instead of a nullptr on a creature that exists but is not spawned (no condition involving creatures that are not spawned should return true). That's how it's done for the similar (but not exactly equivalent) cmangos condition:

        case CONDITION_CREATURE_IN_RANGE:
        {
            Creature* creature = nullptr;


            MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*target, m_value1, true, false, m_value2, true);
            MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(creature, creature_check);
            Cell::VisitGridObjects(target, searcher, m_value2);


            return creature != nullptr;
        }

The error I mentioned earlier is what happens when the Event has already ended before the script fires. In the case the event is still ongoing this is what it looks like:

Screenshot 2024-09-26 014802