Sign in to follow this  
[FR] zakhy

I am looking for a script for randomness

7 posts in this topic

If I understand your post, you are interested in random spawns?  Meaning when you die and respawn the player doesn't get to choose where they re-spawn in, it's a random choice made by the server?

If so, I haven't done it myself but found this on the forum that might help you;

 

  • Like 1

Share this post


Link to post
Share on other sites
Advertisement
Spoiler

//Random loadout by Pattoh
private ["_uniforms", "_headGear", "_pistols", "_vests", "_inventoryItems", "_backpacks", "_linkItems", "_howManyClips", "_addMagZ"];


_uniforms =  selectRandom  [
								"Exile_Uniform_Woodland",
								"U_C_Journalist",
								"U_C_Poloshirt_blue",
								"U_C_Poloshirt_burgundy",
								"U_C_Poloshirt_salmon",
								"U_C_Poloshirt_stripped",
								"U_C_Poloshirt_tricolour",
								"U_C_Poor_1",
								"U_C_Poor_2",
								"U_C_Poor_shorts_1",
								"U_C_Scientist",
								"U_OrestesBody",
								"U_Rangemaster",
								"U_NikosAgedBody",
								"U_NikosBody",
								"U_Competitor"
							];
				
_headGear =  selectRandom  [
								"Exile_Headgear_SantaHat",
								"Exile_Headgear_SafetyHelmet",
								"H_Cap_blk",
								"H_Cap_blk_Raven",
								"H_Cap_blu",
								"H_Cap_brn_SPECOPS",
								"H_Cap_grn",
								"H_Cap_headphones",
								"H_Cap_khaki_specops_UK",
								"H_Cap_oli",
								"H_Cap_press",
								"H_Cap_red",
								"H_Cap_tan",
								"H_Cap_tan_specops_US",
								"H_Watchcap_blk",
								"H_Watchcap_camo",
								"H_Watchcap_khk",
								"H_Watchcap_sgg",
								"H_MilCap_blue",
								"H_MilCap_dgtl",
								"H_MilCap_mcamo",
								"H_MilCap_ocamo",
								"H_MilCap_oucamo",
								"H_MilCap_rucamo",
								"H_Bandanna_camo",
								"H_Bandanna_cbr",
								"H_Bandanna_gry",
								"H_Bandanna_khk",
								"H_Bandanna_khk_hs",
								"H_Bandanna_mcamo",
								"H_Bandanna_sgg",
								"H_Bandanna_surfer",
								"H_Booniehat_dgtl",
								"H_Booniehat_dirty",
								"H_Booniehat_grn",
								"H_Booniehat_indp",
								"H_Booniehat_khk",
								"H_Booniehat_khk_hs",
								"H_Booniehat_mcamo",
								"H_Booniehat_tan",
								"H_Hat_blue",
								"H_Hat_brown",
								"H_Hat_camo",
								"H_Hat_checker",
								"H_Hat_grey",
								"H_Hat_tan",
								"H_StrawHat",
								"H_StrawHat_dark",
								"H_Beret_02",
								"H_Beret_blk",
								"H_Beret_blk_POLICE",
								"H_Beret_brn_SF",
								"H_Beret_Colonel",
								"H_Beret_grn",
								"H_Beret_grn_SF",
								"H_Beret_ocamo",
								"H_Beret_red",
								"H_Shemag_khk",
								"H_Shemag_olive",
								"H_Shemag_olive_hs",
								"H_Shemag_tan",
								"H_ShemagOpen_khk",
								"H_ShemagOpen_tan",
								"H_TurbanO_blk"
							];

