Jump to content
Sign in to follow this  
Kaisoft

2 questions. addaction and computer.

Recommended Posts

Hello all. Sorry my bad english so i am spanish...

First Question:

i would like to know how can i make "addaction" for all clients. For example, "skiptime 12" in script sqs or sqf.

In MP, this addaction make night for only one client... for others.. it´s still morning :confused:.

Second Question:

I have seen one script called "Mission Control Center MCC Sandbox" but this requires ACE mod.

Is there any script that works like this without ACE mod???

Im making a training mission and need this "magic" computer for create vehicles, soldiers, objects and more.

I belong to GRUPO ARMADOS and we got a lot new recruits...

Thank you for your time.

Edited by Kaisoft

Share this post


Link to post
Share on other sites

If you want to achieve this without addons, your only two options are to use public variable event handlers or the MP Framework. This is necessary because addAction and skiptime both only have local effects. I highly recommend the first method. Let me work on some code examples for you:

// init.sqf

//If the public variable has not already been set due to a public variable broadcast then set it.

if (isNil "skipTimeNow") then
{
skipTimeNow = false;
};

// Add a public variable event handler that will fire whenever skipTimeNow changes.
//_this select 0: variable name.  _this select 1: new variable value 
"skipTimeNow" addPublicVariableEventHandler {[_this select 1] execVM "skipTimeNow.sqf";};

You did not say where you were adding the action. Should all players have it or is it assigned to a flag pole or other object? Either way, when selected, have it execute a script called "skipTimeAction.sqf"

// skipTimeAction.sqf

// Make the public variable skipTime true and broadcast it to the server and all clients
skipTimeNow = true;
publicVariable "skipTimeNow";
// Since the client that broadcasts the public variable does not trigger the PVEH to fire, then execute it directly.
skipTime 12;

// skipTimeNow.sqf

// The server and other clients should skip time when teh PVEH fires.
skipTime 12;

I should note that this will not work properly for JIP players since when they join they will skip to 12 but other players already connected will be past that already. To make that sync properly involved more code. You may want to consider sxp2high's suggestion below.

Edited by Loyalguard

Share this post


Link to post
Share on other sites

If skipTime is executed on the server only it will synchronize the clients after a while. Up to 1 minute i guess. JIPs will receive the new time too.

For immediate synchronized time skips you have to use setDate, which is the better command for multiplayer anyway.

Share this post


Link to post
Share on other sites

i tried that method LoyalGuard and it´s happen something interesting..

i set skiptime 12. But in MP, when i am alone skiptime works correctly. But i invited to friend for try it. When we were in the "beta" mision and switch the skiptime, it´s turned day, night, day, night, day, night, every time... i understand what´s happen but i dont know how to solve.

I add the "addaction" to a car. For make a timemachine..

Share this post


Link to post
Share on other sites
I add the "addaction" to a car. For make a timemachine..

Nice idea!.... We need a Tardis!

Share this post


Link to post
Share on other sites
i tried that method LoyalGuard and it´s happen something interesting..

i set skiptime 12. But in MP, when i am alone skiptime works correctly. But i invited to friend for try it. When we were in the "beta" mision and switch the skiptime, it´s turned day, night, day, night, day, night, every time... i understand what´s happen but i dont know how to solve.

I add the "addaction" to a car. For make a timemachine..

Does the time keep skipping forever or does it stop? If you did not set your own loop, then perhaps the issue sxp2high highlighted is affecting the time, that is, the server is also switching after some time...let me do some testing...perhaps it is only best to skip on the server and wait for it to changes the clients automatically after a period of time.

Share this post


Link to post
Share on other sites

I would suggest using setVehicleInit in this case rather than PV event handlers. This will produce consistent results, even for JIP players, and it is exceedingly simple. Simply put the following in your action script:

player setVehicleInit "skipTime 12";
processInitCommands;

That's it. JIP players should immediately skip time forward as many times as the other players have performed the skip upon joining.

Share this post


Link to post
Share on other sites

I can not believe it... it works perfectly... but i dont understand how it works.

What is processinitcommands??

Thank you and i hope help you when you need

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  

×