Hey, Im fairly new to modding and scripting in general and kinda learning as I go along, But I want to change the condition of clothes/items to be random at freshspawn and I cant figure out how
class CustomMission: MissionServer
{
void SetRandomHealth(EntityAI itemEnt)
{
int rndHlt = Math.RandomInt(5,40);
itemEnt.SetHealth("","",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)
{
//
TStringArray tops = {"Layered_Shirt_Lily","Layered_Shirt_Courage","Layered_Shirt_Cheburashka","Layered_Shirt_White","Medium_Sleeves_Shirt","Medium_Sleeves_Shirt_Red","Medium_Sleeves_Shirt_Blue",};
TStringArray pants = {"Kneepads_Jeans_Base","Kneepads_Jeans_Black",};
TStringArray shoes = {"AthleticShoes_Black","AthleticShoes_Brown","AthleticShoes_Grey","HikingBootsLow_Beige","HikingBootsLow_Black","HikingBootsLow_Grey","HikingBoots_Black","HikingJacket_Black",};
TStringArray drink = {"SodaCan_Cola","SodaCan_Kvass","SodaCan_Pipsi","SodaCan_Spite",};
TStringArray food = {"Worm","SmallGuts","PowderedMilk","PeachesCan","Pear",};
TStringArray tool = {"OrienteeringCompass","PurificationTablets","Matchbox", "RoadFlare", "CanOpener","Rope", "SmallStone",};
//
player.RemoveAllItems();
EntityAI itemEnt;
EntityAI itemIn;
ItemBase itemBs;
//Clothes
player.GetInventory().CreateInInventory(tops.GetRandomElement());
itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory(pants.GetRandomElement());
itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory(shoes.GetRandomElement());
itemBs = ItemBase.Cast(itemEnt);
SetRandomHealth(itemEnt);
//Starting Gear and Food
player.GetInventory().CreateInInventory(drink.GetRandomElement());
player.GetInventory().CreateInInventory(food.GetRandomElement());
player.GetInventory().CreateInInventory(tool.GetRandomElement());
player.GetInventory().CreateInInventory("PersonalRadio");
player.GetInventory().CreateInInventory("StoneKnifeSpawn");//
player.GetInventory().CreateInInventory("Battery9V");
ItemBase rags = player.GetInventory().CreateInInventory("Rag");
rags.SetQuantity(2);