Reddog 10 Posted September 18, 2014 I'm hoping you can point me in the direction of scripting information on how to change the time of day on a dynamic map running on a dedicated (public/paid) server. We have a tool in game that allows us to choose the time, but nothing is happening except on client side. Our creator and scripter recently died so we are struggling to keep a server running when we hit this simple problems. I did notice that when we run the in-game script for changing the time of day, it changes for about 1 second, until the server responds, then it reverts back to the default time of 10:30am. The script is not getting back to server wide. Anybody know a simple control line we can add to the game server's .cfg file?? Thank you Share this post Link to post Share on other sites
Lala14 135 Posted September 18, 2014 this is what you do GlobalServerTime = date; GlobalServerTime set [3,14]; //this will be hours (24hr) GlobalServerTime set [4,30]; //this will be minutes publicVariable "GlobalServerTime"; setDate GlobalServerTime; Share this post Link to post Share on other sites
Reddog 10 Posted September 18, 2014 (edited) Thank you mate for that, but I need to ask a newbie question, so bear with me. Where does this code go so that it will change time, or weather on a MP server? Do I copy that PHP code into the Server.cfg file?? Seems like the only place to do it. We have an ingame script that allows us to choose time of day in increments, does the PHP code have to allow for that? This is our ingame script which works great locally... teg_fnc_morningMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Good Morning Soldier !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; _date = date; _date set [3,05]; //--- new hour (18) _date set [4,35]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time _date, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; setdate _date; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_midmorningMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "A Good Mid-Morning Fight !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; _date = date; _date set [3,09]; //--- new hour (18) _date set [4,22]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time _date, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; setdate _date; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_noonMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "It is Noon and No time for a siesta !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; _date = date; _date set [3,12]; //--- new hour (18) _date set [4,45]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time _date, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; setdate _date; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_afternoonMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Late Afternoon - Stay Frosty !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; _date = date; _date set [3,15]; //--- new hour (18) _date set [4,38]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time _date, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; setdate _date; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_eveningMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Good Evening - You have a date!" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; _date = date; _date set [3,18]; //--- new hour (18) _date set [4,17]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time _date, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; setdate _date; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_nightMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "No Time For Sleep !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; _date = date; _date set [3,23]; //--- new hour (18) _date set [4,55]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time _date, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; setdate _date; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_moonMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "No Time For Sleep !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; _date = date; _date set [0, 2014]; //--- new year _date set [1, 6]; //--- new month _date set [2, 2]; //--- new day _date set [3, 23]; //--- new hour (23) _date set [4, 55]; //--- new minute (59) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time _date, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; setdate _date; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_nomoonMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Dark Side Of The Moon !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; _date = date; _date set [0, 2014]; //--- new year _date set [1, 6]; //--- new month _date set [2, 15]; //--- new day _date set [3, 23]; //--- new hour (18) _date set [4, 55]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time _date, //--- End time 100 //--- Counter speed ] call bis_fnc_showTime; setdate _date; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; Edited September 18, 2014 by Reddog Share this post Link to post Share on other sites
Lala14 135 Posted September 19, 2014 ok see where each section has setdate _date. We have to change the _date to something else so we can use the PublicVariable. I decided to change it to GlobalChangedDate I then at each setDate just before put the PublicVariable. Also PHP code just makes all the code look colourful! Below in the spoiler is the new modified time code thing. teg_fnc_morningMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Good Morning Soldier !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; GlobalChangedDate = date; GlobalChangedDate set [3,05]; //--- new hour (18) GlobalChangedDate set [4,35]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time GlobalChangedDate, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; publicVariable "GlobalChangedDate"; setdate GlobalChangedDate; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_midmorningMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "A Good Mid-Morning Fight !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; GlobalChangedDate = date; GlobalChangedDate set [3,09]; //--- new hour (18) GlobalChangedDate set [4,22]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time GlobalChangedDate, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; publicVariable "GlobalChangedDate"; setdate GlobalChangedDate; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_noonMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "It is Noon and No time for a siesta !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; GlobalChangedDate = date; GlobalChangedDate set [3,12]; //--- new hour (18) GlobalChangedDate set [4,45]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time GlobalChangedDate, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; publicVariable "GlobalChangedDate"; setdate GlobalChangedDate; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_afternoonMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Late Afternoon - Stay Frosty !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; GlobalChangedDate = date; GlobalChangedDate set [3,15]; //--- new hour (18) GlobalChangedDate set [4,38]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time GlobalChangedDate, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; publicVariable "GlobalChangedDate"; setdate GlobalChangedDate; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_eveningMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Good Evening - You have a date!" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; GlobalChangedDate = date; GlobalChangedDate set [3,18]; //--- new hour (18) GlobalChangedDate set [4,17]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time GlobalChangedDate, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; publicVariable "GlobalChangedDate"; setdate GlobalChangedDate; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_nightMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "No Time For Sleep !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; GlobalChangedDate = date; GlobalChangedDate set [3,23]; //--- new hour (18) GlobalChangedDate set [4,55]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time GlobalChangedDate, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; publicVariable "GlobalChangedDate"; setdate GlobalChangedDate; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_moonMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "No Time For Sleep !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; GlobalChangedDate = date; GlobalChangedDate set [0, 2014]; //--- new year GlobalChangedDate set [1, 6]; //--- new month GlobalChangedDate set [2, 2]; //--- new day GlobalChangedDate set [3, 23]; //--- new hour (23) GlobalChangedDate set [4, 55]; //--- new minute (59) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time GlobalChangedDate, //--- End time 95 //--- Counter speed ] call bis_fnc_showTime; publicVariable "GlobalChangedDate"; setdate GlobalChangedDate; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; teg_fnc_nomoonMsg = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Dark Side Of The Moon !" + "<br />" + "<t size='1.5'>" + "Mission Time Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; GlobalChangedDate = date; GlobalChangedDate set [0, 2014]; //--- new year GlobalChangedDate set [1, 6]; //--- new month GlobalChangedDate set [2, 15]; //--- new day GlobalChangedDate set [3, 23]; //--- new hour (18) GlobalChangedDate set [4, 55]; //--- new minute (35) cuttext ["","black out"]; 1 fadesound 0; sleep 1; _showtime = [ date, //--- Start time GlobalChangedDate, //--- End time 100 //--- Counter speed ] call bis_fnc_showTime; publicVariable "GlobalChangedDate"; setdate GlobalChangedDate; 2 fadesound 1; sleep 2; _showtime cuttext ["","black in"]; cuttext ["","black in"]; }; Share this post Link to post Share on other sites
Magirot 14 Posted September 19, 2014 (edited) You have to execute the setDate command itself on the server, public variabling the value alone doesn't help. BIS_fnc_MP is helpful in this case, and doesn't require the extra pV. If you use it with the original script, it works if you replace all the lines that read setdate _date; with [[[_date], { setDate (_this select 0) }], "BIS_fnc_spawn"] call BIS_fnc_MP; Edit: That's for changing the time alone, the fades and texts would require more of the same, but it would be better to define them as functions instead of using BIS_fnc_spawn. Where is the script called from? As in how do you use it in-game. Edited September 19, 2014 by Magirot Share this post Link to post Share on other sites
Reddog 10 Posted September 19, 2014 You have to execute the setDate command itself on the server, public variabling the value alone doesn't help. BIS_fnc_MP is helpful in this case, and doesn't require the extra pV. If you use it with the original script, it works if you replace all the lines that read setdate _date; with [[[_date], { setDate (_this select 0) }], "BIS_fnc_spawn"] call BIS_fnc_MP; Edit: That's for changing the time alone, the fades and texts would require more of the same, but it would be better to define them as functions instead of using BIS_fnc_spawn. Where is the script called from? As in how do you use it in-game. Hmmmmm.... It has been so long since I've done this kind of thing, so I have to get my mind right around the logic of where the code is, ie client or server side, and what its doing. We have a graphical pad we can call up in game that has all these scripts attached to it. We call it the Thor Pad. In that pad two screens down, is the set date GUI, Nice looking icons that tell the user what time it is by where the sun or moon is located. Quick and easy. The fade in's allow everyone on the server to halt and get ready for the time switch, so stop moving. So. I'm getting a better picture of what your stating, but still not clear on if I need to make a modification to our MP server.cfg file that is running the server at Gamerservers.com, or is this script coding just modified inside our change time of day script above? Share this post Link to post Share on other sites
Reddog 10 Posted September 19, 2014 It worked GREAT!!!!! Thank you so much Magirot!!!!! your the best! Share this post Link to post Share on other sites
csk222 23 Posted September 20, 2014 Hello and thank you very much for the help you have provided thus far. Magirot you provided the solution to the problem. I was wondering if you could help us out or guide us in the right direction with another "idea" we would like to implement in our mission. We have been experimenting with weather changes. It is very similar to the above script but with "weather" commands. I get the following to work in the editor but have yet to try it on the dedicated server. Before we go the trial and error method like we did with the time change issue we had, I want to ask the forum for help/guidance. teg_fnc_rain = { private ["_text","_1","_msg"]; _text = "<t size='1'>" + "Rain" + "<br />" + "<t size='1.5'>" + "Mission Weather Change" + "</t>" + "<br />" + "<img size='4' image='images\a3_bombadge2.paa'/>" + "</t>"; _1 =[_text,0.01,0.01,10,-1,0,90]spawn bis_fnc_dynamicText; cuttext ["","black out"]; 1 fadesound 0; sleep 1; skipTime -24; 0 setOvercast 1; 0 setRain 1; 0 setFog 1; //setWind [1,1,true]; <-- Not sure if that works so its commented out. skipTime 24; sleep 1; simulWeatherSync; 2 fadesound 1; sleep 2; cuttext ["","black in"]; }; Share this post Link to post Share on other sites