Jump to content
Sign in to follow this  
--Scorpion--

Putting guns on the wall

Recommended Posts

I know how to put them on a table but I can't find a way to put them on the wall, they're always on the wrong side with the barrel facing the ground using SetVectorUp command.

So anyone know how to do this ?

Share this post


Link to post
Share on other sites

Ok here's what I've so far using the command weaponHolder and SetVectorUp.

The gun on the table is working great

arma2oa2012-11-3016-13-30-65.jpg

#1st Guns
M16A2 = "weaponholder" createVehicle getpos Desk;

M16A2 addMagazineCargo ["30Rnd_556x45_Stanag",2];

M16A2 addWeaponCargo ["M16A2",1]; 

M16A2 setpos [getPos Desk select 0,getPos Desk select 1,0.88];

exit

But the gun on the wall is not working so great

arma2oa2012-11-3016-08-45-28.jpg

#1st Guns
M16A2 = "weaponholder" createVehicle getpos Desk;

M16A2 addMagazineCargo ["30Rnd_556x45_Stanag",2];

M16A2 addWeaponCargo ["M16A2",1]; 

M16A2 setpos [getPos Desk select 0,getPos Desk select 1,0.88];

M16A2 setVectorUp [180, 0, 0]

exit

As you can see the gun barrel is facing the ground and I want it to face the container door so anyone who know how to flip the gun in the right direction. I'm not familiar with these command so maybe I missing something here. It's really frustrating that I can't find the solution for that when I'm so close.

Any help will be really appreciated.

Share this post


Link to post
Share on other sites

There is a great object called Library_WeaponHolder which does exactly what you need without any vectorups.

Share this post


Link to post
Share on other sites
There is a great object called Library_WeaponHolder which does exactly what you need without any vectorups.

Where I can find this object ? It's a BIS object coming with the game or a community made addon ?

Share this post


Link to post
Share on other sites

Its a stock BIS object.

_wepholder = createVehicle ["Library_WeaponHolder", getpos Desk, [], 0, "CAN_COLLIDE"]; 
_wepholder addWeaponCargo ["M16A2",1];

The only problem is that you are unable to access it as player, it only lets you use objects for showcase purposes. Having standard weapon holder on wall wouldn't be great idea too since ammo and other objects that can be put into it will look like glued to the wall.

Edited by SaMatra

Share this post


Link to post
Share on other sites
The only problem is that you are unable to access it as player, it only lets you use objects for showcase purposes. Having standard weapon holder on wall wouldn't be great idea too since ammo and other objects that can be put into it will look like glued to the wall.

Well I'll have to forget the Library_WeaponHolder object then since I want the player to be able to take the weapon from the wall. About the ammo glued to the wall, I know it look weird and I was thinking about removing them and put them in a ammo box or use a script giving the player the ammo when he take the gun.

Share this post


Link to post
Share on other sites

Looks like addAction doesn't show up action for WeaponHolder and Library one. Anyway, here is how to properly rotate the WeaponHolder (You need BIS functions module on map):

[wh, 90, 270] call BIS_fnc_setPitchBank;

wh is your Weaponholder

270 is azimuth you will want to change to align it to your wall

Share this post


Link to post
Share on other sites

Here's how the final product look like

arma2oa2012-12-0115-44-59-82.jpg

#Gun01
wh01 = "weaponholder" createVehicle getpos Desk;

wh01 addWeaponCargo ["M16A4",1]; 

wh01 setpos [(getPos Desk select 0)-0.34,(getPos Desk select 1)-1.25,1.25];

[wh01, 90, 90] call BIS_fnc_setPitchBank;

exit

As you can see I decided to put ammo box inside instead of using a script, so far everything is working just fine. The only bug that I've found is that if you put the gun back on the wall while having ammo, it put the ammunition on the wall with the gun and that look really weird. The only way for that not happening is to put all your ammunition in the ammo box before putting the gun back on the wall. It's not perfect but it work.

Share this post


Link to post
Share on other sites

