Custom Loadouts

Custom Loadouts

« posted: Jul 15, 2014, 10:45 PM »
Is there a way to set up custom loadouts for specific players? Say for instance, I want to have it so the donors of my server spawn with a larger backpack than the default backpack, or other items yet to be determined. Is there a way to set up a UID check which will make this happen?
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Custom Loadouts

« Reply #1 posted: Jul 16, 2014, 05:33 AM »
The backpack, guns, and items are determined in playerSetupGear.sqf, while side and class clothing items are in getDefaultClothing.sqf

You could use the whitelisting script posted not too long ago as a basis to pick who gets what.

Re: Custom Loadouts

« Reply #2 posted: Jul 21, 2014, 03:10 AM »
I think I am having the problem of not really wanting to use the whitelisting script because it restricts too many players from entering the server. What I would really like to do is something similar to what was available in Arma 2 DayZ where the server could do a Player UID or Steam ID check and then add items or cash or whatnot.
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Custom Loadouts

« Reply #3 posted: Jul 21, 2014, 03:29 AM »
No, I mean, use the UID check from the whitelisting script, but when adding items instead

Re: Custom Loadouts

« Reply #4 posted: Jul 21, 2014, 02:37 PM »
Ooooh I see. Use the script in playersetupgear.sqf got it lol

Re: Custom Loadouts

« Reply #5 posted: Jul 22, 2014, 02:56 PM »
Okay so now that BI implemented the Virtual Arsenal it actually seems to make this a a much easier task as far as the coding and the names of the objects. However it does not seem to be working, either because the coding is slightly different for wasteland or it is the clothing that is causing the problem. Below is what I put in playersetupgear.sqf which was exported using the Virtual Arsenal. I have tried it without the clothing as well but my player seems to just spawn in underwear regardless. I have also tried changing every line that could be changed to start with "_player" instead of "this" which also did not seem to work. Here is what the Virtual Arsenal exports code wise, and I added the first line for getting the player/my UID.

if ((getPlayerUID) in ["76561198062430792"]) then {
//"Remove existing items";
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;

//"Add containers";
this forceAddUniform "U_I_GhillieSuit";
this addItemToUniform "FirstAidKit";
for "_i" from 1 to 3 do {this addItemToUniform "20Rnd_762x51_Mag";};
for "_i" from 1 to 2 do {this addItemToUniform "11Rnd_45ACP_Mag";};
this addVest "V_PlateCarrierIAGL_dgtl";
this addItemToVest "SmokeShell";
this addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {this addItemToVest "Chemlight_green";};
this addItemToVest "HandGrenade";
for "_i" from 1 to 2 do {this addItemToVest "11Rnd_45ACP_Mag";};
this addBackpack "B_Kitbag_rgr";
this addItemToBackpack "Medikit";
for "_i" from 1 to 2 do {this addItemToBackpack "FirstAidKit";};
for "_i" from 1 to 2 do {this addItemToBackpack "20Rnd_762x51_Mag";};
for "_i" from 1 to 2 do {this addItemToBackpack "11Rnd_45ACP_Mag";};
for "_i" from 1 to 2 do {this addItemToBackpack "HandGrenade";};
this addHeadgear "H_HelmetB";

//"Add weapons";
this addWeapon "srifle_EBR_F";
this addPrimaryWeaponItem "optic_MRCO";
this addWeapon "hgun_Pistol_heavy_01_F";

//"Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "ItemRadio";
this linkItem "ItemGPS";
this linkItem "NVGoggles";
this linkItem "Rangefinder";
};
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Custom Loadouts

« Reply #6 posted: Jul 22, 2014, 03:33 PM »
The "this" keyword is only valid from the init field in the mission editor, you have to replace all of those with "_player" to use them in playerSetupGear

You must specify the player object when calling getPlayerUID, like : "getPlayerUID _player"

Uniforms must absolutely match the team of the player or be civilian, otherwise the player appears naked to other players. If they drop it, they can't take it back, and it doesn't get restored from the player save unless you change team to the one of the uniform before spawning.

Hence why I handle clothing separately in getDefaultClothing.

If you want me to help further, you need to upload your full playerSetupGear.sqf somewhere I can read it, preferably Gist or Pastebin

Re: Custom Loadouts

« Reply #7 posted: Jul 22, 2014, 04:52 PM »
I have uploaded my entire playersetupgear.sqf to Gist with the changes you suggested. I also removed clothing and vests so my hope is that it will defer to the default clothing. https://gist.github.com/20ab7ef9b654d9b28ace.git

Its my first time using Gist and that link didn't seem to work for me. Try this one if it doesn't work for you https://gist.github.com/anonymous/20ab7ef9b654d9b28ace

Also I just noticed I forgot to delete the line: "this addHeadgear "H_HelmetB";" I have deleted it now but that is the only change I made. Everything else is the same

  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Custom Loadouts

« Reply #8 posted: Jul 22, 2014, 06:28 PM »
Before I continue helping you, I'd like you to configure Arma 3 in Steam to start with the launch parameter "-showScriptErrors", then try the script again.

Re: Custom Loadouts

« Reply #9 posted: Jul 22, 2014, 07:49 PM »
I will have to wait until tomorrow as I have to head off to work soon and I cannot restart my server right now to test the scripts because there are quite a few players in the server. I don't want to restart it at times when population is high and it is not already scheduled to restart.
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Custom Loadouts

« Reply #10 posted: Jul 22, 2014, 10:46 PM »
You don't have to restart the server, you can just start the mission in LAN mode from your own game and you can test it without even making a PBO, if your mission folder is located in MPMissions and has the map suffix in the name. That's how I test my stuff.

Re: Custom Loadouts

« Reply #11 posted: Jul 23, 2014, 05:01 AM »
Umm what? So not a .pbo but just the extracted mission folder in the default MPMissions directory? Also I seem to be having a problem changing the launch parameters via steam. I am not getting the option, I can launch the "Arma 3 Launcher" within which I can set Mod parameters and such but I cannot find the steam launch parameters for Arma 3. I'll admit it has been some time since I changed the launch parameters of a game, but if I remember correctly it is under the Steam window in the library and you right click on the game.
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Custom Loadouts

« Reply #12 posted: Jul 23, 2014, 05:04 AM »
Right click > Properties > Set Launch Options

Re: Custom Loadouts

« Reply #13 posted: Jul 23, 2014, 06:45 AM »
Ok I have done all of the above and launched my mission in LAN with the -showscripterrors enabled. What now?
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2600

Re: Custom Loadouts

« Reply #14 posted: Jul 23, 2014, 12:41 PM »
Don't you see a black box saying Error on line 9 Undefined variable "getPlayerUID_player"? There needs to be a space between D and _