Jump to content
Wiket

Any idea how to make this work?

Recommended Posts

I am a VERY novice scripter and I normally wouldn't ask for help but I cant figure out how to pull a variable name from an array in this instance (the classnames are from a mod I have on)

scrap = ["ar_scrap_airfilter","ar_scrap_old_cartridges","ar_things_weapon_parts_low","ar_things_weapon_parts_med","ar_things_weapon_parts_high","ar_scrap_electronic","ar_scrap_can_empty","ar_scrap_scrapmetal","ar_scrap_rustymetal","ar_scrap_rustycomponent","ar_scrap_gasmask","ar_scrap_rubbertube","ar_things_boards","ar_things_bottle_plastic_empty”,ar_things_rope_old","ar_things_hook","ar_things_bottle_glass_empty","ar_scrap_assaultrifle","ar_scrap_submachinegub","ar_scrap_pistol","ar_scrap_rifle","ar_garbage_tatteredpaper","ar_clothes_bundle_small","ar_clothes_diverpack","ar_clothes_oldrubberboots","ar_clothes_olduniform","ar_clothes_oldleatherbag","ar_containers_machineparts","ToolKit"];  
private _box1 = ["scraplo", "scraplo_1", "scraplo_2", "scraplo_3"];
[SelectRandom _box1] addItemCargo [select Random scrap,1];

or instead could I do it using thisList in a trigger area? Still causes same issue though
 

Share this post


Link to post
Share on other sites

are the scraplo, scraplo_1 etc object names in the editor?

 

if so something like this should work:

 

private _box1 = [scraplo, scraplo_1, scraplo_2, scraplo_3];    // Note no quotes, each word is a variable name

(SelectRandom _box1) addItemCargo [selectRandom scrap,1];

 

not sure about addItemCargo, it depends on what type of object you are adding the gear

 

  • Like 1

Share this post


Link to post
Share on other sites
16 hours ago, Wiket said:

 could I do it using thisList in a trigger area? Still causes same issue though

thisList refers to a preset condition of your trigger (like: BLUFOR Present) . It's not a custom list.

Share this post


Link to post
Share on other sites

Thanks worked perfectly!

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

×