-ami- mofo 13 Posted July 20, 2014 Hi community, I'm hosting a MP mission on my own gaming rig that myself and several friends join in on and I'm having a little trouble with the custom loadouts not working consistently. Basically someone can start with all the stuff they should have but somebody else won't. It's a bit all over the shop. I have this for example.... removeAllWeapons _this; removeAllItems _this; _this unassignItem "NVGoggles"; _this removeItem "NVGoggles"; _this removeWeapon "itemGPS"; _this removeWeapon "itemradio"; _this addBackpack "B_AssaultPack_blk_DiverExp"; _this removeItem "ToolKit"; _this removeItem "MineDetector"; //ADD WEAPON & AMMO _this addmagazines ["30Rnd_65x39_caseless_mag",6]; _this addMagazines ["1Rnd_HE_Grenade_shell",3]; _this addweapon "arifle_MX_GL_F"; //_this addMagazines ["30Rnd_556x45_Stanag",6]; //_this addMagazines ["1Rnd_HE_Grenade_shell",3]; //_this addWeapon "arifle_TRG21_GL_F"; //_this addMagazines ["20Rnd_762x51_Mag",6]; //_this addWeapon "srifle_EBR_F"; //_this addMagazines ["30Rnd_45ACP_Mag_SMG_01",6]; //_this addWeapon "SMG_01_F"; //ADD WEAPON ATTACHMENTS _this addPrimaryWeaponItem "optic_Arco"; //_this addPrimaryWeaponItem "optic_Hamr"; //_this addPrimaryWeaponItem "optic_tws"; _this addPrimaryWeaponItem "muzzle_snds_H"; //_this addPrimaryWeaponItem "acc_pointer_IR"; _this addPrimaryWeaponItem "acc_flashlight"; //ADD EQUIPMENT _this addWeapon "ACRE_PRC152"; _this addWeapon "ItemGPS"; //_this addWeapon "Binocular"; _this addWeapon "Rangefinder"; //_this addWeapon "LaserDesignator"; _this additem "NVGoggles"; _this assignitem "NVGoggles"; _this action ["NVGoggles",this]; //ADD ORDNANCE - SMOKE - FLARES //_this addMagazines ["DemoCharge_Remote_Mag",1]; //_this addMagazines ["SatchelCharge_Remote_Mag",1]; //_this addmagazines ["ATMine_Range_Mag",1]; //_this addmagazines ["APERSBoundingMine_Range_Mag",2]; _this addMagazines ["UGL_FlareWhite_F",1]; //_this addmagazines ["SmokeShellRed",1]; At the very top of all that I've tried if (!isServer) exitWith {}; and also waituntil {time>0}; These work in the editor but give varying success and failure when we MP. I'm really hoping somebody can give me the correct line or lines to add to my loadout scripts which is MP compatible and works everytime? Thanks. Share this post Link to post Share on other sites
tryteyker 28 Posted July 20, 2014 Most important question: What's _this? I see no initialization for _this anywhere in the script, but I assume you have it since it works in SP. Anyhow, loadouts have varying localization issues. For crates, it's mostly server-side (ie using as many global commands as possible), but for players on MP it's practically the other way around, which is funny enough. If _this is your player unit, try adding if !(local _this) exitWith {}; to the top and make sure it's executed on each machine (as in, init.sqf). Share this post Link to post Share on other sites
-ami- mofo 13 Posted July 20, 2014 Hi mate for example in the init of the playable unit (team leader) in the editor I have this.... null0 = this execVM "Scripts\1_team_leader.sqf"; which calls it from a .sqf file in my mission's/script folder. I have 6 players in the mission and each one has a different loadout.sqf file named after them. So you're saying that I should be calling all of these from my mission's init.sqf file? And does this !(local _this) exitWith {}; go in the mission init.sqf? or in each player's loadout.sqf? This is my mission init.sqf as it is at the moment.. //Mission parameters skiptime (paramsArray select 0); sleep 2; // Wait for player object to initialise before processing init.sqf for JIP) if (!isServer && (player != player)) then { waitUntil {player == player}; waitUntil {time > 10}; }; enableSaving [false,false]; call compile preprocessFile "=BTC=_revive\=BTC=_revive_init.sqf"; enableRadio false; enableSentences false; setViewDistance 2000; { if ( side _x == EAST ) then { _x removeAllEventHandlers "HandleDamage"; _x addEventHandler ["HandleDamage",{ _damage = (_this select 2)*2; // <-- the *2 multiples the damage by 2 _damage }]; }; }forEach allUnits; { if ((side _x) == EAST) then { _x setUnitAbility 0.1; _x setskill ["aimingAccuracy",0.15]; _x setskill ["aimingShake",0.45]; _x setskill ["aimingSpeed",0.6]; _x setskill ["spotDistance",0.3]; _x setskill ["spotTime",0.4]; _x setskill ["courage",1]; _x setskill ["reloadSpeed",1]; }; } forEach allUnits; []execVM "eos\OpenMe.sqf"; [] execVM "scripts\cleanup.sqf"; Share this post Link to post Share on other sites
tryteyker 28 Posted July 20, 2014 Just following F3's example blindly, but yeah the if !(local _this) exitWith {}; (IF is important here) should go into each loadout file. Also, you sure that HandleDamage EH properly applies the multiplied damage to OPFOR units? Share this post Link to post Share on other sites
wiggum2 31 Posted July 20, 2014 Put: private ["_unit"]; _unit = _this select 0; removeAllWeapons _unit; ... ... At the beginning of every gear script. In the units init: if (isServer) then {nul = [this] execVM "Scripts\1_team_leader.sqf";}; Share this post Link to post Share on other sites
-ami- mofo 13 Posted July 21, 2014 Hey guys I tried all the things you've said but having no luck, isn't even working in the editor now using those methods. I also put the if (isServer) then {nul = [this] execVM "Scripts\1_team_leader.sqf";}; into the player unit's init in the editor. But because I don't really know scripting I'm wondering if I've just put something in a bit wrong. Here is my loadout.sqf as it is now... //TEAM LEADER //place in init line of unit:- null0 = this execVM "Scripts\U1_kit.sqf"; waituntil {time>0}; removeAllWeapons _this; removeAllItems _this; _this unassignItem "NVGoggles"; _this removeItem "NVGoggles"; _this removeWeapon "itemGPS"; _this removeWeapon "itemradio"; _this addBackpack "B_AssaultPack_blk_DiverExp"; _this removeItem "ToolKit"; _this removeItem "MineDetector"; //ADD WEAPON & AMMO _this addmagazines ["30Rnd_65x39_caseless_mag",6]; _this addMagazines ["1Rnd_HE_Grenade_shell",3]; _this addweapon "arifle_MX_GL_F"; //_this addMagazines ["30Rnd_556x45_Stanag",6]; //_this addMagazines ["1Rnd_HE_Grenade_shell",3]; //_this addWeapon "arifle_TRG21_GL_F"; //_this addMagazines ["20Rnd_762x51_Mag",6]; //_this addWeapon "srifle_EBR_F"; //_this addMagazines ["30Rnd_45ACP_Mag_SMG_01",6]; //_this addWeapon "SMG_01_F"; //ADD WEAPON ATTACHMENTS _this addPrimaryWeaponItem "optic_Arco"; //_this addPrimaryWeaponItem "optic_Hamr"; //_this addPrimaryWeaponItem "optic_tws"; _this addPrimaryWeaponItem "muzzle_snds_H"; //_this addPrimaryWeaponItem "acc_pointer_IR"; _this addPrimaryWeaponItem "acc_flashlight"; //ADD EQUIPMENT _this addWeapon "ACRE_PRC152"; _this addWeapon "ItemGPS"; //_this addWeapon "Binocular"; _this addWeapon "Rangefinder"; //_this addWeapon "LaserDesignator"; _this additem "NVGoggles"; _this assignitem "NVGoggles"; _this action ["NVGoggles",this]; //ADD ORDNANCE - SMOKE - FLARES //_this addMagazines ["DemoCharge_Remote_Mag",1]; //_this addMagazines ["SatchelCharge_Remote_Mag",1]; //_this addmagazines ["ATMine_Range_Mag",1]; //_this addmagazines ["APERSBoundingMine_Range_Mag",2]; _this addMagazines ["UGL_FlareWhite_F",1]; //_this addmagazines ["SmokeShellRed",1]; And here is my mission init.sqf as it is now..... //Mission parameters skiptime (paramsArray select 0); sleep 2; // Wait for player object to initialise before processing init.sqf for JIP) if (!isServer && (player != player)) then { waitUntil {player == player}; waitUntil {time > 10}; }; enableSaving [false,false]; call compile preprocessFile "=BTC=_revive\=BTC=_revive_init.sqf"; enableRadio false; enableSentences false; setViewDistance 2000; { if ( side _x == EAST ) then { _x removeAllEventHandlers "HandleDamage"; _x addEventHandler ["HandleDamage",{ _damage = (_this select 2)*2; // <-- the *2 multiples the damage by 2 _damage }]; }; }forEach allUnits; { if ((side _x) == EAST) then { _x setUnitAbility 0.1; _x setskill ["aimingAccuracy",0.15]; _x setskill ["aimingShake",0.45]; _x setskill ["aimingSpeed",0.6]; _x setskill ["spotDistance",0.3]; _x setskill ["spotTime",0.4]; _x setskill ["courage",1]; _x setskill ["reloadSpeed",1]; }; } forEach allUnits; []execVM "eos\OpenMe.sqf"; [] execVM "scripts\cleanup.sqf"; Can I be a pain and ask you to modify them as you think will work so I can just copy/paste them and then try it all out? At least then I'll know if it's me that's stuffed it up or that it just doesn't work? Much appreciated :) Share this post Link to post Share on other sites
wiggum2 31 Posted July 21, 2014 Like i said: Put that in the beginning of your loadout.sqf: private ["_unit"]; _unit = _this select 0; removeAllWeapons _unit; // replace every _this with _unit ! ... and remove the waitUntil. Share this post Link to post Share on other sites
-ami- mofo 13 Posted July 22, 2014 Ok I did what you said and it still doesn't work. This is what the loadout.sqf looks like now... //TEAM LEADER //place in init line of unit:- null0 = this execVM "Scripts\1_team_leader.sqf"; private ["_unit"]; _unit = _this select 0; removeAllWeapons _unit; ... removeAllItems _unit; _unit unassignItem "NVGoggles"; _unit removeItem "NVGoggles"; _unit removeWeapon "itemGPS"; _unit removeWeapon "itemradio"; _unit addBackpack "B_AssaultPack_blk_DiverExp"; _unit removeItem "ToolKit"; _unit removeItem "MineDetector"; //ADD WEAPON & AMMO _unit addmagazines ["30Rnd_65x39_caseless_mag",6]; _unit addMagazines ["1Rnd_HE_Grenade_shell",3]; _unit addweapon "arifle_MX_GL_F"; //_unit addMagazines ["30Rnd_556x45_Stanag",6]; //_unit addMagazines ["1Rnd_HE_Grenade_shell",3]; //_unit addWeapon "arifle_TRG21_GL_F"; //_unit addMagazines ["20Rnd_762x51_Mag",6]; //_unit addWeapon "srifle_EBR_F"; //_unit addMagazines ["30Rnd_45ACP_Mag_SMG_01",6]; //_unit addWeapon "SMG_01_F"; //ADD WEAPON ATTACHMENTS _unit addPrimaryWeaponItem "optic_Arco"; //_unit addPrimaryWeaponItem "optic_Hamr"; //_unit addPrimaryWeaponItem "optic_tws"; _unit addPrimaryWeaponItem "muzzle_snds_H"; //_unit addPrimaryWeaponItem "acc_pointer_IR"; _unit addPrimaryWeaponItem "acc_flashlight"; //ADD EQUIPMENT _unit addWeapon "ACRE_PRC152"; _unit addWeapon "ItemGPS"; //_unit addWeapon "Binocular"; _unit addWeapon "Rangefinder"; //_unit addWeapon "LaserDesignator"; _unit additem "NVGoggles"; _unit assignitem "NVGoggles"; _unit action ["NVGoggles",this]; //ADD ORDNANCE - SMOKE - FLARES //_unit addMagazines ["DemoCharge_Remote_Mag",1]; //_unit addMagazines ["SatchelCharge_Remote_Mag",1]; //_unit addmagazines ["ATMine_Range_Mag",1]; //_unit addmagazines ["APERSBoundingMine_Range_Mag",2]; _unit addMagazines ["UGL_FlareWhite_F",1]; //_unit addmagazines ["SmokeShellRed",1]; Share this post Link to post Share on other sites
oldbear 390 Posted July 22, 2014 I am still using .sqf for AI loadouts but have switched to individual loadout for player as previous loadout script system has ceased to work well some time ago. I found it easier to build up loadouts on a text editor, then past is in 'Initialization'. Last update has destroyed my work on all my FIA missions due to fancy FIA randomization effect. So after an answer from Locklear at this "How to stop FIA soldiers headgear randomized cycle ?" , I had switched to individual loadout for players built the easy way in 'Arsenal' then imported in text and pasted in 'Initialization'. I will use this until the script based loadout for players is working again ... Share this post Link to post Share on other sites
Belbo 462 Posted July 22, 2014 If I may, I'd advertise my own loadout-script. :D http://forums.bistudio.com/showthread.php?180520-ADV-Gear-Distribution-Script Share this post Link to post Share on other sites
-ami- mofo 13 Posted July 23, 2014 Thanks Belbo but I already went the way of putting the loadout in each player's init in the editor. It's a bit messy but it works. Share this post Link to post Share on other sites
wiggum2 31 Posted July 23, 2014 Or just remove the ... That's not part of the script and I just put it as ' and so on ' Share this post Link to post Share on other sites