Jump to content
Sign in to follow this  
VonNexus

Spawning weapons on the ground

Recommended Posts

Hi,

I searched on the forums and on the internet and found several codes. However, I'm still not able to spawn weapons on the ground like is seen in the ARMEX (ArmA II Operation Arrowhead ). Basically, I want a weapon (M16A4 and several mags) to be spawned on a table. createVehicle doesn't do the trick. I think the weapon is spawned underground or isn't spawned. ANy helps?

Share this post


Link to post
Share on other sites

Place a game logic and name it AKM and put this in it's init field.

AKM = "WeaponHolder" createVehicle getPos this; AKM addWeaponCargo ["AK_47_M",1]; AKM setPos [getPos this select 0,getPos this select 1,0.78]; AKM addMagazineCargo ["30Rnd_762x39_AK47",2]; AKM SETDIR 90

That will give you a floating AK-47 0.78 Meters of the floor with 2 magazines.

Now you need to place a table under your game logic for the ak47 to look like it's on the table.

Depending on the height of the table, adjust the height of the spawned AK47.

The AKM SETDIR 90 means the AK will be placed at that amount of angle, change according to your needs.

Edited by Koni

Share this post


Link to post
Share on other sites

Uhm, could you correct this one? I followed your indications, but changed the weapon's name. Check this out, the error shown says that "30Rnd_556x45_Stanag" mags cannot be found.

m16a4 = "WeaponHolder" createVehicle getPos this; m16a4 addWeaponCargo ["30Rnd_556x45_Stanag",1]; m16a4 setPos [getPos this select 0,getPos this select 1,0.78]; m16a4 SETDIR 80

Share this post


Link to post
Share on other sites
Uhm, could you correct this one? I followed your indications, but changed the weapon's name. Check this out, the error shown says that "30Rnd_556x45_Stanag" mags cannot be found.

Firstly you didn't add the actual weapon, secondly you tried adding the magazines using the addweapon command...

Compare mine to yours and you'll see where you went wrong.

m16a4 = "WeaponHolder" createVehicle getPos this; 

m16a4 addWeaponCargo ["M16A4",1]; 

m16a4 addMagazineCargo ["30Rnd_556x45_Stanag",2]; 

m16a4 setPos [getPos this select 0,getPos this select 1,0.78]; 

m16a4 SETDIR 80 

EDIT: Left magazines as AK, ON THIS REPLY, changed to M16

Edited by Koni

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  

×