[DiscordArchive] This is my first time working with scripted AI, and I'd appreciate some help if someone has time to
[DiscordArchive] This is my first time working with scripted AI, and I'd appreciate some help if someone has time to
Archived author: KJack • Posted: 2023-10-23T07:17:55.224000+00:00
Original source
This is my first time working with scripted AI, and I'd appreciate some help if someone has time to look. I'm having a very difficult time getting events to actually schedule. I'm looking at other examples that work fine and I don't understand why mine is different. Can anyone clue me in?
<https://github.com/azerothcore/azerothcore-wotlk/blob/5b8352f69c5a1795d006fc1f64a166137649d416/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp#L124-L217>
Specifically, the event scheduled at line 186 never fires. I verified that JustEngagedWith IS getting fired and I get the LOG_ERROR debug I (temporarily) threw in there.
I also know that UpdateAI is firingbecause my MoveSplinePath logic is working correctly. It's just the event case statement that never gets called.
Can someone tell me what kind of idiot I am?
Archived author: KJack • Posted: 2023-10-23T07:20:54.941000+00:00
Original source
This is the log output that happens during the encounter:
```
Jeklk: EVENT_SPAWN_FLYING_BATS
Bat Rider: mode: NPC_BAT_RIDER_MODE_BOSS
Bat Rider: Reset
Bat Rider: JustEngagedWith Testbiah
Bat Rider: mode: NPC_BAT_RIDER_MODE_BOSS
Bat Rider: not moving, re-running loop
Jeklk: EVENT_SPAWN_FLYING_BATS
Bat Rider: mode: NPC_BAT_RIDER_MODE_BOSS
Bat Rider: Reset
Bat Rider: JustEngagedWith Testbiah
Bat Rider: mode: NPC_BAT_RIDER_MODE_BOSS
Bat Rider: not moving, re-running loop
Bat Rider: not moving, re-running loop
Bat Rider: not moving, re-running loop
Bat Rider: not moving, re-running loop
```
Archived author: Anchy • Posted: 2023-10-23T07:28:19.906000+00:00
Original source
are any events firing at all
Archived author: KJack • Posted: 2023-10-23T07:28:38.123000+00:00
Original source
for the boss (Jeklik), yes. for my bat rider, no.
Archived author: KJack • Posted: 2023-10-23T07:28:52.838000+00:00
Original source
EVENT_SPAWN_FLYING_BATS is what's summoning the bats
Archived author: Anchy • Posted: 2023-10-23T07:28:58.259000+00:00
Original source
have you created an EventMap
Archived author: KJack • Posted: 2023-10-23T07:29:38.708000+00:00
Original source
it *looks* to me like one comes with CreatureAI.
<https://github.com/kjack9/azerothcore-wotlk/blob/5b8352f69c5a1795d006fc1f64a166137649d416/src/server/game/AI/CreatureAI.h#L74>
Archived author: KJack • Posted: 2023-10-23T07:30:08.207000+00:00
Original source
some scripts seems to use that one, others declare their own. i did try making my own and it didn't seem to matter.
Archived author: Anchy • Posted: 2023-10-23T07:30:25.754000+00:00
Original source
honestly I had the same issue so I made my own event map and it worked
Archived author: KJack • Posted: 2023-10-23T07:30:49.346000+00:00
Original source
hah! okay, let me see if i can rework that then.
any reason i shouldn't be doing work in the constructor?