Hello, this is my code to grab all the tagged creature spawners in my level and set an array with all of them.
var Spawners : []creature_spawner_device = array{}
InitSpawners(): void =
TempSpawners := GetCreativeObjectsWithTag(MonsterSpawner{})
var Iterator: int = 0
for(Index -> TempSpawner : TempSpawners):
#cast to creature spawner
if(ValidSpawner:= creature_spawner_device[TempSpawner]):
Print("Cast")
#Add to spawners array
if(set Spawners[Index] = ValidSpawner):
Print("Num spawners added: {Index}")
else {Print("Set Array Failed")}
This ends up printing Cast, then Set Array Failed for each spawner in my level every time, and I am confused what I am doing wrong as I have this exact same code on another project but it works fine. It is finding the objects, casting them, but setting the array is not working. Any help is greatly appreciated!