Jump to content
Sign in to follow this  
sproyd

How to swap out guns on mission load

Recommended Posts

So I'm spawning 3 divers but the default diver gun sucks - it has no sights and I'm pretty sure the default UW ammo is glitched and doesn't damage anything (it looks like it falls out of the barrel!!). I don't need my divers to shoot underwater so I have two questions - one of which is editor related

1) The new 6.5mm caseless default BLUFOR guns - from a reality point of view do you guys think these would work above water after being submerged for say 10 minutes in salt water at depths of up to say 20m?

My thoughts are yes - given these are standard NATO BLUFOR issue they would have gone through a rigorous RFP process. I suspect of course that a gun immersed in salt water would need to be rinsed within the day but I'm talking about immediate use for say a 30 min op. Open to thoughts of course. Same goes for the ammo.

2) How do I spawn the divers with these guns/attachments/ammo? I take it I use the init code box for each unit but what's the code to add guns and ammo?

Share this post


Link to post
Share on other sites

Easiest way to change loadouts is with an external script like this:

removeAllWeapons user;

removeAllAssignedItems user;

removeVest user;

removeHeadgear user;

removeUniform user;

removeBackpack user;

user addUniform "U_B_Wetsuit";

user addBackpack "B_FieldPack_blk_DiverTL";

pack = unitBackpack user;

clearMagazineCargo pack;

pack addItemCargoGlobal ["U_B_CombatUniform_mcam_vest",1];

pack addItemCargoGlobal ["V_PlateCarrier2_rgr",1];

pack addItemCargoGlobal ["H_HelmetB",1];

pack addMagazineCargoGlobal ["30Rnd_65x39_caseless_green",6];

pack addMagazineCargoGlobal ["16Rnd_9x21_Mag", 3];

user addWeapon "hgun_P07_F";

user addWeapon "arifle_Khaybar_F";

user linkItem "V_RebreatherB";

user linkItem "ItemMap";

user linkItem "ItemCompass";

user linkItem "ItemWatch";

hint "SEAL Insertion Loadout Applied";

Save that in the mission folder as a *.sqf file and then in the init line of your unit call it like this:

script = [] execVM "myFirstScript.sqf";

Share this post


Link to post
Share on other sites

Remember though the default Diver gun is the only one useable underwater.

Share this post


Link to post
Share on other sites
Remember though the default Diver gun is the only one useable underwater.

No you can put in standard 5.56 and it works above water. I don't think the underwater rounds work above ground though.

Edit: Sorry misread your post

Edited by sproyd

Share this post


Link to post
Share on other sites

Hey,

First im pretty new to this stuff :)

Soo... i maked a new .txt --> wrote down the commends u posted --> saved as first.sqf --> open the init.sqf and wrote down...script = [] execVM "first.sqf" & saved --> get back into the editor and tryed it out.

Only the "hint...SEAL Insertion Loadout Applied..." show´s up and nothing more, the diver´s got the same loadout as usual ;(

Did i something wrong or is there a trick ? :)

Share this post


Link to post
Share on other sites

@Skymir

You need to replace the "user" with "player" (without quotation marks).

Share this post


Link to post
Share on other sites

If you just copied and pasted my code you need to make sure that your player unit is named "user" or if you want change every reference of user to "player" in my script. Make sense?

Share this post


Link to post
Share on other sites

yes i just copied you code, now i tried a bit around to see what´s difference ... and yeah... now it makes sense :)

Thanks for the fast replay guys :)

Share this post


Link to post
Share on other sites
Easiest way to change loadouts is with an external script like this:

Thanks pedwards3x.

However, I think the easiest way is to use the init field in the editor.

My init text that worked (and you can copy, paste this regardless of unit name).

this moveincargo boat; removeAllWeapons this; pack = unitBackpack this; this addMagazines ["30Rnd_65x39_caseless_mag",7]; this addMagazines ["16Rnd_9x21_Mag",3]; this addWeapon "arifle_MXC_ACO_flash_grip_mzls_F"; this addWeapon "hgun_P07_snds_F"; pack addItemCargo ["NVGoggles",1]; pack addItemCargo ["acc_pointer_IR",1];

What this does (in order) - moves the unit to start in the boat, removes all weapons, create a variable called pack which is the unit's backpack. Add some 6.5mm and 9mm mags to the player (not the player's pack), then add a primary and sidearm (I found if you add these before you add ammo they won't be loaded with ammo by default), add NVGs and an IR pointer attachment into the backpack for when it becomes night.

Good Luck have fun.

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
Sign in to follow this  

×