Jump to content
Sign in to follow this  
Ice_Rhino

Custom Loadout not working on more than one player

Recommended Posts

When I put a custom load out in the initialize field for each player char, when previewing in editor & single playing the Saves As MP export, the loadout works fine. When I co-op with my friend, it gives me random amounts of what I have requested as per the load out for both of us.

Is this a common fault? I can't find much about it. I used to call a custom load out SQF file but that was the same, some or none of what was requested when more than one human player.

Thanks in advance

IR

Share this post


Link to post
Share on other sites

http://community.bistudio.com/wiki/publicVariableClient

Found it here

http://forums.bistudio.com/showthread.php?180960-Get-player-who-runs-script

But if you want more help from people, what exactly did you type in the init field? Did you use THIS or <UNITNAME> etc?

this addweapon blaablaa; this addmagazine blaablaa;? player1 addweapon blaa; player2 addmagazine blaa;?

You could also simplify (read: be lazy like me) by using VAS or Virtual Arsenal in your mission, if that is an option.

With Virtual Arsenal, just put down an ammobox and in the init field put this: ["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;

Can customize your loadouts, save/load.

VAS: http://forums.bistudio.com/showthread.php?149077-Virtual-Ammobox-System-%28VAS%29

I like VAS more, its simpler, faster, doesn't give me a loading screen.

Youtube-vid that might be of interest

Edited by mamasan8

Share this post


Link to post
Share on other sites

Thanks for the response. I have watched that YouTube video 50 times and still it does not work on reliably on me when there is more than one human player in the game. In the editor, perfect, SP mode on the MP mission, perfect, two plus humans, random results!

I would be happy with Pressing a key sequence and it load the config that way, that would do me, more than happy with that

IR

Share this post


Link to post
Share on other sites

http://steamcommunity.com/app/107410/discussions/0/558749824362537157/

I think you will have to script it in.

Shouldn't be too hard to figure out, theres a wiki for script commands.

http://community.bistudio.com/wiki/addItem

Watch this

Check last post here as well

http://www.armaholic.com/forums.php?m=posts&q=20986

Cook me some food! :P

Sometimes saving a mission in editor doesnt seem to work. In that case you can save it under new name but remember to copy all files except mission.sqm to the new folder from the old folder. I'm lazy so I rarely do that (only when I'm forced, when server won't load mission). Normally I just go to Intel and change the name but save it as same. So, Intel might say Name: mission_nr200 but i'm still saving it as ubersniperklown1 (missionname-folder under my documents) when exporting to MP.

Classnames-list

http://browser.six-projects.net/cfg_weapons/classlist?utf8=%E2%9C%93&version=73&commit=Change&options[group_by]=weap_type&options[custom_type]=&options[faction]=

Couldn't find backpacks above, found them here

http://wiki.7thcavalry.us/wiki/ARMA_3_Backpacks_and_Vests

And one last tip: add a magazine before adding the gun. This way the gun will be loaded and ready.

Quick sniper-loadout-example, tested in editor, should work. Save as loadout.sqf for example and place in your mission folder. C:\Users\username\Documents\Arma 3 - Other Profiles\Armaname\missions\missionname.islandname

In the units init, put:

null = [this] execvm "loadout.sqf";

waituntil {!isnull player};
_unit = _this select 0;

removeallWeapons this;
removeallassigneditems this;
removeBackpack this;
removeallitems this;
removevest this;
removeuniform this;

_unit addmagazine "7Rnd_408_Mag";
_unit addweapon "srifle_LRR_F";
_unit addprimaryweaponitem "optic_Nightstalker";
_unit adduniform "U_B_GhillieSuit";
_unit addvest "V_TacVestCamo_khk";
_unit addbackpack "B_HuntingBackpack";

_unit additem "ItemWatch";
_unit additem "Itemcompass";
//_unit additem "itemgps";
_unit additem "itemradio";
_unit additem "itemmap";
_unit additem "nvgoggles";
_unit addweapon "laserdesignator";
_unit additem "firstaidkit";
_unit additem "b_uavterminal";

_unit assignitem "Itemwatch";
_unit assignitem "Itemcompass";
//_unit assignitem "itemgps";
_unit assignitem "itemradio";
_unit assignitem "Itemmap";
_unit assignitem "nvgoggles";
_unit assignitem "laserdesignator";
_unit assignitem "b_uavterminal";

_unit addmagazines ["7Rnd_408_Mag", 10];
_unit addmagazines ["laserbatteries", 2];

if (true) exitwith {};

Note: Laserdesignator is an addweapon. If I use additem it only ends up in inventory.

Edited by mamasan8

Share this post


Link to post
Share on other sites

Hi,

I have narrowed down that the Host of the 2 Player COOP only gets the kit in his backpack, no uniform or vest items. Here is the content of my initialization and loadout script;


player_1 - Initialization
this = group this; {_x moveInCargo blu_helodown_a} forEach units group this;null = [this] execVM "tc-pl-ar-001.sqf";

player_2 - Initialization
this = group this; {_x moveInCargo blu_helodown_a} forEach units group this;null = [this] execVM "tc-pl-ar-002.sqf";
[/Code]

[Code]
[u]Contents of tc-pl-ar-001.sqf[/u]
waitUntil {!isNull player}; //to prevent MP / JIP issues
_unit = _this select 0;
removeallweapons _unit;
removeallassigneditems _unit;
removeallcontainers _unit;
removeuniform _unit;
removevest _unit;
removebackpack _unit;
_unit addvest "V_PlateCarrierH_CTRG";
_unit addbackpack "B_TacticalPack_mcamo";
_unit addheadgear "H_Booniehat_mcamo";
_unit addGoggles "G_Shades_Black";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addmagazine "20Rnd_762x51_Mag";
_unit addweapon "srifle_EBR_F" ;
_unit addPrimaryWeaponItem "acc_pointer_IR";
_unit addprimaryweaponitem "optic_DMS";
_unit addprimaryweaponitem "muzzle_snds_B";
_unit addPrimaryWeaponItem "srifle_EBR_F";
_unit addweapon "Binocular";
_unit additem "nvgoggles";
_unit additem "ItemCompass";
_unit additem "itemgps";
_unit additem "itemmap";
_unit additem "itemradio";
_unit additem "itemwatch";
_unit assignitem "nvgoggles";
_unit assignitem "itemcompass";
_unit assignitem "itemgps";
_unit assignitem "itemmap";
_unit assignitem "itemradio";
_unit assignitem "itemwatch";
_unit addweapon "hgun_P07_F";
_unit addmagazine "16Rnd_9x21_Mag";
_unit addmagazine "16Rnd_9x21_Mag";
_unit addmagazine "16Rnd_9x21_Mag";
_unit addmagazine "handGrenade";
_unit addmagazine "handGrenade";
_unit addmagazine "handGrenade";
_unit addmagazine "handGrenade";
_unit addmagazine "DemoCharge_Remote_Mag";
_unit addmagazine "DemoCharge_Remote_Mag";
_unit addmagazine "DemoCharge_Remote_Mag";
_unit additem "FirstAidKit";
_unit additem "FirstAidKit";
_unit additem "optic_TWS";
_unit adduniform "U_B_CombatUniform_mcam";
if(true) exitWith{};
[/Code]

I hope this helps. Just a sideline, I am running a full Clean non-dev install

IR

Share this post


Link to post
Share on other sites

Hello Ice_Rhino,

I have below a few changes that will hopefully fix the problem.

I have decided to use an init.sqf file in order to help organize your custom loadout. Within your mission folder, you will need to create a new file called "init.sqf" with the contents below:

waitUntil {!isNull player};

_script = player execVM "loadout.sqf";
waitUntil {scriptDone _script};

This is no different than what your current file contains, however, it separates the loudout commands from the initialization commands in order to help debug any problems that may arise.

I've also changed your loudout.sqf file for greater readability:

_unit = _this;

_arrayOfItems = ["NVGoggles", "ItemCompass", "itemGPS", "itemMap", "itemRadio", "itemWatch"];
_arrayOfWeaponItems = ["acc_pointer_IR", "optic_DMS", "muzzle_snds_B", "srifle_EBR_F"];

removeAllWeapons _unit;
removeAllAssignedItems _unit;
removeAllContainers _unit;
removeUniform _unit;    
removeVest _unit;   
removeBackpack _unit;  

_unit addUniform "U_B_CombatUniform_mcam";
_unit addVest "V_PlateCarrierH_CTRG";   
_unit addBackpack "B_TacticalPack_mcamo";   
_unit addHeadgear "H_Booniehat_mcamo";   
_unit addGoggles "G_Shades_Black";  

_unit addWeapon "srifle_EBR_F" ;
_unit addWeapon "hgun_P07_F";
_unit addWeapon "Binocular";

_unit addMagazines ["20Rnd_762x51_Mag", 20];
_unit addMagazines ["16Rnd_9x21_Mag", 3];
_unit addMagazines ["DemoCharge_Remote_Mag", 3];
_unit addMagazines ["handGrenade", 3];

{
_unit addItem _x;
_unit assignItem _x;
} forEach _arrayOfItems;

{
_unit addPrimaryWeaponItem _x;
} forEach _arrayOfWeaponItems;

_unit addItem "FirstAidKit";   
_unit addItem "FirstAidKit";  

_unit addItem "optic_TWS";

You will notice the redundancy of using the same command to add materials is mitigated with the use of newly introduced commands to ArmA 3 (i.e. addMagazines instead of addMagazine), and also the use of forEach loops.

The forEach loops utilize an array that hold the classnames of the items you intend to add to each player. This way, you are only required to add or remove items in the appropriate array that suit your needs.

Using this method, you are not required to add any commands in the initialization field in the editor. The "init.sqf" located in the root directory of the mission folder file will always run as the player enters the battle, so there is no need to execute this script manually, however, this is not the case for other "init.sqf" files located in additional folders.

If there are specific initialization needs for the player, such as spawning inside vehicles or at locations, you are able to place the commands in the "init.sqf" file.

Based on:

this = group this; {_x moveInCargo blu_helodown_a} forEach units group this;null = [this] execVM "tc-pl-ar-001.sqf";

It appears that the players are supposed to spawn in a downed helicopter. Within the "init.sqf" file, you can use the command "player moveInCargo blu_helodown_a;" instead.

What is your intention with "this = group this;?"

Edited by norybiak

Share this post


Link to post
Share on other sites

Thank you for your reply. I shall try to implement this now. One question, I tend to name my player & playable chars, player_1 & player_2. Does this impact your suggestions in anyway?

Hope to hear from you soon

IR

Share this post


Link to post
Share on other sites
Thank you for your reply. I shall try to implement this now. One question, I tend to name my player & playable chars, player_1 & player_2. Does this impact your suggestions in anyway?

Hope to hear from you soon

IR

No. You can name the playable characters what ever you want and this method will still work fine.

Share this post


Link to post
Share on other sites

Hi

Well it accepted the new code and in the editor at least I had everything I needed. I shall wait for my online coop buddy to appear later and see how she behaves in a real MP game. I shall of course update this thread accordingly.

I really appreciate your assistance on this, thank you very much

IR

Share this post


Link to post
Share on other sites

Thanks to Norybiak, works a treat.

Sorry this is in the wrong forum

IR

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  

×