Author: ProfCupcake
Author Website:

Requirements: No addons required

Version: 1.2

Short description: A simple vehicle resupply script which has customisable resupply amount and resupply time.

Date: 2013-10-28 22:16


Comments: (0)
Rating:



 





Dead Simple Vehicle Resupply Script

by
ProfCupcake


Description:
A simple vehicle resupply script which has customisable resupply amount and resupply time.


Installation / Usage:
Put the 'scripts' folder in your mission folder.

For the action version:
Pick an object, and put the following in the 'init' field:
this addAction ["Resupply", "scripts\resupplyAction.sqf", [5,1], 50, true, true, "", "vehicle _this isKindOf 'LandVehicle'"];
Note that "scripts\resupply.sqf" can be changed to wherever you put the script, the two numbers in the array directly after that correspond to the maximum time it takes for each part of the resupply, and how much it will be resupplied to (e.g. a second value there of 0.5 will only resupply the vehicle to half its total values).

Also, if you use the exact code as above, it will only work for land vehicles. If you want it to work for air or sea vehicles, replace 'LandVehicle' with either 'Air' or 'Sea'.

For the trigger version:
Place a trigger, and set it up however you want it to be. Call the script with the following:
nul = [unit to affect, time, amount] execVM "scripts\resupplyTrigger.sqf";
Where 'unit to affect' is the player unit (NOT the vehicle itself), and 'time' and 'amount' correspond to the same time and amount values as above.

WARNING: This has only been tested in single-player, and will likely not work in multiplayer. I strongly recommend you use the action for multiplayer missions.

I would also recommend having something like this in the trigger's conditions:
(vehicle (unit to affect) != (unit to affect))

To make sure the unit actually has a vehicle to resupply.


Notes:
The trigger version was not tested in multiplayer, and in all likelihood will not work in multiplayer. I do not recommend using it in multiplayer.


Credits & Thanks:
With credit to Hypnomatic, for solving a problem


Changelog:
v1.2
- A whole bunch of fixes that I can't remember (there was so much going wrong, I'm amazed I ever uploaded the previous version).
- User input is now disabled while resupplying, and the engine forced off.

v1.1
- Added the 'trigger' version, as mentioned above.
- Added a sample mission, which should hopefully explain how to use it a bit better than my rubbish text file.


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Resupply,   Vehicle