Jump to content
KutPax

[Need Help] RemoteExec this addaction

Recommended Posts

Hi there,

Me and a group of friends love playing arma, and we recently found a script which we wanted to use. The only problem we encountered is that the addaction wasn't remotely executed so it would not work in MP. 
My sqf skills are not that great, hence I'm posting here for your help!

The code is as follows:
SKM_AddAction = {
    ls = (_this select 0) addAction ["Launch Skyhook", {[(_this select 0)] Call SKM_Action}];
    (_this select 0) setVariable ["SKM",["P",
    (((_this select 0) getVariable "SKM") select 1), //Rope Length 
    (((_this select 0) getVariable "SKM") select 2), //Hit Zone
    (((_this select 0) getVariable "SKM") select 3), //Light
    (((_this select 0) getVariable "SKM") select 4), //Texture
    ls],true];
};

I really hope someone out there knows a solution to my issue. Thanks in advance!

Share this post


Link to post
Share on other sites

[   // what you want to add the action to\\   , ["Tittle", {      // put the script here\\        } ]] remoteExec ["addAction"];
      ^ for example the player or cursortarget
I hope this helps 

Share this post


Link to post
Share on other sites

Not sure how to implement this @bumyplum since there's no script to execute. Do you think you can make an example out of the code I posted in my first post? Like I said I'm not that great with sqf 😉

Share this post


Link to post
Share on other sites

Basically to sum it up, when I test it in the Editor, it works. When I test it with multiplayer, I get the option for the addaction, but the other players do not get the option. I want to fix this with remoteExec, only I don't know how to change the code displayed above into it.

Share this post


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

Basically to sum it up, when I test it in the Editor, it works. When I test it with multiplayer, I get the option for the addaction, but the other players do not get the option. I want to fix this with remoteExec, only I don't know how to change the code displayed above into it.

Hard to tell from the info you're giving, since there's a few ways to solve locality.

You can handle the addAction functions on the server and broadcast them to player clients, or you can put anything addAction related into initPlayerLocal.sqf, so every player gets his own addAction without the need to use remoteExec etc.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

@Grumpy Old Man

Sorry for the lack of information. I am trying to edit the following script:

The creator of the script has abandoned it, and it only functions properly in Singleplayer. I am trying to edit it so it will work with Multiplayer, but I am having the following problem. When testing in Multiplayer (Client hosted), it only gives the option to deploy the Skyhook to the host. The host is able to deploy it for himself and for others, but others can't get the addaction to pop up for themselves. My idea was to make the function with remoteExec so it will work for the other players aswell. When in the Eden editor, playable units have this in their init:

Spoiler

this setVariable ["SKM",["P",30,50,true,2,""],true];

 

I suspect that the following code has to be edited to make it work:
 

Spoiler

SKM_Init = {
//Setup of Actions
{ if(typeName ((_x getVariable "SKM")select 5) != "SCALAR") then {[_x] call SKM_AddAction;};} foreach allMissionObjects "All";; //Units
};

SKM_AddAction = {
    // mp issues may occure
    ls = (_this select 0) addAction ["Launch Skyhook", {[(_this select 0)] Call SKM_Action }];
    (_this select 0) setVariable ["SKM",["P",
    (((_this select 0) getVariable "SKM") select 1), //Rope Length 
    (((_this select 0) getVariable "SKM") select 2), //Hit Zone
    (((_this select 0) getVariable "SKM") select 3), //Light
    (((_this select 0) getVariable "SKM") select 4), //Texture
    ls],true]; 
};


I hope someone's out there with better sqf knowledge than me who knows how to fix it. If I have still supplied you with insufficient information, please do let me know. Thanks in advance!

 

Share this post


Link to post
Share on other sites
3 hours ago, KutPax said:

Bump (Again)

 

Hello there KutPax !

Strange !

There is not a single reply ?

Let me check it !

 

 

Before i see anything , i haven't even read the code yet ,

you can add your code to your initplayerlocal.sqf , in order to have the action added to evevry player.

Share this post


Link to post
Share on other sites
44 minutes ago, GEORGE FLOROS GR said:

There is not a single reply ?

 

Oops !

Grumpy already did !

Share this post


Link to post
Share on other sites

@GEORGE FLOROS GR Thanks for replying, and sorry for not replying back (I was on vacation). Is there any chance you are willing to help me revive this script? If so could you send me a private message, thanks in advance.

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

×