Search the Community
Showing results for tags 'disablecollisionwith'.
Found 1 result
-
Command in nested loops - wrong result
pierremgi posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, I'm in trouble with what I guessed a simple code but my double loop doesn't work. Aim: make all foot units and land vehicles without collision. Don't crush any body. To start, i did it simple: SP context. Repeatable simple scenario: On map: a Hunter player, 1 or 2 empty Hunter. (or any vehicle you want). 3 civilians. I run this simple code: 0 = [] spawn { result = []; { _veh = _x; { _unit = _x; _veh disableCollisionWith _unit; result pushBack [_veh,_unit]; } forEach (allUnits select {isNull objectParent _x}); } forEach (vehicles select {_x isKindOf "landVehicle" && !(_x isKindOf "WeaponHolderSimulated")}); hint str result; }; I obtain the hint for every couple (vehicle,civilian) but the weird thing is: - only one vehicle is fully collision disabled with the whole civilians; (last loop checked I guess) - the other vehicles are collision disabled with the last civilian (last checked probably), but not with the other ones. I did a full day of tests, coming from MP environment, as it was supposed to loop for spawned units. then simplify everything up to this basic test. Testing further, for variables: 0 = [] spawn { result1 = []; result2 = []; private ["_veh","_unit"]; // doesn't make any difference { _veh = _x; { _unit = _x; [_veh,_unit] spawn { params ["_car","_man"]; _car disableCollisionWith _man; result1 pushBack [_car,_man]; }; result2 pushback [_veh,_unit]; } forEach (allUnits select {isNull objectParent _x}); } forEach (vehicles select {_x isKindOf "landVehicle" && !(_x isKindOf "WeaponHolderSimulated")}); hint (str result1 + str result2); }; Now, my results are: - result1 = []; - result2 is a consistent array of couple (vehicle,unit)!!! Any idea? Thanks