Jump to content
Sign in to follow this  
BullyBoii

How to add unit into players group

Recommended Posts

hi guys, ive just been playng around with the editor again, and i waswondering how you can add units into

the players group. Obviously ths can be done, like in Warfare.

i have been unable to do this so far, i have tried creating a group and then seting a "join" waypoint to the player, however im an unsure of how you synch scripted waypoints, which is where i fell down.

any help is appreciated

Adam

Share this post


Link to post
Share on other sites

this group is spawned in with a script. Ill post the script below.

_dir = getdir player;
_sideHQ = createcenter west;
_group = creategroup west;
_group = [getpos player, WEST ,["B_soldier_SL_F", "B_soldier_GL_F", "B_Medic_F"], [],[],[],[],[], _dir] call BIS_fnc_spawnGroup;
_wp1 = _group addwaypoint [position player ,0];
_wp1 setwaypointtype "JOIN";

hope thats enoguh info for you guys

Share this post


Link to post
Share on other sites

You're looking for the following commands:

join

joinSilent (units won't report themselves through radio upon joining)

Share this post


Link to post
Share on other sites
You're looking for the following commands:

join

joinSilent (units won't report themselves through radio upon joining)

no way, its that easy, i must have missed that command, goddam, so annoying when ive been spending ages trying to figure out a work around :)

thanks very much

Share this post


Link to post
Share on other sites

Sometimes the easiest way is to simply search for a specific term related to what you want (e.g., join, damage, velocity, ...) in the scripting command list ;)

Share this post


Link to post
Share on other sites

i do have another question, i didnt want create another thread but i getting a problem. If the members of my group are killed i would like to spawn new ones

this is the code i am using that detects the number of units alive in my group, ive set it so that if the number reaches 1 (i.e. only theplayer is alive) a hint will appear.

however after playing the game and loosing all the units the hint does not appear. I have checked that the number returned is one using hint format, and the returned

value is in fact one, however the hint does not appear, there are no scripting errors, so im a bit confused, have i done this right??

// request_group.sqf

//removes action
_actTar = _this select 0;
_actcal = _this select 1;
_actID = _this select 2;
_actArg = _this select 3;

_actCal removeAction _actID;

_actCal = _player;

_dir = getdir player;
_sideHQ = createcenter west;
_group = creategroup west;
_group = [getpos player, WEST ,["B_soldier_SL_F", "B_soldier_GL_F", "B_Medic_F"], [],[],[],[],[], _dir] call BIS_fnc_spawnGroup;

_groupunits = units _group;
_groupunits join (group player);
hint format ["Units:%1, have been added to your group", _groupunits];

//number of units alive in group
aliveUnits = {alive _x} count units group player;

waitUntil {aliveUnits == 1};
hint "We can fly reinforcements to your position";


thanks for all the help so far

Edited by BullyBoii
New topic

Share this post


Link to post
Share on other sites

That's because the line :

aliveUnits = {alive _x} count units group player;

is only executed once, so aliveunits value never changes.

Use :

waitUntil {{alive _x} count units group player == 1};

instead, as the condition is checked every frame.

Share this post


Link to post
Share on other sites

thanks, im having a bit of a dull moment, probably should get some sleep, ive been working on this mission for too long :)

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  

×