BullyBoii 10 Posted April 15, 2013 hi im struggling with spawning in units via a script and then automatically placing those units inside a house here is my code _group1 = [getmarkerpos "opfor_spawn_3", EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call bis_fnc_spawnGroup; {_x setpos (nearestBuilding _x buildingPos random 5);} forEach unit _group1; i cant see to get the desired effect, which is hindering gameplay, please can you offer some advice. thanks Share this post Link to post Share on other sites
Champy_UK 1 Posted April 15, 2013 You could try this........ http://www.armaholic.com/page.php?id=19833 I havent tried it but looks interesting Share this post Link to post Share on other sites
BullyBoii 10 Posted April 15, 2013 You could try this........http://www.armaholic.com/page.php?id=19833 I havent tried it but looks interesting thanks, i managed to get it working, turned out i forgot to include 1 line of code thanks for the help and that link is a help ful utility :) Share this post Link to post Share on other sites
mikie boy 18 Posted April 15, 2013 just remember there may not be 5 positions in a particular house - you should count the positions in the house then randomly select that. example code of how i spawn a cache inside a randomly selected house for [Fock]ers Cache Hunt, I then randomly select the position - i also u this for AI to search houses for the. _Weapcrates = createVehicle ["Land_HelipadEmpty_F", [((getmarkerpos "middle") select 0) + _dx, ((getmarkerpos "middle") select 1) + _dy, 0], [], 0, "None"]; house = nearestBuilding _Weapcrates; // hint format ["house= %1", house]; if (Damage house > 0.1) then {house setdamage 0;}; m=0; while { format ["%1", (house) buildingPos m] != "[0,0,0]" } do {m=m+1}; m=m-1; sleep 0.05; _total = m; _sum = random _total; private ["_boxpos"]; if (_sum <0) then { _boxpos = 0; } else { _boxpos = ceil _sum; }; // hint format ["box pos %1", _boxpos]; sleep 0.5; //create ammo box and move caches = createVehicle ["Box_NATO_Wps_F", getmarkerpos "WeaponsInit", [], 0, "None"]; removeAllWeapons caches; caches setPosATL (house buildingPos _boxpos); _newboxpos = getposATL caches; Share this post Link to post Share on other sites