twisted 127 Posted July 29, 2012 (edited) i am trying to spawn weapons indoors at random positions inside, thereby giving players incentive to perform a house to house searches. however i am finding it bloody tricky. i can get smokegrenades spawning indoors. but the weaponholders seem to have invisible borders i keep running into and getting injured/dying on. even worse, somehow the weapons spawned in the weapon holders get pushed outside the building. probably due to the invisble size of weaponholder. its happens on all buildings from hangars to firestations to enterable houses. can someone please advise on how to get weapons to spawn indoors. SOLVED>>> Needed to move the weaponholder a little off the floor. thanks to this post i get answer.. http://forum.armedassault.info/index.php?showtopic=4422 Edited July 29, 2012 by twisted Share this post Link to post Share on other sites
twisted 127 Posted August 1, 2012 (edited) Sorry for double post but i have a related questiion. do the different buildings have different floor heights? barns higher than hangars? etc reason i ask is that setting the weaponholder a bit higher doesnt always seem to be enough, but setting it too high makes the damn weapons float in space. also, i die a lot from the invisible boundary of the weapon holder? that seems mad but i can run into it at full speed and i die. how to turn the invisible box around weapon holders off? the code i am using... // inspiration taken from Tophe's random house patrol script // and very very useful help from Zonekiller sleep 0.5; if (!isServer) exitWith {}; private ["_Position1"]; // introduce random chance _Position1 = _this select 0; _position = getPos _Position1; _house = nearestBuilding _Position1; _x = 0; _notbugged = true; while { format ["%1", _house buildingPos _x] != "[0,0,0]" } do {_x = _x + 1}; _x = _x - 1; _Position1 setPos (_house buildingPos (random _x)); if ((getPos _Position1 select 0 == 0) and (getPos _Position1 select 1 == 0)) then {_Position1 setPos _position; _notbugged = false; _Position1 globalChat format ["Choose a different building"]; Smoke3 = "SmokeshellGreen" createVehicle getPos _Position1; }; _chance = floor (random 10); if (_chance <=7) then { //Smoke1 = "Smokeshell" createVehicle getPos _Position1; _arrayw = ["LeeEnfield","AK_47_M","SVD_des_EP1","RPG7V","Huntingrifle"]; _arraya = ["10x_303","30Rnd_762x39_AK47","10Rnd_762x54_SVD","PG7VR","5x_22_LR_17_HMR"]; _randnum = floor (random (count _arrayw)); _WeaponH = _arrayw select _randnum; _ammoH = _arraya select _randnum; _randammo = ceil (random 6); Weapon1 = "weaponHolder" createVehicle getpos _Position1 ;Weapon1 addWeaponCargo [_WeaponH,1]; Weapon1 addMagazineCargo [_ammoH,_randammo]; _tempos = getPos Weapon1; Weapon1 setposATL[(getPosATL _Position1 select 0),(getPosATL _Position1 select 1), 0.05]; }; if (_chance >7 ) then { Smoke1 = "SmokeshellRed" createVehicle getPos _Position1; }; // called with _nil = [this] execVM "randammoinbuilding.sqf" Edited August 1, 2012 by twisted Share this post Link to post Share on other sites
samatra 85 Posted August 1, 2012 (edited) You should know the difference between setPos, setPosATL and setPosASL, since you use ATL this will mean that any invisible ground elevation under building will move your weaponholder position accordingly, i would recommend you to spawn weaponholders relative to building position\elevation, not relative to terrain level. Also I would recommend you to use createVehicle array instead of old deprecated way of creating vehicles you use right now, to be more specific you might want to experiment with different "special" parameters of newly created vehicle (Should be CAN_COLLIDE i think). Also take a look at http://community.bistudio.com/wiki/modelToWorld and http://community.bistudio.com/wiki/worldToModel, this might help you creating predefined spots for weapon holders for each building class. Edit: Here is my loot position generation mission I used for myself, basically it creates loot spots relative to building and dumps them into ArmA2OA.RPT (delete "# and #" in dump to get array of loot positions), scripts are bit messy but maybe you will find it useful. Edited August 1, 2012 by SaMatra Share this post Link to post Share on other sites
twisted 127 Posted August 2, 2012 You should know the difference between setPos, setPosATL and setPosASL, since you use ATL this will mean that any invisible ground elevation under building will move your weaponholder position accordingly, i would recommend you to spawn weaponholders relative to building position\elevation, not relative to terrain level. Also I would recommend you to use createVehicle array instead of old deprecated way of creating vehicles you use right now, to be more specific you might want to experiment with different "special" parameters of newly created vehicle (Should be CAN_COLLIDE i think). Also take a look at http://community.bistudio.com/wiki/modelToWorld and http://community.bistudio.com/wiki/worldToModel, this might help you creating predefined spots for weapon holders for each building class.Edit: Here is my loot position generation mission I used for myself, basically it creates loot spots relative to building and dumps them into ArmA2OA.RPT (delete "# and #" in dump to get array of loot positions), scripts are bit messy but maybe you will find it useful. thanks. i tried createvhecile as an array Weapon1 = createVehicle ["weaponHolder", [(getPos _Position1 select 0),(getPos _Position1 select 1), 0.01], [], 0, "CAN_COLLIDE"]; //"weaponHolder" createVehicle getpos _Position1 ; Weapon1 addWeaponCargo [_WeaponH,1]; Weapon1 addMagazineCargo [_ammoH,_randammo]; still keep getting the same issues. actually i die more often now from running into invisible boubding boxes. I tried changin Can _collide to NONe but same problem. i am still learning this stuff. Share this post Link to post Share on other sites
f2k sel 164 Posted August 2, 2012 For the height issue I'd spawn a man at the location the use setpos to place him. Then move the weapon holder to the man as he will always find the floor level something like this _s1 = "USMC_Soldier_Pilot" createVehicle getpos Weapon1; // create fake unit _s1 setpos getpos _position1; // set him at building pos _s1 setvelocity [0,0,5]; // in case he spawns a little high let him fall (may not be needed) sleep 2; // allow time to fall to the floor (again may not be needed) Weapon1 setpos (_s1 modeltoworld [0,0,0]); //place weapons at his feet. deletevehicle _s1; // remove soldier hopefully with the weapons on the ground collision won't be an issue, I've not noticed it. Share this post Link to post Share on other sites
twisted 127 Posted August 4, 2012 For the height issue I'd spawn a man at the location the use setpos to place him.Then move the weapon holder to the man as he will always find the floor level something like this _s1 = "USMC_Soldier_Pilot" createVehicle getpos Weapon1; // create fake unit _s1 setpos getpos _position1; // set him at building pos _s1 setvelocity [0,0,5]; // in case he spawns a little high let him fall (may not be needed) sleep 2; // allow time to fall to the floor (again may not be needed) Weapon1 setpos (_s1 modeltoworld [0,0,0]); //place weapons at his feet. deletevehicle _s1; // remove soldier hopefully with the weapons on the ground collision won't be an issue, I've not noticed it. thanks! that's an intersting solution. i'll try it out. Share this post Link to post Share on other sites