ich hab mir son kleinen pvp server zusammen gebastelt und wollte die gebäude über die init.c spawnen. Auf meinem mainserver funzt es, auf dem neuen lädt er es nicht.
ich vermute eine falsche klammer, aber ich finde den fehler nicht. Die anderen einstellungen lädt er ohne probleme. Nur halt keine objekte
Code
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);
//Your custom spawned objects
SpawnObject("Land_Tenement_Small", "12114 8.6 2460", "0 0 0"); //insel
//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( "100", "100", 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.GetStatEnergy().Set(7500);
player.GetStatWater().Set(5000);
EntityAI itemClothing;
EntityAI itemEnt;
ItemBase itemBs;
float rand;
player.RemoveAllItems();
ref TStringArray topsArray = {"MVS_Shirt_BDU","MVS_Shirt_BDU","MVS_Shirt_BDU"};
ref TStringArray pantsArray = {"MVS_CombatPants_ERDL","MVS_CombatPants_ERDL"};
ref TStringArray shoesArray = {"MilitaryBoots_Black","MilitaryBoots_Black"};
ref TStringArray backpackArray = {"MVS_Rucksack_ERDL","MVS_Rucksack_ERDL"};
ref TStringArray helmArray = {"MVS_Helmet_01_ERDL","MVS_Helmet_01_ERDL"};
ref TStringArray gurtelArray = {"MVS_Belt_ERDL","MVS_Belt_ERDL"};
ref TStringArray handschuheArray = {"TacticalGloves_Black","TacticalGloves_Black"};
ref TStringArray vestArray = {"MVS_ChestRig_ERDL","MVS_ChestRig_ERDL"};
EntityAI item1 = player.GetInventory().CreateInInventory(topsArray.GetRandomElement());
EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
EntityAI shoeknife = item3.GetInventory().CreateAttachment("HuntingKnife");
EntityAI item4 = player.GetInventory().CreateInInventory(backpackArray.GetRandomElement());
EntityAI backpackRadio = item4.GetInventory().CreateAttachment("PersonalRadio");
backpackRadio.GetInventory().CreateAttachment("Battery9V");
EntityAI backpackGun = item4.GetInventory().CreateAttachment("TWP_Kar98");
itemEnt = item4.GetInventory().CreateInInventory( "Ammo_762x54Tracer" );
EntityAI item5 = player.GetInventory().CreateInInventory(helmArray.GetRandomElement());
EntityAI helmvision = item5 .GetInventory().CreateAttachment("NVGoggles");
helmvision.GetInventory().CreateAttachment("Battery9V");
EntityAI item6 = player.GetInventory().CreateInInventory(gurtelArray.GetRandomElement());
EntityAI gurtelholster = item6.GetInventory().CreateAttachment("MVS_Holster_ERDL");
gurtelholster.GetInventory().CreateAttachment("TWP_WaltherP99");
EntityAI gurtelMedic = item6.GetInventory().CreateAttachment("MVS_Medical_Pouch_ERDL");
itemEnt = gurtelMedic.GetInventory().CreateInInventory( "BandageDressing" );
itemEnt = gurtelMedic.GetInventory().CreateInInventory( "TetracyclineAntibiotics" );
itemEnt = gurtelMedic.GetInventory().CreateInInventory( "PsilocybeMushroom" );
itemEnt = gurtelMedic.GetInventory().CreateInInventory( "BandageDressing" );
itemEnt = gurtelMedic.GetInventory().CreateInInventory( "Battery9V" );
itemEnt = gurtelMedic.GetInventory().CreateInInventory( "Battery9V" );
EntityAI gurtelMAG = item6.GetInventory().CreateAttachment("MVS_Magazine_Pouch_ERDL");
itemEnt = gurtelMAG.GetInventory().CreateInInventory( "WaterBottle" );
itemEnt = gurtelMAG.GetInventory().CreateInInventory( "WaterBottle" );
itemEnt = gurtelMAG.GetInventory().CreateInInventory( "sandwich_mung" );
itemEnt = gurtelMAG.GetInventory().CreateInInventory( "sandwich_mung" );
itemEnt = gurtelMAG.GetInventory().CreateInInventory( "sandwich_mung" );
itemEnt = gurtelMAG.GetInventory().CreateInInventory( "sandwich_mung" );
EntityAI item7 = player.GetInventory().CreateInInventory(handschuheArray.GetRandomElement());
EntityAI item8 = player.GetInventory().CreateInInventory(vestArray.GetRandomElement());
itemEnt = item8.GetInventory().CreateInInventory( "Splint" );
itemEnt = item8.GetInventory().CreateInInventory( "WeaponCleaningKit" );
itemEnt = item8.GetInventory().CreateInInventory( "TWP_WaltherP99_mag_15Rnd" );
itemEnt = item8.GetInventory().CreateInInventory( "TWP_WaltherP99_mag_15Rnd" );
itemEnt = item8.GetInventory().CreateInInventory( "TWP_WaltherP99_mag_15Rnd" );
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}
Alles anzeigen