Jump to content
Djavu

Play video for all players on the server

Recommended Posts

Hello. I need help with spawn bis_fnc_playvideo. For it to work in MP and dedicated. I call the script through an addAction. In the sqf file:
bigScreen setobjecttextureglobal [0, "scripts \ video \ action1.ogv"];
["scripts \ video \ action1.ogv", [10,10]] spawn bis_fnc_playvideo;
is only seen by who initiates addAction, I know that AddAction is local. I wonder if there is another way to call the script and that it works in the environments mentioned above.

Edited by Djavu

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/remoteExec

https://community.bistudio.com/wiki/BIS_fnc_playVideo

// Example from Wiki
<params> remoteExec ["fnc_someScriptedFunction", targets, JIP];

So, first off, change "fnc_someScriptedFunction" to:

BIS_fnc_playVideo

It should look like:
 

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

Now, look at what arguments (params) BIS_fnc_playVideo takes. See Wiki. For this, I will use one from the Wiki.

["\a3\missions_f_exp\video\exp_m04_v02.ogv"] call BIS_fnc_playVideo;

Switch <params> with everything from first [ to the last ] before call and you should now have this:

["\a3\missions_f_exp\video\exp_m04_v02.ogv"] remoteExec ["BIS_fnc_playVideo", targets, JIP];

As stated on the Wiki:

Quote

targets (Optional): [default: 0 = everyone]

Number - Only 0 and 2 are special. When 0, the function or command will be executed globally, i.e. on the server and every connected client, including the one where remoteExec was originated. When 2, it will be executed only on the server. When 3, 4, 5...etc it will be executed on the client where clientOwner ID matches the given number. When number is negative, the effect is inverted. -2 means execute on every client but not the server. -12, for example, means execute on the server and every client, but not on the client where clientOwner ID is equal to 12.

Object - the function will be executed only where unit is local

String - the function will be executed only where object or group defined by the variable with passed name is local

Side - the function will be executed only on clients where the player is on the specified side

Group - the function will be executed only on clients where the player is in the specified group. In order to execute the function where group is local pass owner of the group as param:
_myGroup remoteExec ["deleteGroup", groupOwner _myGroup];

Array - array of any of types listed above

As you want it to show on all clients, you can do this:

([0,-2] select isDedicated)

See the note on Wiki from Revo:

Quote

While KK's solution works fine in sp missions and on dedicated servers, it will not work properly for hosted missions.
Solution: [0,0.5] remoteExec ['fadeRadio',[0,-2] select isDedicated,true];
Singleplayer: isDedicated returns false -> code is executed everywhere (0)
Hosted: isDedicated returns false -> code is executed everywhere including host (0)
Dedicated: isDedicated returns true -> code is executed everywhere excluding server(-2)

You should now have something like:

["\a3\missions_f_exp\video\exp_m04_v02.ogv"] remoteExec ["BIS_fnc_playVideo", ([0, -2] select isDedicated), JIP];

The last argument (parameter) is up to you, I can't say I ever use it personally though. It takes a BOOL true or false. True if you want it to run for JIP and false if not.

["\a3\missions_f_exp\video\exp_m04_v02.ogv"] remoteExec ["BIS_fnc_playVideo", ([0, -2] select isDedicated), false];

Depending on if you use it or not, and on your mission setup, you might need to whitelist the function.

https://community.bistudio.com/wiki/Description.ext#CfgRemoteExec

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, HazJ said:

https://community.bistudio.com/wiki/remoteExec

https://community.bistudio.com/wiki/BIS_fnc_playVideo


// Example from Wiki
<params> remoteExec ["fnc_someScriptedFunction", targets, JIP];

So, first off, change "fnc_someScriptedFunction" to:

BIS_fnc_playVideo

It should look like:
 


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

Now, look at what arguments (params) BIS_fnc_playVideo takes. See Wiki. For this, I will use one from the Wiki.


["\a3\missions_f_exp\video\exp_m04_v02.ogv"] call BIS_fnc_playVideo;

Switch <params> with everything from first [ to the last ] before call and you should now have this:


