Jump to content
Sign in to follow this  
jakerod

Make units playable/respawnable midgame

Recommended Posts

I've been adding a script into the init.sqf lately that allows my brother and I to recruit friendly soldiers into our squads mid-mission. We use respawn as team (4) in the mission and the problem that we're having is that the guys who join our squad cannot act as "additional respawns" unless they were previously playable. Making every friendly unit on the map playable causes the player select menu to be quite cluttered and is also time consuming. I tried adding setPlayable and addSwitchableUnit but they don't seem to work. Both wiki pages suggest that they're broken but they haven't been modified in a long time either so maybe they're out of date.  So I'm looking for some way to meet the following requirements:

  • New units, that were originally non-playable, will allow us to respawn into them
  • Must work in MultiPlayer

 

This is the script that I am currently using:

if (alive player) then {
	{
		if ((side _x) == independent) then {
			_x addAction ["Recruit",{[(_this select 0)] join (group (_this select 1)); (_this select 0) setCaptive false; setPlayable (_this select 0); addSwitchableUnit (_this select 0); dostop (_this select 0)}, [], -1, false, true, "", "_this distance _target < 7 && !(_this in units group _target) && (alive _target)"];
			_x addAction ["Remove",{[(_this select 0)] join grpNull;}, [], -1, false, true, "", "_this distance _target < 7 && (_this in units group _target) && !(isPlayer _target) && (alive target)"];
			};
	} forEach allUnits;
}; 

Thanks for your help!

  • Like 1

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  

×