OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: 170th on 21 Apr 2007, 12:20:38
-
Id like to run a random weather script at the beginning of the mission. Problem... "Join in Progress" (not all clients have the same weather)
feuer_an = false;
?(!(local server)):exit
? startwetter < 1: goto "Condition1"
? startwetter < 2: goto "Condition2"
? startwetter < 3: goto "Condition3"
? startwetter < 4: goto "Condition4"
? startwetter < 5: goto "Condition5"
;Morgendämmerung, Klare Sicht, Regen
#Condition1
skiptime 4.5
0 setFog 0
0 setOvercast 1
feuer_an = true;
exit
;Morgendämmerung, Halbe Sicht, Regen
#Condition2
skiptime 4.5
0 setFog 0.5
0 setOvercast 1
feuer_an = true;
exit
;Morgendämmerung, Nebel, Regen
#Condition3
skiptime 4.5
0 setFog 1
0 setOvercast 1
feuer_an = true;
exit
;Morgendämmerung, Klare Sicht
#Condition4
skiptime 4.5
0 setFog 0
0 setOvercast 0
feuer_an = true;
exit
;Morgendämmerung, Halbe Sicht
#Condition5
skiptime 4.5
0 setFog 0.5
0 setOvercast 0
feuer_an = true;
exit
?!(local Server):exit
startwetter = random 24;
publicvariable "startwetter";
exit
Any Idea to run this correct on a Dedi?
I hope someone can help me with the prob ...thx and greez Sgt.Ace
-
I am not up to speed in ArmA, but this is how it should be done.
Write one script to run only on the server. It will set the weather and time then publicVariable the weather variables and time of day every minute or so.
Write one script to run on all clients. This script will set the time and weather every minute or so based on the variables which the server is sending. Make sure this script is set to launch for a client who JIP. For simplicity set the mission start time to midnight in the editor.
Example server script:
if (not local server) then {exit};
_timeofday = random 24;
_overcast_1 = random 1;
_overcast_2 = random 1;
_fog_1 = random 1;
_fog_2 = random 1;
_weathertime = 6;
_pause = 30;
_delta_overcast = (_overcast_2 - _overcast_1)/_weathertime;
_delta_fog = (_fog_2 - _fog_1)/_weathertime;
_timeincr = 0;
while {TRUE} do
{
_timeincr = _timeincr + _pause/60;
_timeofday = _timeofday + _pause/60;
��¦nbsp; ��¦nbsp;m_overcast = _delta_overcast * _timeincr + _overcast_1;
��¦nbsp; ��¦nbsp;m_fog = _delta_fog * _timeincr + _fog_1;
��¦nbsp; ��¦nbsp;m_time = _timeofday - daytime;
��¦nbsp; ��¦nbsp;0 setOvercast m_overcast;
��¦nbsp; ��¦nbsp;0 setFog m_fog;
��¦nbsp; ��¦nbsp;skipTime m_time;
��¦nbsp; ��¦nbsp;{{publicVariable _x} ForEach ["m_overcast","m_fog","m_time"]};
��¦nbsp; ��¦nbsp;waitUntil {(time mod _pause) == 0);
};
Example client script;
if (local server) then {exit};
_pause = 30;
waitUntil {(not isnil m_overcast) && (not isnil m_fog) && (not isnil m_time)};
while {TRUE} do
{
��¦nbsp; ��¦nbsp;0 setOvercast m_overcast;
��¦nbsp; ��¦nbsp;0 setFog m_fog;
��¦nbsp; ��¦nbsp;skipTime m_time;
��¦nbsp; ��¦nbsp;sleep _pause;
};
This code is, of course, untested but it should give you an idea of how to proceed... :shhh:
-
Cool mate realy great ill try it... thx :cool2:
-
Take Note, that when a JIP player enters the game, they will not be synced withj any of the following
Daytime: (if skiptime has been used)
Weather settings :
(where code altering the weather has been used, eg 1 setfog 0.5)
BI's motto should be
If it's important, don't fix it, we'll have a jet bomber addon instead