Understanding fn_refillbox

  • Offline CTA
  • Fresh Spawn
  • *
  • Posts: 2

Understanding fn_refillbox

« posted: Jun 06, 2022, 11:10 AM »
I'm seeming to have trouble understanding the way refill box takes parameters and the way that RANDOM_BETWEEN works on items

As far as I'm aware this line should add 0-2 rifles and 3-7 mags
["wep", "CUP_arifle_AK101", RANDOM_BETWEEN(0,2), RANDOM_BETWEEN(3,7)]

Will using this line spawn 0-2 rifles and 0 mags?
["wep", "CUP_arifle_AK101", RANDOM_BETWEEN(0,2)]

I assume I am understanding this part correctly so far

This is where I'm having trouble understanding the way to use RANDOM_BETWEEN

["itm", [
      ["V_PlateCarrier1_rgr", "V_PlateCarrier1_blk", "V_PlateCarrierIA1_dgtl"], // Lite
      ["V_PlateCarrier2_rgr", "V_PlateCarrier2_blk", "V_PlateCarrierIA2_dgtl"], // Rig
      ["V_PlateCarrierSpec_rgr", "V_PlateCarrierSpec_blk", "V_PlateCarrierSpec_mtp"], // Special
      ["V_PlateCarrierGL_rgr", "V_PlateCarrierGL_blk", "V_PlateCarrierGL_mtp", "V_PlateCarrierIAGL_dgtl", "V_PlateCarrierIAGL_oli"] // GL
], RANDOM_BETWEEN(1,4)]

I don't understand how the array gets chosen, does it choose between 1-4 arrays of items at random and then spawn that many? Does it choose 1 array at random and then choose between 1-4 items at random from that array? Does it choose a random between all the arrays to spawn between 1-4 of? I can't seem to understand the way this works, I've tried testing multiple times but due to it being random I can't be certain how it works exactly, thanks for any help







  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2650

Re: Understanding fn_refillbox

« Reply #1 posted: Jun 12, 2022, 10:13 PM »
One element is randomly selected in the array. If the item itself happens to be another array, then an item inside that array will be selected at random. You can nest as many arrays as your want. The point of this mechanic is to allow different variants of a particular item to be selected at random without affecting the odds of other main items. Take this line for example:

Code: [Select]
["wep", [["MMG_02_sand_F", "MMG_02_camo_F", "MMG_02_black_F"], ["MMG_01_tan_F", "MMG_01_hex_F"]], RANDOM_BETWEEN(2,4), RANDOM_BETWEEN(2,4)],
First, it will randomly pick between Navid and SPMG arrays. Then, it will it pick a random camo in that array.