Forum Jump :

Author Message


Posts: 4
Rank:


Level: Member

Country: uk
Location: United Kingdom
Occupation: Creator of RGO
Age:
In-game name:

 
#1 Posted at 2013-03-11 21:52        
     
Okay so this has been bothering me for quite some time now. Essentially, all I want to have is one script that is executed via an action menu on an ammo box. All this script / action does is this:

Scroll and click on "Rifleman" or "Medic" or "Anti-Tank", then the script gives you the preset loadout chosen by the mission maker (me).

Now, this is easily done by using multiple scripts but that is too easy and slow, right?

What I want, is one script with different sections. For instance, if you select "Rifleman" on the ammo box, it will execute the script, and ONLY run the rifleman section of the script.

Here is what I have in the init field of the ammo box:
rifle = this addAction ["Rifleman","scripts\LoadoutPreset.sqf"]; medic = this addAction ["Medic","scripts\LoadoutPreset.sqf"];

Here is what is inside "LoadoutPreset.sqf":
_box = _this select 0;
_unit = _this select 1;

////////////////////////////////////////////////////////////////////

//Rifleman
if (rifle == true) then
{
	_rifle = "arifle_MX_ACO_point_gripod_mzls_F";
	_pistol = "hgun_P07_snds_F";
	_rmags = "30Rnd_65x39_caseless_mag";
	_pmags = "16Rnd_9x21_Mag";
	_nades = "HandGrenade";
	_smokes = "SmokeShell";
	_charges = "DemoCharge_Remote_Mag";
	_meds = "FirstAidKit";

	removeAllWeapons _unit;

	_unit addWeapon _rifle;
	_unit addWeapon _pistol;
	{_unit addMagazine _rmags} forEach [1,2,3,4,5,6];
	{_unit addMagazine _pmags} forEach [1,2,3,4];
	{_unit addMagazine _nades} forEach [1,2];
	{_unit addMagazine _smokes} forEach [1,2];
	{_unit addMagazine _charges} forEach [1];
	{_unit addItem _meds} forEach [1,2,3];
};

///////////////////////////////////////////////////////////////////

//Medic
if (medic == true) then {
_pistol = "hgun_P07_snds_F";
_pmags = "16Rnd_9x21_Mag";
_nades = "HandGrenade";
_smokes = "SmokeShell";
_charges = "DemoCharge_Remote_Mag";
_meds = "FirstAidKit";

removeAllWeapons _unit;

_unit addWeapon _pistol;
{_unit addMagazine _pmags} forEach [1,2,3,4];
{_unit addMagazine _nades} forEach [1,2];
{_unit addMagazine _smokes} forEach [1,2];
{_unit addMagazine _charges} forEach [1];
{_unit addItem _meds} forEach [1,2,3];
};

//////////////////////////////////////////////////////////////////

Oh yeah, currently it is not working... If anyone can help me or at least send me in the direction of a command I will be very grateful.

Regards,

JKingsley


Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location: California
Occupation: US Air Force
Age: 22
In-game name: [WD]Elvis

 
#2 Posted at 2013-03-11 22:10        
     
oh god i cant wait to use this XD THANK YOU


Advertisement


Author Message


Posts: 4
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2013-03-12 03:26        
     
Hope this one helps you, it's not quite in 1 file, but it is nice and neat in its own folder.

Paste the following into an object you wish to have the options on.
null = [this] execVM "LoadoutPresets\ActionAdd.sqf";

If you wish to change the colour of the action you can by changing the following Hexcolour in the 'ActionAdd.sqf'
_ActionObject addAction ["<t color='#FFFFFF'>" + "Rifleman" + "</t>","LoadoutPresets\PresetLoader.sqf",("rifleman")];

To add more actions and loadouts, simply make a new entry in the ActionAdd.sqf
_ActionObject addAction ["<t color='#FFFFFF'>" + "NEW ENTRY" + "</t>","LoadoutPresets\PresetLoader.sqf",("NEW_ENTRY")];

and then one in the PresetLoader.sqf
case "NEW_ENTRY":
	{
		null = [_player] execVM "LoadoutPresets\Gear\NEW_ENTRY.sqf";
	};

Just copy and paste and then rename one of the two in the gear folder to your new preset and there you have it! All done and working.

Feel free to use this as you wish, expand, change, whatever.. this is the cut down simplified version of the one I use, with the exception of your variables in the gear.sqf. Works on dedicated servers and has caused no known problems before (been using it for around 5-6 months)

http://www.gamefront.com/files/23064089/LoadoutPreset.Stratis.rar Download

Mirrors welcomed!

Enjoy!

David

This post was edited by Foxhound (2013-09-19 17:44, ago)


Author Message


Posts: 1
Rank:


Level: Member

Country: se
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2013-09-19 17:41        
     
Bumping!

Anyone who got a script like this somewhere laying around?