Jump to content
Sign in to follow this  
jakkob4682

Help with dynamic object comps,module spawning and sync

Recommended Posts

this is the code I use to spawn, add magazines and synchronize the M119's in the composition with arty logic

private ["_magCount","_grp"];
_grp = _this select 0;
pos = _this select 1;

waitUntil {!isNil "BIS_Fnc_Init"};
artyGuns = nearestObjects [pos,["M119","M252"],500];
pos = [getPos leader _grp,random 50,random 360] call BIS_fnc_relPos;
artyGrp = createCenter sideLogic;
artyGrp = createGroup sideLogic;
artyVeh = artyGrp createUnit ["BIS_ARTY_LOGIC",getPos leader _grp,[],0,"NONE"];
artyPos = [getPosATL leader _grp,50,random 360] call BIS_fnc_relPos;
FireBase = [(pos), (getDir leader _grp), "FireBase1_US"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));
{
	if (typeOf _x == "M119") then {
		_magCount = count Magazines _x;
       };
   }forEach artyGuns;
for [{_magCount = 0},{_magCount < 2},{_magCount = _magCount + 1}] do {
       {artyVeh synchronizeObjectsAdd [_x]}forEach artyGuns;
        };
nul = [_grp,FireBase] call BIS_fnc_taskDefend;
player sideChat "Arty Ready";

I am using this little script for AI arty

while {alive player} do {
_tgt = objNull;
_tgts = player nearTargets 500;
{
	_pos = [];
	_type = _x select 1;
	_side = _x select 2;
	if (_side == east) then {
		_tgt = _x select 4;
		_pos = getPosATL _tgt;
		};
}forEach _tgts;

if (!isNull _tgt) then {
	[artyVeh,getPosATL _tgt,["Immediate","HE",1,2]] call BIS_ARTY_F_executeTemplateMission;
	waitUntil {artyVeh getVariable "ARTY_ONMISSION"};
	player sideChat format ["%1 FFE at:%2",artyVeh,getPosATL _tgt];
	player sideChat format ["%1",count synchronizedObjects artyVeh];
	player sideChat "Impact incoming";
	sleep 5;
	};
};

when i use the debug message for count synchronizedObjects it returns 0 though

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  

×