[DiscordArchive] So you should put SetActive(true) when NPC reaches any waypoint?
[DiscordArchive] So you should put SetActive(true) when NPC reaches any waypoint?
Archived author: Vel • Posted: 2024-11-25T19:57:29.569000+00:00
Original source
So you should put SetActive(true) when NPC reaches any waypoint?
Archived author: Northstrider • Posted: 2024-11-25T19:57:41.256000+00:00
Original source
no. setactive as soon as it spawns
Archived author: Vel • Posted: 2024-11-25T19:57:51.900000+00:00
Original source
And will it spawn without player logging in?
Archived author: Northstrider • Posted: 2024-11-25T19:57:58.373000+00:00
Original source
no.
Archived author: Northstrider • Posted: 2024-11-25T19:58:15.965000+00:00
Original source
you need to trigger the loading either by loading all grids or writing a script that loads the cell once on player login
Archived author: Northstrider • Posted: 2024-11-25T19:58:20.006000+00:00
Original source
there is no other way
Archived author: Northstrider • Posted: 2024-11-25T19:59:17.585000+00:00
Original source
there is no nice or clean solution for it as of right now. that's one of the oldest issues
Archived author: Alistar • Posted: 2024-11-25T19:59:35.391000+00:00
Original source
I had to do the same a week ago because setactive in smart_scripts wasn't working unless the player moves to the npc first, so on smart_script load I store all npcs that have the SMART_ACTION_SET_ACTIVE and on AddToWorld I setactive. It's a workaround.
Archived author: Vel • Posted: 2024-11-25T20:01:29.543000+00:00
Original source
Can I write you a PM to get some knowledge from you for this?
Archived author: Vel • Posted: 2024-11-25T20:02:37.277000+00:00
Original source
So something like this won't work? (ignore the invalid syntax, just demonstration purposes)
```c++
void Unit::AddToWorld()
{
if (IsInWorld())
return;
WorldObject::AddToWorld();
i_motionMaster->AddToWorld();
if ( in_array(GetEntry(), [123,321,456,768]) ) {
setActive(true);
}
}
```