twisted 127 Posted September 22, 2013 (edited) strange thing this. when i try select 0 from an vehcile created by BIS_fnc_spawnVehicle i get a group not the vechile itself. its me stuffing ity up, but hell knows how. these are code snipps but should give a workign example: _veh_array = ["O_MBT_02_arty_F", "O_APC_Tracked_02_cannon_F", "O_APC_Wheeled_02_rcws_F", "O_MBT_02_cannon_F", "O_APC_Tracked_02_AA_F","O_Truck_02_Ammo_F", "O_Truck_02_fuel_F","O_Truck_02_medical_F", "O_Truck_02_box_F","O_MRAP_02_F", "O_MRAP_02_gmg_F", "O_MRAP_02_hmg_F", "O_Truck_02_transport_F", "O_Truck_02_covered_F","O_APC_Wheeled_02_rcws_F"]; _spawnvehicle1 = _veh_array select 9; // choose type of car. will be ultimetley randomised _spawnvehicle2 = _veh_array select 11; // choose type of car _spawnvehicle3 = _veh_array select 11; // choose type of car _spawnvehicleVIP = _veh_array select 10; // choose type of car _start = _this select 0; _startingpos = getpos _start; _radius = 3000; _veharray = [ _spawnvehicle1, _spawnvehicle2, _spawnvehicle3, _spawnvehicleVIP ]; // note the forum ruins the text here but it is not typed wrong. i triple checked _aigroup = createGroup east; _vehcs = []; //_spawnedvehicles = []; { private ["_p","_target"]; _p = [ _startingpos , 30 + ceil ( random 60) ,random 270] call BIS_fnc_relPos; _target = [_p , random 360, _x, _aigroup] call bis_fnc_spawnvehicle; _targetvec = _target select 0; _targetcrew = _target select 1; _targetgroup = _target select 2; hint format["_targetvec is %1" , _targetvec]; diag_log format["_targetvec is %1" , _targetvec]; sleep 0.2; _vehcs = _vehcs + [_targetvec]; //_spawnedvehicles set [count _spawnedvehicles, _targetvec]; // try another way for future. } foreach _veharray; // now see whats in the array { hint format["_vehcs is %1" , _x]; diag_log format["_vehcs is %1" , _x]; } foreach _vehcs; and this returns: "_vehcs is O Alpha 1-2:1" "_vehcs is O Alpha 1-2:3" "_vehcs is O Alpha 1-2:5" "_vehcs is O Alpha 1-2:7" :butbut: what am i doing wrong here? Edited September 22, 2013 by twisted Share this post Link to post Share on other sites
kylania 567 Posted September 22, 2013 (edited) That's returning correctly, it's returning the driver for each vehicle but if you follow that code up with a: {_x setDamage 1} forEach _vehcs; and you'll have 4 big explosions on your hand and not just 4 dead drivers. You can test it by telling the drivers to get out. At that point your vehcs select 0 would be the p3d of the ifrit. But once you put the driver back in it returns as the driver object again. The array of vechs however is the array of the vehicle objects. Edited September 22, 2013 by kylania Share this post Link to post Share on other sites
twisted 127 Posted September 22, 2013 (edited) That's returning correctly, it's returning the driver for each vehicle but if you follow that code up with a: {_x setDamage 1} forEach _vehcs; and you'll have 4 big explosions on your hand and not just 4 dead drivers. You can test it by telling the drivers to get out. At that point your vehcs select 0 would be the p3d of the ifrit. But once you put the driver back in it returns as the driver object again. The array of vechs however is the array of the vehicle objects. thanks again for the answer. if it is right, how would i tell a unit to get in one of the vechiles if i am unable to access its name? EDIT - damn i should read more. answer plain as can be : Object = vehicle unitName Edited September 22, 2013 by twisted Share this post Link to post Share on other sites