Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug] Conditions 2434 and 2435 cause errors in console #2779

Open
FlagFlayer opened this issue Sep 25, 2024 · 10 comments
Open

🐛 [Bug] Conditions 2434 and 2435 cause errors in console #2779

FlagFlayer opened this issue Sep 25, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@FlagFlayer
Copy link
Contributor

FlagFlayer commented Sep 25, 2024

🐛 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
@FlagFlayer FlagFlayer added the bug Something isn't working label Sep 25, 2024
@ratkosrb
Copy link
Contributor

What is the error?

@FlagFlayer
Copy link
Contributor Author

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

@ratkosrb
Copy link
Contributor

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

@FlagFlayer
Copy link
Contributor Author

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

@ratkosrb
Copy link
Contributor

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

@ratkosrb
Copy link
Contributor

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.

@FlagFlayer
Copy link
Contributor Author

FlagFlayer commented Sep 25, 2024

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?

@ratkosrb
Copy link
Contributor

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.

@FlagFlayer
Copy link
Contributor Author

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;
        }

@FlagFlayer
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants