Jump to content
Sign in to follow this  
fortun

Making a script start on each client

Recommended Posts

I have tried the most things i can find. Looking through Multiplayer framework (At which i don't understand a shit) and trying different things.

But how am i able to make a script execute on all clients?

This is my Suitcase.sqf


deleteVehicle suit;   ////This deletes a editor placed suitcase, works fine on both host and client
deleteVehicle c2;   ////This deletes a Chemlight placed in editor. This however won't delete if Client is the one starting the script. Weird since client can delete the Suitcase?


///// This is FHQ_TT TaskTracker. This needs to be executed serverside, however. If the client is the one opening the script, then nothing will happen But if the Host open it works fine. How to fix?

[  west,                                                                ["Hidden Task",
          "Find the hidden suitcase on the wreck (This objective is one of the hidden tasks. There are 3 hidden suitcases, try find them all). Well done!",
          "Hidden Objective: Find suitcase 1",
          "",    "Succeeded"          ]  ] call FHQ_TT_addTasks;    

          ["Hidden Task", "succeeded"] call FHQ_TT_setTaskState;    

This gets executed when aiming at the suitcase via this

this addAction ["Take Suitcase","Suitcase.sqf" ,[suit],1,false,true,"","(_target distance _this) < 3"]; 

Think i may need to use publicvariable somewhere, but how would i do that if it helps?

Please anyone, help me.

Share this post


Link to post
Share on other sites

So i would simply put it like this then?

this addAction ["Take Suitcase","Suitcase.sqf" ,[suit],1,false,true,"","(_target distance _this) < 3"] call BIS_fnc_MP; 

Also, why doesen't them chemlight dissappear but the suitcase? Getting error on it when client execute the script

Share this post


Link to post
Share on other sites

if that code is placed in the editor then it should work fine

the suit case addaction.

Share this post


Link to post
Share on other sites

Hmm, tested the code

this addAction ["Take Suitcase","Suitcase.sqf" ,[suit],1,false,true,"","(_target distance _this) < 3"] call BIS_fnc_MP;

Still doesent seems to broadcast it when client uses the action. Don't get any new task.

Also, this is the errorcode i get for the chemlight (called c2) when client uses Deletevehicle on it (in the script). However, as i said it works on the Suitcase (called suit in script).

MLeid1E.jpg

Have no freaking idea how it should look like. If its to messy to do i think i skip the whole multiplayer thing..

Edited by FortuN

Share this post


Link to post
Share on other sites

You're using the wrong syntax. Here:

this addAction ["Take Suitcase",{[[_this select 3,"Suitcase.sqf"],"BIS_fnc_execVM",true] call BIS_fnc_MP},[suit],1,false,true,"","(_target distance _this) < 3"];

Share this post


Link to post
Share on other sites

Thanks, would never figured it out without an example of it!

The only thing i get now after this change is

(This is in the script aswell)

_per = _this select 0;  // Person who had the addAction
_ldr = _this select 1;  // Person who used the addAction
_act = _this select 2;  // ID of the addAction

Now is says

_act is zero divisor

But has the Id of the action changed then?

If i have

_unit RemoveAction 0; Then it works perfectly. Why?

Edited by FortuN

Share this post


Link to post
Share on other sites

Just use _this instead of _this select 3 to pass all the information given by addAction. _this select 3 is only passing the arguments provided e.g [suit]

this addAction ["Take Suitcase",{[[_this,"Suitcase.sqf"],"BIS_fnc_execVM",true] call BIS_fnc_MP},[suit],1,false,true,"","(_target distance _this) < 3"];

Share this post


Link to post
Share on other sites
Just use _this instead of _this select 3 to pass all the information given by addAction. _this select 3 is only passing the arguments provided e.g [suit]

this addAction ["Take Suitcase",{[[_this,"Suitcase.sqf"],"BIS_fnc_execVM",true] call BIS_fnc_MP},[suit],1,false,true,"","(_target distance _this) < 3"];

This is correct, just make sure to adjust Suitcase.sqf accordingly.

For example, the suit argument would then become (_this select 3) select 0 instead of (_this select 0).

Share this post


Link to post
Share on other sites
This is correct, just make sure to adjust Suitcase.sqf accordingly.

For example, the suit argument would then become (_this select 3) select 0 instead of (_this select 0).

but isnt the action being added to the suitcase???

edit

never mind i'll go back into my hole.

Edited by Lala14

Share this post


Link to post
Share on other sites

If you pass _this to your suitcase.sqf script, then you'll be passing the array that addAction provides. Hence: [target (_this select 0),caller (_this select 1),ID (_this select 2),arguments (_this select 3)]

Which means that if suitcase.sqf is not expecting this array, but instead is expecting only the argument "[suit]", you'll need to adjust it to account for the new arguments.

Share this post


Link to post
Share on other sites
If you pass _this to your suitcase.sqf script, then you'll be passing the array that addAction provides. Hence: [target (_this select 0),caller (_this select 1),ID (_this select 2),arguments (_this select 3)]

Which means that if suitcase.sqf is not expecting this array, but instead is expecting only the argument "[suit]", you'll need to adjust it to account for the new arguments.

Yea I know about that I just was going to say to use (_this select 0) but yea then I saw the arguments.

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  

×