I don't know how you would get init.c to randomly do that. Here is my init.c for a new spawn load out:
added after the line "SetRandomHealth( itemEnt );"
player.GetInventory().CreateInInventory("AliceBag_Black"); // added items
player.GetInventory().CreateInInventory("Compass"); // added items
player.GetInventory().CreateInInventory("Canteen"); // added items
player.GetInventory().CreateInInventory("SardinesCan"); // added items
player.GetInventory().CreateInInventory("CombatKnife"); // added items
player.GetInventory().CreateInInventory("MilitaryBelt"); // added items
player.GetInventory().CreateInInventory("NylonKnifeSheath"); // added items
player.GetInventory().CreateInInventory("PlateCarrierHolster"); // added items
player.GetInventory().CreateInInventory("PistolSuppressor"); // added items
player.GetInventory().CreateInInventory("CanOpener"); // added items
player.GetInventory().CreateInInventory("M4A1"); // added items
player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd"); // added items
player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd"); // added items
player.GetInventory().CreateInInventory("AmmoBox_556x45_20Rnd"); // added items
player.GetInventory().CreateInInventory("AmmoBox_556x45_20Rnd"); // added items
player.GetInventory().CreateInInventory("Glock19"); // added items
player.GetInventory().CreateInInventory("Mag_Glock_15Rnd"); // added items
player.GetInventory().CreateInInventory("Mag_Glock_15Rnd"); // added items
player.GetInventory().CreateInInventory("AmmoBox_9x19_25rnd"); // added items
player.GetInventory().CreateInInventory("AmmoBox_9x19_25rnd"); // added items
player.GetInventory().CreateInInventory("BandageDressing"); // added items
player.GetInventory().CreateInInventory("WoodAxe"); // added items
player.GetInventory().CreateInInventory("SodaCan_Pipsi"); // added items
player.GetInventory().CreateInInventory("SodaCan_Spite"); // added items
player.GetInventory().CreateInInventory("TacticalBaconCan"); // added items
player.GetInventory().CreateInInventory("Matchbox"); // added items
player.GetInventory().CreateInInventory("WeaponCleaningKit"); // added items
to add items, find the name for what you want to add in the types.xml file, copy the line and replace with desired item.
Display More
this is what i got now but cant seem to find server after restart once text added.... is something wrong??
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 );
SetRandomHealth( itemEnt );
string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
int rndIndex = Math.RandomInt( 0, 4 );
itemEnt = itemClothing.GetInventory().CreateInInventory( chemlightArray[rndIndex] );
SetRandomHealth( itemEnt );
rand = Math.RandomFloatInclusive( 0.0, 1.0 );
if ( rand < 0.35 )
itemEnt = player.GetInventory().CreateInInventory( "Apple" );
else if ( rand > 0.65 )
itemEnt = player.GetInventory().CreateInInventory( "Pear" );
else
itemEnt = player.GetInventory().CreateInInventory( "Plum" );
SetRandomHealth( itemEnt );
}
player.GetInventory().CreateInInventory("AliceBag_Black");
player.GetInventory().CreateInInventory("Compass");
player.GetInventory().CreateInInventory("Canteen");
player.GetInventory().CreateInInventory("SardinesCan");
player.GetInventory().CreateInInventory("CombatKnife");
player.GetInventory().CreateInInventory("MilitaryBelt");
player.GetInventory().CreateInInventory("NylonKnifeSheath");
player.GetInventory().CreateInInventory("PlateCarrierHolster");
player.GetInventory().CreateInInventory("PistolSuppressor");
player.GetInventory().CreateInInventory("CanOpener");
player.GetInventory().CreateInInventory("M4A1");
player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");
player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd");
player.GetInventory().CreateInInventory("AmmoBox_556x45_20Rnd");
player.GetInventory().CreateInInventory("AmmoBox_556x45_20Rnd");
player.GetInventory().CreateInInventory("Glock19");
player.GetInventory().CreateInInventory("Mag_Glock_15Rnd");
player.GetInventory().CreateInInventory("Mag_Glock_15Rnd");
player.GetInventory().CreateInInventory("AmmoBox_9x19_25rnd");
player.GetInventory().CreateInInventory("AmmoBox_9x19_25rnd");
player.GetInventory().CreateInInventory("BandageDressing");
player.GetInventory().CreateInInventory("WoodAxe");
player.GetInventory().CreateInInventory("SodaCan_Pipsi");
player.GetInventory().CreateInInventory("SodaCan_Spite");
player.GetInventory().CreateInInventory("TacticalBaconCan");
player.GetInventory().CreateInInventory("Matchbox");
player.GetInventory().CreateInInventory("WeaponCleaningKit");
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}