Jump to content
HogsMaws

Own Server Config

Recommended Posts

hi guys - I recently got my provate dayz server up and am new to this. i'm trying to get my friend into this game but there is a huge learning curve so I setup my own server so he can PvE for a while until he becomes comfortable with the game. my issue is that I am trying to edit the items that a freshie gets in the beginning. I have the right file and here is the code:

  EntityAI itemTop;
  EntityAI itemEnt;
  ItemBase itemBs;
  float rand;
  
  itemEnt = itemTop.GetInventory().CreateInInventory("M4-A1");
  itemBs = ItemBase.Cast(itemEnt);
  
  itemEnt = itemTop.GetInventory().CreateInInventory("Field_Backpack");
  itemBs = ItemBase.Cast(itemEnt);
      
  itemTop = player.FindAttachmentBySlotName("Body");
  
  if ( itemTop )
  {
   itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
   if ( Class.CastTo(itemBs, itemEnt ) )
    itemBs.SetQuantity(6);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("Compass");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("M4_OEBttstck");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("M4_PlasticHndgrd");
   
   itemEnt = itemTop.GetInventory().CreateInInventory("30Rnd_Standardized_Mag");
   itemBs = ItemBase.Cast(itemEnt);
    itemBs.SetQuantity(3);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("Standardized_Suppressor");
   itemBs = ItemBase.Cast(itemEnt);
      
   itemEnt = itemTop.GetInventory().CreateInInventory("AmmoBox_556x45_20Rnd");
   itemBs = ItemBase.Cast(itemEnt);
   itemBs.SetQuantity(10);
   
   SetRandomHealth(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("RoadFlare");
   SetRandomHealth(itemEnt);
  
   itemEnt = itemTop.GetInventory().CreateInInventory("StoneKnife");
   SetRandomHealth(itemEnt);
   
  }

 

the only thing that works is the compass, buttstock, handguard and just 20 rounds of the ammo. can anyone help me get this sorted out?

ty

 

Share this post


Link to post
Share on other sites

I'm not sure why you have the If statement in there -- I don't think it's necessary -- here's an example loadout from on my server -- just change my entries to match yours and add your extra items.  Also, for things like AmmoBox_556x45_20Rnd, you don't set a quantity for those -- if you want 10 boxes of ammo, list that entry 10 times.  The quantity value associated with an item are for things you can stack into one section of inventory slots like rags or burlap sacks.

    override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
 
        EntityAI itemEnt;
        ItemBase itemBs;
 
          player.RemoveAllItems();
 
        itemEnt = player.GetInventory().CreateInInventory("Rag");
        itemBs = ItemBase.Cast(itemEnt);
        itemBs.SetQuantity(2);
 
        itemEnt = player.GetInventory().CreateInInventory("TShirt_Blue");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("Jeans_BlueDark");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("MilitaryBoots_Black");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("Plum");
        itemBs = ItemBase.Cast(itemEnt);
    }

  • Like 1

Share this post


Link to post
Share on other sites

are we talking about 1.0?

can you post your entire init.c file contents? at this point I am just trying to spawn in with a backpack... I wanted an M4 too but its just too complicated.

Edited by HogsMaws
fix

Share this post


Link to post
Share on other sites

I am still using the 0.63 format for my init.c because I want to be able to adjust the weather values -- so far at least, it seems to work fine.  Here's the entire init.c that I'm using:

 
void main()
{
 
    Hive ce = CreateHive();
    if ( ce )
        ce.InitOffline();
 
    Weather weather = g_Game.GetWeather();
    weather.MissionWeather(true);
 
    weather.GetOvercast().SetLimits( 0.1 , 0.3 );
    weather.GetRain().SetLimits( 0.0 , 0.0 );
    weather.GetFog().SetLimits( 0.0 , 0.0 );
 
    weather.GetOvercast().SetForecastChangeLimits( 0.0 , 0.2 );
    weather.GetRain().SetForecastChangeLimits( 0.0 , 0.0 );
    weather.GetFog().SetForecastChangeLimits( 0.0 , 0.0 );
 
    weather.GetOvercast().SetForecastTimeLimits( 300 , 600 );
    weather.GetRain().SetForecastTimeLimits( 150 , 420 );
    weather.GetFog().SetForecastTimeLimits( 300.0 , 600.0 );
 
    weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
    weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
    weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
 
    weather.SetWindMaximumSpeed(3);
 
    GetGame().GetWorld().SetDate(2018, 6, 22, 16, 0);
}
 
