Orion987 1 Posted March 6, 2013 Hello. I was wondering if there was anyway I could get the multiplayer framework working on Arma 3 so I could make RE calls. Is there anyway I could do this? I have already tried manually creating the module, but the "\ca\modules\MP\data\scripts\MPframework.sqf" I used in Arma 2 no longer seems to exist in Arma 3 (after looking around in the AddOns folder, I noticed that 'modules' is now 'modules_f', however, changing to that doesn't work either. Thanks! Share this post Link to post Share on other sites
Horner 13 Posted March 6, 2013 Easy enough, just use a PVEH. if (isNil "RemExCode") then { RemExCode = [{}, []]; publicVariable "RemExCode"; }; "RemExCode" addPublicVariableEventHandler { private["_this","_code","_params"]; _this = _this select 1; _code = _this select 0; _params = _this select 1; _params call _code; }; Share this post Link to post Share on other sites
Orion987 1 Posted March 6, 2013 (edited) I seem to be having trouble with this code. If I execute this on the server, shouldn't both the client and the server see the hint "WORKING"? I am not getting the hint on the client or the server when I run this. Thanks if (isNil "RemExCode") then { RemExCode = [{}, []]; publicVariable "RemExCode"; }; "RemExCode" addPublicVariableEventHandler { private["_this","_code","_params"]; _this = _this select 1; _code = _this select 0; _params = _this select 1; _params call _code; }; RemExCode= [compile "hint 'WORKING'" ,[]]; publicVariable "RemExCode"; Edited March 6, 2013 by Orion987 Share this post Link to post Share on other sites
neokika 62 Posted March 6, 2013 There is a new Framework, an improved version of the one included in Take On Helicopters. This already takes advantage of the new publicVariableClient and publicVariableServer commands. In editor open the Functions Viewer, select from the left list box the entry called MP and check BIS_fnc_MP. /* Author: Karel Moricky Description: Send function for remote execution (and executes locally if conditions are met) Parameter(s): 0: ANY - function params 1: STRING - function name 2 (Optional): OBJECT - function will be executed only where unit is local [default: everyone] BOOL - true to execute on every client, false to execute it on server only NUMBER - function will be executed only on client with the given ID ARRAY - array of objects 3 (Optional): BOOL - true for persistent call (will be called now and for every JIP client) [default: false] Returns: ARRAY - sent packet */ Share this post Link to post Share on other sites
Orion987 1 Posted March 6, 2013 I saw that , so I tried running [[],"myscript.sqf",true] spawn BIS_fnc_MP; on the server. However, it doesn't execute the given code (Just a hint statement) on either the server or the client. Any ideas? Edit: Is it because "myscript.sqf" isn't technically a function? If so, do I have to compile it first or something? Share this post Link to post Share on other sites
neokika 62 Posted March 6, 2013 (edited) I saw that , so I tried running [[],"myscript.sqf",true] spawn BIS_fnc_MP; on the server. However, it doesn't execute the given code (Just a hint statement) on either the server or the client. Any ideas? You are passing a script path, but you need a function name. You need to define the function before using the command. Keep in mind that the function needs to exist where this will run. myFunction = { hint "Hello World!"; }; [[],"myFunction",true] spawn BIS_fnc_MP; Edited March 6, 2013 by neokika Share this post Link to post Share on other sites
Orion987 1 Posted March 6, 2013 (edited) Could I define a function to call a script? For example myFunction = { [] execVM "myscript.sqf"} Would that call the function from the client computer then if I ran my previous code (with "myFunction" instead of "myscript.sqf")? Edit: I tried to do this with the following code, which is not working either... _func = {[] spawn "myscript.sqf"}; [[],"_func",true] spawn BIS_fnc_MP; Edited March 6, 2013 by Orion987 Share this post Link to post Share on other sites
neokika 62 Posted March 6, 2013 Could I define a function to call a script? For example myFunction = { [] execVM "myscript.sqf"} Would that call the function from the client computer then if I ran my previous code (with "myFunction" instead of "myscript.sqf")? Yes, but unnecessary. Share this post Link to post Share on other sites
adamjm 10 Posted March 6, 2013 Are these functions to do things like prevent scripts executing once for each client and causing lag and such? Is this like the old game logic global form OFP? Share this post Link to post Share on other sites
Orion987 1 Posted March 6, 2013 (edited) Edit: Just editing over this post to update it. Anyway... I am running this in my init.sqf myFunction = { hint "Hello World!"; }; if (isServer) then { [[],"myFunction",true] spawn BIS_fnc_MP; }; I am getting the hint on the server, but not the client. I don't understand why, since that true parameter should execute the code on clients as well. Putting a publicVariable "myFunction" before the BIS_fnc_MP call does not help either. ---------- Post added at 10:24 PM ---------- Previous post was at 09:24 PM ---------- Figured it out. Since the spawn function was being called on the clients computer, it was being run in parallel to the server, which had to do more work, so the client was executing the code first. Using a 'waitUntil' command worked fine (but I did need to declare publicVariable for the function). Thanks so much neokika! Edited March 6, 2013 by Orion987 Share this post Link to post Share on other sites
clydefrog 3 Posted March 9, 2013 Edit: Just editing over this post to update it. Anyway... I am running this in my init.sqf myFunction = { hint "Hello World!"; }; if (isServer) then { [[],"myFunction",true] spawn BIS_fnc_MP; }; I am getting the hint on the server, but not the client. I don't understand why, since that true parameter should execute the code on clients as well. Putting a publicVariable "myFunction" before the BIS_fnc_MP call does not help either. ---------- Post added at 10:24 PM ---------- Previous post was at 09:24 PM ---------- Figured it out. Since the spawn function was being called on the clients computer, it was being run in parallel to the server, which had to do more work, so the client was executing the code first. Using a 'waitUntil' command worked fine (but I did need to declare publicVariable for the function). Thanks so much neokika! Orion or anybody else reading this, have you figured out how to use BIS_fnc_MP with tasks yet so they work properly for multiplayer (i.e they show their proper status for JIP players)? Share this post Link to post Share on other sites
mikie boy 18 Posted March 10, 2013 use this to hint to all in your init.sqf... //GLOBAL HINT "FOCK_GHint" addPublicVariableEventHandler { private ["_GHint"]; _GHint = _this select 1; hint format["%1", _GHint]; }; in whatever script you have - use this... FOCK_GHint = "New Cache has been created - Start Hunting"; publicVariable "FOCK_GHint"; // This data will only be received on other machines. Not on the machine where it is executed. hint FOCK_GHint; //this hints locally as the code above never runs locally ------------------------------ exactly the same for executing a file across the board - same process init.sqf //execute script for all "FOCK_CallScriptEveryone" addPublicVariableEventHandler { private ["_forAll"]; _forAll = _this select 1; execVM _forAll; }; in whatever script.sqf FOCK_CallScriptEveryone = "EndMission.sqf"; publicVariable "FOCK_CallScriptEveryone"; execVM FOCK_CallScriptEveryone; Share this post Link to post Share on other sites