Icaruk 14 Posted January 16, 2014 Hi, i'm working on a script to spawn different type of loot: { _mkrcolor = getmarkercolor _x; switch (_mkrcolor) do { //normal loot case "ColorBlack" : { _armaN = ["arifle_Katiba_C_F", "arifle_Katiba_C_F", "arifle_Katiba_C_ACO_F", "arifle_Katiba_GL_F"] call BIS_fnc_selectRandom; _arma1 = createVehicle ["groundweaponHolder",getMarkerPos _x,[], 0, "can_collide"]; _arma1 addweaponcargo [_armaN,1]; }; //normal ammo case "ColorWhite" : { _ammoN = ["30Rnd_65x39_caseless_green", "30Rnd_65x39_caseless_green", "30Rnd_65x39_caseless_green", "6Rnd_45ACP_Cylinder", "6Rnd_45ACP_Cylinder"] call BIS_fnc_selectRandom; _ammo1 = createVehicle ["groundweaponHolder",getMarkerPos _x,[], 0, "can_collide"]; _ammo1 addmagazinecargo [_ammoN,2]; }; //military loot case "ColorRed" : { _armaM = ["srifle_DMR_01_F"] call BIS_fnc_selectRandom; _arma2 = createVehicle ["groundweaponHolder",getMarkerPos _x,[], 0, "can_collide"]; _arma2 addweaponcargo [_armaM,1]; }; //military ammo case "ColorOrange" : { _ammoM = ["10Rnd_762x51_Mag"] call BIS_fnc_selectRandom; _ammo2 = createVehicle ["groundweaponHolder",getMarkerPos _x,[], 0, "can_collide"]; _ammo2 addmagazinecargo [_ammoM,2]; }; };} foreach allmapmarkers; It works good on the ground, but when I try to spawn something inside a house, it goes UNDER the house :/ Any thought? Share this post Link to post Share on other sites
das attorney 857 Posted January 16, 2014 Find the buildings positions and spawn the loot into them. http://community.bistudio.com/wiki/BIS_fnc_buildingPositions _array = [nearestBuilding player] call BIS_fnc_buildingPositions; { _ammo2 = createVehicle ["groundweaponHolder", _x, [], 0, "can_collide"]; _ammo2 addmagazinecargo ["10Rnd_762x51_Mag",2]; } forEach _array; Just a basic example there. Not tested but should put you on the right track. Share this post Link to post Share on other sites
Icaruk 14 Posted January 16, 2014 Find the buildings positions and spawn the loot into them.http://community.bistudio.com/wiki/BIS_fnc_buildingPositions _array = [nearestBuilding player] call BIS_fnc_buildingPositions; { _ammo2 = createVehicle ["groundweaponHolder", _x, [], 0, "can_collide"]; _ammo2 addmagazinecargo ["10Rnd_762x51_Mag",2]; } forEach _array; Just a basic example there. Not tested but should put you on the right track. My plan is to put a bunch of markers on the map, so if I put a marker inside a building, the loot doesn't spawns under it. So I can't use [nearestBuilding player] because the script will be launched just one time for all the map loot. Share this post Link to post Share on other sites
fight9 14 Posted January 16, 2014 Use a differ color and switch for buildings. Share this post Link to post Share on other sites
das attorney 857 Posted January 16, 2014 Well if you don't want to use nearestBuilding <object> or nearestObject <to your marker> filtered by class then you could spawn it say 1m in the air over your marker and use a while{condition} do loop checking the height with lineIntersects and move it down a little bit if there is no intersection. I've used that for a couple of scripts and it works well. It's really up to you though. Share this post Link to post Share on other sites
Icaruk 14 Posted January 16, 2014 Well if you don't want to use nearestBuilding <object> or nearestObject <to your marker> filtered by class then you could spawn it say 1m in the air over your marker and use a while{condition} do loop checking the height with lineIntersects and move it down a little bit if there is no intersection. I've used that for a couple of scripts and it works well.It's really up to you though. Can you give me some examples please? Share this post Link to post Share on other sites