Jump to content
nobodyslick

classname global edit

Recommended Posts

So, I use modules to populate some of my areas with soldiers. I can't get the kit range I want. So, I want to know what command I'd script to a trigger to change to loadout of the spawned troops.

 

removeHeadgear this;
removeGoggles this;
removeallweapons this;
removeallassigneditems this;
removeallcontainers this;
this addUniform "U_B_CTRG_1"; 
this addheadgear "H_HelmetB_light"; 
this addvest "V_PlateCarrierH_CTRG"; 
this addItem "FirstAidKit";
this addMagazines ["HandGrenade", 2];
this addMagazines ["MiniGrenade", 2];
this addmagazines ["30Rnd_65x39_caseless_mag", 1];
this addweapon "arifle_MX_black_F";
this addmagazines ["30Rnd_65x39_caseless_mag", 12];
this addmagazines ["30Rnd_65x39_caseless_mag_Tracer", 1];
this addMagazines ["SmokeShell", 1];
this addmagazines ["SmokeShellBlue", 1];
this addweapon "ItemCompass";
this addweapon "ItemMap";
this addweapon "ItemRadio";
this addweapon "ItemWatch";
this addPrimaryWeaponItem "optic_Hamr";
this addPrimaryWeaponItem "acc_pointer_IR";
this addWeapon "NVGoggles";
this assignItem "NVGoggles";
this assignItem "Binocular";
 

ect. ect. except I'd like to target a specific type of unit. Like all of the currently alive AAF Autorifleman across the map.

 

Thanks in advance if anyone is able to assist.

Share this post


Link to post
Share on other sites

bump. I figure it'll look like: 

 

{
    if(side _x == opfor) then {
_x this addWeapon "n";
    };
} foreach (allUnits); 

 

I just wonder how to designate a specific class of soldier. So I can efficiently switch load-outs on all of the units.
 

Share this post


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

So, I use modules to populate some of my areas with soldiers. I can't get the kit range I want. So, I want to know what command I'd script to a trigger to change to loadout of the spawned troops.

 

removeHeadgear this;
removeGoggles this;
removeallweapons this;
removeallassigneditems this;
removeallcontainers this;
this addUniform "U_B_CTRG_1"; 
this addheadgear "H_HelmetB_light"; 
this addvest "V_PlateCarrierH_CTRG"; 
this addItem "FirstAidKit";
this addMagazines ["HandGrenade", 2];
this addMagazines ["MiniGrenade", 2];
this addmagazines ["30Rnd_65x39_caseless_mag", 1];
this addweapon "arifle_MX_black_F";
this addmagazines ["30Rnd_65x39_caseless_mag", 12];
this addmagazines ["30Rnd_65x39_caseless_mag_Tracer", 1];
this addMagazines ["SmokeShell", 1];
this addmagazines ["SmokeShellBlue", 1];
this addweapon "ItemCompass";
this addweapon "ItemMap";
this addweapon "ItemRadio";
this addweapon "ItemWatch";
this addPrimaryWeaponItem "optic_Hamr";
this addPrimaryWeaponItem "acc_pointer_IR";
this addWeapon "NVGoggles";
this assignItem "NVGoggles";
this assignItem "Binocular";
 

ect. ect. except I'd like to target a specific type of unit. Like all of the currently alive AAF Autorifleman across the map.

 

Thanks in advance if anyone is able to assist.

 

Been there, done that.

Most efficient way would be to make use of the commands select, apply and getUnitLoadout/setUnitLoadout.

Using those commands you can get rid of all those lines and reduce it to a whopping two line snippet:

 

_newGear = getUnitLoadout player;
_needGearing = (allUnits select {typeOf _x == "I_Soldier_AR_F" AND _x getVariable ["GOM_fnc_needsNewGear",true]}) apply {_x setUnitLoadout _newGear;_x setVariable ["GOM_fnc_needsNewGear",false,true]};

To break it up:

First allUnits array is getting filtered for the matching type and if the unit did already receive its new gear.

Then apply comes into play on the filtered unit list and sets the new gear and a flag that the unit received gear, so you could loop this to catch all units that are being spawned during runtime.

 

Now here's the biggest advantage:

Using setUnitLoadout and getUnitLoadout lets you play dolls in the editor, equip units as you want them to be in your mission.

You can simply copy the entire loadout with a single command, save the result in an array and have it available in every mission, looks like this, taking the player as a dressing doll:

_newGear = getUnitLoadout player;
copyToClipboard str _newGear; //now hop in the text editor, hit CTRL+V and you can save that loadout in your .sqf file, taking init.sqf as example

 

This is how your init.sqf could look like:

//init.sqf
//here we declare the gear swapping as its own function for convenience
GOM_fnc_replaceGear = {
	params ["_newGear","_typeToReplace"];
	_needGearing = (allUnits select {typeOf _x == _typeToReplace AND _x getVariable ["GOM_fnc_needsNewGear",true]}) apply {_x setUnitLoadout _newGear;_x setVariable ["GOM_fnc_needsNewGear",false,true]};
true
};

//further down in the init.sqf you can define all your loadouts and name them, using the copytoClipboard command from the example above:
BadGuyLoadout1 = [["arifle_MXC_Holo_pointer_F","","acc_pointer_IR","optic_Holosight",["30Rnd_65x39_caseless_mag",30],[],""],[],["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],["U_B_CombatUniform_mcam_vest",[["FirstAidKit",1],["30Rnd_65x39_caseless_mag",2,30],["Chemlight_green",1,1]]],["V_Chestrig_rgr",[["30Rnd_65x39_caseless_mag",3,30],["16Rnd_9x21_Mag",2,16],["HandGrenade",2,1],["SmokeShell",1,1],["SmokeShellGreen",1,1],["SmokeShellBlue",1,1],["SmokeShellOrange",1,1],["Chemlight_green",1,1]]],["B_Kitbag_mcamo_Eng",[["ToolKit",1],["MineDetector",1],["SatchelCharge_Remote_Mag",1,1],["DemoCharge_Remote_Mag",2,1]]],"H_HelmetB_desert","",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]];

You only need to do above step once and be done with it, then whenever you want to replace the gear of a certain unit type it could look like this:

 

_replaceGear = ["I_Soldier_AR_F",BadGuyLoadout1] call GOM_fnc_replaceGear;

This way every AAF autorifleman will receive BadGuyLoadout1.

No need for dozens of lines all over the place.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

Thanks. I was so used to just dropping stuff into individual unit int lines. Did it since Operation Flashpoint.

 

The modules force me to edit units after they've spawned.

 

Basically my goal is to slightly tweak the loadout of AAF to where they're feasible modern units. Without having a ton of mods so i can release a mission with 2018 level gear. 

 

It's a complicated one. (dark too) Has a story. I'm using the Malden Island because it can be fully populated and not neutralize the playability of a mission. Basically it's a lone wolf mission. It just irks me having these caseless weapons. (I actually like them usually. However, I'm wanting to make this a period piece so...)

 

The objective is to create an accessible mission that persons who did not mod their game extensively can play it and be immersed. I'm even experimenting with my own voice acting. My scenario is actually pretty slick. I even have the PSD of the target taking good positions. Multiple triggers to make the target attempt to evade and seek greater protection.

 

I'm torn as if to keep it really simple and just send a lone wolf operator in. Then have him control drones to force multiply enough to take out an army. AAF is great because it is so contemporary. The only break in the suspension of disbelief is the mk200 LMG. The sounds for the M249 are amazing. The sound of the thing peeling rounds at you is amazing.

 

As a thanks I'll update here or pm you completed work. It's a long project since I'm inefficient and working real jobs.

 

Anyway, my love of the 249 is huge. Almost every game I play it's what I'm using. Sadly, I don't own one in the real. Just an FN Scar Heavy. 

 

unrelated but enjoy one of my best replays. I'm gonna string em together on youtube eventually. This one is funny because I got glitched out and wasn't able to group with my friends so we had to communicate our positions in a much more real world fashion. (especially since my friend's audio was down) I actually msg him making sure I wasn't able to wax my own crew.

 

Love arma. I've played since I was 14. 6500 hrs in 3 since 2013. I play more than I build. However, I wanted to apply some minor real world knowledge to making a badass scenario that might actually feel like you are facing down real people. (I'm abusing individually named units and (psd_1 setpos "up";) ect. ect. ect.

 

Seriously, thanks so much for your reply. I wasn't expecting one actually. I'll start work when I wake up tomorrow. (I'll prolly need to reread this post a few times to make sure I don't bone it up.) Goodnight/day.

 

https://plays.tv/video/59487722221426d64c/4-minutes-25-seconds-of-snap-snap?from=search&search=nobodyslick  

  • Like 1

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

×