["\a3\missions_f_exp\video\exp_m04_v02.ogv"] remoteExec ["BIS_fnc_playVideo", targets, JIP];

As stated on the Wiki:

As you want it to show on all clients, you can do this:


([0,-2] select isDedicated)

See the note on Wiki from Revo:

You should now have something like:


["\a3\missions_f_exp\video\exp_m04_v02.ogv"] remoteExec ["BIS_fnc_playVideo", ([0, -2] select isDedicated), JIP];

The last argument (parameter) is up to you, I can't say I ever use it personally though. It takes a BOOL true or false. True if you want it to run for JIP and false if not.


["\a3\missions_f_exp\video\exp_m04_v02.ogv"] remoteExec ["BIS_fnc_playVideo", ([0, -2] select isDedicated), false];

Depending on if you use it or not, and on your mission setup, you might need to whitelist the function.

https://community.bistudio.com/wiki/Description.ext#CfgRemoteExec

Thank you for your attention, my friend. See if this will be correct my action1.sqf file:

bigScreen setobjecttextureglobal [0, "scripts \ video \ action1.ogv"];

["scripts \ video \ action1.ogv", [10,10]] remoteExec ["BIS_fnc_playVideo", ([0, -2] select isDedicated), true];

The code runs on all clients including the server and JIP, however, as far as I understand, it will not work on hosted.

Share this post


Link to post
Share on other sites
51 minutes ago, Djavu said:

Thank you for your attention, my friend. See if this will be correct my action1.sqf file:

bigScreen setobjecttextureglobal [0, "scripts \ video \ action1.ogv"];

["scripts \ video \ action1.ogv", [10,10]] remoteExec ["BIS_fnc_playVideo", ([0, -2] select isDedicated), true];

The code runs on all clients including the server and JIP, however, as far as I understand, it will not work on hosted.

It will work on hosted as well. See example #3 on the Wiki.

https://community.bistudio.com/wiki/BIS_fnc_playVideo

Something like this:

_video = "\a3\missions_f_exp\video\exp_m04_v02.ogv";
_screen = "Land_TripodScreen_01_large_F" createVehicle (player modelToWorld [0, 10, 0]);
_screen setObjectTextureGlobal [0, _video];
[_video, [10, 10]] remoteExec ["BIS_fnc_playVideo", ([0, -2] select isDedicated), false];

 

Share this post


Link to post
Share on other sites
1 minute ago, HazJ said:

Isso também funcionará hospedado. Veja o exemplo # 3 no Wiki.

https://community.bistudio.com/wiki/BIS_fnc_playVideo

Algo assim:


 

I understood, now my doubt is about class CfgRemoteExec in the description.ext file, I'm breaking my head, I have not the slightest idea. Thank you again. I'm already embarrassed by so many questions.

Share this post


Link to post
Share on other sites
Just now, Djavu said:

I understood, now my doubt is about class CfgRemoteExec in the description.ext file, I'm breaking my head, I have not the slightest idea. Thank you again. I'm already embarrassed by so many questions.

I'd say for now, don't worry about it. Doesn't seem like you have that setup anyway. :dontgetit:

Share this post


Link to post
Share on other sites
1 hour ago, Djavu said:

I mean it's not necessary to have CfgRemoteExec class in my description.ext file? 

https://community.bistudio.com/wiki/Description.ext#CfgRemoteExec  :scratchchin:

 

Not required, no, it is up to you. Most missions don't use it, and the ones that do are usually "Altis Life" and maybe Wasteland perhaps (not sure on this one).

Share this post


Link to post
Share on other sites
2 hours ago, HazJ said:

Not required, no, it is up to you. Most missions don't use it, and the ones that do are usually "Altis Life" and maybe Wasteland perhaps (not sure on this one).

Thanks again, it was a big help.

The only thing that worked was:
["scripts \ video \ action1.ogv", [10,10]] remoteExec ["BIS_fnc_playVideo", 0, true];

Working perfectly for JIP too
I have now tested on the hosted server, I will soon test more on the dedicated :thumb:

  • Haha 1

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

×