Jump to content
  • 0

Custom vehicles - removing ammo same as new patch.


GingerNinja

Question

hey guys,

on my server i'm running a few extra vehicles like the BTR-40 "BTR40_MG_TK_GUE_EP1"...
Is there a way to have its ammo removed the same as all the other standard vehicles in epoch?
I cant just let people still have this vehicle if its going to spawn in with ammo every restart, and i kind of dont want to just remove the vehicle.

there has to be some sort of simple script i can use to reset ammo / spawn vehicles with out ammo...

Cheers,
Ginger

Link to comment
Share on other sites

Recommended Posts

  • 0

You'll need to iterate over the vehicles turrets and use removeMagazinesTurret to clear the ammo:

http://community.bistudio.com/wiki/removeMagazinesTurret

 

You can use magazinesTurret to determine the magazine names for specific turrets:

http://community.bistudio.com/wiki/magazinesTurret

 

Plenty of examples out there, can probably create an array of vehicle names to strip ammo from and check/process this as they are spawned by the server. I'll be working on something similar over the weekend, as I wish to add Jackal/BTR-40 DKSHM back to my server.

Link to comment
Share on other sites

  • 0

shizweak,
Cheers for your response. 
I'm guessing your the owner of the other Aussie Taviana Server??
(only guessing because i saw it a few days ago as Shizweak Taviana epoch.)

I'm not totally down with scripting, but I'm doing fine so far being the first Australian Taviana epoch to launch and Running Multiple Scripts LOL! but...
Is this similar to how people talk about removing the Weapons and Ammo from vehicles using the server_monitor.sqf in the server.pbo?
If so, i was reading alot of talk about that method and it seemed if you removed the ammo from a vehicle that was taking away the "slot" to load ammo in. so it couldn't hold ammo. (if you know what i mean. I will play with this over next couple of days.
If i find anything i'll post back here.
Cheers,
Ginger

Link to comment
Share on other sites

  • 0

shizweak,

Cheers for your response. 

I'm guessing your the owner of the other Aussie Taviana Server??

(only guessing because i saw it a few days ago as Shizweak Taviana epoch.)

I'm not totally down with scripting, but I'm doing fine so far being the first Australian Taviana epoch to launch and Running Multiple Scripts LOL! but...

Is this similar to how people talk about removing the Weapons and Ammo from vehicles using the server_monitor.sqf in the server.pbo?

If so, i was reading alot of talk about that method and it seemed if you removed the ammo from a vehicle that was taking away the "slot" to load ammo in. so it couldn't hold ammo. (if you know what i mean. I will play with this over next couple of days.

If i find anything i'll post back here.

Cheers,

Ginger

 

 

Yep that's me, had a Taviana server running for a bit - going to convert it over to Lingor shortly though, the main server is still running Chernarus.

 

 

EDIT: REMOVED CODE, complete instructions incoming below.

Link to comment
Share on other sites

  • 0

OK, had a chance to test it, it appears the above solution does work - removes all ammo from all guns on a vehicle.

 

EDIT: Oops, as someone gracefully reminded me - we also need to strip ammo from dynamically spawned vehicles:

 

 

Firstly, in your mission file, lets create an array of vehicles we want to strip ammo from - this way we can always just edit the mission file if we decide to add new armed vehicles. Inside init.sqf, simply add a new variable called "DZE_StripAmmo" near the others at the top of the file, e.g. here is what I have (not the full file, just the custom variables):

dayz_fullMoonNights = true;
DZE_BuildingLimit = 500;
DZE_StripAmmo = ["BAF_Jackal2_L2A1_D", "HMMWV_MK19", "HMMWV_Armored", "HMMWV_M2", "BRDM2_HQ_Gue", "BTR40_MG_TK_INS_EP1"];

You may add any armed vehicle to this array, to have it's weapons stripped of ammo.

 

 

 

Secondly, you want to edit the dayz_server code (extract the pbo), and jump into dayz_server/init/server_functions.sqf, and around line 260 we have the following:

_veh = createVehicle [_vehicle, _position, [], 0, "CAN_COLLIDE"];

Update this, to include the ammo removal:

_veh = createVehicle [_vehicle, _position, [], 0, "CAN_COLLIDE"];
if(_vehicle in DZE_StripAmmo) then { _veh setVehicleAmmo 0 }; 
Done, save the file.
 

 

 

And finally, you want to edit the server monitor which is in dayz_server/system/server_monitor.sqf - open up the file and jump down to around line 130, we have:

_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];

Update this to also include the ammo removal:

_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
if(_type in DZE_StripAmmo) then { _object setVehicleAmmo 0 };

Save the file, repack your server pbo, and your mission file if you choose to pack it - and give it a run!

 

You can find the class names for vehicles from A2 AND A2:OA here:

http://community.bistudio.com/wiki/ArmA_2:_Vehicles

http://community.bistudio.com/wiki/ArmA_2_OA:_Vehicles

Link to comment
Share on other sites

  • 0

Yep that's me, had a Taviana server running for a bit - going to convert it over to Lingor shortly though, the main server is still running Chernarus.

sad to see Your leaving the taviana map :\ now i only have Panda's server to compete with. haha but hopefully lingor works out nice for you mate. 

