Aloha
does anyone here have a simple solution to this Problem? How can i manage a larger number of enemy groups, where ONLY the last one standing of each group (not even wave, since several groups should exist at the same time) will drop the assigned loot?
Spawning loot from every killed enemy is not a problem, but i struggle a little bit with the logic to make so, that only the last one, that is alive will drop it, not even the last one spawned from that particular group, since they do not spawn at the same time, but indeed only the last living group member.
Right now i have several spawn points, in my level, that spawn each group. I thougt about using the spawn points as controlling units, that watches over the status of all its spawned enemies, but then again, what would be the best way to realize it, since they spawn one after another, and can be killed in the mean time, or not.
I am somehow not fond of the idea to use the “Get all actors of class”, if i only want to know the status of SOME actors of this class (namely, only the ones of one particular group, out of several coexisting groups). Or is there a way to make each group of the same enemy type it´s own class? ^.^
Tags are also an idea, that the Spawnpoint adds an individual tag to each of it´s spawned enemies, that identifies them as member of the group of this spawnpoint, but i am afraid, that the “get actors with tag” is just as expensive as the “get all actors of class”, since it has to check every enemy for this particular group tag.
The Spawnpoint (or whatever i will put in charge) then also has to know, if an enemy is killed and update its array/database, to either send a signal to the last survivor, so that this enemy then spawns the loot, or to get the position of the last survivor during its kill, to spawn the loot on that position (then the spawnpoint would be responsible for spawning the loot too).
I got Event Dispatchers working, just not sure, if there is an easier way for communication this stuff. Otherwise i would go with them, so that every enemy calls a dispatcher or event in it´s spawnpoint, so that this then can update it´s list.
Or maybe an enemy manager, that keeps track of all groups? But even then it has to know, who spawns, who gets killed and to which group did it belong, who should spawn what loot.
The loot won´t be random, it will be assigned to each group individually.
Could someone please push me in a good direction?