You can try to make a loop that will check if ammo was put into these weapon holder and if it is then it creates new weapon holder on the ground and puts magazines there (like ammo sack fell on the ground). The only problem is that since you can't get\set exact amount of ammo into mags players might be able to exploit it and refill their mags. Like if they will put M16 mag with 1 bullet script will remove it and create new one on the ground which will have 30 bullets by default.

Also if you want to have reusable weaponholder there is WeaponHolder_MPA object which doesn't delete itself when empty unlike stock WeaponHolder.

Share this post


Link to post
Share on other sites
You can try to make a loop that will check if ammo was put into these weapon holder and if it is then it creates new weapon holder on the ground and puts magazines there (like ammo sack fell on the ground). The only problem is that since you can't get\set exact amount of ammo into mags players might be able to exploit it and refill their mags. Like if they will put M16 mag with 1 bullet script will remove it and create new one on the ground which will have 30 bullets by default.

Also if you want to have reusable weaponholder there is WeaponHolder_MPA object which doesn't delete itself when empty unlike stock WeaponHolder.

The thing is I really hate these huge bag for each mag that it create, I'll not mind so much if it was the actual weapon mag but these bag look ugly.

About the script, I was thinking using this solution to give the player the right ammunition for the gun he took but then I thought the player will always have pre-defined loadout and not what he really want. So even if I'll use a script for this, I'll probably need to put ammo box inside anyway just to be sure the player can have the loadout he want and I was starting to have a headache just thinking about how it'll complicate thing for nothing. I know it's far away to be perfect but it's simple and easy to use. I can imagine that it'll not work that great in MP but it's to be used only in SP mission anyway.

Thanks again SaMatra, your help is really appreciated.

Share this post


Link to post
Share on other sites

Btw, CCP project was included in last beta (not fully yet) which will mean that 1.63 will have proper models for most mags.

My idea involves ammo boxes on the ground, its just a way to handle situations when players will start putting their ammo into weaponholders on walls, script will just remove them from there and put on the ground.

Share this post


Link to post
Share on other sites

Your idea sound pretty interesting but how you'll script something like that ?

What's the CCP project you're talking about ? Are you talking about the Arma 2 CCP project ? I like the idea of having real model for the mag instead of these bags and I presume that by 1.63, you mean the official 1.63 patch right ?

P.S. Check your PM inbox, I'll send you one soon about something else.

Share this post


Link to post
Share on other sites

Yes, official 1.63 should include CCP in stock game which includes mags models instead of bags.

How to code it? Well if you could post your code that generates your armory (places guns on walls) then i'll try to help you.

Share this post


Link to post
Share on other sites

Possible it could be realized here?! Some fixes of this project are already in the latest beta version...

Share this post


Link to post
Share on other sites
How to code it? Well if you could post your code that generates your armory (places guns on walls) then i'll try to help you.

Here's the entire code I'm using to place guns on the wall

#Gun01
wh01 = "weaponholder" createVehicle getpos Desk;

wh01 addWeaponCargo ["M16A4",1]; 

wh01 setpos [(getPos Desk select 0)-0.34,(getPos Desk select 1)-1.25,1.25];

[wh01, 90, 90] call BIS_fnc_setPitchBank;


#Gun02
wh02 = "weaponholder" createVehicle getpos Desk;

wh02 addWeaponCargo ["G36K",1]; 

wh02 setpos [(getPos Desk select 0)-0.34,(getPos Desk select 1)-3,1.25];

[wh02, 90, 90] call BIS_fnc_setPitchBank;


#Gun03
wh03 = "weaponholder" createVehicle getpos Desk;

wh03 addWeaponCargo ["DMR",1]; 

wh03 setpos [(getPos Desk select 0)-0.33,(getPos Desk select 1)-4.5,1.25];

[wh03, 90, 90] call BIS_fnc_setPitchBank;


#Gun04
wh04 = "weaponholder" createVehicle getpos Desk;

wh04 addWeaponCargo ["M4A1_aim",1]; 

wh04 setpos [(getPos Desk select 0)-0.34,(getPos Desk select 1)-1.25,0.75];

[wh04, 90, 90] call BIS_fnc_setPitchBank;


#Gun05
wh05 = "weaponholder" createVehicle getpos Desk;

wh05 addWeaponCargo ["M249",1]; 