class CustomMission: MissionServer
{
    void SetRandomHealth(EntityAI itemEnt)
    {
        int rndHlt = Math.RandomInt(40,100);
        itemEnt.SetHealth("","",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 itemEnt;
        ItemBase itemBs;
 
          player.RemoveAllItems();
 
        itemEnt = player.GetInventory().CreateInInventory("Rag");
        itemBs = ItemBase.Cast(itemEnt);
        itemBs.SetQuantity(2);
 
        itemEnt = player.GetInventory().CreateInInventory("TShirt_Blue");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("Jeans_BlueDark");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("MilitaryBoots_Black");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("Plum");
        itemBs = ItemBase.Cast(itemEnt);
    }
};
 
Mission CreateCustomMission(string path)
{
    return new CustomMission();
}

Share this post


Link to post
Share on other sites

I think that is the disconnect we are having. they changed stuff again...

Share this post


Link to post
Share on other sites
10 hours ago, drgullen said:

I am still using the 0.63 format for my init.c because I want to be able to adjust the weather values -- so far at least, it seems to work fine.  Here's the entire init.c that I'm using:

 
void main()
{
 
    Hive ce = CreateHive();
    if ( ce )
        ce.InitOffline();
 
    Weather weather = g_Game.GetWeather();
    weather.MissionWeather(true);
 
    weather.GetOvercast().SetLimits( 0.1 , 0.3 );
    weather.GetRain().SetLimits( 0.0 , 0.0 );
    weather.GetFog().SetLimits( 0.0 , 0.0 );
 
    weather.GetOvercast().SetForecastChangeLimits( 0.0 , 0.2 );
    weather.GetRain().SetForecastChangeLimits( 0.0 , 0.0 );
    weather.GetFog().SetForecastChangeLimits( 0.0 , 0.0 );
 
    weather.GetOvercast().SetForecastTimeLimits( 300 , 600 );
    weather.GetRain().SetForecastTimeLimits( 150 , 420 );
    weather.GetFog().SetForecastTimeLimits( 300.0 , 600.0 );
 
    weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
    weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
    weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
 
    weather.SetWindMaximumSpeed(3);
 
    GetGame().GetWorld().SetDate(2018, 6, 22, 16, 0);
}
 
class CustomMission: MissionServer
{
    void SetRandomHealth(EntityAI itemEnt)
    {
        int rndHlt = Math.RandomInt(40,100);
        itemEnt.SetHealth("","",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 itemEnt;
        ItemBase itemBs;
 
          player.RemoveAllItems();
 
        itemEnt = player.GetInventory().CreateInInventory("Rag");
        itemBs = ItemBase.Cast(itemEnt);
        itemBs.SetQuantity(2);
 
        itemEnt = player.GetInventory().CreateInInventory("TShirt_Blue");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("Jeans_BlueDark");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("MilitaryBoots_Black");
        itemBs = ItemBase.Cast(itemEnt);
 
        itemEnt = player.GetInventory().CreateInInventory("Plum");
        itemBs = ItemBase.Cast(itemEnt);
    }
};
 
Mission CreateCustomMission(string path)
{
    return new CustomMission();
}

i have added you to steam if you still need help ile lend a hand :D (well there was only 1 drgullen haha)

Share this post


Link to post
Share on other sites
1 hour ago, mrwolv said:

i have added you to steam if you still need help ile lend a hand :D (well there was only 1 drgullen haha)

Thanks, but it's @HogsMaws who was asking for the help, not me

Share this post


Link to post
Share on other sites

I was hoping that someone on 1.0 could post a working init file that has a backpack and a rifle as spawnable items.

Share this post


Link to post
Share on other sites
55 minutes ago, HogsMaws said:

I was hoping that someone on 1.0 could post a working init file that has a backpack and a rifle as spawnable items.

I am on 1.0 but I just don't use their init.c because of how they defined the weather.  I see where you got the if statement from now, my bad on that.  I noticed in your original post you are referencing the M4 and the Field Backpack before you have defined ItemTop -- that is part of the problem.  Also, in types.xml, the M4 is listed as M4A1 and not M4-A1.  There also is no item called Field_Backpack -- search for the word "bag" in the types.xml to see all the different backpacks as they are defined.

Here is the official 1.0 init.c file that came with 1.0.150000 -- use this and substitute their item names for other valid item names as defined in types.xml and it should work:


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);
    
