maybe it is a very stuiped problem but i cant find a fix for that, so i hope you can help.
I did spawn a few buildings on my server with this code in my init.c
//Spawn helper function
void SpawnObject( string type, vector position, vector orientation )
{
auto obj = GetGame().CreateObject( type, position );
obj.SetPosition( position );
obj.SetOrientation( orientation );
obj.SetOrientation( obj.GetOrientation() ); //Collision fix
obj.Update();
obj.SetAffectPathgraph( true, false );
if( obj.CanAffectPathgraph() ) GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( GetGame().UpdatePathgraphRegionByObject, 100, false, obj );
}
void main()
{
//INIT WEATHER BEFORE ECONOMY INIT------------------------
Weather weather = g_Game.GetWeather();
weather.MissionWeather(false); // false = use weather controller from Weather.c
weather.GetOvercast().SetLimits( 0.3 , 1.0 );
weather.GetRain().SetLimits(0.0, 0.5);
weather.GetFog().SetLimits(0.1, 0.28);
weather.GetOvercast().SetForecastChangeLimits(1.0, 1.0);
weather.GetRain().SetForecastChangeLimits(0.0, 0.06);
weather.GetFog().SetForecastChangeLimits(0.10, 0.30);
weather.GetOvercast().SetForecastTimeLimits(1800, 1800);
weather.GetRain().SetForecastTimeLimits(250, 500);
weather.GetFog().SetForecastTimeLimits(1800, 1800);
weather.GetOvercast().Set(Math.RandomFloatInclusive(0.3, 0.4), 0, 0);
weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
weather.GetFog().Set(Math.RandomFloatInclusive(0, 1), 0, 0);
weather.SetWindMaximumSpeed(30);
weather.SetWindFunctionParams(0.1, 1.0, 50);
//INIT ECONOMY--------------------------------------
Hive ce = CreateHive();
if ( ce )
ce.InitOffline();
//ALUHUT Schilder
SpawnObject( "land_billboard_1_ml", "6423.720215 9.570000 2713.739990", "-76.000000 0.000000 0.000000" );
... all my customs stuff ...
SpawnObject( "Land_Wreck_Uaz", "13278.871094 67.072304 11867.122070", "0.000000 14.999999 0.000000" );
//GetCEApi().ExportProxyData( "7500 0 7500", 20000 ); //Center of map, radius of how far to go out and find buildings.
//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 );
}
itemClothing = player.FindAttachmentBySlotName( "Legs" );
if ( itemClothing )
SetRandomHealth( itemClothing );
itemClothing = player.FindAttachmentBySlotName( "Feet" );
if ( itemClothing )
SetRandomHealth( itemClothing );
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}
It all spawns perfect and works fine BUT when a Z is coming he can walk through the buildings. I did make an extra Zombievent with an extra territorium but still not working.
Plz Help