wh05 setpos [(getPos Desk select 0)-0.34,(getPos Desk select 1)-3,0.75];

[wh05, 90, 90] call BIS_fnc_setPitchBank;


#Gun06
wh06 = "weaponholder" createVehicle getpos Desk;

wh06 addWeaponCargo ["M4SPR",1]; 

wh06 setpos [(getPos Desk select 0)-0.33,(getPos Desk select 1)-4.5,0.75];

[wh06, 90, 90] call BIS_fnc_setPitchBank;


#Gun07
wh07 = "weaponholder" createVehicle getpos Desk;

wh07 addWeaponCargo ["M1014",1]; 

wh07 setpos [(getPos Desk select 0)-0.34,(getPos Desk select 1)-1.25,0.25];

[wh07, 90, 90] call BIS_fnc_setPitchBank;


#Gun08
wh08 = "weaponholder" createVehicle getpos Desk;

wh08 addWeaponCargo ["G36_c_SD_eotech",1]; 

wh08 setpos [(getPos Desk select 0)-0.34,(getPos Desk select 1)-3,0.25];

[wh08, 90, 90] call BIS_fnc_setPitchBank;


#Gun09
wh09 = "weaponholder" createVehicle getpos Desk;

wh09 addWeaponCargo ["SMAW",1]; 

wh09 setpos [(getPos Desk select 0)-0.28,(getPos Desk select 1)-4.5,0.25];

[wh09, 90, 90] call BIS_fnc_setPitchBank;


#Gun10
wh10 = "weaponholder" createVehicle getpos Desk;

wh10 addWeaponCargo ["AKS_74_kobra",1]; 

wh10 setpos [(getPos Desk select 0)+0.51,(getPos Desk select 1)-1,1.25];

[wh10, 90, 270] call BIS_fnc_setPitchBank;


#Gun11
wh11 = "weaponholder" createVehicle getpos Desk;

wh11 addWeaponCargo ["AK_107_kobra",1]; 

wh11 setpos [(getPos Desk select 0)+0.51,(getPos Desk select 1)-2.75,1.25];

[wh11, 90, 270] call BIS_fnc_setPitchBank;


#Gun12
wh12 = "weaponholder" createVehicle getpos Desk;

wh12 addWeaponCargo ["SVD",1]; 

wh12 setpos [(getPos Desk select 0)+0.51,(getPos Desk select 1)-4.25,1.25];

[wh12, 90, 270] call BIS_fnc_setPitchBank;


#Gun13
wh13 = "weaponholder" createVehicle getpos Desk;

wh13 addWeaponCargo ["AKS_74_UN_kobra",1]; 

wh13 setpos [(getPos Desk select 0)+0.51,(getPos Desk select 1)-1,0.75];

[wh13, 90, 270] call BIS_fnc_setPitchBank;


#Gun14
wh14 = "weaponholder" createVehicle getpos Desk;

wh14 addWeaponCargo ["PK",1]; 

wh14 setpos [(getPos Desk select 0)+0.47,(getPos Desk select 1)-2.7,0.75];

[wh14, 90, 270] call BIS_fnc_setPitchBank;


#Gun15
wh15 = "weaponholder" createVehicle getpos Desk;

wh15 addWeaponCargo ["VSS_Vintorez",1]; 

wh15 setpos [(getPos Desk select 0)+0.51,(getPos Desk select 1)-4.25,0.75];

[wh15, 90, 270] call BIS_fnc_setPitchBank;


#Gun16
wh16 = "weaponholder" createVehicle getpos Desk;

wh16 addWeaponCargo ["Bizon_silenced",1]; 

wh16 setpos [(getPos Desk select 0)+0.51,(getPos Desk select 1)-1,0.25];

[wh16, 90, 270] call BIS_fnc_setPitchBank;


#Gun17
wh17 = "weaponholder" createVehicle getpos Desk;

wh17 addWeaponCargo ["Saiga12K",1]; 

wh17 setpos [(getPos Desk select 0)+0.51,(getPos Desk select 1)-2.75,0.25];

[wh17, 90, 270] call BIS_fnc_setPitchBank;


#Gun18
wh18 = "weaponholder" createVehicle getpos Desk;

