Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
FlyingM

Set mission time for all players

Recommended Posts

Hi

I'm somewhat new to Arma scripting and I'm currently struggling with a small script that I want to integrate in a little sandbox map.

I would like it to be possible for all players to acces a menu via addAction which allows them to switch the mission time from day to night and back again whenever they please. setdate and skiptime both work fine but since they are local-only, only the player who activates the option will see the effect. I can't imagine that this is that hard to achieve but I've searched for about a day now and could not find any helpful hint anywhere. Can anyone help me with this?

Below is the code I've added in the script file so far:

_target = _this select 0;
_caller = _this select 1;
_action = _this select 2;

_playerName = name _caller;
_strMsg = "";

if(day) then
{
_strMsg = _playerName + " switched to NIGHT!";
day = false;		
}
else
{
_strMsg = _playerName + " switched to DAY!";
day = true;
};

skipTime 12;
titleText[_strMsg,"Plain"];

As I said, it works fine but only for the player who activates the action. Obviously, the same problem exists for the titleText[] method. I'd like the message to be displayed for every player in the game but currently, nobody but me can read it when I push the button.

Share this post


Link to post
Share on other sites

This is just a idea i find it in community before.Take a look.

Init.sqf

enablesaving [false, false];
waituntil {!isnil "bis_fnc_init"};
call compile preprocessfile "skip.sqf"; // skip time function

Skip.sqf

targetTime = -1; 

gotoTime ={
targetTime = _this select 0;
publicVariable "targetTime";
};


monitorTime ={
while {true} do {
	waitUntil {targetTime != -1};
	skiptime (targetTime - daytime); 
	targetTime = -1;
};
};

[] spawn { [] call monitorTime;};

- Put a function module in map

use this code to skip time in script or trigger.

[5] call gotoTime ;

"5 hours skip time"

and this is about how to show massage to all clients

[nil,nil,rTITLETEXT,"5 HOURS LATER", "BLACK FADED"] call RE;

Share this post


Link to post
Share on other sites
Sign in to follow this  

×