Jump to content
Sign in to follow this  
h a w a i i a n

looking for a specific config template

Recommended Posts

Aloha, I was hoping someone can kindly share a config on how to randomize vests, uniforms (full,half sleeved,t-shirt), and helmets in a config for just one "Rifleman" unit. I'll be dissecting configs and trying my hand at doing this myself, but in the mean time I was hoping if someone out there has one he/shes willing to share. It would help me "kill" some time in the process of making my addon.

EDIT: Nevermind, I found the motivation to actually make this happen. I'll share with you what I implemented/taken and edited from another addon makers config.

1.First make an SQF file and name it whatever you like (example: myunits_random_gear)

2.add this to your sqf

/*
   File: randomize_equipment.sqf
   Author: pettka, modified for a different purpose by "ante"


Description:

Randomizes a headgear form _headgear array and puts it to civilian's headgear slot upon startup of mission.

_rnd1 is used to have some civilians without any headgear

_rnd2 is used to determine particular headgear from array


   Parameter(s):
   None

   Returns:
   Nothing
*/


_uniform = ["nameofyour_uniform","nameofyour_uniform1","nameofyour_uniform2","etc"];

_headgear = ["nameofyourhelmet","nameofyourhelmet1","nameofyourhelmet2","etc"]; <<if you would like a unit without a helmet, you would have to put "", just quotations.

_vest = ["nameofyour_PlateCarrier","nameofyour_PlateCarrier1","nameofyour_PlateCarrier2","etc"];

_headCount = count _headgear;

_uniformCount = count _uniform;

_vestCount = count _vest;

if (isServer) then {
   BIS_randomSeed1 = [];

BIS_randomSeed2 = [];

_rnd1 = floor random _uniformCount;    

_this setVariable ["BIS_randomSeed1", _rnd1, TRUE];

_rnd2 = floor random _headCount;

_this setVariable ["BIS_randomSeed2", _rnd2, TRUE];
};


waitUntil {!(isNil {_this getVariable "BIS_randomSeed1"})};

waitUntil {!(isNil {_this getVariable "BIS_randomSeed2"})};

_randomSeed1 = _this getVariable "BIS_randomSeed1";

_randomSeed2 = _this getVariable "BIS_randomSeed2";


_magazines = magazines _this;

_items = items _this; 
// Medkits, ToolKits etc.
_assitems = assignedItems _this; 
// NVG's, GPS etc.

if (true) then {
   Removeuniform _this;

Removeheadgear _this;
   _this adduniform (_uniform select _randomSeed1);

_this addheadgear (_headgear select _randomSeed2);

_this addvest (_vest select (((_randomSeed1 + _randomSeed2) % (_vestCount - 1)) * (floor random _vestCount) % (_vestCount + 1 )));
};


{_this addItem _x} forEach _items;

{_this addMagazine _x} forEach _magazines;

{_this addItem _x} forEach _assitems;

{_this assignItem _x} forEach _assitems;


if (0.5 > _randomSeed1 / _headCount) then {

_this addmagazine ("9Rnd_45ACP_Mag");

_this addweapon ("hgun_ACPC2_F");

_this addmagazine ("9Rnd_45ACP_Mag");

_this addmagazine ("9Rnd_45ACP_Mag");

_this addmagazine ("9Rnd_45ACP_Mag");
};

3.put that file in the folder your addon is (sameplace you have your config for your entire addon)

4.than open your config and add below whatever unit/vehicle class you want randomized gear on and add this

		class EventHandlers {
		init = "(_this select 0) execVM '\your_addon_folder\myunits_random_gear.sqf";
	};
};

and that's it I guess, works like a charm. If you get errors, pm me and I'll help because at first I had errors after packing the addon, pm me if you need help and I'll explain how I fixed this. This is not my script, I pretty much stole it and made it mine!!!!(well for my addon mainly lol) Anyway give credits to these homies, Author: pettka, modified for a different purpose by "ante" and check out "Redhawk Inc. - Mercs" by ZiR where I found this gem.

Edited by Hawaii_Based

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
Sign in to follow this  

×