[DiscordArchive] I am having an issue with a SmartScript. My SmartScript works when the event_flags is set to 0, but
[DiscordArchive] I am having an issue with a SmartScript. My SmartScript works when the event_flags is set to 0, but
Archived author: 郑佩茹 • Posted: 2022-08-26T18:48:47.848000+00:00
Original source
I am having an issue with a SmartScript. My SmartScript works when the event_flags is set to 0, but when I set it to 6 (only fire in difficulty 0 and 1,) it no longer works in any difficulty. I added a log to the code to check, and it passes the bitmask check condition in SmartScript::FillScript correctly when in difficulties 0 and 1 but not 2, as expected, but even after adding to mEvents vector it does not fire. Does anyone know why this might be happen?
Archived author: 郑佩茹 • Posted: 2022-08-26T18:49:47.218000+00:00
Original source
Here is the relevant function:
```
void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at)
{
(void)at; // ensure that the variable is referenced even if extra logs are disabled in order to pass compiler checks
if (e.empty())
{
if (obj)
LOG_DEBUG("sql.sql", "SmartScript: EventMap for Entry {} is empty but is using SmartScript.", obj->GetEntry());
if (at)
LOG_DEBUG("sql.sql", "SmartScript: EventMap for AreaTrigger {} is empty but is using SmartScript.", at->entry);
return;
}
for (SmartAIEventList::iterator i = e.begin(); i != e.end(); ++i)
{
#ifndef ACORE_DEBUG
if ((*i).event.event_flags & SMART_EVENT_FLAG_DEBUG_ONLY)
continue;
#endif
if ((*i).event.event_flags & SMART_EVENT_FLAG_DIFFICULTY_ALL)//if has instance flag add only if in it
{
if (obj && obj->GetMap()->IsDungeon())
{
LOG_ERROR("", "Spawn Mode {}, Event Flags {}, Shifted Value {}", obj->GetMap()->GetSpawnMode(), (*i).event.event_flags, (1 << (obj->GetMap()->GetSpawnMode() + 1)));
if ((1 << (obj->GetMap()->GetSpawnMode() + 1)) & (*i).event.event_flags)
{
LOG_ERROR("", "Fired event!"); // This is working and this log is appearing, but the action does not happen!
mEvents.push_back((*i));
}
}
continue;
}
mEvents.push_back((*i));//NOTE: 'world(0)' events still get processed in ANY instance mode
}
}
```
Archived author: Ĝ̷̳r̸̹͊a̷̜̚k̴̞̔ • Posted: 2022-08-26T18:53:41.129000+00:00
Original source
k it looks like it just goes down the list nicely, warrior is 1, paladin is 10, hunter 100, rogue 1000 so on
Archived author: Ĝ̷̳r̸̹͊a̷̜̚k̴̞̔ • Posted: 2022-08-26T18:54:08.498000+00:00
Original source
so 0001101101 should get me all my classes
Archived author: Ĝ̷̳r̸̹͊a̷̜̚k̴̞̔ • Posted: 2022-08-26T18:56:16.323000+00:00
Original source
cache :/
Archived author: eldwarvo0001 • Posted: 2022-08-26T18:56:55.236000+00:00
Original source
But, what's the use? Agility doesnt do anything for casters
Archived author: eldwarvo0001 • Posted: 2022-08-26T18:57:22.208000+00:00
Original source
It's fun though
Archived author: Ĝ̷̳r̸̹͊a̷̜̚k̴̞̔ • Posted: 2022-08-26T18:57:32.574000+00:00
Original source
i wasnt giving it to casters
Archived author: eldwarvo0001 • Posted: 2022-08-26T18:57:45.578000+00:00
Original source
Archived author: Ĝ̷̳r̸̹͊a̷̜̚k̴̞̔ • Posted: 2022-08-26T18:58:00.493000+00:00
Original source
and it does lots for casters, like when they are silenced