#Helping Verdant - Script and Mod Help
1 messages · Page 1 of 1 (latest)
So far all we've done is used drongos config generator to make the 9 random guys we want and exported it as a faction and packed it into a pbo
We read through this a bit and would like to do ours the same way of having each loadout in its own script and making the unit select a random one at spawn, we are just unsure where to really start
Hello. I am having trouble with random loadout upon start. I've got two questions; first one; I have nine .sqm files with loadouts in my mission root folder. I have three BLUFOR units. I want each BLUFOR to random select one of the nine .sqm loadout upon start, but I do not know how to make the an script to randomly select one of the nine .sqm l...
ok so first lets look at your configs
what we are going to make sure you have is the init eventhandler. if you don't have one on the units, you will have to make one
and we can go from there if you need to make one
This is one of our configs
Right now we have a lot of units in it with different outfits but the same gun
ok so we want to first create a script that will run on a unit when it is created
Okay
first we will import any parameters into our script that we will give externally
params [
["_unit", objNull, [objNull]]
];
if !(local _unit) exitWith {};
this makes anything we add to the brackets [] call myfunctionnamehere imported as _unit so we can use it in our code
then we make sure that the unit is local because we are going to be doing some commands that have a global effect (meaning it will show on every machine. if you don't filter what machine is running what, you will get overwrites - so we just make the machine that "owns" the unit run the code)
how will you be storing your loadouts?
lets just do variables for now
Okay
give me some uniform classes you want to use
Let me check through them real quick and grab a couple
grab a few uniforms, a few headgear, vests, backpacks
Okay
Here's a couple we want to use
"UK3CB_LNM_B_U_Shirt_Pants_05"
"Project_BJC_PCU_Cargo4"
"PP_West_Squadleader_2_pack"
"PP_West_Veteran_L1A1_6_pack"
UK3CB_ANA_B_H_Beret_GRN
assuming pack is backpacks?
Yes
"UK3CB_ANA_B_H_Beret_MAR"
My friend is grabbing a few more items
These are vests
"UK3CB_V_Chicom_Brown"
"rhs_belt_sks"
"V_BandollierB_blk"
"V_EOD_coyote_F"
"PP_West_rhs_weap_Izh18"
"PP_West_rhs_weap_l1a1_wood_rhsgref_acc_falMuzzle_l1a1"
"PP_West_UK3CB_M16A1"
So a lot of these have the name of our abreviated faction at the start of them, will that cause any issue?
yes because you used a generator. the generator is for basic stuff. you want to customize things on spawn so that takes more stuff
i need the base class
the direct parent class
How would I find that instead?
PP_West_Veteran_L1A1_3_pack: rhs_sidor
the parent class is after the : that you are importing into your class
actually
if you are changing the values of things in your own items, then give me those classes, which you already have above
Okay I think we found some of the actual guns now
i hate generators sometimes
you end up having to work backwards from all the extra crap it does
rhs_weap_Izh18
LIB_M1A1_Thompson
LIB_M1A1_Carbine
LIB_M1A1_Thompson
UK3CB_M14
UK3CB_M16A1
uk3cb_enfield_no4_walnut
oooooh i see what the generator did... its making new "backpacks" with stuff already inside
that's great for static loadouts, not for something you want randomized
Yea we were struggling with Alive generator before trying this one and this is the first time either of us have got into coding so its really new to us both, we really appreciate the help thus far
so what you have now, you can give units one of your "backpacks" which will have what you have defined in them
All we've been putting in the backpacks is firstaid kits and extra magazines depending on the gun
yeah but now if you randomize the gun, you can't do that cause your mag will be wrong
ok lets start over
i want you to make your loadouts using this and just put them in their own files for storage until we go to throw them in code:
[
[
"arifle_MX_GL_F","muzzle_snds_H", "acc_pointer_IR", "optic_Aco", // Primary weapon, (weapon items) silencer, pointer, optic
["30Rnd_65x39_caseless_mag", 30], // Loaded mag in primary muzzle, ammo count
["1Rnd_HE_Grenade_shell", 1], // Loaded mag in secondary muzzle, ammo count
"" // Bipod
],
[], // Secondary weapon info (see primary above)
[ // handGun info (see primary above)
"hgun_P07_F", "", "", "",
["16Rnd_9x21_Mag", 16],
[],
""
],
[ // Uniform
"U_B_CombatUniform_mcam", // Uniform Type
[ // Uniform Items
["FirstAidKit", 1], // Type, count
["30Rnd_65x39_caseless_mag", 2, 30] // Magazines are: Type, count, ammo
]
],
[ // Vest Info
"V_PlateCarrierGL_rgr", // Vest Type
[ // Vest Items
["30Rnd_65x39_caseless_mag", 3, 30]
]
],
[ // Backpack Info
"B_Carryall_ocamo", // Backpack type
[ // Backpack Items
["B_Carryall_khk", true], // A backpack inside the backpack (isBackpack is true, so item is defined in CfgVehicles)
["U_B_CombatUniform_mcam", false], // A uniform inside the backpack (isBackpack is false, so item is defined in CfgWeapons)
// A weapon inside the backpack
[["arifle_MX_ACO_pointer_F", "", "acc_pointer_IR", "optic_Aco", [], [], ""], 1]
]
],
"H_HelmetSpecB_blk", // Helmet
"G_Tactical_Clear", //Facewear glasses/bandanna etc
["Binocular", "", "", "", [], [], ""], // Weapon Binocular (follows same layout as other weapons above)
["ItemMap", "ItemGPS", "ItemRadio", "ItemCompass", "ItemWatch", "NVGoggles"] // AssignedItems ItemGPS can also be a UAV Terminal
]
really pay attention to your brackets
or what you can do is create the loadouts you want in the editor
then select your unit
and go to the debug menu and type
getUnitLoadout (get3DENMouseOver select 1)
and copy its return
it will load everything into this format above
Awesome, doing that now i'll let you know when it's done
I created a loadout and have the unit selected when I type that command in the debug menu I just get an error
okay
so then I got something like this, its correct?
one sec
[["UK3CB_M14","","","",["UK3CB_M14_20rnd_762x51",20],[],""],[],[],["UK3CB_TKA_I_U_CombatUniform_01_OLI",[["UK3CB_M14_20rnd_762x51",2,20]]],["UK3CB_ADA_B_V_TacVest_BLK",[["UK3CB_M14_20rnd_762x51",5,20]]],["UK3CB_B_Hiker",[["FirstAidKit",6],["UK3CB_M14_20rnd_762x51",13,20]]],"UK3CB_ANA_B_H_Beret_GRN","UK3CB_G_Bandanna_brown_check",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch",""]]
yuppers
okay, will do that a few more times and save them in a notepad for now
and put a header on them so you know what is what
yeah just a little note for yourself like, squad leader, team leader etc
well poo its almost 4am. so I'll leave you with that task for now
thank you so much for all your help, hopefully we can pick back up at some point tomorrow, we really were struggling on where to begin and you've been a great help
yeah i'll let this thread close and pick up in PMs later
Awesome, have a good night