wh18 addWeaponCargo ["RPG7V",1]; 

wh18 setpos [(getPos Desk select 0)+0.45,(getPos Desk select 1)-4.25,0.25];

[wh18, 90, 270] call BIS_fnc_setPitchBank;


######################################################################################################

#Gun19
wh19 = "weaponholder" createVehicle getpos Desk;

wh19 addWeaponCargo ["M9SD",1]; 

wh19 setpos [(getPos Desk select 0)-0.75,(getPos Desk select 1)-0.2,1.2];

[wh19, 90, 0] call BIS_fnc_setPitchBank;


#Gun20
wh20 = "weaponholder" createVehicle getpos Desk;

wh20 addWeaponCargo ["M9",1]; 

wh20 setpos [(getPos Desk select 0)-0.35,(getPos Desk select 1)-0.2,1.2];

[wh20, 90, 0] call BIS_fnc_setPitchBank;


#Gun21
wh21 = "weaponholder" createVehicle getpos Desk;

wh21 addWeaponCargo ["colt1911",1]; 

wh21 setpos [(getPos Desk select 0)-0.75,(getPos Desk select 1)-0.2,0.85];

[wh21, 90, 0] call BIS_fnc_setPitchBank;


#Gun22
wh22 = "weaponholder" createVehicle getpos Desk;

wh22 addWeaponCargo ["glock17_ep1",1]; 

wh22 setpos [(getPos Desk select 0)-0.35,(getPos Desk select 1)-0.2,0.85];

[wh22, 90, 0] call BIS_fnc_setPitchBank;


#Gun23
wh23 = "weaponholder" createVehicle getpos Desk;

wh23 addWeaponCargo ["UZI_SD_ep1",1]; 

wh23 setpos [(getPos Desk select 0)+0.35,(getPos Desk select 1)-0.2,1.2];

[wh23, 90, 0] call BIS_fnc_setPitchBank;


#Gun24
wh24 = "weaponholder" createVehicle getpos Desk;

wh24 addWeaponCargo ["UZI_ep1",1]; 

wh24 setpos [(getPos Desk select 0)+0.75,(getPos Desk select 1)-0.2,1.2];

[wh24, 90, 0] call BIS_fnc_setPitchBank;


#Gun25
wh25 = "weaponholder" createVehicle getpos Desk;

wh25 addWeaponCargo ["MakarovSD",1]; 

wh25 setpos [(getPos Desk select 0)+0.35,(getPos Desk select 1)-0.2,0.85];

[wh25, 90, 0] call BIS_fnc_setPitchBank;


#Gun26
wh26 = "weaponholder" createVehicle getpos Desk;

wh26 addWeaponCargo ["Makarov",1]; 

wh26 setpos [(getPos Desk select 0)+0.75,(getPos Desk select 1)-0.2,0.85];

[wh26, 90, 0] call BIS_fnc_setPitchBank;


#Gun27
wh27 = "weaponholder" createVehicle getpos Desk;

wh27 addWeaponCargo ["Revolver_ep1",1]; 

wh27 setpos [(getPos Desk select 0)-0.55,(getPos Desk select 1)-0.2,0.4];

[wh27, 90, 0] call BIS_fnc_setPitchBank;


#Gun28
wh28 = "weaponholder" createVehicle getpos Desk;

wh28 addWeaponCargo ["Sa61_ep1",1]; 

wh28 setpos [(getPos Desk select 0)+0.55,(getPos Desk select 1)-0.2,0.4];

[wh28, 90, 0] call BIS_fnc_setPitchBank;

exit

I've named the ammo boxes USbox and RUbox.

I could upload the mission template too if you prefer, that way you could see how I've done it.

Share this post


Link to post
Share on other sites

Ok I've tested it and everything is working as you said.

The only problem I've found is that it put the gun under the player's feet too loosing one of the weapon holder in the process. Did you think it'll be possible to place the gun back on the wall and have only the ammo being spawn under the player's feet ? I ask because after changing your weapon a few times, you find yourself with a bunch of weapons on the ground with almost no more weapon holder on the wall.

BTW you really did a great job, you're like a magicman with script.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×