_pistols =	selectRandom 	[					
								"CUP_hgun_Colt1911",                                
								"CUP_hgun_Compact",                               
								"CUP_hgun_Duty_M3X",                                                     
								"CUP_hgun_M9",									                           
								"CUP_hgun_Makarov",                                                                                                                                                       
								"CUP_hgun_Duty",                                    
								"CUP_hgun_Phantom",                                
								"CUP_hgun_Glock17",                                     
								"CUP_hgun_PB6P9",
								"Exile_Weapon_Colt1911",   	
								"Exile_Weapon_Makarov",	
								"Exile_Weapon_Taurus",		
								"hgun_P07_khk_F",			
								"hgun_Pistol_01_F",			
								"hgun_Pistol_heavy_01_F",										 
								"hgun_Pistol_heavy_02_F",	
								"hgun_ACPC2_F",				
								"hgun_P07_F",			
								"hgun_Rook40_F"	
							];
				
_vests = selectRandom 	[					
							"V_Rangemaster_belt"
						];	
						
_inventoryItems =	[					
						"Exile_Item_EMRE",
						"Exile_Item_ExtensionCord",
						"Exile_Item_PlasticBottleFreshWater",
						"Exile_Item_Bandage"		
					];	

_backpacks = selectRandom 	[					
								"TRYK_B_Belt_BLK",
								"TRYK_B_Belt_CYT",
								"TRYK_B_Belt_tan",
								"TRYK_B_Belt_br",
								"TRYK_B_Belt_GR",
								"TRYK_B_Belt_AOR1",
								"TRYK_B_Belt_AOR2",
								"TRYK_B_tube_cyt",
								"TRYK_B_tube_od",
								"TRYK_B_tube_blk"
							];	

_linkItems =					[					
									"ItemMap",
									"ItemCompass",
									"Exile_Item_XM8",
									"ItemRadio"					
								];	

player addHeadgear _headGear;
player addVest _vests;
player forceAddUniform _uniforms;

{
	player linkItem _x;
} forEach _linkItems;

waitUntil {uiSleep 0.5; ((getPosATL player select 2 < 1) && (vehicle player == player))};
	
player addBackpack _backpacks;

player addWeapon _pistols;

{
	player addMagazine _x;
} forEach _inventoryItems;


switch (true) do 
{
	case (ExileClientPlayerScore >= 50000 && ExileClientPlayerScore <= 99999):
	{
		_howManyClips = 3;
	};
	case (ExileClientPlayerScore >= 100000 && ExileClientPlayerScore <= 499999):
	{
		_howManyClips = 4;
	};
	case (ExileClientPlayerScore >= 500000):
	{
		_howManyClips = 5;
	};
	default
	{
		_howManyClips = 2;
	};
};

//serena thanks
Fn_Gear_CompatibleMagazines = { 
 private _cls = configFile >> "CfgWeapons" >> _this; 
 private _res = []; 
 {_res pushBack (if (_x == "this") 
  then {getArray(_cls >> "magazines")}); 
 } forEach getArray(_cls >> "muzzles"); 
 
 _res 
}; 

//serena again
AddmagZ = { 
 private _play = player; 
 
 { if (count _x > 0) then { 
   { if (count _x > 0) then {    
     _play addMagazines [(_x select 0),_howManyClips]} 
   } foreach (_x call Fn_Gear_CompatibleMagazines)  
  } 
 } forEach [primaryWeapon _play, handgunWeapon _play]; 
};

player addMagazine call AddmagZ;

 

A good start is this.

Name the above Randout.sqf and place it in a folder called 'custom' inside the mission file folder.

Add the below to your own ExileClient_object_player_network_createPlayerResponse.sqf (you will need to override in the CFGcustomCode section) add this right down the bottom but just before the last like where it says 'true'.

[] execVM "custom\Randout.sqf"; 

Make sure you remove any starting items in your config.cpp then you should be good then.

This also adds extra clips for the starting guns, that scale with your respect.

Edited by Pattoh
  • Like 1

Share this post


Link to post
Share on other sites

@[FR] zakhy yes, I have approximately 20 different uniforms and other components in mine.

In the Github, look at the "Randomised Loadout" version. https://github.com/kuplion/Randomised-Loadout

In the file  ExileServer_object_player_network_createPlayerRequest.sqf  you'll see there variables with arrays such as "_bambiUniforms = selectRandom" all you need to do is add the components you want into the appropriate array.

See how you go.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.