Tutorial- Remove weapons/Replace weapons on vehicles

Hi, there is setVehicleAmmo command, which can be used. Thats the only way i found to remove ammo from some vehicles.

//KA52
if (_object isKindOf "KA52") then {
_object setVehicleAmmo 0;
};
 
//KA52
if (_object isKindOf "KA52") then {
_object setVehicleAmmo 0;
};[/quote]


will re-arm stations refill the ammo ?
 
So I got this working. What I have noticed though is that it only affects vehicles that are in the hive at server start. Spawned in vehicles or ones purchased from traders do not lose the weapons till restart. Anyway to have the code run every time a vehicle spawns?
 
sounds like your running epoch.
spawned DZE vehicles shouldnt have any ammo
if you added regular armed vehicles to trader just charge alot more for them or im sure some1 knows a way.
in the mission.pbo init.sqf
DZE_vehicleAmmo = 1; //Default = 0, deletes ammo from vehicles with machine guns every restart if set to 0.
 
Yep i got a script Working just fine for random spawn+restart+trader spawned vehicles. i post the code in a tutorial when i got some spare minutes (busy atm fixing other errors)
 
I was wondering if there would be a way to remove ammo from armed vehicles like the salvage menu for removing vehicle parts? It's kind of a bummer in epoch to either spend gold buying ammo for them or spending time searching just to lose them at server restart. This way players could remove any leftover ammo saving it before restarts!
 
yeh the salvage vehicle thing is just a piece of code. the same can be done with removing ammo from vehicles. just more complex
1)get player cursor target
2) get cursortargets id number and type
3) if type is uh1h then ammo = m240, get the vehicles current ammo list
4) if cursor target is in remove ammo vehicle list and has ammo then addaction remove ammo
5) on action click page - remove menu, remove the mag from the vehicle
6) save vehicle so that it cant be exploited on server restarts
7) add mag to players inventory
8) call player sync

finding the commands can be done here (the above is just short hand)

http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2
 
I'm having a weir issue, I'm changing the AH6J and AN2 but they're spawning with ~600 boxes of ammo:

Code:
{
if (_object isKindOf "AN2_DZ") then {
_object addWeapon "TwinVickers";
_object addMagazine "500Rnd_TwinVickers";

};
if (_object isKindOf "AH6J_EP1") then {
                     _object removeWeapon "TwinM134";
                     _object removeWeapon "FFARLauncher_14";
                     _object removeWeapon "M134_2";
                     };
        
            if (_object isKindOf "AH6J_EP1") then {
                     _object addWeapon "PKT_veh";
                     _object addMagazine "2000Rnd_762x54_PKT";
                     };
 
i have tried everything, can not remove Hydra from AH64D. what is weird, once i enable manual fire, hydra isnt active. The minute i disable manual fire, Hydra's are back. Any thought?

//## AIR VEHICLES
//AH64D remove weapons
if (_object isKindOf "AH64D") then {
_object removeWeapon "FFARLauncher";
_object removeMagazine "38Rnd_FFAR";
_object removeMagazine "28Rnd_FFAR";
_object removeWeapon "FFARLauncher";
_object removeMagazine "38Rnd_FFAR";
_object removeMagazine "28Rnd_FFAR";
_object addWeapon "FlareLauncher";
_object addMagazine "FlareLauncherMag";
_object removeWeapon "HellfireLauncher";
_object removeMagazine "8Rnd_Hellfire";

};
 
I tried to add a gun to a motorbike. Its there with ammo, but I can't fire it.

any suggestions?
 
Still playing around with it, but there just doesn't seem to be a way to make the bike fire with a click of the left mouse. I could put a script on to fire the weapons, but....
 
Still playing around with it, but there just doesn't seem to be a way to make the bike fire with a click of the left mouse. I could put a script on to fire the weapons, but....
As i am currently in New Zealand i can't look into this problem on my own. But have you tried to bind the "Fire Key" to something else than LMB? Maybe that fixes it. I do rather think it has something to do with the car horn (or Motorbike horn in this case, should be the same classname though). Maybe removing it and then adding your weapon will fix it.
But as i said i can't really help you any further than this, bc i can't connect to a server from here and test stuff.
If you still have this problem in like 8 months i will be more than happy to help you :D.
 
i'll be patient.

I did remove the horn before adding the gun. its there, it ammo's up green.

What do you mean by bind the fire key to something else? just in the regular options of arma 2? I'll try that tomorrow.
 
i'll be patient.

I did remove the horn before adding the gun. its there, it ammo's up green.

What do you mean by bind the fire key to something else? just in the regular options of arma 2? I'll try that tomorrow.
Yep, for example I use the Razer Anansi back home and I bound the thumbkeys to the F-Keys, and so my primary FireButton is F6 if I don't remember it wrong.
 
Back
Top