i'll be giving this ammo thing a shot once my little girls in bed. (Parenting sadly comes before gaming every time) :'(

Link to comment
Share on other sites

  • 0

cheers, mate. testing this now.

I wish i was that good with scripting to be able to do that. it looks so simple now i see it all written.

was it hard for you to work that out?

 

It's not too hard to figure it out, I've been playing around with the ARMA engine for a while now - but I come from a programming background too, which helps. Either way, there are plenty of resources to learn from - especially the BIS forums/wiki.

 

The code above need some more additions to make it complete too - I forgot about purchased vehicles (that's if you add your additional vehicles to the trader). Should be another one liner in the trade scripts somewhere - will update the post soon.

Link to comment
Share on other sites

  • 0

Awesome guys, I will be trying this soon too. One question though: with removing the ammo types that aren't already in as spawns, are we able to add those ammo types to the ammo type spawns in any way?

 

Say a box of hydras for example. Not that I really want players strafing stuff with hydras - but just used that as an example. I don't really want to remove ammo from certain vehicles if that ammo can't be re-stocked hehe. Even if I have to add it to vendors.

Link to comment
Share on other sites

  • 0

I tried this last night and it works great. Vehicles bought spawn with full ammo, but after restart thats reset. so i just set my prices higher for the vehicles so the player is paying for the ammo that it comes with. 

As for adding the ammo ingame, I'm currently testing this using the Epoch Event weapons crate. editing the weapons and adding vehicle ammo to them. this is seperate to the ammo crates that were added in 1.0.2.4 patch.

Link to comment
Share on other sites

  • 0

I tried this last night and it works great. Vehicles bought spawn with full ammo, but after restart thats reset. so i just set my prices higher for the vehicles so the player is paying for the ammo that it comes with. 

As for adding the ammo ingame, I'm currently testing this using the Epoch Event weapons crate. editing the weapons and adding vehicle ammo to them. this is seperate to the ammo crates that were added in 1.0.2.4 patch.

 

Excellent, glad it worked mate, in regards to purchased vehicles, in the server code simply update the compile/server_publishVehicle2.sqf script, so it looks like this:

if(DZE_TRADER_SPAWNMODE) then {
  _object_para = "ParachuteMediumWest" createVehicle [0,0,0];
  _object_para setpos [_location select 0, _location select 1,(_location select 2) + 65];
  _object = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
} else {
  _object = createVehicle [_class, _location, [], 0, "CAN_COLLIDE"];
};

if(_class in DZE_StripAmmo) then { _object setVehicleAmmo 0 };

Then your purchased vehicles with have no ammo too!

Link to comment
Share on other sites

  • 0

Excellent work. I'd thought this might work, but didn't want to bring down my server to test it. Also, as you said above, you can use removeMagazinesTurret to strip individual weapons for different vehicles. For example, I added the AH6J Little Bird and removed ammo from the Hydras (while leaving the flares and 4000rnd M134) by adding this after your DZE_StripAmmo line.

 

server_functions.sqf:

if(_vehicle == "AH6J_EP1") then {
	_veh removeMagazinesTurret ["14Rnd_FFAR",[-1]];
};

server_monitor.sqf:

if(_type == "AH6J_EP1") then {
	_object removeMagazinesTurret ["14Rnd_FFAR",[-1]];
};

server_publishVehicle2.sqf:

if(_class == "AH6J_EP1") then {
	_object removeMagazinesTurret ["14Rnd_FFAR",[-1]];
};
Link to comment
Share on other sites

  • 0

 

Excellent work. I'd thought this might work, but didn't want to bring down my server to test it. Also, as you said above, you can use removeMagazinesTurret to strip individual weapons for different vehicles. For example, I added the AH6J Little Bird and removed ammo from the Hydras (while leaving the flares and 4000rnd M134) by adding this after your DZE_StripAmmo line.

 

Awesome, you could probably just add the AH6J to the standard setup either way and remove all ammo, this will force people to actually re-ammo the M134 - and they won't be able to get flare or hydra ammo from anywhere, and neither are really necessary.

Link to comment
Share on other sites

  • 0

Awesome, you could probably just add the AH6J to the standard setup either way and remove all ammo, this will force people to actually re-ammo the M134 - and they won't be able to get flare or hydra ammo from anywhere, and neither are really necessary.

Unfortunately, I don't think the AH6J takes 2000rnd M134, only 4000rnd.

Link to comment
Share on other sites

  • 0
This is how I did it in server_monitor.sqf  they will not spawn with any ammo at restart
just under this part 
clearWeaponCargoGlobal  _object;
clearMagazineCargoGlobal  _object;
// _object setVehicleAmmo DZE_vehicleAmmo;
 
//BTR40_MG_TK_GUE_EP1 remove ammo
if (_object isKindOf "BTR40_MG_TK_GUE_EP1") then {
_object removeMagazine "50Rnd_127x107_DSHKM";
_object removeMagazine "50Rnd_127x107_DSHKM";
_object removeMagazine "50Rnd_127x107_DSHKM";
_object removeMagazine "50Rnd_127x107_DSHKM";
_object removeMagazine "50Rnd_127x107_DSHKM";
};
Link to comment
Share on other sites

  • 0

Anyone ever heard of opendayz.net? Good for many stuffs.

http://opendayz.net/threads/release-remove-weapons-ammunition-thermal-from-vehicle-epoch-version.18044/

 

Yes works just fine with 1.0.4

 

So with your script do I have to go and add each vehicle to the fnc_remWepSG.sqf ? I added your script and it's not removed ammo from the custom vehicles I have on my server.

Link to comment
Share on other sites

  • 0

... ay of course you have to add them... What dou you think was it going to do? Autodetect every non epoch and removed the things you want?

 

 

and you also have to get your weapon/ammo classnames for the things you want to remove and also the seat. it's not esay to use but it's working like a charm.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...