Lucky44 13 Posted July 26, 2016 (Honestly, I've spent the better part of an hour searching posts for help on this, and I've worked on this issue for a couple years, but I can't find anything clear enough for my thick head...) I understand the general ideas of locality. And I get the concept of BIS_fnc_MP (and remoteExec), but I'm still not really understanding the syntax in different situations. It's my understanding that BIS_fnc_MP and remoteExec are both viable still; if it's a big deal to use remoteExec over BIS_fnc_MP, let me know! If I want to addAction to an object at mission start, on a Dedi, I can run this, right? NameOfObjectToGetAction addAction ["Text displayed for scroll action", { [[[_this select 0], "scriptCalledByAction.sqf"], "BIS_fnc_ExecVM", true, true] call BIS_fnc_MP}]; Now I'm stuck trying to get some .sqf scripts to run at start and have them work for all clients. Here are some examples. Example 1: prepPlayers.sqf This script should do two things: move all players into an aircraft, and give them each a custom backpack using Zade_BOC to get the backpacks on their chests. if (!isServer) exitWith {}; //Move players into the aircraft: ===================================================================================== { //to avoid this happening for JIPs, check to see if the plane is still around if (!isNull _x) then { _x moveInCargo Plane1; }; } forEach [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12]; //Give each unit a custom backpack -ON CHEST- based on role ================================================================================ //Squad Leader if (!isNull p1) then { [p1,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Fire Team Leader if (!isNull p2) then { [p2,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; ---etc. for more units Here's what I'm trying in the init.sqf: [{execVM "scripts\prepPlayers.sqf"}, "BIS_fnc_execVM", false, false] call BIS_fnc_MP; But it's not working. It's putting the backpacks on players' chests, but they're not filled and they're not accessible like they should be. -This does work fine in SP. Any help with how to best implement/script these to work on a Dedicated server will be GREATly appreciated! Share this post Link to post Share on other sites
bigpoppablunts 53 Posted July 26, 2016 This function is now defunct. https://community.bistudio.com/wiki/BIS_fnc_MP to https://community.bistudio.com/wiki/remoteExec Share this post Link to post Share on other sites
Lucky44 13 Posted July 26, 2016 Thanks for the reply, bigpoppablunts, but it's not really defunct. remoteExec is just more processor friendly/efficient, if I understand right. But if you know how to do what I'm trying to do with remoteExec, I'm all ears! Share this post Link to post Share on other sites
benargee 20 Posted July 27, 2016 Shouldnt it be ["scripts\prepPlayers.sqf", "BIS_fnc_execVM", false, false] call BIS_fnc_MP; and not [{execVM "scripts\prepPlayers.sqf"}, "BIS_fnc_execVM", false, false] call BIS_fnc_MP; Also I imagine Zade_BOC_FNC_AddChestBackpack is adding an action the unit locally to where it is called(server). In other words, only the server can activate the action and not the player. addAction must be executed on every machine that interaction is to be enabled. Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted July 27, 2016 bis_fnc_mp still works and it just calls remoteexec itself. there won't be a noticeable performance different, but good idea just to use remoteexec Share this post Link to post Share on other sites
Lucky44 13 Posted July 27, 2016 Thanks, Benargee and mdcclxxvi. Ben, you said use: ["scripts\prepPlayers.sqf", "BIS_fnc_execVM", false, false] call BIS_fnc_MP; But shouldn't it be wrapped differently? I have seen something like [[[], "scripts\prepPlayers.sqf"], "BIS_fnc_execVM", false,false] call BIS_fnc_MP; mdcclxxvi, how would you write it using remoteExec, then? Share this post Link to post Share on other sites
benargee 20 Posted July 28, 2016 https://community.bistudio.com/wiki/BIS_fnc_execVMonly requires one argument but can optionally take two. Either should work. Share this post Link to post Share on other sites
kylania 568 Posted July 28, 2016 You don't need remoteExec or BIS_fnc_MP for any of that. Just put it all in initPlayerLocal.sqf 2 Share this post Link to post Share on other sites
Lucky44 13 Posted July 28, 2016 You don't need remoteExec or BIS_fnc_MP for any of that. Just put it all in initPlayerLocal.sqf Thanks, Kylania, for your insight and experience. I tried that, and part of it works and part didn't. Here's what I did: I moved the following into the initPlayerLocal.sqf: //Move players into the aircraft: ===================================================================================== if (!isNil "plane1") then { { if (!isNil {_x} ) then { _x moveInCargo plane1; }; } forEach [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12]; } else {hint "PLANE IS GONE!"}; //Give each unit a custom backpack -ON CHEST- based on role ================================================================================ //Squad Leader if (!isNil "p1") then { [p1,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Fire Team Leader if (!isNil "p2") then { [p2,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Fire Team Leader if (!isNil "p3") then { [p3,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Corpsman (medic) if (!isNil "p4") then { [p4,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_bloodIV_500","ACE_epinephrine","ACE_bloodIV_500","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Corpsman (medic) if (!isNil "p5") then { [p5,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_bloodIV_500","ACE_epinephrine","ACE_bloodIV_500","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Electronics Specialist if (!isNil "p6") then { [p6,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_wirecutter","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //SAW Gunner if (!isNil "p7") then { [p7,"B_TacticalPack_blk",["itemMap","RHSUSF_200Rnd_556x45_soft_pouch","RHSUSF_200Rnd_556x45_soft_pouch","RHSUSF_200Rnd_556x45_soft_pouch","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Designated Marksman if (!isNil "p8") then { [p8,"B_AssaultPack_blk",["itemMap","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","optic_nightstalker","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Demo Specialist if (!isNil "p9") then { [p9,"B_TacticalPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","SatchelCharge_Remote_Mag","SatchelCharge_Remote_mag","ACE_wirecutter","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Operator (MP5) if (!isNil "p10") then { [p10,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Operator (HK416) if (!isNil "p11") then { [p11,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Operator (HK416) if (!isNil "p12") then { [p12,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; And the Zade_BOC stuff worked (it put custom backpacks on units chests, as expected). But the moveInCargo to plane1 didn't work. Is my check to make sure the plane still exists bad? (I am doing that so that if players JIP in, and the plane is gone, they don't get errors.) Is the syntax right for the !isNil check on {_x} in the forEach? EDIT: it seems to be putting 1 backpack on each player's chest PER CLIENT. What's the best way to fix that? I'd also like to ask how to simply call a .sqf script using remoteExec via a trigger or on an object's init box, but first things first. Share this post Link to post Share on other sites
jwllorens 43 Posted July 28, 2016 Thanks, Kylania, for your insight and experience. I tried that, and part of it works and part didn't. Here's what I did: I moved the following into the initPlayerLocal.sqf:And the Zade_BOC stuff worked (it put custom backpacks on units chests, as expected). But the moveInCargo to plane1 didn't work. Is my check to make sure the plane still exists bad? (I am doing that so that if players JIP in, and the plane is gone, they don't get errors.) Is the syntax right for the !isNil check on {_x} in the forEach? EDIT: it seems to be putting 1 backpack on each player's chest PER CLIENT. What's the best way to fix that? I'd also like to ask how to simply call a .sqf script using remoteExec via a trigger or on an object's init box, but first things first. If all that is in initPlayerLocal, here is what is happening. every time a player joins, they download initPlayerLocal, and run that script. That script adds backpacks and stuff to EVERY player, using script commands that have global effect most likely. Even though the script only runs once per client, it is running multiple times if there are multiple clients. Each time it runs (when a player joins), it adds stuff to EVERY player. Instead, just trim down your code. Replace this code: if (!isNil "plane1") then { { if (!isNil {_x} ) then { _x moveInCargo plane1; }; } forEach [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12]; } else {hint "PLANE IS GONE!"}; with this: if (!isNil "plane1") then { player moveInCargo plane1; } else {hint "PLANE IS GONE!"}; Each time a player joins, they run initPlayerLocal on their machine, so "player" will return that player only. You want to run it once per player, and only on that player, and only when they join. Now, for the rest of your code. You should probably change how you define the player's role, but lets just work with what you have. Replace this: //Squad Leader if (!isNil "p1") then { [p1,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Fire Team Leader if (!isNil "p2") then { [p2,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Fire Team Leader if (!isNil "p3") then { [p3,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Corpsman (medic) if (!isNil "p4") then { [p4,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_bloodIV_500","ACE_epinephrine","ACE_bloodIV_500","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Corpsman (medic) if (!isNil "p5") then { [p5,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_bloodIV_500","ACE_epinephrine","ACE_bloodIV_500","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Electronics Specialist if (!isNil "p6") then { [p6,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_wirecutter","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //SAW Gunner if (!isNil "p7") then { [p7,"B_TacticalPack_blk",["itemMap","RHSUSF_200Rnd_556x45_soft_pouch","RHSUSF_200Rnd_556x45_soft_pouch","RHSUSF_200Rnd_556x45_soft_pouch","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Designated Marksman if (!isNil "p8") then { [p8,"B_AssaultPack_blk",["itemMap","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","optic_nightstalker","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Demo Specialist if (!isNil "p9") then { [p9,"B_TacticalPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","SatchelCharge_Remote_Mag","SatchelCharge_Remote_mag","ACE_wirecutter","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Operator (MP5) if (!isNil "p10") then { [p10,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Operator (HK416) if (!isNil "p11") then { [p11,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; //Operator (HK416) if (!isNil "p12") then { [p12,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]] call Zade_BOC_FNC_AddChestBackpack; }; with this: _gear = switch (player) do { case p1: {[p1,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p2: {[p2,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p3: {[p3,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p4: {[p4,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_bloodIV_500","ACE_epinephrine","ACE_bloodIV_500","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p5: {[p5,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_epinephrine","ACE_bloodIV_500","ACE_epinephrine","ACE_bloodIV_500","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_morphine","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p6: {[p6,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_wirecutter","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p7: {[p7,"B_TacticalPack_blk",["itemMap","RHSUSF_200Rnd_556x45_soft_pouch","RHSUSF_200Rnd_556x45_soft_pouch","RHSUSF_200Rnd_556x45_soft_pouch","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p8: {[p8,"B_AssaultPack_blk",["itemMap","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","RHSUSF_20Rnd_762x51_m993_mag","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","optic_nightstalker","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p9: {[p9,"B_TacticalPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_epinephrine","ACE_bloodIV_500","SatchelCharge_Remote_Mag","SatchelCharge_Remote_mag","ACE_wirecutter","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p10: {[p10,"B_AssaultPack_blk",["itemMap","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","HLC_30Rnd_9x19_SD_MP5","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p11: {[p11,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; case p12: {[p12,"B_AssaultPack_blk",["itemMap","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","HLC_30rnd_556x45_SPR","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_FieldDressing","ACE_morphine","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_optic_MRCO_2D","ACE_EntrenchingTool","rhsusf_opscore_bk","NVGoggles_OPFOR"]]}; }: _gear call Zade_BOC_FNC_AddChestBackpack; 2 Share this post Link to post Share on other sites
Lucky44 13 Posted July 28, 2016 Thanks, JWL, for taking the time to do that. I appreciate the explanation. I *thought* that it was getting executed every time a client joined, so it would move everyone to the plane and do their loadouts 1x/client. I was excited to see your revisions. So I tried your code, and it didn't work on a dedi server, to my surprise! (In SP, it loaded me into the plane, but it didn't give me the gear.) My only guess is that the _gear variable isn't set to private at the start of the script, but I don't think that would have this effect, would it? Any ideas why this wouldn't work? --Running in SP for more testing, with Show Script Errors, I found this error on start: undefined variable in expression: _gear Could there be something wrong with the syntax? Share this post Link to post Share on other sites
jwllorens 43 Posted July 29, 2016 Alright so there are likely a lot of problems with what I posted, I didn't test it. All I did was rewrite it so that it only puts the player in the plane and only calls your custom function once on the player, and if it is inside of initPlayerLocal.sqf then it should do it once for each player rather than do it for every player... for each player. So lets go through and work out the errors. It isnt working, and _gear is undefined. There are no typos with the variable _gear itself. Since that means the switch statement isn't working and returning an array, we need to look at the statements in each case, and the conditions. So lets figure out why. After closer inspection, it looks like the code within each case of the switch statement is not defining anything and therefore should be returning the multidimensional array inside, so I don't think the problem is the statements in each case. Just from the syntax, _gear should be defined by the switch statement, so I am guessing that the error is being thrown when you try to pass _gear to Zade_BOC_FNC_AddChestBackpack. That means _gear must be undefined because the switch statement is not matching any case and the default case is not defined. So, we need to understand why player == p1 or player == p2 ect... is never coming up as true. Could you explain how and where you are defining the variables p1, p2, ect? You may need to "publicVariable" them or something to make sure that they exist everywhere, are consistent, and are accessible by initPlayerLocal.sqf, Try putting the following into initServer.sqf publicVariable "plane1"; for "_i" from 1 to 12 do { publicVariable ("p" + (str _i)); }; See if that fixes the problem. If not, it would really help to know what exactly p1 and p2 and all that actually is, because I am going off of assumptions here. Also, are you running any kind of respawn in the mission? Share this post Link to post Share on other sites
Lucky44 13 Posted July 29, 2016 Wow, I appreciate your taking the time to help like this. Thanks. p1, p2,...p12 are the player units, placed on the map and named in their var name boxes. Yes, I'm running ACE3 and the ACE respawn module. Is that enough info? I don't see why we'd need to pvar them if they're units placed in the editor; knowing that's what they are, do you still think we need the loop to pvar them? I'll try it anyway. ----OK, I found the issue! at the end of your switch, you have }: and it needs to be }; I tested it on SP and it works right. But on the dedi server it now does the gear properly, but it isn't moving the player into the plane (plane1). This seems like a simple issue. Could it be something about the condition? The if (!isNil "plane1") ? (FWIW, when I tried executing this code if (!isNil "plane1") then { player moveInCargo plane1}; just in the debugging console, it worked and moved me into the plane. Hmm. Share this post Link to post Share on other sites
jwllorens 43 Posted July 30, 2016 Wow, I appreciate your taking the time to help like this. Thanks. p1, p2,...p12 are the player units, placed on the map and named in their var name boxes. Yes, I'm running ACE3 and the ACE respawn module. Is that enough info? I don't see why we'd need to pvar them if they're units placed in the editor; knowing that's what they are, do you still think we need the loop to pvar them? I'll try it anyway. ----OK, I found the issue! at the end of your switch, you have }: and it needs to be }; I tested it on SP and it works right. But on the dedi server it now does the gear properly, but it isn't moving the player into the plane (plane1). This seems like a simple issue. Could it be something about the condition? The if (!isNil "plane1") ? (FWIW, when I tried executing this code if (!isNil "plane1") then { player moveInCargo plane1}; just in the debugging console, it worked and moved me into the plane. Hmm. Ok yea then you don't need to public var anything if those are editor names. Try doing this. Put all that code, both the switch statement and the little if statement that moves the player into the plane. Take all of that and put it in this: null = [] spawn { waitUntil {player in [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12]}; //Put the moveInCargo and switch do code here. }; I honestly don't know if this will fix anything but give it a shot. Share this post Link to post Share on other sites
Lucky44 13 Posted July 30, 2016 OK, I assume you mean to put that in the initPlayerLocal, so that's what I tried. In SP, it worked (both moved into plane and gave gear), but it also threw an error. I was in the p1 slot, and it had "unknown variable" for p2. -Would you put a if (!isNil {_x}) on that?? In a dedi server, it was as before: it gives the BOC gear as desired, but it doesn't move the player into the plane. EDIT: I tried something. I put a trigger on the ground to detect BluFor Present (for 2 seconds). And in the On Act, I put if (!isNil "plane1") then {player moveInCargo plane1} The players start outside it and must walk into it. And it works on the dedi server. -Is this a bad approach to take? It's not the same as just starting the players in there, but I could change the time to zero (or 1?) and start the players in it?? Share this post Link to post Share on other sites
jwllorens 43 Posted July 30, 2016 OK, I assume you mean to put that in the initPlayerLocal, so that's what I tried. In SP, it worked (both moved into plane and gave gear), but it also threw an error. I was in the p1 slot, and it had "unknown variable" for p2. -Would you put a if (!isNil {_x}) on that?? In a dedi server, it was as before: it gives the BOC gear as desired, but it doesn't move the player into the plane. EDIT: I tried something. I put a trigger on the ground to detect BluFor Present (for 2 seconds). And in the On Act, I put if (!isNil "plane1") then {player moveInCargo plane1} The players start outside it and must walk into it. And it works on the dedi server. -Is this a bad approach to take? It's not the same as just starting the players in there, but I could change the time to zero (or 1?) and start the players in it?? Seems like your solution is fine. For some reason it looks like the code to put the people in a plane is running before all the global variables are defined. I don't know why that is but it probably has to do with load order. Your solution is fine. Triggers are useful for all kinds of stuff and generally it is usually a good idea performance wise to contort the game engine to do what you want by using things like triggers, as opposed to having entirely scripted solutions. 1 Share this post Link to post Share on other sites
Lucky44 13 Posted July 30, 2016 OK, so while I have your knowledge, can I go back to the original question? How should I use either remoteExec or BIS_fnc_MP to call a script to fire? Both in a trigger or from another script? -Really, what I'm looking for is a better explanation of the syntax for those two things; the wiki is not very clear to me! EDIT: I'm going to start a new thread to ask for some good explanation on these. https://forums.bistudio.com/topic/193288-a-better-explanation-of-bis-fnc-mp-and-remoteexec-please/ Share this post Link to post Share on other sites