[DiscordArchive] how can i grab a creature's SmartAI from code? is there a function that takes in the creature ID and
[DiscordArchive] how can i grab a creature's SmartAI from code? is there a function that takes in the creature ID and
Archived author: KJack • Posted: 2023-10-23T19:30:03.836000+00:00
Original source
how can i grab a creature's SmartAI from code? is there a function that takes in the creature ID and returns the AI object?
Archived author: Nyeriah • Posted: 2023-10-23T19:38:05.763000+00:00
Original source
GetAI()
Archived author: Nyeriah • Posted: 2023-10-23T19:38:43.736000+00:00
Original source
You can cast it to smartai if that’s what you need, granted they use sai there won’t be issues
Archived author: KJack • Posted: 2023-10-23T19:51:16.617000+00:00
Original source
sorry, let me give some context. i'm trying to have this stupid bat have the `npc_batrider` script assigned in the database, but if i detect that it's not a boss summon i want it to use the SAI entries in the DB. the way i'm attemping to go about this is with `me->SetAI()` inside the script, but I have to construct the AI I'm assigning and then determine how to activate it correctly. so far... it is not done yet.
Archived author: KJack • Posted: 2023-10-23T19:51:31.464000+00:00
Original source
i have "redo the SAI in the script" as a backup plan
Archived author: KJack • Posted: 2023-10-23T19:54:15.086000+00:00
Original source
the AI is resisting being replaced. I tried doing SmartAI in the DB and then replacing it with `SetAI()` and my `npc_batrider` AI I created, but the scheduling doesn't work correctly when I do it that way.
Archived author: KJack • Posted: 2023-10-23T19:56:24.490000+00:00
Original source
```c++
// enable SmartAI for the creature, replacing this script
me->SetAI(new SmartAI(me));
```
was my first attempt, but that ends up with a bat that doesn't run any of its SAI action.
Archived author: Nyeriah • Posted: 2023-10-23T20:19:38.371000+00:00
Original source
Yeah no you can’t replace AI during run time
Archived author: Nyeriah • Posted: 2023-10-23T20:20:03.943000+00:00
Original source
Sai script f.e is loaded when the creature is added to world
Archived author: KJack • Posted: 2023-10-23T20:27:32.238000+00:00
Original source
got it. that's unfortunate, but understood.