Heya, im really new to scripting and dayz modding in general and im trying to change the condition of items that you spawn in with, I got an array working for clothes and figured out how to spawn with set items, but I havent managed to figure out how to change the condition of clothes from pristine to lets say damaged, or set it to be random inbetween damaged/worn,
Also I want to spawn in with a Stone knife that's badly damaged, A friend told me to add a stoneknife to types.XML by copying the StoneKnife that's there and making a new one but changing it to StoneKnifeSpawn and changing the quantmin/quantmax but i can't even get it to spawn now
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)
{
//
TStringArray tops = {"Hoodie_Black","Hoodie_Blue","Hoodie_Brown"};
TStringArray pants = {"Jeans_Black","Jeans_BlueDark","Jeans_Blue","Jeans_Brown","Jeans_Green","Jeans_Grey"};
TStringArray shoes = {"AthleticShoes_Black","AthleticShoes_Brown","AthleticShoes_Grey","HikingBootsLow_Beige","HikingBootsLow_Black","HikingBootsLow_Grey","HikingBoots_Black"
TStringArray drink = {"SodaCan_Cola","SodaCan_Kvass","SodaCan_Pipsi","SodaCan_Spite"};
TStringArray food = {"PowderedMilk","PeachesCan","Pear"};
TStringArray tool = {"OrienteeringCompass","Knife","PurificationTablets","Matchbox"};
//
player.RemoveAllItems();
player.Getinventory().CreateinInventory(tops.GetRandomElement());
player.GetInventory().CreateInInventory(pants.GetRandomElement());
player.GetInventory().CreateInInventory(shoes.GetRandomElement());
player.GetInventory().CreateInInventory(drink.GetRandomElement());
player.GetInventory().CreateInInventory(food.GetRandomElement());
player.GetInventory().CreateInInventory(tool.GetRandomElement());
player.GetInventory().CreateInInventory("PersonalRadio");
player.GetInventory().CreateInInventory("Battery9V");
player.GetInventory().CreateInInventory("StoneKnifeSpawn");
ItemBase rags = player.GetInventory().CreateInInventory("Rag");
rags.SetQuantity(2);
}
};
Also I want to spawn in with a Stone knife that's badly damaged, A friend told me to add a stoneknife to types.XML by copying the StoneKnife that's there and making a new one but changing it to StoneKnifeSpawn and changing the quantmin/quantmax but i can't even get it to spawn now
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)
{
//
TStringArray tops = {"Hoodie_Black","Hoodie_Blue","Hoodie_Brown"};
TStringArray pants = {"Jeans_Black","Jeans_BlueDark","Jeans_Blue","Jeans_Brown","Jeans_Green","Jeans_Grey"};
TStringArray shoes = {"AthleticShoes_Black","AthleticShoes_Brown","AthleticShoes_Grey","HikingBootsLow_Beige","HikingBootsLow_Black","HikingBootsLow_Grey","HikingBoots_Black"
TStringArray drink = {"SodaCan_Cola","SodaCan_Kvass","SodaCan_Pipsi","SodaCan_Spite"};
TStringArray food = {"PowderedMilk","PeachesCan","Pear"};
TStringArray tool = {"OrienteeringCompass","Knife","PurificationTablets","Matchbox"};
//
player.RemoveAllItems();
player.Getinventory().CreateinInventory(tops.GetRandomElement());
player.GetInventory().CreateInInventory(pants.GetRandomElement());
player.GetInventory().CreateInInventory(shoes.GetRandomElement());
player.GetInventory().CreateInInventory(drink.GetRandomElement());
player.GetInventory().CreateInInventory(food.GetRandomElement());
player.GetInventory().CreateInInventory(tool.GetRandomElement());
player.GetInventory().CreateInInventory("PersonalRadio");
player.GetInventory().CreateInInventory("Battery9V");
player.GetInventory().CreateInInventory("StoneKnifeSpawn");
ItemBase rags = player.GetInventory().CreateInInventory("Rag");
rags.SetQuantity(2);
}
};