rick rawlings 2 Posted May 29, 2018 So here is what I am trying to do: I have a town that needs defending. There are three approaches. There is but one castle gate that is guarded by thirty men. I have trucks with soldiers loaded on them that are supposed to pull up and disgorge their men to attack the town based on their waypoints. I want either all of Supergroup A to attack or all of Supergroup B or all of Supergroup C to attack per playthrough, i.e. just one of the three at random each time. I have seen methods to select random units, but I don't know how to approach it with all of the units in a Supergroup and their waypoints. The Random Patrol module does kind of what I want, but I could end up with trucks with no men or vise versa... I'm thinking I could name everything and select random with everything in some big arrays, but maybe there is an easier way? Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted May 29, 2018 11 minutes ago, rick rawlings said: So here is what I am trying to do: I have a town that needs defending. There are three approaches. There is but one castle gate that is guarded by thirty men. I have trucks with soldiers loaded on them that are supposed to pull up and disgorge their men to attack the town based on their waypoints. I want either all of Supergroup A to attack or all of Supergroup B or all of Supergroup C to attack per playthrough, i.e. just one of the three at random each time. I have seen methods to select random units, but I don't know how to approach it with all of the units in a Supergroup and their waypoints. The Random Patrol module does kind of what I want, but I could end up with trucks with no men or vise versa... I'm thinking I could name everything and select random with everything in some big arrays, but maybe there is an easier way? Select all units and vehicles from supergroup A Right click -> Attributes In the init field type: this setVariable ["TAG_fnc_groupID","A"]; do this for supergroups B and C and adjust the last letter in the line above to respectively "B" or "C" In the initServer.sqf: _allGroups = ["A","B","C"]; _group = selectRandom _allGroups; _allGroups = _allGroups - [_group]; systemchat format ["Deleting groups: %1",_allGroups]; { _id = _x getVariable ["TAG_fnc_groupID",""]; if (_id in _allGroups) then {deleteVehicle _x}; } forEach (vehicles + allUnits); Cheers Share this post Link to post Share on other sites
Harzach 2505 Posted May 29, 2018 Why not think of it as one group that could attack from one of three directions? That way, you are only concerned with defining the group and selecting a random route. *edit* - Or are you doing this with editor-placed units? Share this post Link to post Share on other sites
rick rawlings 2 Posted May 29, 2018 Thank you, will give it a try! Share this post Link to post Share on other sites
rick rawlings 2 Posted May 29, 2018 2 hours ago, Harzach said: *edit* - Or are you doing this with editor-placed units? This! Grumpy Old Man: I did something wrong, I guess, they all showed up each time... here's the virtual test mission and init file (I tried calling it both init.sqf and initserver.sqf) http://s000.tinyupload.com/index.php?file_id=34073374008716392683 http://s000.tinyupload.com/index.php?file_id=80048666435169541602 Share this post Link to post Share on other sites
KevsNoTrev 44 Posted May 29, 2018 Can't this be done in the editor with one group. Place three markers and then sync the groups to the markers. When the mission starts the group will spawn in one of those locations. It used to work with player starts. Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted May 30, 2018 13 hours ago, KevsNoTrev said: Can't this be done in the editor with one group. Place three markers and then sync the groups to the markers. When the mission starts the group will spawn in one of those locations. It used to work with player starts. Can be done, you still need to take into account that when vehicles are involved things can go downhill pretty fast if they don't spawn in the proper direction. Cheers Share this post Link to post Share on other sites