Author Topic: Day and night.  (Read 504 times)

I have a version of it, but it crashes people occasionally. I think it starts crashing once over 10 people join the server since it starts lagging out functions and it deletes the sky but lags too much to add the new one in.
Code: [Select]
function MakeSky(%color, %fog)
{
    echo("deleting sky");
   sky.delete();
   new Sky(Sky)
   {
      position = "336 136 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      materialList = "base/data/skies/Sky_Default/resource.dml";
      cloudHeightPer[0] = "0.349971";
      cloudHeightPer[1] = "0.3";
      cloudHeightPer[2] = "0.199973";
      cloudSpeed1 = "0.0005";
      cloudSpeed2 = "0.001";
      cloudSpeed3 = "0.0003";
      visibleDistance = "600";
      fogDistance = "500";
      fogColor = %fog;
      fogStorm1 = "0";
      fogStorm2 = "0";
      fogStorm3 = "0";
      fogVolume1 = "0 0 0";
      fogVolume2 = "0 0 0";
      fogVolume3 = "0 0 0";
      fogVolumeColor1 = "128.000000 128.000000 128.000000 -222768174765569860000000000000000000000.000000";
      fogVolumeColor2 = "128.000000 128.000000 128.000000 0.000000";
      fogVolumeColor3 = "128.000000 128.000000 128.000000 -170698929442160050000000000000000000000.000000";
      windVelocity = "0 0 0";
      windEffectPrecipitation = "1";
      SkySolidColor = %color;
      useSkyTextures = "0";
      renderBottomTexture = "1";
      noRenderBans = "1";
      locked = "true";
   };

   MissionGroup.add(Sky);
}
Once the server crashed, I checked the console and the last line was the echo saying the sky was deleted. Is there any way to make sure the new sky exists before deleting the old one?

isObject(sky);

Also, you must be doing something wrong, this hasn't ever happened to me.

isObject(sky);

Also, you must be doing something wrong, this hasn't ever happened to me.
So where do I put that?

Why are the 4th  fog volume color values so huge?

So where do I put that?
Nowhere, if it was trying to delete the sky when there wasn't a sky there would be an error message.
Why are the 4th  fog volume color values so huge?
Engine weirdness, those are the default values and I didn't bother to change them as they don't seem to effect anything.