Jump to content
Sign in to follow this  
Cockheaven

Debug Console "Server Exec"

Recommended Posts

So, what is it doing. To elaborate, when I run the code execvm "myscript.sqf"; in the debug console and select the "SERVER EXEC" button, what command it being run. I'm asking this because I'm chasing my tail around getting a function to run in a dedicated server properly.

myscript.sqf
 

Spoiler

_Bomba = ["CUP_BAF_IEDBox","Box_IED_Exp_F","Land_GarbageBarrel_02_buried_F","CUP_IED_V1","CUP_IED_V2","CUP_IED_V3","CUP_IED_V4","Land_CarBattery_01_F","Land_CarBattery_02_F","PowerCable_01_Roll_F","Land_PaperBox_01_small_stacked_F","Land_GarbageBarrel_01_english_F","Land_PressureWasher_01_F","Land_Device_assembled_F","Land_Pallet_MilBoxes_F","MetalBarrel_burning_F","Land_Suitcase_F","Land_PlasticCase_01_small_F","Wooden_barrels"] call BIS_fnc_selectRandom; // pick a neto object


_markers = allMapMarkers select {toUpper _x find "MINEFEILD" >= 0}; // find the minefield

CK_BOMB = createVehicle [_Bomba,getmarkerpos (selectrandom _markers), [], 0]; //create neto object @ minefield


[CK_BOMB,"small",2,600,true,3,0,west] spawn MCC_fnc_createIED; // run this function from this mod

 

The problem Is that I cannot figure how I should be calling this, currently I'm using an addaction with execvm "myscript.sqf";
This works fine when I host in MP, but when I run the addaction on the dedicated machine I get the object creation but it doesn't run the function from the mod. My solution is to use whatever "SERVER EXEC" uses in the debug console and embed that into the addaction, but what does that button use?

Share this post


Link to post
Share on other sites

Try remoteExec to have the server run MCC_fnc_createIED.

 

Can't say that's how "SERVER EXEC" button works, but when part of addAction works in hosted and not on dedicated it indicates a locality issue, that portion likely needs to be run by server.  RemoteExec or remoteExecCall is used to have the server run it.  addAction runs local on client.

  • Thanks 1

Share this post


Link to post
Share on other sites

So, in the addaction I want remoteExec ["execVM "myscript.sqf"", 0, true]
Just unclear on the formatting, I need the object to spawn then the function to run, I cannot just execute the function....

Share this post


Link to post
Share on other sites

Use 2, not 0.  Using 0 will remote exec on all machines, server and clients.  2 is for server only.  You're creating objects, and creating on all will result in duplicates being created.

 

As I see it, you could remoteExec from addaction and have the server run the entire script.

_unit addAction ["Create IED",{"myscript.sqf" remoteExec ["execVM",2];}];

 

Or you could just modify the spawn function line of the script, and remoteExec to have the server run the function.

[CK_BOMB,"small",2,600,true,3,0,west] remoteExec ["MCC_fnc_createIED",2];

 

Only concerns I see are,

- do the "MINEFEILD" markers exist on the dedicated server, and

- does it matter at all whether the CK_BOMB object is local to client or server.  The MCC IED will be created local to server, apparently.  and,

- is there security configured in your mission or in MCC on the MCC function, i.e., to control use of the function (I don't use MCC so don't know).  It could effect whether remoteExec the function from client is allowed.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

So I went with in the script
 

[CK_BOMB,"small",2,600,true,3,0,west] remoteExec ["MCC_fnc_createIED",0];

because when I used 
 

[CK_BOMB,"small",2,600,true,3,0,west] remoteExec ["MCC_fnc_createIED",2];

it created the objects but didn't fire the function, or at least didn't create the desired response
Thanks for the help!

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  

×