Author: mcFlaw
Author Website: http://www.taw.net/

Requirements: No addons required

Version: 1.0

Short description: Adds extra ammo for a vehicle mounted weapon into a virtual "cargo", presumably the trunk, the passanger area, around the gunners legs or what have you.

Date: 2014-02-25 10:11


Comments: (0)
Rating:



 

Flaw's Reload From Cargo script

by
mcFlaw


Description:
Adds extra ammo for a vehicle mounted weapon into a virtual "cargo", presumably the trunk, the passanger area, around the gunners legs or what have you. This cargo can be searched through to see if there are any extra magazines and if so, add one to the weapon.


Features:
* Mission makers can initialize any vehicle with extra ammo in a virtual cargo space
* Gunners can search through said cargo space for the ammo they need
* If ammo is found, it's added to their gun's inventory
* If no ammo is found, the action is removed and the gunner has wasted his time. Better keep count next time!
* Any compatible ammo for a gun can be stored, allowing for the technical to carry the 500 round AA magazines for instance.


Installation / Usage:
For users:
Anyone manning a gun with extra ammo in the virtual cargo will have an Action Menu item for each magazine type. These let's the gunner search for resp. ammo type in the cargo and add it to his gun. The action is removed when none is found.

For mission creators:
Add the following line to init.sqf for every weapon on every vehicle that should have ammo in the "cargo":
[<vehicle>,<position>,<turretpath>,<weapon>,<magazines>] execVM <path/to/this/script>;
<vehicle>: [STRING] Name of the vehicle
<position>: [STRING] Name of the seat ("Gunner", "Driver" etc)
<turretpath>: [ARRAY] Array-path to the turret gun is in. This can be tricky to find out, but its a branching tree path. Main turret is [0] (first turret on main body). A commander HMG is [0][0] (first turret on the first turret), Smokelaunchers are [0][1] (second turret on the first turret) and so forth.
<weapon>: [STRING] Class name of the weapon (ex: "HMG_M2")
<magazines>: [ARRAY] Array of number of magazines for each compatible magazine type for the weapon. Check "CfgWeapons >> <weapon> >> magazines" for list of compatible magazines. (Ex: [2,1] would add 2 magazines of the first compatible type, 1 of the second and none of the rest in that list)
<path/to/this/script> [STRING] Mission file relative path to wherever you've placed this script file. (ex: "scripts/FLAW_reloadfromcargo.sqf")

Full example:
Add 2 Green and 1 Yellow Tracer cartridge for the .50cal on a Technical named 'v':
[v,"gunner",[0],"HMG_M2",[0,0,2,1]] execVM "scripts\FLAW_reloadfromcargo.sqf";


Future plans:
Possible future features (if I ever get around to improving this):
* Ability to add more ammo from ammo boxes and trucks
* Max size for virtual storage
* Ability to put ammo back into storage from the gun, and move ammo between vehicles
* Ability for gunner to take stocks on current supplies in virtual cargo


Credits & Thanks:
Big thanks to all the great people in MISDEV, ArmA2 Divison of The Art of Warfare (www.taw.net)!
Would've taken me ages to figure this out without your help. :D
Sincerely,
mcFlaw


Changelog:
v1.0
- first release


Forum topic:
- Armaholic forums




Enable javascript to be able to download from Armaholic please!



Tags: Cargo,   Mounted,   Rearm,   Reload