Настройка стартового лута для игрока DayZ

В DayZ стартовый лут для игроков настраивается в файле init.c. Этот файл находится в папке с миссией, например, по пути mpmissions/dayzOffline.chernarusplus/init.c.

В init.c можно задать, с какими предметами игроки будут начинать игру, добавляя нужные вещи в инвентарь персонажа прямо в коде. Администратор сервера может настроить начальный набор вещей — например, добавить одежду, еду, медицинские предметы или оружие — чтобы адаптировать стартовые условия под стиль сервера, будь то хардкорный выживач или более лояльная среда для новичков.

Файл init.c

Файл init.c написан на Enforce Script, разбирать сам код файла мы не будем и просто объясним как прописать стартовый лут, вот так выглядит настроенный файл для стартового лута, вы можете просто скопировать его к себе на сервер:

void main()
{
	//INIT ECONOMY--------------------------------------
	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();

	//DATE RESET AFTER ECONOMY INIT-------------------------
	int year, month, day, hour, minute;
	int reset_month = 2, reset_day = 1;
	GetGame().GetWorld().GetDate(year, month, day, hour, minute);

	if ((month == reset_month) && (day < reset_day))
	{
		GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
	}
	else
	{
		if ((month == reset_month + 1) && (day > reset_day))
		{
			GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
		}
		else
		{
			if ((month < reset_month) || (month > reset_month + 1))
			{
				GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
			}
		}
	}
}

class CustomMission: MissionServer
{
	void SetRandomHealth(EntityAI itemEnt)
	{
		if ( itemEnt )
		{
			float rndHlt = Math.RandomFloat( 0.95, 0.98 );
			itemEnt.SetHealth01( "", "", rndHlt );
		}
	}
	
	void SetLowHealth(EntityAI itemEnt)
	{
		if ( itemEnt )
		{
			float rndHlt = Math.RandomFloat( 0.85, 0.95 );
			itemEnt.SetHealth01( "", "", rndHlt );
		}
	}
	
	void SetQuantity(EntityAI itemEnt)
	{
		if ( itemEnt )
		{
			float rndHlt = Math.RandomInt( 4, 5 );
			itemEnt.SetQuantity(rndHlt);
		}
	}

	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer( identity, characterName, pos, 0, "NONE" );
		Class.CastTo( m_player, playerEnt );

		GetGame().SelectPlayer( identity, m_player );

		return m_player;
	}

	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		player.RemoveAllItems();
		
		//EntityAI itemClothing;
		EntityAI itemEnt;
		ItemBase itemBs;
		
		//float rand;
		// Куртка
		itemEnt = player.GetInventory().CreateInInventory("TacticalShirt_Tan");
		itemBs = ItemBase.Cast(itemEnt);
		// Штаны
		itemEnt = player.GetInventory().CreateInInventory("CargoPants_Beige");
		itemBs = ItemBase.Cast(itemEnt);
		// Рюкзак
		itemEnt = player.GetInventory().CreateInInventory("TortillaBag");
		itemBs = ItemBase.Cast(itemEnt);
		// Кепка
		itemEnt = player.GetInventory().CreateInInventory("BaseballCap_Beige");
		itemBs = ItemBase.Cast(itemEnt);
		// Перчатки
		itemEnt = player.GetInventory().CreateInInventory("HandsCover_Improvised");
		itemBs = ItemBase.Cast(itemEnt);
		// Обувь
		itemEnt = player.GetInventory().CreateInInventory("HikingBoots_Brown");
		itemBs = ItemBase.Cast(itemEnt);
		// Бинт
		itemEnt = player.GetInventory().CreateInInventory("BandageDressing");
		itemBs = ItemBase.Cast(itemEnt);
		// консерва
		itemEnt = player.GetInventory().CreateInInventory("TunaCan");
		itemBs = ItemBase.Cast(itemEnt);
		// Кабачок
		itemEnt = player.GetInventory().CreateInInventory("Zucchini");
		itemBs = ItemBase.Cast(itemEnt);
		// Бутылка
		itemEnt = player.GetInventory().CreateInInventory("WaterBottle");
		itemBs = ItemBase.Cast(itemEnt);
		// Нож
		itemEnt = player.GetInventory().CreateInInventory("BoneKnife");
		itemBs = ItemBase.Cast(itemEnt);
		// пистолет
		itemEnt = player.GetInventory().CreateInInventory("MKII");
		itemBs = ItemBase.Cast(itemEnt);
		// обойма
		itemEnt = player.GetInventory().CreateInInventory("Mag_MKII_10Rnd");
		itemBs = ItemBase.Cast(itemEnt);
		// патроны
		itemEnt = player.GetInventory().CreateInInventory("AmmoBox_22_50Rnd");
		itemBs = ItemBase.Cast(itemEnt);
	
	}
};

Mission CreateCustomMission(string path)
{
	return new CustomMission();
}

Нас интересует вот этот блок кода:

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		player.RemoveAllItems();
		
		//EntityAI itemClothing;
		EntityAI itemEnt;
		ItemBase itemBs;
		
		//float rand;
		// Куртка
		itemEnt = player.GetInventory().CreateInInventory("TacticalShirt_Tan");
		itemBs = ItemBase.Cast(itemEnt);
		// Штаны
		itemEnt = player.GetInventory().CreateInInventory("CargoPants_Beige");
		itemBs = ItemBase.Cast(itemEnt);
		// Рюкзак
		itemEnt = player.GetInventory().CreateInInventory("TortillaBag");
		itemBs = ItemBase.Cast(itemEnt);
		// Кепка
		itemEnt = player.GetInventory().CreateInInventory("BaseballCap_Beige");
		itemBs = ItemBase.Cast(itemEnt);
		// Перчатки
		itemEnt = player.GetInventory().CreateInInventory("HandsCover_Improvised");
		itemBs = ItemBase.Cast(itemEnt);
		// Обувь
		itemEnt = player.GetInventory().CreateInInventory("HikingBoots_Brown");
		itemBs = ItemBase.Cast(itemEnt);
		// Бинт
		itemEnt = player.GetInventory().CreateInInventory("BandageDressing");
		itemBs = ItemBase.Cast(itemEnt);
		// консерва
		itemEnt = player.GetInventory().CreateInInventory("TunaCan");
		itemBs = ItemBase.Cast(itemEnt);
		// Кабачок
		itemEnt = player.GetInventory().CreateInInventory("Zucchini");
		itemBs = ItemBase.Cast(itemEnt);
		// Бутылка
		itemEnt = player.GetInventory().CreateInInventory("WaterBottle");
		itemBs = ItemBase.Cast(itemEnt);
		// Нож
		itemEnt = player.GetInventory().CreateInInventory("BoneKnife");
		itemBs = ItemBase.Cast(itemEnt);
		// пистолет
		itemEnt = player.GetInventory().CreateInInventory("MKII");
		itemBs = ItemBase.Cast(itemEnt);
		// обойма
		itemEnt = player.GetInventory().CreateInInventory("Mag_MKII_10Rnd");
		itemBs = ItemBase.Cast(itemEnt);
		// патроны
		itemEnt = player.GetInventory().CreateInInventory("AmmoBox_22_50Rnd");
		itemBs = ItemBase.Cast(itemEnt);
	
	}

Просто измените названия предметов на свои которые вы хотите давать игрокам при старте, и перезагрузите сервер.

Играйте с HOSTIQO!

Last updated

Was this helpful?