Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
inozemcev

Можно ли так писать стартовый сет

Написал сет, но почему-то не работает

Скрытый текст

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {    
        EntityAI itemTop;
        EntityAI itemEnt;
        ItemBase itemBs;
        EntityAI itemCreated = NULL;
        float rand;
        
        player.RemoveAllItems();
        
        itemCreated = player.GetInventory().CreateInInventory("Balaclava3Holes_Green");
                itemCreated = NULL;    
        
        itemEnt = player.GetInventory().CreateInInventory("Headtorch_Black");
        SetRandomHealth(itemEnt);
        
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand <= 0.125 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Black");    
                itemCreated = NULL;
            else if ( rand <= 0.25 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Green");    
                itemCreated = NULL;
            else if ( rand <= 0.375 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Blue");    
                itemCreated = NULL;
            else if ( rand <= 0.5 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Red");    
                itemCreated = NULL;
            else if ( rand <= 0.625 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Grey");    
                itemCreated = NULL;
            else if ( rand <= 0.75 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Orange");    
                itemCreated = NULL;
            else if ( rand <= 0.875 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Yellow");    
                itemCreated = NULL;
            else
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Violet");    
                itemCreated = NULL;
                
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.5 )
                itemEnt = player.GetInventory().CreateInInventory("TrackSuitPants_Black");
            else
                itemEnt = player.GetInventory().CreateInInventory("TrackSuitPants_Blue");
        
        itemCreated = player.GetInventory().CreateInInventory("WorkingBoots_Grey");
        itemCreated = NULL;    
        
        itemTop = player.FindAttachmentBySlotName("Body");

        if ( itemTop )
        {
            itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
            if ( Class.CastTo(itemBs, itemEnt ) )
                itemBs.SetQuantity(4);

            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);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
            SetRandomHealth(itemEnt);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("KitchenKnife");
            SetRandomHealth(itemEnt);
            
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.25 )
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola");
        else if ( rand > 0.75 )
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Spite");
        else
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi");
        
        SetRandomHealth(itemEnt);
        
        itemEnt = itemTop.GetInventory().CreateInInventory("PeachesCan");
            SetRandomHealth(itemEnt);
        itemEnt = itemTop.GetInventory().CreateInInventory("PeachesCan");
            SetRandomHealth(itemEnt);
            
            }
            My_Custom_Spawn_Parameters.Load_And_Check_StartLoadout(player);
    }

 

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts










  • 0
Скрытый текст

#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ConnectDisconnectMessagesInChat.c"
#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\InfoMessages.c" 
#include "$CurrentDir:mpmissions\dayzOffline.chernarusplus\CustomSpawnPlayerConfig\Script.c"
#include "$CurrentDir:mpmissions\dayzOffline.chernarusplus\CustomSpawnPlayerConfig\Sets.c"
ref CustomSpawnPlayerConfig  My_Custom_Spawn_Parameters = new CustomSpawnPlayerConfig();
ref StartSetsPlayersConfig StartSetsPlayers = new StartSetsPlayersConfig();
void    SpawnObject ( string type, vector position, vector orientation )
{
    auto obj = GetGame().CreateObject( type, position );
    obj.SetPosition( position );
    obj.SetOrientation( orientation );
    vector roll = obj.GetOrientation();
    roll [ 2 ] = roll [ 2 ] - 1;
    obj.SetOrientation( roll );
    roll [ 2 ] = roll [ 2 ] + 1;
    obj.SetOrientation( roll );
    
}

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);
            }
        }
    }
    GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(My_Custom_Spawn_Parameters.Read_Update_Config, 120000, true); // Обновление настроек скрипта кастомных спавнов, 1 минута = 60000
    GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CustomInformation, TIME_Information_Repeat, true); 
}

class CustomMission: MissionServer
{
    void SetRandomHealth(EntityAI itemEnt)
    {
        if ( itemEnt )
        {
            int rndHlt = Math.RandomInt(55,100);
            itemEnt.SetHealth("","",rndHlt);
        }
    }

    override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
    {
        pos = My_Custom_Spawn_Parameters.Load_And_Check_Spawnpoints(identity, pos);
        characterName = My_Custom_Spawn_Parameters.Load_And_Check_SpawnSkin_Player(identity, characterName);
        Entity playerEnt;
        playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
        Class.CastTo(m_player, playerEnt);

        GetGame().SelectPlayer(identity, m_player);

        return m_player;
    }

    override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {    
        EntityAI itemTop;
        EntityAI itemEnt;
        EntityAI itemLegs;
        ItemBase itemBs;
        float rand;
        
        itemEnt = player.GetInventory().CreateInInventory("Headtorch_Black");
        SetRandomHealth(itemEnt);
        
        itemTop = player.FindAttachmentBySlotName("Body");

        if ( itemTop )
        {
            itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
            if ( Class.CastTo(itemBs, itemEnt ) )
                itemBs.SetQuantity(4);

            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);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
            SetRandomHealth(itemEnt);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("KitchenKnife");
            SetRandomHealth(itemEnt);
            
            rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.25 )
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola");
        else if ( rand > 0.75 )
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Spite");
        else
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi");
        
        SetRandomHealth(itemEnt);
        
