๐ [Bug] Conditions 2434 and 2435 cause errors in console
FlagFlayer opened this issue ยท 10 comments
๐ Bug report
Conditions were added here:
core/sql/migrations/20211212152302_world.sql
Lines 291 to 326 in 450073c
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
- ...
- 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;
}