Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
with just normal clothing though
for each player that joins my server
many thanks for any help as not too clever at this stuff
doesnt have to be ak but something similar
Smokey, if you want you can help me. I have never programmed in my life, but having my own DayZ server I felt I wanted to be able to adjust fresh spawn loadouts at the very least.
What I want is something that randomizes the clothes on the character from a pool of preset items that I have determined in advance. I googled a little and found commands that I believe would do the trick:
TStringArray tops = {"POSSIBLE-TOP-1","POSSIBLE-TOP-2"};
TStringArray pants = {"POSSIBLE-PANTS-1","POSSIBLE-PANTS-2"};
TStringArray shoes = {"POSSIBLE-SHOES-1","POSSIBLE-SHOES-2"};
TStringArray backpacks = {"POSSIBLE-BP-1","POSSIBLE-BP-2"};
TStringArray vests = {"POSSIBLE-VEST-1","POSSIBLE-VEST-2"};
And
EntityAI item = player.GetInventory().CreateInInventory(tops.GetRandomElement());
EntityAI item2 = player.GetInventory().CreateInInventory(pants.GetRandomElement());
EntityAI item3 = player.GetInventory().CreateInInventory(shoes.GetRandomElement());
EntityAI item4 = player.GetInventory().CreateInInventory(backpacks.GetRandomElement());
EntityAI item6 = player.GetInventory().CreateInInventory(vests.GetRandomElement());
Now, I get that the lower lines of text most likely will pull values from the upper ones; randomizing the outcome so that when a new player spawns in, he will either have whatever I put in "POSSIBLE-TOP-1 or in "POSSIBLE-TOP-2" on his chest and the same applies to the other categories.
However, I have absolutely no idea where to input these lines of text. This is my code, and as you can see, I haven't edited it much from the original one, just removed a few entries and added a couple more.
void main()
{
//INIT WEATHER BEFORE ECONOMY INIT------------------------
Weather weather = g_Game.GetWeather();
weather.MissionWeather(false); // false = use weather controller from Weather.c
weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
weather.GetRain().Set( 0, 0, 1);
weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);
//INIT ECONOMY--------------------------------------
Hive ce = CreateHive();
if ( ce )
ce.InitOffline();
//DATE RESET AFTER ECONOMY INIT-------------------------
int year, month, day, hour, minute;
int reset_month = 9, reset_day = 20;
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.25, 0.65 )
itemEnt.SetHealth01( "", "", 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)
{
EntityAI itemClothing;
EntityAI itemEnt;
ItemBase itemBs;
float rand;
itemClothing = player.FindAttachmentBySlotName( "Body" );
if ( itemClothing )
{
SetRandomHealth( itemClothing );
itemEnt = itemClothing.GetInventory().CreateInInventory( "Rag" );
if ( Class.CastTo( itemBs, itemEnt ) )
itemBs.SetQuantity( 4 );
itemEnt = player.GetInventory().CreateInInventory("StoneKnife");
player.SetQuickBarEntityShortcut(itemEnt, 0);
itemEnt = player.GetInventory().CreateInInventory("Spear");
player.SetQuickBarEntityShortcut(itemEnt, 1);
itemEnt = player.GetInventory().CreateInInventory("Izh18");
SetRandomHealth(itemEnt);
player.SetQuickBarEntityShortcut(itemEnt, 2);
itemEnt = player.GetInventory().CreateInInventory("Whetstone");
itemEnt = itemEnt.GetInventory().CreateAttachment("HandDrillKit");
itemEnt = player.GetInventory().CreateInInventory("Rope");
itemEnt = player.GetInventory().CreateInInventory("Ammo_762x39");
if ( Class.CastTo( itemBs, itemEnt ) )
itemBs.SetQuantity( 10 );
itemEnt = player.GetInventory().CreateInInventory("Mackerel");
itemEnt = player.GetInventory().CreateInInventory("Compass");
SetRandomHealth(itemEnt);
itemEnt = player.GetInventory().CreateInInventory("FurCourierBag");
}
itemClothing = player.FindAttachmentBySlotName( "Legs" );
if ( itemClothing )
SetRandomHealth( itemClothing );
itemClothing = player.FindAttachmentBySlotName( "Feet" );
if ( itemClothing )
SetRandomHealth( itemClothing );
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}
Now, I don't really know what all the brackets and paragraphs and squiggly lines do. I basically just throw ♥♥♥♥ into the mix and see what sticks. ^^ I just want to know how I should build up the code so it will do what I described. Could you tell me? :)
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 = 9, reset_day = 20;
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.45, 0.65 );
itemEnt.SetHealth01( "", "", 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)
{
EntityAI itemClothing;
EntityAI itemEnt;
ItemBase itemBs;
float rand;
player.RemoveAllItems();
ref TStringArray topsArray = {"MMG_tactical_shirt_multicamblack"};
ref TStringArray pantsArray = {"mmg_tactical_pants_multicamblack"};
ref TStringArray shoesArray = {"MMG_boots_multicamblack"};
ref TStringArray backpackArray = {"DryBag_Black"};
ref TStringArray helmArray = {"mmg_boonie_multicamblack"};
ref TStringArray handsArray = {"mmg_tactical_gloves_multicamblack"};
EntityAI item1 = player.GetInventory().CreateInInventory(topsArray.GetRandomElement());
EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
EntityAI item4 = player.GetInventory().CreateInInventory(backpackArray.GetRandomElement());
EntityAI item5 = player.GetInventory().CreateInInventory(helmArray.GetRandomElement());
EntityAI item6 = player.GetInventory().CreateInInventory(handsArray.GetRandomElement());
itemClothing = player.FindAttachmentBySlotName( "Body" );
if ( itemClothing )
{
SetRandomHealth( itemClothing );
itemEnt = player.GetInventory().CreateInInventory("Longhorn");
player.SetQuickBarEntityShortcut(itemEnt, 1);
itemEnt = player.GetInventory().CreateInInventory("PistolOptic");
itemEnt = player.GetInventory().CreateInInventory("BandageDressing");
player.SetQuickBarEntityShortcut(itemEnt, 2);
itemEnt = player.GetInventory().CreateInInventory("Combatknife");
player.SetQuickBarEntityShortcut(itemEnt, 4);
itemEnt = player.GetInventory().CreateInInventory("RGD5Grenade");
player.SetQuickBarEntityShortcut(itemEnt, 3);
itemEnt = player.GetInventory().CreateInInventory("Carp");
itemEnt = player.GetInventory().CreateInInventory("Ammo_308Win");
}
itemClothing = player.FindAttachmentBySlotName( "Legs" );
if ( itemClothing )
SetRandomHealth( itemClothing );
itemClothing = player.FindAttachmentBySlotName( "Feet" );
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}
you are soo late to the party, that the server has already closed.
I always wonder.... what the duck made you dig up a 4 year old post, and then comment this?
whats going on here?
Finally, I have waited 3 years for this.
Think it's these -
"Mag_AKM_Drum75Rnd"
"AK_Suppressor"
"MediumTent"
init.c editing for Loadouts is the outdated method. With the latest game updates, you can now just write a .json file, placed in a folder called "custom" in your mission folder, and add a pointer to the folder in your cfggameplay.json, as below:
"PlayerData":
{
"disablePersonalLight": true,
"spawnGearPresetFiles": [add loadouts here],
As it is now, after that latest update, Loot weapons have a high chance of having a round chambered, so no modifications is even needed for a "chance" to have loadout weapons "loaded" .. I'd have to look at the latest code to know if they also put in an easily edited parameter, or if it is via the encrypted game code, that would require a light-weight mod.