Comrades in Arms Discussion Board
Doing custom loadouts, the easy way with @fhq_debug - Printable Version

+- Comrades in Arms Discussion Board (http://forum.ciahome.net)
+-- Forum: Comrades in Arms Life (http://forum.ciahome.net/forumdisplay.php?fid=3)
+--- Forum: Mission Making (http://forum.ciahome.net/forumdisplay.php?fid=8)
+--- Thread: Doing custom loadouts, the easy way with @fhq_debug (/showthread.php?tid=2487)

Pages: 1 2 3


Re: Doing custom loadouts, the easy way with @fhq_debug - Outlawz7 - 08-18-2014

Actually, I did add something of my own at the end of the loadouts in that particular mission:

Code:
private ["_unit", "_backpack"];

/* Replace _this below if you want to call this script differently */
_unit = _this;

if (!isNull _unit) then {
    removeAllWeapons _unit;
    removeAllItems _unit;
    removeBackpack _unit;
    removeAllAssignedItems _unit;
    removeUniform _unit;
    removeVest _unit;
    removeHeadgear _unit;
    removeGoggles _unit;

    /* Other gear, goggles, vest, uniform */
    _unit forceAddUniform "U_B_CTRG_3";
    _unit addVest "V_PlateCarrierL_CTRG";
    _unit addHeadgear "H_HelmetSpecB_paint2";
    _unit addGoggles "G_Bandanna_tan";

    /* Magazines and weapons in main inventory */
    _unit addMagazineGlobal "30Rnd_556x45_Stanag";
    _unit addMagazineGlobal "1Rnd_HE_Grenade_shell";
    _unit addMagazineGlobal "NLAW_F";
    _unit addMagazineGlobal "11Rnd_45ACP_Mag";
    _unit addWeaponGlobal "arifle_Mk20_GL_plain_F";
    _unit addWeaponGlobal "launch_NLAW_F";
    _unit addWeaponGlobal "hgun_Pistol_heavy_01_F";

    /* Weapons attachments and magazines */
    _unit addPrimaryWeaponItem "muzzle_snds_M";
    _unit addPrimaryWeaponItem "acc_pointer_IR";
    _unit addPrimaryWeaponItem "optic_Aco";
    _unit addHandgunItem "muzzle_snds_acp";
    _unit addHandgunItem "optic_MRD";

    /* Assigned items (maps, radios, NV Goggles, etc */
    _unit linkItem "ItemMap";
    _unit linkItem "ItemCompass";
    _unit linkItem "ItemWatch";
    _unit linkItem "ItemRadio";
    _unit linkItem "ItemGPS";
    _unit addWeapon "NVGoggles";

    /* Magazines and weapons in vest */
    _vest = vestContainer _unit;
    _vest addMagazineCargoGlobal ["HandGrenade", 2];
    _vest addMagazineCargoGlobal ["11Rnd_45ACP_Mag", 4];
    _vest addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 1];
    _vest addMagazineCargoGlobal ["1Rnd_HE_Grenade_shell", 5];
    _vest addItemCargoGlobal ["FirstAidKit", 5];

    /* Magazines and weapons in uniform */
    _uniform = uniformContainer _unit;
    _uniform addMagazineCargoGlobal ["SmokeShell", 2];
    _uniform addMagazineCargoGlobal ["Chemlight_green", 4];
    _uniform addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 2];
    _uniform addMagazineCargoGlobal ["1Rnd_HE_Grenade_shell", 2];

    _unit selectWeapon "this";
    reload _unit;

    /* Backpack */
    _unit addBackpack "B_AssaultPack_rgr";
    _backpack = unitBackPack _unit;
    clearMagazineCargoGlobal _backpack;
    clearWeaponCargoGlobal _backpack;

    _backpack addMagazineCargoGlobal ["NLAW_F", 2];

_randomSpeaker = ["Male01ENGB","Male02ENGB","Male03ENGB","Male04ENGB","Male05ENGB"] call bis_fnc_selectRandom;
_unit setSpeaker _randomSpeaker;

};

Could that wreck it?


Re: Doing custom loadouts, the easy way with @fhq_debug - Alwarren - 08-18-2014

(08-18-2014, 08:20 PM)Outlawz7 link Wrote: Could that wreck it?

No, I really couldn't think of a reason why it would.


Re: Doing custom loadouts, the easy way with @fhq_debug - Varanon - 08-18-2014

Did you call these scripts on the machine that the unit is local to ?

The problem might be locality, since it works in single player... You must call the loadout scripts on the machine the object is local to (and only those), otherwise, it won't work.



Re: Doing custom loadouts, the easy way with @fhq_debug - alias - 08-18-2014

There is a way to deal with ammo also loadout via  fhq_debug?


Re: Doing custom loadouts, the easy way with @fhq_debug - Varanon - 08-19-2014

(08-18-2014, 10:32 PM)alias link Wrote: There is a way to deal with ammo also loadout via  fhq_debug?

There is a button in FHQ DebugConsole that will save a script that will restore the inventory of the units as it was when the button was pressed. I've included another function to edit the loadout, but it's limited. You can also use Arsenal and once done, use the function to create the script. The resulting script is better than arsenal, since the latter just assumes that the loadout should be added to player


Re: Doing custom loadouts, the easy way with @fhq_debug - alias - 08-19-2014

I've tested the script and loadout system, bu at that time i didn't find a way to change magazines to replace for instance normal magazines with tracers.


Re: Doing custom loadouts, the easy way with @fhq_debug - Varanon - 08-19-2014

(08-19-2014, 12:57 PM)alias link Wrote: I've tested the script and loadout system, bu at that time i didn't find a way to change magazines to replace for instance normal magazines with tracers.

I don't know what you mean ? The console can only save the loadout, or you can modify it (ammo isn't handled by the console's customization).

You can modify the scripts after you pasted them from clipboard, to replace the magazines with tracers. Apart from that, you can use Arsenal to do that as well, and save afterwards with the console.

I guess I'll add a shortcut to Arsenal into the console, too


Re: Doing custom loadouts, the easy way with @fhq_debug - Outlawz7 - 08-19-2014

(08-18-2014, 09:36 PM)Varanon link Wrote: Did you call these scripts on the machine that the unit is local to ?

[this, "loadout.sqf"] call OTL7_fnc_safeAddLoadout;

in each unit's init field.

Also I exported a loadout from Arsenal and added it the same way and it didn't seem to have issues in dedicated (aside from one mag less in inventory as they were loaded into their weapons), then again I didn't have issues with loadouts exported from FHQ debug until now, either.


Re: Doing custom loadouts, the easy way with @fhq_debug - alias - 08-19-2014

The loadout script works fine. I have no problems on test, when hosting, but on dedicated if i try to pick up a weapon (NATO SF for instance) the game crashes. This is what i use in the unit init:

Code:
this call compile preprocessFileLineNumbers "Scripts\fia_at.sqf";

Where fia_at.sqf is the script generated in FHQ debug.


Re: Doing custom loadouts, the easy way with @fhq_debug - Varanon - 08-19-2014

(08-19-2014, 05:20 PM)alias link Wrote: I have no problems on test, when hosting, but on dedicated if i try to pick up a weapon (NATO SF for instance) the game crashes.

I had that problem in Choplifter: If I picked up a weapon, I'd crash. Turns out that I had two pistols so the script was running too often.

What you should do is only run the script when the unit is local to the machine. Use Alwarren's safeAddLoadout function here


Re: Doing custom loadouts, the easy way with @fhq_debug - alias - 08-19-2014

Thanks Smile, i''ll give it a try!


Re: Doing custom loadouts, the easy way with @fhq_debug - Lightspeed - 06-07-2015

Can someone plz explain.
If loading the units loadouts using the script created by debug console placed in the init file of each unit

Then

What is the purpose of the safe_addloadout function?




Re: Doing custom loadouts, the easy way with @fhq_debug - Alwarren - 06-07-2015

(06-07-2015, 01:54 PM)Lightspeed link Wrote: Can someone plz explain.
If loading the units loadouts using the script created by debug console placed in the init file of each unit

Then

What is the purpose of the safe_addloadout function?

Scripts can be executed multiple times. For example, the init field of units is executed every time a player JIP's. And unless you take precautions, the init.sqf will run the same every time a player JIP's. That basically means that every time a player JIP's, you run the loadout script again.

FHQ_fnc_safeAddLoadout only ensures that the script runs once. Thus, it will never overwrite a loadout on JIP.


Re: Doing custom loadouts, the easy way with @fhq_debug - Lightspeed - 06-07-2015

ok now i understand. thanks.