Jump to content
Sign in to follow this  
splatsh

Problem, they dont stand in formation

Recommended Posts

What is wrong here, I cant get them to be private with my code, and I cant get them to stand in formation.

Look here, here I did gave them one order "Formation Line".

arma22010060216041076.th.jpg

And here is my code that I am running with this:

["mas_usa_spec_at_w_hvy",1.0,"PRIVATE"] execVM "script\fncReinforce.sqf";

fncReinforce.sqf

// ["mas_usa_spec_at_w_hvy",1.0] execVM "script\fncReinforce.sqf";


private ["_unitType", "_unitSkill", "_unitRank", "_pos", "_dir", "_trg", "_airtype", "_pType", "_mygroup", "_Message", "_vehicle", "_unit", "_unit2"];

// Configuration
_unitType 	= _this select 0;
_unitSkill 	= _this select 1;
_unitRank 	= _this select 2;
_pos 		= getPos ASpad;
_dir 		= getPos ASpad;
_trg		= position player;
_airtype 	= "C130J";
_pType 	= "USMC_Soldier_Pilot";
_mygroup 	= creategroup side player;
_Message 	= "This is eagle two, we are inbound with your reinforce drop, please stand by...";



// Create plane
_vehicle = createVehicle [_airtype, _pos, [], 0, "FLY"];
//_vehicle setVehicleVarName "plane";
//plane = _vehicle;

// Create pilot
_unit = _mygroup createUnit [_pType, _pos, [], 0, "FLY"];
//_unit setVehicleVarName "pilot";
//pilot = _unit;
_unit moveinDriver _vehicle;
_unit flyinHeight 200;
_vehicle flyinHeight 200;

// Create soldier
_unit2 = _mygroup createUnit [_unitType, _pos, [], 0, "FORM"];
_unit2 setSkill _unitSkill;
_unit2 setRank _unitRank;
_unit2 moveInCargo [_vehicle, 0];


// make trigger to check plane
_trig = createTrigger["EmptyDetector",getPos player];
_trig setTriggerArea[0,0,0,false];
_trig setTriggerActivation["NONE","PRESENT",true];
_trig setTriggerStatements["(!alive plane)", "deletevehicle _trig;eject = false;deletevehicle _vehicle;deletevehicle _unit;", ""];



// fly to player
_wp10 = _mygroup addwaypoint[_trg,0];
_wp10 setWaypointSpeed "FULL";
_wp10 setwaypointtype "MOVE";
_wp10 setWaypointStatements ["true", "eject=true;"];
sleep 2;

// fly home	
_target22 = getPos ASpad;
_wp11 = _mygroup addwaypoint[_target22,0];
_wp11 setWaypointSpeed "NORMAL";
_wp11 setwaypointtype "MOVE";
_wp11 setWaypointStatements ["true", "deletevehicle _trig;eject = false;deletevehicle _vehicle;deletevehicle _unit;"];


// Eject soldier at player position
waitUntil{ eject };
	(driver _vehicle) sideChat _Message;
	unassignVehicle _unit2;
	_unit2 action ["EJECT", _vehicle];
	eject = false;
	[_unit2] join player;
	group player setGroupId["Alpha"];
	group player selectLeader player;
	leader group player == leader player;
	deletevehicle _trig;deletevehicle _vehicle;deletevehicle _unit; // For testing

So what is wrong?

Edited by splatsh

Share this post


Link to post
Share on other sites

Well, I'm not sure if the "formation" special actually places spawned units in their formation position. It might, but I never use createUnit so I don't know too much about it. I'd say this is most likely the reason.

But other things you can try are actually setting the group's formation. Again, since I never create/spawn groups/units in my missions I'm not terribly familiar with the behavour of it. But it seems possible that unless you actually set the group's formation (assuming that what I mentioned above actually does happen) prior to spawning the units, they won't be put in formation.

And if all else fails, you can just setPos them to their formation positions. You might be able to make use of formationPosition for this.

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  

×