Results 1 to 6 of 6

Thread: weaponholder pushes weapons outside building

  1. #1

    weaponholder pushes weapons outside building

    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
    Last edited by twisted; Jul 29 2012 at 14:05.

  2. #2
    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...

    Code:
    // 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"
    Last edited by twisted; Aug 1 2012 at 14:31.

  3. #3
    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.
    Last edited by SaMatra; Aug 1 2012 at 20:01.

  4. #4
    Quote Originally Posted by SaMatra View Post
    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

    Code:
    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.

  5. #5
    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

    PHP Code:
    _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.

  6. #6
    Quote Originally Posted by F2k Sel View Post
    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

    PHP Code:
    _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.

Similar Threads

  1. Building that Sells Units and Weapons/Ammo
    By kikkoman808 in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Mar 20 2010, 17:16
  2. WeaponHolder help (sort of)
    By Mitch in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 4
    Last Post: Jan 25 2010, 03:52
  3. Weaponholder issue
    By Dan ick(uk) in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Dec 30 2007, 15:02
  4. new WeaponHolder class
    By 5133p39 in forum OFP : CONFIGS & SCRIPTING
    Replies: 3
    Last Post: Jan 27 2006, 07:12
  5. Replies: 11
    Last Post: Jul 2 2002, 21:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •