IRONFRONT FANS FORUM
Register Latest Topics
 
 
 


Reply
  Author   Comment  
Tayuk

Avatar / Picture

Admin
Registered:
Posts: 455
Reply with quote  #1 
Download: Ammobox on Parachute

Place an ammobox in the editor and name it ammo1

Then if using an addaction on a player, put this in the players init line
Code:
act = this addAction ["Ammodrop", "ammodrop1.sqf"];


That calls this script called "ammodrop1.sqf" (LIB_BasicWeaponsBox_US is the class name of the box you placed in the editor, change it to suit the one you want).
This code creates the ammobox on the end of a parachute at a height of 350m above the player, it falls to the ground, then the editor created ammobox called ammo1 is moved to the location of the created box, just before the created box is deleted. (I did it this way because the original created ammobox was always locked when dropped and I can have a custom loadout on the box thats moved).

Code:
_box = ammo1;

_veh = createVehicle ["parachutewest", position player, [], 0, "FLY"];

_veh setposATL [getPosATL player select 0, getPosATL player select 1, 350];

_veh setVehicleInit "parachute1 = this"; processInitCommands;

_ammobox = "LIB_BasicWeaponsBox_US" createVehicle [0, 0, 0];

_ammobox setPos [(getpos _veh select 0), (getPos _veh select 1)-10, (getPos _veh select 2)-10];

_ammobox attachto [parachute1, [0, 0, 0]];

sleep 0.5;

waitUntil {(getPos _ammobox select 2) < 1};

detach _ammobox;

_box setpos [(getpos _ammobox select 0), (getpos _ammobox select 1), 0];

deleteVehicle _ammobox;

"SmokeShellGreen" createVehicle getPos _box;



To have a cutom loadout on the box I use this method.

Ammo box placed in the editor has this in its init

Code:
nul = [this] execVM "ammoboxUS.sqf";


Which applies this script to it (which in this case gives me all the US weapons and the ammo, just change class names to suit you)

 

Code:

_box = _this select 0;

_amountWeapon = 2;

_amountAmmo = 20;

_refreshTime = 600; // refill every 10 minutes

_box allowDamage false;

// Loop forever

while {alive _box} do

{

// Clear box

clearWeaponCargo _box;

clearMagazineCargo _box;

// Fill box

// German Weapons

_box addWeaponCargo ["LIB_M1_Garand", _amountWeapon];

_box addWeaponCargo ["LIB_M1_Carbine", _amountWeapon];

_box addWeaponCargo ["LIB_M1903A4_Springfield", _amountWeapon];

_box addWeaponCargo ["LIB_M1A1_Thompson", _amountWeapon];

_box addWeaponCargo ["LIB_M1918A2_BAR", _amountWeapon];

_box addWeaponCargo ["LIB_M1A1_Bazooka",_amountWeapon];

_box addWeaponCargo ["LIB_Colt_M1911", _amountWeapon];

_box addWeaponCargo ["LIB_FLARE_PISTOL", _amountWeapon];

//Ammo

_box addMagazineCargo ["LIB_8Rnd_762x63", _amountAmmo];

_box addMagazineCargo ["LIB_15Rnd_762x33", _amountAmmo];

_box addMagazineCargo ["LIB_5Rnd_762x63", _amountAmmo];

_box addMagazineCargo ["LIB_30Rnd_45ACP", _amountAmmo];

_box addMagazineCargo ["LIB_20Rnd_762x63", _amountAmmo];

_box addMagazineCargo ["LIB_1Rnd_60mm_M6", _amountAmmo];

_box addMagazineCargo ["LIB_1Rnd_flare_yellow", _amountAmmo];

_box addMagazineCargo ["LIB_1Rnd_flare_green", _amountAmmo];

_box addMagazineCargo ["LIB_1Rnd_flare_red", _amountAmmo];

_box addMagazineCargo ["LIB_1Rnd_flare_white", _amountAmmo];

_box addMagazineCargo ["LIB_7Rnd_45ACP", _amountAmmo];

//Other items

_box addWeaponCargo ["LIB_Binocular_SU", 12];

_box addWeaponCargo ["LIB_w", 12];

_box addMagazineCargo ["LIB_Ladung_PM_MINE_mag", _amountAmmo];

_box addMagazineCargo ["LIB_Ladung_Small_MINE_mag", _amountAmmo];

_box addMagazineCargo ["LIB_Ladung_Big_MINE_mag", _amountAmmo];

_box addMagazineCargo ["LIB_PM_Provod_100", _amountAmmo];

_box addMagazineCargo ["LIB_TMI_42_MINE_mag", _amountAmmo];

_box addMagazineCargo ["LIB_US_Mk_2", _amountAmmo];

_box addMagazineCargo ["LIB_US_M18_Red", _amountAmmo];

_box addMagazineCargo ["LIB_US_M18_Green", _amountAmmo];

_box addMagazineCargo ["LIB_US_M18_Yellow", _amountAmmo];

_box addMagazineCargo ["LIB_US_M18", _amountAmmo];

_box addMagazineCargo ["PIPEBOMB", _amountAmmo];

// Wait the duration of the timer

sleep _refreshTime;

};

 
0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #2 
Hi there tay-uk,
please bear with me,i like the sound of the ammo box on a parachute but where does one write the code you gave.I have never done this before and and am really in the dark..
thanks
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,733
Reply with quote  #3 
You will have to edit the player unit and then in the initialization box put the code.
__________________
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,733
Reply with quote  #4 
Tay is this your script or did some else create it?
I want to know who to give credits to when i host it.

edit........

Script is now hosted on the MR, comes with readme, first post has been updated with link to download.

__________________
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,733
Reply with quote  #5 
Anyway we can add a timer to the script so that you cant call it constantly, maybe give it a 5 min delay and then have a hint popup that will say
you can call for ammo in another 5 min or something?

__________________
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.