Jump to content
alphagamer1981

custom start gear for multiple members

Recommended Posts

Hi there, We have just started a server and hope to find a way to make specific spawn loadouts for members in our discord. Now I know how to set up a player spawn loadout as default, but is there a way to set a loadout script for specific steam members? if so how do i do it? if there is a current working mod that already has this ability, could i get a link also.

 

Thank you for your time

Edited by alphagamer1981

Share this post


Link to post
Share on other sites
23 hours ago, Shaggoth said:

removed

Here some code.

Init.c  for one player

Spoiler

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
	EntityAI itemEnt;
	ItemBase itemBs;
		
	player.RemoveAllItems();
  	if (player.GetIdentity().GetPlainId() == "7659119*************") // SteamID64
    {
      	player.GetInventory().CreateInInventory("TTsKOJacket_Camo");
		player.GetInventory().CreateInInventory("TTSKOPants");
		player.GetInventory().CreateInInventory("MilitaryBoots_Black");
      
		Weapon wpn = player.GetInventory().CreateInInventory("MakarovIJ70");
		Magazine mag = player.GetInventory().CreateInInventory("Mag_IJ70_8Rnd");
		mag.SetQuantity(mag.GetQuantityMax(),false,false,true);
		wpn.AttachMagazine(0,mag); // <- my fnc for add some mags in inventory
	
		player.SetQuickBarEntityShortcut(wpn, 1, true);
		addMags(player, "Mag_IJ70_8Rnd", 3);
		TStringArray headGear = {"BoonieHat_Dubok", "OfficerHat", "MilitaryBeret_CDF", "MilitaryBeret_ChDKZ", "MilitaryBeret_NZ", "MilitaryBeret_Red", "MilitaryBeret_UN", "PilotkaCap", "Ssh68Helmet"};
		player.GetInventory().CreateInInventory(headGear.GetRandomElement());
    }
}

 

Same equipment for 2 players

Spoiler

class CustomMission: MissionServer
{
	ref TStringArray admins = {"ADMIN_1_STEAMID64","ADMIN_2_STEAMID64","ADMIN_Xn_STEAMID64"};
	
	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		EntityAI itemEnt;
		ItemBase itemBs;		
		player.RemoveAllItems();
  
		for ( int i = 0; i < admins.Count(); ++i )
    	{
			if(player.GetIdentity().GetPlainId() == admins[i])
			{
          		TStringArray headGear = {"BoonieHat_Dubok", "OfficerHat", "MilitaryBeret_CDF", "MilitaryBeret_ChDKZ", "MilitaryBeret_NZ", "MilitaryBeret_Red", "MilitaryBeret_UN", "PilotkaCap", "Ssh68Helmet"};
              player.GetInventory().CreateInInventory("TTsKOJacket_Camo");
              player.GetInventory().CreateInInventory("TTSKOPants");
              player.GetInventory().CreateInInventory("MilitaryBoots_Black");
      
              Weapon wpn = player.GetInventory().CreateInInventory("MakarovIJ70");
              Magazine mag = player.GetInventory().CreateInInventory("Mag_IJ70_8Rnd");
              mag.SetQuantity(mag.GetQuantityMax(),false,false,true);
              wpn.AttachMagazine(0,mag);

              player.SetQuickBarEntityShortcut(wpn, 1, true);
              addMags(player, "Mag_IJ70_8Rnd", 3); // <- my fnc for add some mags in inventory

              player.GetInventory().CreateInInventory(headGear.GetRandomElement());
              break;
        	}
		}
    }
}

 

If you want to set different random outwear for not admin

Spoiler

#include "$CurrentDir:\\mpmissions\\dayz.chernarusplus\\SomeFolder\\Solder_TTSKO.c"; // <- Create a folder in mission and place there loadouts

class CustomMission: MissionServer
{
	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		EntityAI itemEnt;
		ItemBase itemBs;
		player.RemoveAllItems();
		
		switch (Math.RandomInt(0, 11)) 
		{
			case 0: Solder_TTSKO(player); break;
			
			case 1: OTHER RANDOM LOADOUT;break;
			...
		}
	}
}

 

If you want to set some skin for player (repeat skin after respawn)
 

Spoiler

class CustomMission: MissionServer
{
	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt;
		switch (identity.GetPlainId())
		{
			case "7656119**********": // Admin 1
				playerEnt = GetGame().CreatePlayer( identity, "SurvivorM_Peter", pos, 0, "NONE");
			break;
			case "7656119**********": // Admin 2
				playerEnt = GetGame().CreatePlayer( identity, "SurvivorM_Peter", pos, 0, "NONE");
			break;
			default:					// Default player
				playerEnt = GetGame().CreatePlayer( identity, characterName, pos, 0, "NONE"); //Creates random player
			break;
		}
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);
		return m_player;
	}
}

 

Have a fun.

Edited by Sid Debian

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

×