Jump to content
Barba-negra

scripts with remoteExec

Recommended Posts

hello good afternoon guys, greetings to all, I come here with a question to see if you can help me, I'm using a way to call a scritps with remoteExec, and at the moment it has worked for me, but I think it is not the correct way to do it because the page explains it in another way, the way I'm doing it is,

 

[[],'Objetivo01.sqf'] remoteExec ['BIS_fnc_execVM'];

 

however on the page https://community.bistudio.com/wiki/remoteExec Explains that the script should be called by means of a function, and is there my confucion, to what function does it refer? Maybe a public variable ?, and the way he calls it explains about a paramter, an objective and a JIP, things that I do not understand very well either, could someone explain it to me? thanks to everyone

 

<params> remoteExec ["fnc_someScriptedFunction", targets, JIP];

Share this post


Link to post
Share on other sites
46 minutes ago, elthefrank said:

Explains that the script should be called by means of a function

You already are, 'BIS_fnc_execVM' is a function that execVM's the named script file passed to it ( Objetivo01.sqf ).

Targets are a reference to what machine you want the function to run on. 2 server, 0 everyone, BOB some player whos unit has the varName BOB

JIP is whether you want this remoteExec to happen for each new client that joins your mission.

  • Thanks 1

Share this post


Link to post
Share on other sites

Instead of remote executing an sqf, you could run it on any client/server (with trigger of example, but not only). What do you intend to do with your sqf?

  • Like 1

Share this post


Link to post
Share on other sites

ok Mr. @Larrow  then the function is 'BIS_fnc_execVM', now I understand a little more, then the way I'm doing it is fine, Should I put the 0 equal to the end?

 

[[], 'Objetivo01.sqf'] remoteExec ['BIS_fnc_execVM', 0];

 

or already the function 'BIS_fnc_execVM' fulfills that task? because without putting the 0 I think it is working globally

Share this post


Link to post
Share on other sites

@pierremgi Objetivo01.sqf add an addation to a button, and activate a localized target alarms, and add an image to a screen, everything works very well so far

Share this post


Link to post
Share on other sites

but this work started it all for a player, and now I'm converting it to multiplayer, and I already have a big forward, so I ask how to use the remoteExec properly so that the work is without fail

Share this post


Link to post
Share on other sites

[] Spawn {

pc4 say3d "Objetivo";

terminate Localizando;

Sleep 2;

pc4 setObjectTextureGlobal [0, "\ZNV\objetivo.paa"];

Computadora1 addaction ['Disparar a Barco',{['launch01.sqf','BIS_fnc_execVM',true,false] spawn BIS_fnc_MP;}];

};

 

here the objective.sqf scripts, but I do not understand what is meant by an example trigger, as could be done @pierremgi ?

Share this post


Link to post
Share on other sites

That will fail, anyway, because you're remote executing everywhere a global command supposed to be fired one time (I know, this not explicit in BIKI)  (setObjectTextureGlobal).

 

You need to read BIKI and apply syntax + arguments and effects for each command / function you're using, but also remarks and discussions. "Dura lex sed lex".

 

You don't need to spawn inside your script here (you're already in a scheduled scope here, with execVM, and even addAction). Just a detail.

 

What I suggest:

Forget your Objetivo01.sqf.  In your addAction code:

pc4 remoteExec ["say3D];

sleep 2;

pc4 setObjectTextureGlobal [0, "\ZNV\objetivo.paa"];

 

For Computadora1, you can remoteExec the addAction after these lines, or think about the addAction in editor, on object init field, and wait for a condition (example: a variable set to true and added to your addAction above).

 

Anyway, what ever you choose:

First case: To remoteExec the addAction:

[Computadora1, ['Disparar a Barco',{<your code here>}] ] remoteExec ["addAction",0,true];

 

Second case: addAction on object in editor is fine because you don't need to remoteExec it. Just play with the condition to make it appear or not.

 

Note: If you script an addAction, there are two levels of scopes: you need to remoteExec the addAction itself to make it visible for any player. You need to remoteExec or use global effect command, to make your code global (like your say3D or setTextureGlobal as show above)

  • Thanks 1

Share this post


Link to post
Share on other sites

your appreciation is very good @pierremgi I'm going to make those changes and I'll publish it, so they can see it and give me their opinions, thanks guys

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

×