Jump to content
Sign in to follow this  
wozzsta

How to name a group of spawned in units.

Recommended Posts

Hi guys, i want to name a group of 5 guys i am spawning in via a trigger. 

When i have spawned them in and then killed them i need my next trigger to be able to read if they are alive or not. 

However, i cant figure out how to name the group im spawning in. 

 

Here is my code. 

 

hint "Wave 1 Incoming";
 
_group1 = [getmarkerpos "wave1", EAST, " ["O_soldierU_AR_F","O_soldierU_AR_F","O_soldierU_AR_F","O_soldierU_AR_F","O_soldierU_AR_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
_wp1 = _group1 addWaypoint [getmarkerpos "wp1", 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FULL"; _wp1 setWaypointBehaviour "AWARE"; _wp1 setWaypointFormation "WEDGE";
_wp2 = _group1 addWaypoint [getmarkerpos "wp2", 0]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "FULL"; _wp2 setWaypointBehaviour "AWARE"; _wp2 setWaypointFormation "WEDGE"; 
_wp3 = _group1 addWaypoint [getmarkerpos "wp3", 0]; _wp3 setWaypointType "SAD"; _wp3 setWaypointSpeed "FULL"; _wp3 setWaypointBehaviour "AWARE"; _wp3 setWaypointFormation "WEDGE"; 

Share this post


Link to post
Share on other sites

The group is already assigned to the _group1 variable. If you need this variable to be global so that it is usable in your next trigger, simply remove the underscore before "group1". Keep in mind, however, that if you run this spawn code more than once, only the last spawned group will be "group1".

Edited by Dux2

Share this post


Link to post
Share on other sites

The group is already named _group1. If you need this variable to be global so that it is usable in your next trigger, simply remove the underscore before "group1". Keep in mind, however, that if you run this spawn code more than once, only the last spawned group will be "group1".

 

You sir are a saint, i have spent over an hour trying to figure that out! and all i had to do was remove and underscore!

 

Thanks so much!

Share this post


Link to post
Share on other sites

Ok follow up question now, is it possible to spawn in multiple different squads/units all named group 1? 

 

because i just copy and pasted this line: group1 = [getmarkerpos "wave1", EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault")] call BIS_fnc_spawnGroup;

 

and it spawned what i wanted, however only the first group spawn are treated as group1 by my next trigger. so can i keep it all on the same line and spawn a bunch of different stuff?

 

 

 

here is an example of what i want to do, but it doesn't work

 

 

hint "Wave 1 Incoming";
 
group1 = [getmarkerpos "wave1", EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault"),(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "OIA_SPGPlatoon_Scorcher")] call BIS_fnc_spawnGroup;
_wp1 = group1 addWaypoint [getmarkerpos "wp1", 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FULL"; _wp1 setWaypointBehaviour "AWARE"; _wp1 setWaypointFormation "WEDGE";
_wp2 = group1 addWaypoint [getmarkerpos "wp2", 0]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "FULL"; _wp2 setWaypointBehaviour "AWARE"; _wp2 setWaypointFormation "WEDGE"; 
_wp3 = group1 addWaypoint [getmarkerpos "wp3", 0]; _wp3 setWaypointType "MOVE"; _wp3 setWaypointSpeed "FULL"; _wp3 setWaypointBehaviour "AWARE"; _wp3 setWaypointFormation "WEDGE"; 

Share this post


Link to post
Share on other sites

Only the last group will have that name:

 

The group is already assigned to the _group1 variable. If you need this variable to be global so that it is usable in your next trigger, simply remove the underscore before "group1". Keep in mind, however, that if you run this spawn code more than once, only the last spawned group will be "group1".

 

You should use an array to spawn and handle multiple groups

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×