    weather.GetRain().SetLimits( 0, 0.1 );

    //INIT ECONOMY--------------------------------------
    Hive ce = CreateHive();
    if ( ce )
        ce.InitOffline();

    //DATE RESET AFTER ECONOMY INIT-------------------------
    int year;
    int month;
    int day;
    int hour;
    int minute;

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

    if (((month <= 9) && (day < 20)) || ((month >= 10) && (day > 20)))
    {
        month = 9;
        day = 20;
        
        GetGame().GetWorld().SetDate(year, month, day, hour, minute);
    }
    
    //-----------------------X-mas
    array<vector> treePositions = { "6560.29 0 2462.12",
                                    "1652.66 0 14230.71",
                                    "3801.06 0 8847.76",
                                    "9442.32 0 8829.03",
                                    "7903.16 0 12576.52",
                                    "11617.75 0 14663.98",
                                    "12830.08 0 10115.18",
                                    "11221.94 0 12225.89",
                                    "3471.93 0 12988.33",
                                    "13933.42 0 13228.44",
                                    "12022.64 0 9082.89",
                                    "10468.54 0 2373.16",
                                    "2725.48 0 5288.75",
    };
    

    Object treeEntity;
    for ( int i=0; i < treePositions.Count(); i++ )
    {
        vector treePos = treePositions;
        float posY = GetGame().SurfaceY(treePos[0], treePos[2]);
        treeEntity = GetGame().CreateObject("ChristmasTree", Vector( treePos[0], posY, treePos[2]), false);

    }
}

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)
    {
        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)
    {
/*
        player.RemoveAllItems();

        EntityAI item = player.GetInventory().CreateInInventory(topsMissionArray.GetRandomElement());
        EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
        EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
*/
        EntityAI itemTop;
        EntityAI itemEnt;
        ItemBase itemBs;
        float rand;
        
        itemTop = player.FindAttachmentBySlotName("Body");
        
        if ( itemTop )
        {
            itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
            if ( Class.CastTo(itemBs, itemEnt ) )
                itemBs.SetQuantity(4);

            SetRandomHealth(itemEnt);
            
            itemEnt = itemTop.GetInventory().CreateInInventory("RoadFlare");
            SetRandomHealth(itemEnt);
        
            itemEnt = itemTop.GetInventory().CreateInInventory("StoneKnife");
            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);

        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);
    }
};
 
Mission CreateCustomMission(string path)
{
    return new CustomMission();
}

Share this post


Link to post
Share on other sites

I tried it and the knife, compass and the can opener is the only thing that spawned. the weaps just wont work. is there a spawnable table that needs to be edited? the cfgspawnabletypes.xml???

btw, how do I turn off weap deterioration and also make items spawn Pristine?

 

here is my init below:

-------------------------------------------------------------


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);
 
 weather.GetRain().SetLimits( 0, 0.1 );

 //INIT ECONOMY--------------------------------------
 Hive ce = CreateHive();
 if ( ce )
  ce.InitOffline();

 //DATE RESET AFTER ECONOMY INIT-------------------------
 int year;
 int month;
 int day;
 int hour;
 int minute;

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

    if (((month <= 9) && (day < 20)) || ((month >= 10) && (day > 20)))
    {
        month = 9;
        day = 20;
  
  GetGame().GetWorld().SetDate(year, month, day, hour, minute);
 }
 
 //-----------------------X-mas
 array<vector> treePositions = { "6560.29 0 2462.12",
         "1652.66 0 14230.71",
         "3801.06 0 8847.76",
         "9442.32 0 8829.03",
         "7903.16 0 12576.52",
         "11617.75 0 14663.98",
         "12830.08 0 10115.18",
         "11221.94 0 12225.89",
         "3471.93 0 12988.33",
         "13933.42 0 13228.44",
         "12022.64 0 9082.89",
         "10468.54 0 2373.16",
         "2725.48 0 5288.75",
 };
 

 Object treeEntity;
 for ( int i=0; i < treePositions.Count(); i++ )
 {
  vector treePos = treePositions;
  float posY = GetGame().SurfaceY(treePos[0], treePos[2]);
  treeEntity = GetGame().CreateObject("ChristmasTree", Vector( treePos[0], posY, treePos[2]), false);

 }
}

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)
 {
  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)
 {
/*
  player.RemoveAllItems();

  EntityAI item = player.GetInventory().CreateInInventory(topsMissionArray.GetRandomElement());
  EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
  EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
*/
  EntityAI itemTop;
  EntityAI itemEnt;
  ItemBase itemBs;
   
  float rand;
  
  itemTop = player.FindAttachmentBySlotName("Body");
  
  if ( itemTop )
  {
   itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
   if ( Class.CastTo(itemBs, itemEnt ) )
    itemBs.SetQuantity(6);
   
   itemEnt = player.GetInventory().CreateInInventory("HuntingKnife");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("Compass");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("CanOpener");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("Canteen");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("RoadFlare");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("UMP45");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("Mag_UMP_25Rnd");
   itemBs = ItemBase.Cast(itemEnt);
   
   itemEnt = itemTop.GetInventory().CreateInInventory("PistolSuppressor");
   itemBs = ItemBase.Cast(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");
  
  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");
      
 }
};
 
Mission CreateCustomMission(string path)
{
 return new CustomMission();
}

 

Edited by HogsMaws

Share this post


Link to post
Share on other sites

You need to spawn a backpack because you're running out of space which is why most of it isn't showing up.

Share this post


Link to post
Share on other sites
13 minutes ago, drgullen said:

You need to spawn a backpack because you're running out of space which is why most of it isn't showing up.

could you please help me? i want to spawn an alice camo pack but i think there was some name change recently? if you could tell me the name and where to put the code i would appreciate it immensely!

 

also, is there a way to make it daytime 24/7?

Edited by HogsMaws

Share this post


Link to post
Share on other sites

Do you not have the Server Files installed?  All the item types are in the types.xml file.  Search for the word alice and you'd find it: AliceBag_Black or AliceBag_Camo or AliceBag_Green are your choices.  Alternatively, search for the word bag and you'd find all the different types of backpacks that you can spawn.

To make it daytime 24/7, replace this:

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

    if (((month <= 9) && (day < 20)) || ((month >= 10) && (day > 20)))
    {
        month = 9;
        day = 20;
  
  GetGame().GetWorld().SetDate(year, month, day, hour, minute);
 }

with this:

GetGame().GetWorld().SetDate(2018, 6, 15, 12, 0);

That would make it noon on June 15th, 2018 all the time.

 

  • Like 1

Share this post


Link to post
Share on other sites

i do have the server files installed. i type those things in for the bag and it doesn't work. i think it's not in the spawnable tables xml. i think the spawnable tables is new?

Share this post


Link to post
Share on other sites

also, how do i made an item spawn more frequently? i.e. more likely?

Share this post


Link to post
Share on other sites

If you're talking about the cfgspawnabletypes.xml file, that is used to determine what cargo and attachments are chosen for the spawned items, so for example, the prison uniform jacket:

    <type name="PrisonUniformJacket">
        <cargo chance="0.33">
            <item name="Rope" chance="0.14" />
        </cargo>
    </type>

This says there's a small chance that you'll find some rope in the containers (i.e. pockets) of the jacket, otherwise, it'll be empty.

This file doesn't come into play though when you're talking about what initially spawns on your character -- that is defined in the init.c file.

As for spawning things more frequently, that is in the types.xml file -- increase the nominal amount of the item you want more of and adjust its min and max values as well and the loot economy should spawn more of that item over time.  You can also balance an increase with a decrease, meaning if you want more of one thing to show up somewhere, decrease the nominal amount of some other item that also spawns there.  This will increase the chance of the item you want more of showing up more often.

I don't know what else to tell you, dude.  If your items aren't showing up, you've either made a typo somewhere or you are asking for more container space than your player has on him -- every time my character hasn't spawned with what I expected, it was one of those two things -- I made a mistake or the backpack didn't have enough slots to store all the things I was asking to be spawned.

  • Like 1

Share this post


Link to post
Share on other sites

it has to do with the top garment code. i don't know where to inject the code for the backpack. the items are vying for space in my hoodie. the jeans stay empty so that leads me to believe that this code is filling the hoodie ONLY.

not sure how to circumvent that. ideas?

Share this post


Link to post
Share on other sites

To add the backpack, use player instead of itemTop:

   itemEnt = player.GetInventory().CreateInInventory("AliceBag_Camo");
   itemBs = ItemBase.Cast(itemEnt);

and then anything else you want to put on the character, use player as well:

   itemEnt = player.GetInventory().CreateInInventory("Canteen");
   itemBs = ItemBase.Cast(itemEnt);

   itemEnt = player.GetInventory().CreateInInventory("UMP45");
   itemBs = ItemBase.Cast(itemEnt);

etc.

  • Like 1

Share this post


Link to post
Share on other sites

thank you so much for your help.

i'm almost there, i just can't figure out why the quantity is not working.

e.g.

itemEnt = itemTop.GetInventory().CreateInInventory("PistolSuppressor");
itemBs = ItemBase.Cast(itemEnt);
itemBs.SetQuantity(6);

does the setquantity come before the itembase.cast?

Share this post


Link to post
Share on other sites

Is it possible that you are having problems because there not enough SLOTS in your TOP clothing item to hold all of the items?

 

 

Share this post


Link to post
Share on other sites
5 hours ago, HogsMaws said:

thank you so much for your help.

i'm almost there, i just can't figure out why the quantity is not working.

e.g.

itemEnt = itemTop.GetInventory().CreateInInventory("PistolSuppressor");
itemBs = ItemBase.Cast(itemEnt);
itemBs.SetQuantity(6);

does the setquantity come before the itembase.cast?

Set quantity only works for internal quantity values eg. items that have actual quantity like ammo and stackable items like rags. 

If you want to give out multiple items like a suppressor you have to create multiple in the inventory.

  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, philippj said:

Set quantity only works for internal quantity values eg. items that have actual quantity like ammo and stackable items like rags. 

If you want to give out multiple items like a suppressor you have to create multiple in the inventory.

ty :)

Share this post


Link to post
Share on other sites

will items fill up the backpack if no room in top & bottom?

nvm it does :)

Edited by HogsMaws

Share this post


Link to post
Share on other sites

not sure if anyone can do this but can i turn OFF deterioration? right now its set to degrade way too fast and its very unrealistic for a can opener to go from pristine to damaged from opening 10 cans...

Edited by HogsMaws

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

×