        itemEnt = itemTop.GetInventory().CreateInInventory("PeachesCan");
            SetRandomHealth(itemEnt);
        
            
            }
        itemLegs = player.FindAttachmentBySlotName("Legs");
        if ( itemLegs )
        {
            itemEnt = itemLegs.GetInventory().CreateInInventory("Heatpack");
            SetRandomHealth(itemEnt);
            itemEnt = itemLegs.GetInventory().CreateInInventory("Heatpack");
            SetRandomHealth(itemEnt);
        }
            
            My_Custom_Spawn_Parameters.Load_And_Check_StartLoadout(player);
    }
};

Mission CreateCustomMission(string path)
{
    return new CustomMission();
}

 

Share this post


Link to post
Share on other sites
  • 0

Не тот файл скинул

Скрытый текст

#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\ConnectDisconnectMessagesInChat.c"
#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\InfoMessages.c" 
#include "$CurrentDir:mpmissions\dayzOffline.chernarusplus\CustomSpawnPlayerConfig\Script.c"
#include "$CurrentDir:mpmissions\dayzOffline.chernarusplus\CustomSpawnPlayerConfig\Sets.c"
ref CustomSpawnPlayerConfig  My_Custom_Spawn_Parameters = new CustomSpawnPlayerConfig();
ref StartSetsPlayersConfig StartSetsPlayers = new StartSetsPlayersConfig();
void    SpawnObject ( string type, vector position, vector orientation )
{
    auto obj = GetGame().CreateObject( type, position );
    obj.SetPosition( position );
    obj.SetOrientation( orientation );
    vector roll = obj.GetOrientation();
    roll [ 2 ] = roll [ 2 ] - 1;
    obj.SetOrientation( roll );
    roll [ 2 ] = roll [ 2 ] + 1;
    obj.SetOrientation( roll );
    
}

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);
            }
        }
    }
    GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(My_Custom_Spawn_Parameters.Read_Update_Config, 120000, true); // Обновление настроек скрипта кастомных спавнов, 1 минута = 60000
    GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CustomInformation, TIME_Information_Repeat, true); 
}

class CustomMission: MissionServer
{
    void SetRandomHealth(EntityAI itemEnt)
    {
        if ( itemEnt )
        {
            int rndHlt = Math.RandomInt(55,100);
            itemEnt.SetHealth("","",rndHlt);
        }
    }

    override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
    {
        pos = My_Custom_Spawn_Parameters.Load_And_Check_Spawnpoints(identity, pos);
        characterName = My_Custom_Spawn_Parameters.Load_And_Check_SpawnSkin_Player(identity, characterName);
        Entity playerEnt;
        playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
        Class.CastTo(m_player, playerEnt);

        GetGame().SelectPlayer(identity, m_player);

        return m_player;
    }

    override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {    
        EntityAI itemTop;
        EntityAI itemEnt;
        ItemBase itemBs;
        EntityAI itemCreated = NULL;
        float rand;
        
        player.RemoveAllItems();
        
        itemCreated = player.GetInventory().CreateInInventory("Balaclava3Holes_Green");
                itemCreated = NULL;    
        
        itemEnt = player.GetInventory().CreateInInventory("Headtorch_Black");
        SetRandomHealth(itemEnt);
        
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand <= 0.125 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Black");    
                itemCreated = NULL;
            else if ( rand <= 0.25 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Green");    
                itemCreated = NULL;
            else if ( rand <= 0.375 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Blue");    
                itemCreated = NULL;
            else if ( rand <= 0.5 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Red");    
                itemCreated = NULL;
            else if ( rand <= 0.625 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Grey");    
                itemCreated = NULL;
            else if ( rand <= 0.75 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Orange");    
                itemCreated = NULL;
            else if ( rand <= 0.875 )
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Yellow");    
                itemCreated = NULL;
            else
                itemCreated = player.GetInventory().CreateInInventory("QuiltedJacket_Violet");    
                itemCreated = NULL;
                
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.5 )
                itemEnt = player.GetInventory().CreateInInventory("TrackSuitPants_Black");
            else
                itemEnt = player.GetInventory().CreateInInventory("TrackSuitPants_Blue");
        
        itemCreated = player.GetInventory().CreateInInventory("WorkingBoots_Grey");
        itemCreated = NULL;    
        
        itemTop = player.FindAttachmentBySlotName("Body");

        if ( itemTop )
        {
            itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
            if ( Class.CastTo(itemBs, itemEnt ) )
                itemBs.SetQuantity(4);

            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);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
            SetRandomHealth(itemEnt);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("KitchenKnife");
            SetRandomHealth(itemEnt);
            
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.25 )
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola");
        else if ( rand > 0.75 )
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Spite");
        else
            itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi");
        
        SetRandomHealth(itemEnt);
        
        itemEnt = itemTop.GetInventory().CreateInInventory("PeachesCan");
            SetRandomHealth(itemEnt);
        itemEnt = itemTop.GetInventory().CreateInInventory("PeachesCan");
            SetRandomHealth(itemEnt);
            
            }
            My_Custom_Spawn_Parameters.Load_And_Check_StartLoadout(player);
    }
};

Mission CreateCustomMission(string path)
{
    return new CustomMission();
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.