Jump to content
Percipio

Loadout script - Add gear to All units on server

Recommended Posts

HI All,

I have a quick question.

Everyone (players and AI) in Chernarus knows that there is going to be a big fight but ALiVE mod only gives AI units one bandage and one morphine each.

So, I want to add a loadout.sqf to my mission file.

The purpose of the loadout is to add 4x basic bandages and 4x morphine syringes to all units spawning (ALIVE mod) all factions only at the beginning of the scenario.


My loadout.sqf looks like this:

forEach allUnits;
{_x for "_i" from 1 to 4 do addItemToUniform "ACE_fieldDressing";};


{_x for "_i" from 1 to 4 do addItemToUniform "ACE_morphine";};

 

 

Added:

call compile preprocessFileLineNumbers "loadout.sqf"; 

to init.sqf

 

I could be barking up the wrong tree but I have not written a script before and perhaps could use some help for this one.

I am using latest version of ACE3 and ALiVE mods among others.


Please help  with this loadout.sqf script.

Thanks

 

 

Share this post


Link to post
Share on other sites

Hi All,

 

Thanks xjoker_ for your reply and your script.

 

So if I wanted to do say Bandage x5 and Morphine x2,

 

Would the script look like this...

 

 {

for "_i" from 1 to 5

do { _x addItemToUniform "ACE_fieldDressing"};

for "_i" from 1 to 2 

do { _x addItemToUniform "ACE_morphine"; };

} foreach allUnits;

 

 

Thanks

 

 

 

Share this post


Link to post
Share on other sites

if you want to add more items later, you can do that 

_loadout = [
	["ACE_fieldDressing",5],
	["ACE_morphine",2]
];

{
	_unit = _x;
	{
		for "_i" from 1 to (_x select 1) do {
			_unit addItemToUniform (_x select 0);
		};
	} foreach _loadout;
} foreach allUnits;

 

Share this post


Link to post
Share on other sites

Hi All,

 

On 1/12/2018 at 5:06 AM, xjoker_ said:

if you want to add more items later, you can do that 


_loadout = [
	["ACE_fieldDressing",5],
	["ACE_morphine",2]
];

{
	_unit = _x;
	{
		for "_i" from 1 to (_x select 1) do {
			_unit addItemToUniform (_x select 0);
		};
	} foreach _loadout;
} foreach allUnits;

 

I didn't understand this script, then I had a scotch and ginger ale and it all became clear:don11:.

Thanks again.

 

 

  • Haha 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×