MZ Is there a way to Event a targeting system more efficiently with Galv's MZ Map Projectiles for a Tower Defence minigame?

It is possible to some extent, but since the targeting is limited to 1 event targeting and 1 trigger at a time, you'd need to keep track of a value to attack multiple enemies with your towers. For example, you can store a health value, use a conditional branch, and target a specific event when it is greater than 0. With multiple of the same targeting different events, it prioritizes those with greater health which is pretty good.

The problem is, if you have 20 enemies for example with different turrets and upgrades, you'd have to make a new common event each time for every turret, tier and enemy which would take forever and make a mess. Furthermore, it doesn't take into account which event is first if they all go at different speeds which isn't ideal to defend, though it might be possible to keep track of regions. There might be a way with script calls, different other plugins or just structuring the event differently. Depending on what is possible, I might have to change my mini-game or simplify it.
I dont know.

What i know:

If you allocate an individual Variable for every Enemy, than you can keep track on how many Steps
each Enemy did.
If Enemies come in range of your Tower, you can use the "Steps Variables" to determine which Enemy/Enemies are at the Front Position. That should help with targeting.

If it is becoming too much Eventcode, you could try to use Scriptlines to build a
Hit detection, that could look like this: (Thanks to @caethyril) (Used in Eventcommand Script)
Code:
hitDist = 0
for (var a = 2; a < 100; a++) {
if (!!$gameMap.event(a)) {   // check that event exists
hitDist = ($gameMap.event(1).screenX() - $gameMap.event(a).screenX()).abs + 
          ($gameMap.event(1).screenY() - $gameMap.event(a).screenY()).abs;
if (hitDist <= 20) {  // in range?
        $gameSelfSwitches.setValue([$gameMap.mapId(), a, 'A'], true);
 }}}
Just an example, not ready for use code for your Problem.
The Code checked if Event ID1 the Bullet is in a Pixel Radius of 20 (Same Maptile) as the Event Ids 2 to 100. If it is the Case, the Code activates Self Switch A of the Hit Event Id/Id's.
It's just a Prototype. But it shows that it is possible to safe some Eventing work.

The MV/MZ Scriptcall List is also very helpful:
Counting steps could work, but there doesn’t seem to be a way to reset since it can only reach a certain number of step once per game (I think ?). I’m tempted of going the long way, but using code seems like a far more efficient way setting it up. I’ll need to learn it a bit since I’ve got no experience with code. Thanks for your help, I’ll look into it !

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-event-a-targeting-system-more-efficiently-with-galvs-mz-map-projectiles-for-a-tower-defence-minigame.152019/