I have an array of NPC Spawners. This array has duplicates of the same spawner. I would like to subscribe to the EliminatedEvent
event for each spawner only once.
As such, I have created an additional array for spawn devices that I have already tracked.
Currently I have:
var trackedSpawnDevices : []npc_spawner_device = array{}
for (SpawnDevice : WaveData):
if (trackedSpawnDevices.Find[SpawnDevice]):
Print("Already here!")
else:
set trackedSpawnDevices += array{SpawnDevice}
SpawnDevice.EliminatedEvent.Subscribe(OnNPCEliminated)
However, I get an error when I try to find the SpawnDevice in the array with Find:
This function parameter expects a value of type tuple(comparable,comparable), but this argument is an incompatible value of type tuple(npc_spawner_device,npc_spawner_device).
I presume this means that I cannot find a device in an array this way. I then tried to loop through the array manually and check if the current item in the array is the same as the one I am checking, but it gives me a similar error.
Is this possible?