SleepyGuardian 0 Posted May 24, 2018 (edited) Hey everyone, I've gone and created a pretty ambitious first mission with multiple paths depending on how effectively the player can assist ground forces. I've completed the mission but I want to refine one of my scripts. I've tried to educate myself as much as possible but I can't seem to find a tutorial/forum post for my specific problem. One of the objectives for the player to complete involves destroying reinforcements dropped off via helicopter. I had scripted the objective to be completed by killing the infantry and destroying their supporting gunship. However, I scripted it using specific names for each individual troop, ie !alive Heli_Troop1a && !alive Heli_Troop1b && !alive Heli_Troop2a etc etc. It was a brute force method to sort of get the effect I wanted and required specific units to be killed. I am looking for a way for each squad member to be counted, totaled, and compared against a desired value. I'm using 7 as that value as that is about 1/3 of all the troops. The script I have tried using in the trigger is: ({alive _x} count units Heli_Troops1 + Heli_Troops2 + Heli_Troops3) < 7 && !alive Heli_2 && triggerActivated Trig_Heli_Troops; The editor accepts the code but upon starting the mission I get an error message about a generic error in expression. I'm not sure what I'm doing wrong, but then again I barely know any real scripting beyond simple commands I can look up. I have also tried multiple different ways of writing the count units section of code including using && instead of + and separating each group name with (). None have worked. If anyone could help me out I'd greatly appreciate it. Edit: Disregard solved it!(({alive _x} count units Heli_Troops1) + ({alive _x} count units Heli_Troops2) + ({alive _x} count units Heli_Troops3)) < 7 && !alive Heli_2 && triggerActivated Trig_Heli_Troops; Still kind of a roundabout way I feel, but it works. Maybe this can help someone else. Edited May 24, 2018 by SleepyGuardian Share this post Link to post Share on other sites
f2k sel 164 Posted May 24, 2018 A little simpler would be to add all the units then count them ({alive _x} count (units Heli_Troops1) + (units Heli_Troops2) +(units Heli_Troops3)) < 7 && !alive Heli_2 && triggerActivated Trig_Heli_Troops; 1 Share this post Link to post Share on other sites
SleepyGuardian 0 Posted May 24, 2018 1 hour ago, f2k sel said: A little simpler would be to add all the units then count them ({alive _x} count (units Heli_Troops1) + (units Heli_Troops2) +(units Heli_Troops3)) < 7 && !alive Heli_2 && triggerActivated Trig_Heli_Troops; Aaahhh, that's a lot easier. I had tried something similar but it wasn't formatted correctly. Thanks for the help! I'll be using what you put Share this post Link to post Share on other sites
pierremgi 4906 Posted August 10, 2020 So disregard as you solved it. Share this post Link to post Share on other sites