• //Spawn helper function

    void SpawnObject( string type, vector position, vector orientation )

    {

    auto obj = GetGame().CreateObject_WIP( type, position, ECE_CREATEPHYSICS );

    obj.SetFlags( EntityFlags.STATIC, false );

    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()

    {

    /*

    [Namalsk] CE init (offline)

    */

    CreateHive();

    GetHive().InitOffline();


    {

    //Your custom spawned objects

    SpawnObject( "Land_Airfield_Hangar_Green", "6250.384277 26.674696 9033.457031", "-179.999893 0.000000 0.000000" );

    SpawnObject( "land_Mil_Barracks_Round_Polar", "6220.756836 22.362341 9060.289063", "-179.999893 0.000000 0.000000" );

    SpawnObject( "land_Mil_Barracks_Round_Polar", "6214.000000 22.351297 9060.142578", "-179.999893 0.000000 0.000000" );

    SpawnObject( "Land_Mil_Barracks6", "6224.956543 20.870070 9105.120117", "90.000000 0.000000 0.000000" );


    //GetCEApi().ExportProxyData( "8096 0 8096", 16384 );


    }

    /*

    [Namalsk] Mission time init

    after CE init to determine if storage mission type is outside of the required time-frame

    currently recommended time-frame is:

    11/1 -> 11/30

    keep in mind that gameplay features are tied to the mission date (stored in the storage) and that it SHOULD remain this period!

    while using:

    day accelerated 6 times (serverTimeAcceleration=6), resulting in an average 78 min of day-time (RL)

    night accelerated 24 times (serverNightTimeAcceleration=4), resulting in an average of 26 min of night-time (RL)

    */

    int year, month, day, hour, minute;

    GetGame().GetWorld().GetDate( year, month, day, hour, minute );


    if ( ( month < 11 ) || ( month >= 12 ) )

    {

    year = 2011;

    month = 11;

    day = 1;


    GetGame().GetWorld().SetDate( year, month, day, hour, minute );

    }

    };


    class CustomMission: MissionServer

    {

    override void OnInit()

    {

    super.OnInit();


    // this piece of code is recommended otherwise event system is switched on automatically and runs from default values

    // comment this whole block if NOT using Namalsk Survival

    if ( m_EventManagerServer )

    {

    // enable/disable event system, min time between events, max time between events, max number of events at the same time

    m_EventManagerServer.OnInitServer( true, 550, 1000, 2 );

    // registering events and their probability

    m_EventManagerServer.RegisterEvent( Aurora, 0.85 );

    m_EventManagerServer.RegisterEvent( Blizzard, 0.4 );

    m_EventManagerServer.RegisterEvent( ExtremeCold, 0.4 );

    m_EventManagerServer.RegisterEvent( Snowfall, 0.6 );

    m_EventManagerServer.RegisterEvent( EVRStorm, 0.35 );

    m_EventManagerServer.RegisterEvent( HeavyFog, 0.3 );

    }

    }


    void SetRandomHealth(EntityAI itemEnt)

    {

    if (itemEnt)

    {

    float rndHlt = Math.RandomFloat( 0.50, 0.85 );

    itemEnt.SetHealth01( "", "", rndHlt );

    }

    }


    override void StartingEquipSetup( PlayerBase player, bool clothesChosen )

    {

    EntityAI itemClothing;

    EntityAI itemEnt;

    ItemBase itemBs;

    float rand;


    // top

    itemClothing = player.FindAttachmentBySlotName( "Body" );

    if ( itemClothing )

    {

    SetRandomHealth( itemClothing );


    itemEnt = itemClothing.GetInventory().CreateInInventory( "Rag" );

    if ( Class.CastTo( itemBs, itemEnt ) )

    {

    SetRandomHealth( itemEnt );

    itemBs.SetQuantity( 4 );

    itemBs.SetCleanness( 1 );

    }

    player.SetQuickBarEntityShortcut( itemEnt, 0 );


    itemEnt = itemClothing.GetInventory().CreateInInventory( "RoadFlare" );

    SetRandomHealth( itemEnt );

    itemEnt = itemClothing.GetInventory().CreateInInventory( "RoadFlare" );

    SetRandomHealth( itemEnt );

    player.SetQuickBarEntityShortcut( itemEnt, 1 );

    }


    // pants

    itemClothing = player.FindAttachmentBySlotName( "Legs" );

    if ( itemClothing )

    {

    SetRandomHealth( itemClothing );


    itemEnt = itemClothing.GetInventory().CreateInInventory( "Heatpack" );

    SetRandomHealth( itemEnt );


    int throwDice = Math.RandomInt( 0, 2 );

    if ( throwDice == 0 )

    itemEnt = itemClothing.GetInventory().CreateInInventory( "dzn_tool_watch" );

    else

    itemEnt = itemClothing.GetInventory().CreateInInventory( "dzn_tool_watch2" );

    player.SetQuickBarEntityShortcut( itemEnt, 2 );

    }


    // shoes

    itemClothing = player.FindAttachmentBySlotName( "Feet" );

    if ( itemClothing )

    {

    SetRandomHealth( itemClothing );

    }


    // bump fresh spawn water and energy values (to compensate for the frozen food and harder-to-get wells)

    player.GetStatWater().Set( 900 );

    player.GetStatEnergy().Set( 1100 );

    }

    };


    Mission CreateCustomMission(string path)

    {

    return new CustomMission();

    };

  • Ich habe dafür kürzlich ein paar Skripe für unseren Server zusammen geschrieben.

    GitHub - DZ-BAM/bam-scripts: Custom Enforce Scripts
    Custom Enforce Scripts. Contribute to DZ-BAM/bam-scripts development by creating an account on GitHub.
    github.com

    Die Konfiguration erfolgt über eine JSON Datei im $profiles Ordner:

    bam-banov-cfg/dzbam_traderobjects.json at main · DZ-BAM/bam-banov-cfg
    Configuration files for BAM Banov server. Contribute to DZ-BAM/bam-banov-cfg development by creating an account on GitHub.
    github.com


    In der init.c dann:

    Code
    #include "$CurrentDir:\\bam-scripts\\main.c"
    
    void main()
    {    
        ...
        
        DZBAM_main();
    }

    Einmal editiert, zuletzt von Schard ()