Jump to content
Sign in to follow this  
fasad

Global exec from within local code

Recommended Posts

G'day all,

Is it possible to start a script (or execute statements in general) on each client + server, from within a script running on one client only? If so, how?

Explanation - I want to execute a script on the server only from within a client only dialog. I imagine it could be done using a trigger or a init line of a newly created object?

Share this post


Link to post
Share on other sites

Well at least with using a trigger should work I think. I haven't tested this but I think it should work.

You set some global boolean variable to true, publicVariable it, then check it in your trigger. Then your trigger checks if server machine, if yes then executes the script. Then the script sets the same boolean variable to false and publicVariables it. Wouldn't it work like that?

Another question is, what happens if multiple clients do the same thing at the same time?

Share this post


Link to post
Share on other sites

Yes if you set a trigger to monitor a "globalvariable" and set the variable to 1 in the local script and have the trigger launch the other script.

Share this post


Link to post
Share on other sites

I had major headaches using that publicVariable under OFP for a fun TT map I made once. Some times it worked, other times it didn't: BUT the problem may have been that I was depending on the value being echoed to all other clients, instead of picking it up at the server and doing something there instead.

The server acting on it and then informing clients may have worked better. Anyone else confirm this is the same in ArmA or has it been fixed?

Share this post


Link to post
Share on other sites

I've had success sending an array as a ~30 character string using a public variable. The server script executes when a trigger activates when it detects the change in the variable. When the server executes the script, it changes the variable back to the null value. I am considering having the client wait a few seconds to ensure the variable got through, is this wise?

Of course, I haven't tested it on a desynched WAN game yet smile_o.gif

Share this post


Link to post
Share on other sites

I got into that habit, as well as putting in checks for a variable change in OFP.

Too many times there was a glitch and something didn't work. So Id say its a good idea but, there are those who say its redundant. I do know that when I started doing it, my maps never had that issue again.

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  

×