Jump to content
Sign in to follow this  
gigiwwa

Need Help with Init.c for custom loadout on Banov

Recommended Posts

Do all the other items spawn fine?

I can't really find any issues with the file at first glance.

I would remove the 'SetRandomHealth' below the battery to see if that's what causing the issue.

Maybe try to spawn only the battery to confirm that it's actually possible.

And ofc make sure that there actually is a 'Battery9v' in your Banov types.xml.

That's the best advice I can give atm.

Best of luck.

 

-indij

Share this post


Link to post
Share on other sites

Allright. So, since the bandage and chemlight do not spawn either, it seems there's some other issue.

I'll give it a second look and see if I can pinpoint the problem.

Share this post


Link to post
Share on other sites

When comparing to my own init, I only notice a couple of things.

Mine doesn't have the '//INIT WEATHER BEFORE ECONOMY' and the '//Loot spawn Creator' part, so I don't know if there are any issues with these.

The '//DATE RESET' part is done in reverse in my init, but I can't find any syntax errors in yours, so that should be fine.

The 'SetRandomHealth' is done with integers in yours, whereas it's done with floats in the Chernarus init. You can try to use floats to see if that's the issue:

Spoiler

void SetRandomHealth(EntityAI itemEnt)
    {
        if ( itemEnt )
        {
            float rndHlt = Math.RandomFloat( 0.45, 0.65 );
            itemEnt.SetHealth01( "", "", rndHlt );
        }
    }

I would try to remove all items and only spawn one, while trying to make it work. Maybe something like this:

Spoiler

//Vanilla Banov Init.c
// Thank you for using my map
void main()
{        
    //INIT WEATHER BEFORE ECONOMY INIT------------------------
    //Banov 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();
    
    //Loot spawn Creator
    //GetCEApi().ExportProxyData(vector.Zero, 100000); //Loot
    //GetCEApi().ExportClusterData(); //Fruit

    //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.55, 1.00 );
            itemEnt.SetHealth01( "", "", rndHlt );
        }
    }

    override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string 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;
        float rand;

        itemTop = player.FindAttachmentBySlotName("Body");

        itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");

       
    }
};

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

If this doesn't work, I'm not sure I can find the problem with the init file.

Are you sure that you not using the chernarusplus missions in your serverDZ.cfg? (I guess banov should be something like template="dayzOffline.banov")

And are you sure it is not the init in the \DayZServer\mpmissions\dayzOffline.chernarusplus you are editing?

And did you make sure that everything you're trying to spawn is actually in the types.xml in your banov missions folder?

These may be silly questions, but I'm at a bit of a loss tbh.

-indij

Share this post


Link to post
Share on other sites

Hi Indiji, thank you for trying,

I do use the right Template for banov empty.banov.

I looked at a few guide's and videos and it didn't look to complicated, but since I never got it working I figured I ask the community.

maybe it just works only on chernorusplus.

 

 

 

Edited by gigiwwa

Share this post


Link to post
Share on other sites

So it seems starting gear is handled different in expansion, if I understand correct. Good to know.

Thanks for posting the solution. Will certainly be useful.

-indij

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×