Перейти к публикации
Поиск в
  • Дополнительно...
Искать результаты, содержащие...
Искать результаты в...
  • Нужна помощь?

    Создайте тему в соответствующем разделе
    Не нужно писать всё в чат!
  • Загляните на торговую площадку

    Там вы можете купить
    всё что касается игровых серверов
  • Не хотите бан?

    Пожалуйста, ознакомьтесь с нашими правилами
    Не нарушайте порядок!
  • Продаёте или покупаете?

    Пользуйтесь услугами гаранта
    Мы сделаем вашу сделку безопасной
  • 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);
    }

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Рекомендованные сообщения






  • 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();
}

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0

@inozemcevудали

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

My_Custom_Spawn_Parameters.Load_And_Check_StartLoadout(player);

и заработает стартовый сет

Изменено пользователем irkutsk38 (история изменений)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 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();
}

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас

×
×
  • Создать...

Важная информация

Используя этот сайт, вы автоматически обязуетесь соблюдать наши Правила и Политика конфиденциальности.
Чтобы сделать этот веб-сайт лучше, мы разместили cookies на вашем устройстве. Вы можете изменить свои настройки cookies, в противном случае мы будем считать, что вы согласны с этим.