Jump to content
Smokeydapot

Custom loadout Loose ammo

Recommended Posts

So i'm making some custom loadouts in the init.c file but i'm coming up against an issue and that is how to add an ammo stack other than the max rounds you get from a box of ammo.

I have been trying a similar method from the init file that adds a number of Rags E.g.

   itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
   if ( Class.CastTo(itemBs, itemEnt ) )
   itemBs.SetQuantity(0.5);

 

To hopefully create a stack of ten 308 rounds but this just creates a full stack of 20, I have also tried:

 itemBs.SetQuantity(10);

But this also creates a full stack of ammo, Does anyone have a solution that creates a stack of loose ammo other than a full box stack of ammo ?

Any help is appreciated.

Edited by Smokeydapot
fixed typo

Share this post


Link to post
Share on other sites

@aussie battler thanks for the reply but I already tried this method also with no success as this also creates a full stack of 20 rounds and not an intended 10 rounds.

Methods tried:

   itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
   if ( Class.CastTo(itemBs, itemEnt ) )
   itemBs.SetQuantity(0.5);

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

itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
   if ( Class.CastTo(itemBs, itemEnt ) )
   itemBs.SetQuantity(10);

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

itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
 itemBs = ItemBase.Cast(itemEnt);
 itemBs.SetQuantity(0.5);

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

itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
 itemBs = ItemBase.Cast(itemEnt);
 itemBs.SetQuantity(10);

 

While this works with rags this method doesn't work for ammo stacks sadly, I did consider also setting a negative value to remove an amount of ammo as a positive value may have been ignored but setting a negative value just removes the ammo stack.

 

Methods tried:

   itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
   if ( Class.CastTo(itemBs, itemEnt ) )
   itemBs.SetQuantity(-0.5);

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

itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
   if ( Class.CastTo(itemBs, itemEnt ) )
   itemBs.SetQuantity(-10);

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

itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
 itemBs = ItemBase.Cast(itemEnt);
 itemBs.SetQuantity(-0.5);

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

itemEnt = itemTop.GetInventory().CreateInInventory("Ammo_308Win");
 itemBs = ItemBase.Cast(itemEnt);
 itemBs.SetQuantity(-10);

Edited by Smokeydapot
additional methods tested

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

×