I looked for this and couldnt find anything on it.
Basically i have an global array of unit groups and 2 triggers.
The first trigger is for when a marine is built it creates 4 "mini marines" that dont do any damage and just follow the marine around and make the marine into a "squad" type unit. When the marine is built it puts it into a unit group variable and also puts the 4 "mini marines" into the same group. Then it puts that group into the global unit group array.
The second trigger is for when a marine dies. It is supposed~ to kill the "mini marines" that are in the same unit group as the marine that just died. But i havent found a way to get the unit group that the marine that just died was in, so i cant kill the "mini marines."
hmmm I would have a trigger that has an even"any unit dies" that checks the condition "triggering unit is (type marine)" so not mini marine.
and then run a for loop to go through your array of group units to check to see if there are any unit groups that don't contain a marine, and then kill all units in unit group.
Loop would be quite ineffective for larger quantities of units (since it would have to loop through every unit group everytime a unit dies), you could use the custom value of your units or the data table to save the index of your global group array for this unit.
Thanks. I couldnt figure out how to check if each group contained a marine, but what i was able to do was count the number of units in the unit group, and if the total number of units in the group was 4 then that meant that the marine was missing ( the unit group was the marine + 4 mini marines). But thats not 100% working, The very 1st 4 mini marines dont die when the 1st marine you make dies. But when you kill the 2nd marine, the mini marines from the 1st marine die. When you kill the 3rd marine the mini marines from the 2nd marine die...etc
Edit:
Figured it out. Had it check if the Triggering Unit was Unit 1 from the global unit group array at each position of the array. When it finds the triggering unit, it kills the rest of the units in that group.
I looked for this and couldnt find anything on it.
Basically i have an global array of unit groups and 2 triggers. The first trigger is for when a marine is built it creates 4 "mini marines" that dont do any damage and just follow the marine around and make the marine into a "squad" type unit. When the marine is built it puts it into a unit group variable and also puts the 4 "mini marines" into the same group. Then it puts that group into the global unit group array.
The second trigger is for when a marine dies. It is supposed~ to kill the "mini marines" that are in the same unit group as the marine that just died. But i havent found a way to get the unit group that the marine that just died was in, so i cant kill the "mini marines."
Any help would be greatly appreciated.
hmmm I would have a trigger that has an even"any unit dies" that checks the condition "triggering unit is (type marine)" so not mini marine.
and then run a for loop to go through your array of group units to check to see if there are any unit groups that don't contain a marine, and then kill all units in unit group.
not 100% sure whether this is easy to code or not
Loop would be quite ineffective for larger quantities of units (since it would have to loop through every unit group everytime a unit dies), you could use the custom value of your units or the data table to save the index of your global group array for this unit.
Thanks. I couldnt figure out how to check if each group contained a marine, but what i was able to do was count the number of units in the unit group, and if the total number of units in the group was 4 then that meant that the marine was missing ( the unit group was the marine + 4 mini marines). But thats not 100% working, The very 1st 4 mini marines dont die when the 1st marine you make dies. But when you kill the 2nd marine, the mini marines from the 1st marine die. When you kill the 3rd marine the mini marines from the 2nd marine die...etc
Edit: Figured it out. Had it check if the Triggering Unit was Unit 1 from the global unit group array at each position of the array. When it finds the triggering unit, it kills the rest of the units in that group.