Just whipped this up as an example of how you could do this via a function. Could put it in the "OnModuleLoad" event or something.
You would need to place a Waypoint in every area and give each one the tag "WEATHER_WP_1", "WEATHER_WP_2", etc. Either that or you could alter this funtion to include the tags of every area in your mod.
But anyway:
const float TIMER = 480.0;//4 hours in game assuming you have 2 minute hour
void SetWeatherSkyBoxAllAreas()
{
object oModule = GetModule();
int iSkyBox;
int iRand = d3();
switch (iRand)
{
case 0: SetWeather(oModule, WEATHER_CLEAR);
iSkyBox = SKYBOX_GRASS_CLEAR;break;
case 1: SetWeather(oModule, WEATHER_SNOW);
iSkyBox = SKYBOX_ICY;break;
case 2: SetWeather(oModule, WEATHER_RAIN);
iSkyBox = SKYBOX_GRASS_STORM;break;
}
int iInt = 1;
object oWP;
object oArea;
oWP = GetWaypointByTag("WEATHER_WP_" + IntToString(iInt));
while (GetIsObjectValid(oWP))
{
oArea = GetArea(oWP);
SetSkyBox(iSkyBox, oArea);
iInt++;
oWP = GetWaypointByTag("WEATHER_WP_" + IntToString(iInt));
}
DelayCommand(TIMER, SetWeatherSkyBoxAllAreas());
}
/*void main()
{
SetWeatherSkyBoxAllAreas();
}*/
Hope that helps. Good Luck.
EDIT: Ok just saw you got it working so nevermind.
'>
Modifié par GhostOfGod, 12 août 2010 - 07:25 .