deus_drone 1 Posted March 8, 2013 Hi Trying to put together a fun co-op for friends andI am making thisup as I go I have added enemy units to the map and have it all setuphowever i want my team to have custom Gear, I dono what I am doing and making this up as I go this is what I found onthe forum by another member removeallweapons player; player addweapon "arifle_MX_Hamr_point_grip_F"; player addweapon "hgun_rook40_f"; player additem "NVGoggles"; player addweapon "Binocular"; player additem "muzzle_snds_H"; player additem "muzzle_snds_L"; player addmagazine "100Rnd_65x39_caseless_mag_Tracer"; player addmagazine "30rnd_9x21_mag"; removeBackpack player; player addBackpack "B_FieldPack_blk_DiverTL"; backpa = unitBackpack player; clearMagazineCargo backpa; backpa additemCargoGlobal ["U_B_CombatUniform_mcam_vest",1]; backpa additemCargoGlobal ["V_PlateCarrier2_rgr",1]; backpa additemCargoGlobal ["H_HelmetB",1]; backpa addmagazineCargoGlobal ["100Rnd_65x39_caseless_mag_Tracer",6]; This is what I modified not knowing what i am doing removeallweapons playable; playable addweapon "arifle_MX_Hamr_point_grip_F"; playable addweapon "hgun_rook40_f"; playable additem "NVGoggles"; playable addweapon "Binocular"; playable additem "muzzle_snds_H"; playable additem "muzzle_snds_L"; playable addmagazine "100Rnd_65x39_caseless_mag_Tracer"; playable addmagazine "30rnd_9x21_mag"; removeBackpack playable; playable addBackpack "B_FieldPack_blk_DiverTL"; backpa = unitBackpack playable; clearMagazineCargo backpa; backpa additemCargoGlobal ["U_B_CombatUniform_mcam_vest",1]; backpa additemCargoGlobal ["V_PlateCarrier2_rgr",1]; backpa additemCargoGlobal ["H_HelmetB",1]; backpa addmagazineCargoGlobal ["100Rnd_65x39_caseless_mag_Tracer",6]; Niether work in multiplayer however the top one I can confirm works in the editor. I asumed it worked in the editor as to preview the editor you have to be known as player and the command definately referrences this "player" but not the playable units I just want to get this to work multiplayer so we can have a bit of fun, Can someone help me clean this up a bit. Thank you Deus Drone Share this post Link to post Share on other sites
Zipper5 74 Posted March 8, 2013 I'd first recommend you check out the following pages describing the usage of each of the commands in your script: player removeAllWeapons addWeapon addItem addMagazine removeBackpack addBackpack unitBackpack clearMagazineCargo addItemCargoGlobal addMagazineCargoGlobal You can also find a list of commands available since Arma 2 here, as well as new ones introduced in Arma 3 here. A couple of things to note: playable is not a command in Arma 3, and will return nothing. When using addItem, you will only add it to the unit's inventory. To equip it, use the assignItem command. To add an attachment automatically to a weapon, use the addPrimaryWeaponItem, addSecondaryWeaponItem and/or addHandgunItem commands. As of Arma 3, there is no need to remove the backpack via removeBackpack before adding a new one via addBackpack. As a rule of thumb, add magazines for weapons before adding the weapons themselves, otherwise you will have to manually load them. Currently, you are only adding one magazine to both the rifle and pistol. Arma 3 has a new command, addMagazines, that will allow you to add multiple. It's probably best for you to look over these commands and their usages, as then you'll be able to understand it. However, if you want to just make this exact loadout definition work for everyone in your multiplayer mission, this is what you'll have to do: Save your mission in the editor. Open a new file in Notepad, or the text editor of your choice. Save this file as init.sqf into your mission's folder. It will be located under: C:\Users\<your Windows name>\Documents\Arma 3 Alpha Other Profiles\<your Arma 3 name>\missions\<mission name>.Stratis Inside this init.sqf file, paste the following: // Do not run on the dedicated server itself if (isDedicated) exitWith {}; // Remove the player's default weapons removeAllWeapons player; // Add rifle with suppressor and 1x 100-round magazine player addMagazine "100Rnd_65x39_caseless_mag_Tracer"; player addWeapon "arifle_MX_Hamr_point_grip_F"; player addPrimaryWeaponItem "muzzle_snds_H"; // Add handgun with suppressor and 1x 30-round magazine player addMagazine "30rnd_9x21_mag"; player addWeapon "hgun_rook40_f"; player addHandgunItem "muzzle_snds_L"; // Add Binoculars and Night Vision Goggles player addWeapon "Binocular"; player addItem "NVGoggles"; player assignItem "NVGoggles"; // Add backpack player addBackpack "B_FieldPack_blk_DiverTL"; // Change the backpack's loadout private ["_backpack"]; _backpack = unitBackpack player; clearMagazineCargoGlobal _backpack; _backpack addItemCargoGlobal ["U_B_CombatUniform_mcam_vest", 1]; // 1x multicam uniform _backpack addItemCargoGlobal ["V_PlateCarrier2_rgr", 1]; // 1x plate carrier vest _backpack addItemCargoGlobal ["H_HelmetB", 1]; // 1x helmet _backpack addMagazineCargoGlobal ["100Rnd_65x39_caseless_mag_Tracer", 6]; // 6x 100-round magazines Share this post Link to post Share on other sites
deus_drone 1 Posted March 8, 2013 (edited) Thank you, I will have to send you the finished product :) How can I alter it to let the gear come back on respawn? Edited March 8, 2013 by deus_drone Share this post Link to post Share on other sites
Zipper5 74 Posted March 8, 2013 (edited) For that, you'll probably want to look into Event Handlers. Specifically, the Respawn variant. Here's the modified code to make it work using your loadout: changeLoadout = { private ["_unit"]; _unit = _this; // Remove the unit's default weapons removeAllWeapons _unit; // Add rifle with suppressor and 1x 100-round magazine _unit addMagazine "100Rnd_65x39_caseless_mag_Tracer"; _unit addWeapon "arifle_MX_Hamr_point_grip_F"; _unit addPrimaryWeaponItem "muzzle_snds_H"; // Add handgun with suppressor and 1x 30-round magazine _unit addMagazine "30rnd_9x21_mag"; _unit addWeapon "hgun_rook40_f"; _unit addHandgunItem "muzzle_snds_L"; // Add Binoculars and Night Vision Goggles _unit addWeapon "Binocular"; _unit addItem "NVGoggles"; _unit assignItem "NVGoggles"; // Add backpack _unit addBackpack "B_FieldPack_blk_DiverTL"; // Change the backpack's loadout private ["_backpack"]; _backpack = unitBackpack _unit; clearMagazineCargoGlobal _backpack; _backpack addItemCargoGlobal ["U_B_CombatUniform_mcam_vest", 1]; // 1x multicam uniform _backpack addItemCargoGlobal ["V_PlateCarrier2_rgr", 1]; // 1x plate carrier vest _backpack addItemCargoGlobal ["H_HelmetB", 1]; // 1x helmet _backpack addMagazineCargoGlobal ["100Rnd_65x39_caseless_mag_Tracer", 6]; // 6x 100-round magazines }; // Doesn't need to be run on the dedicated server itself if (!(isDedicated)) then { // Wait for JIP waitUntil {!(isNull player)}; // Change the player's loadout initially player call changeLoadout; }; // Apply to all units set to Playable { // Change loadout upon respawn _x addEventHandler [ "Respawn", // Respawn event handler { // Find the newly-respawned unit private ["_unit"]; _unit = _this select 0; // Change loadout _unit call changeLoadout; } ]; } forEach playableUnits; Edited March 8, 2013 by Zipper5 Share this post Link to post Share on other sites
XSOF - Toxx 10 Posted March 8, 2013 Amazing customer support there, Zipper5! Gotta love Bohemia! Good luck with Arma3! Share this post Link to post Share on other sites
deus_drone 1 Posted March 8, 2013 I know right, BI are the best! Mission is coming along nicely, Share this post Link to post Share on other sites