Jump to content
Sign in to follow this  
lawndartleo

time and fog changes driving me nuts

Recommended Posts

On a hosted dedicated server...

When I put...

skiptime 1

or...

10 setfog .5

on a radio trigger, everything works.

I want to put the same on a hidden object and get rig of the radio triggers so I did this...

this addaction ["skip 1", "skiptime 1"];

and...

this addaction ["fog 5", "10 setfog .5"];

but that didnt work so i added

this addaction ["skip 1", "if (isDedicated) then {skiptime 1}"];

and...

this addaction ["fog 5", "if (isDedicated) then {10 setfog .5}"];

But that doesn't work, either. What am I missing? The addactions work when I test locally but on the dedicated they do not. I dont want the radio triggers because then anybody with a radio can change things. With a hidden object that only clan members know about, it would work much better.

Share this post


Link to post
Share on other sites

BIS_fnc_MP is your best buddy for code that needs to be executed on every client.

you'll need to make a function for each command (or put them both in one if you want), then you should be able to call them without any parameters, and it should send it out to the server and all clients to change the weather.

you can put actions on an object such as a box or H-barrier somewhere, or you could just use getplayerUID player and compare it against an array of player ids to see if that person can use the action or not.

Share this post


Link to post
Share on other sites

austin_medic is correct, but let me explain a little bit and give you an example...

- Code executed by addAction is always local. Meaning it is only executed on the client that used the action.

- Since one of the recent patches, Arma 3 weather is automatically synchronized in MP (overcast, rain, fog, even wind). Because of that, weather commands have to be executed on the server now, and only on the server. Clients will be synchronized within split-seconds.

So like austin_medic said, you will need to send a "request" from client to server using BIS_fnc_MP.

Define a function (in your init.sqf for example):

fnc_setFog = {
10 setfog 0.5;
};

Then call it from any client:

[[],"fnc_setFog", false, false, true] spawn BIS_fnc_MP;

For skipTime, according to the wiki:

In Arma 3 (around v1.14) skipTime executed on the server will get synced in 5 seconds or so with all the clients. It will also be JIP compatible. skipTime executed on a client will change time on client for about 5 seconds after which it will sync back to server time.

So again, same method as for the weather, send a request to the server and wait to be synced.

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  

×