Member
Last active 8 years ago
Thanks for helping people you dont know.
Sharing knowledge is a very honorable thing to do.
Everything works as expected and I can finally go to sleep without having to google "Arma 3 Loadout scripts" :P
Best wishes and thank you again very much
Hi tried your code and still ran into the issue that no Units were spawning with the preset loadout.
I looked into the RPT file too see whats going on and found these 2 lines multiple times:
Error in expression < then { [_x] execVM "FalLoadout.sqf"}; } forEach units group _unit; { if (typ> Error position: <} forEach units group _unit; { if (typ> Error Missing { File mpmissions\__cur_mp.lingor3\ForceLoadouts.sqf, line 8 Error in expression < then { [_x] execVM "FalLoadout.sqf"}; } forEach units group _unit; { if (typ> Error position: <} forEach units group _unit; { if (typ> Error Missing {
@SpyderBlack723
Thanks it works now!
But I do have another Question, when I copy and paste this code
{
if (typeof _x == "CUP_O_TK_Soldier_AR") then {
[_x] execVM "RpkLoadout.sqf";
// debug
systemchat format ["Replacing unit loadout: %1", _x];
};
} forEach units group _unit;
into the Loadouts.sqf to add another Unit, the Script doesnt work anymore at all.
Here is my Loadouts.sqf at it its atm (apologize my code structure):
params ["_unit"]; if (typeof _x == "CUP_O_TK_Soldier_AA","CUP_O_TK_Soldier_AAT","CUP_O_TK_Soldier_AMG","CUP_O_TK_Soldier_HAT","CUP_O_TK_Commander", "CUP_O_TK_Engineer","CUP_O_TK_Medic","CUP_O_TK_Soldier","CUP_O_TK_Soldier_Backpack","CUP_O_TK_Soldier_LAT", "CUP_O_TK_Soldier_AT","CUP_O_TK_Soldier_FNFAL_Night","CUP_O_TK_Spotter","CUP_O_TK_Soldier_SL","CUP_O_TK_SpecOps_TL", "CUP_O_TK_Story_Aziz") then { [_x] execVM "FalLoadout.sqf"}; } forEach units group _unit; { if (typeof _x == "CUP_I_TK_GUE_Soldier_AA","CUP_I_TK_GUE_Soldier_AR","CUP_I_TK_GUE_Demo","CUP_I_TK_GUE_Soldier", "CUP_I_TK_GUE_Soldier_AAT","CUP_I_TK_GUE_Soldier_AT","CUP_I_TK_GUE_Mechanic","CUP_I_TK_GUE_Soldier_TL", "CUP_I_TK_GUE_Commander") then { [_x] execVM "AkmLoadout.sqf"}; } forEach units group _unit; { if (typeof _x == "CUP_O_TK_Crew","CUP_O_TK_Officer","CUP_O_TK_Pilot") then { [_x] execVM "ak74uLoadout.sqf"}; } forEach units group _unit; { if (typeof _x == "CUP_I_TK_GUE_Soldier_GL","CUP_I_TK_GUE_Soldier_AK_47S") then { [_x] execVM "AkmGlLoadout.sqf"}; } forEach units group _unit; { if (typeof _x == "CUP_O_TK_Soldier_AR") then { [_x] execVM "RpkLoadout.sqf"}; } forEach units group _unit;
I tried to define multiple classes for the "x_ == " but that messed the whole script up.
Is there a way to define mutiple soldier classes who use the same loadout without having to CnP everything with just one changed string?
@Murdock
Thank you for replying!
I did take a look at the Script Snippets and since im running multiple factions I try to use the class names of the units directly (e.g "CUP_O_TK_Soldier") rather than their role (Grenadier, Medic etc.).
Still had no luck with it.
Hello,
I have tried to run a script on my dedicated ALiVE server which forces a certain Loadout for the defined Soldiers classes (Just replacing the Gun from the Soldier).
So far it does work on Editor placed units but I had no luck with ALiVE spawned units.
Sadly I couldnt figure it out myself and with the help of the Interwebs, so I hope you guys can help me out.
I've tried using the following in description.ext based on what I found from others:
class Extended_Init_EventHandlers { class Man { init = "_this call (compile preprocessFileLineNumbers 'ForceLoadouts.sqf')"; }; };
ForceLoadouts.sqf:
private "_this"; _this = _this select 0; { if (typeof _x == "CUP_O_TK_Soldier_AR") then { [_x] execVM "RpkLoadout.sqf"}; } forEach units group _this;
RpkLoadout.sqf:
//Rpk Loadout waitUntil {!isNull player}; _unit = _this select 0; removeAllWeapons _unit; _unit addMagazines ["hlc_45Rnd_545x39_t_rpk", 4]; _unit addWeapon "Weapon_hlc_rifle_rpk74n"; if(true) exitWith{};
Any help is greatly appreciated!