Game Development Community

How to change Sky textures without reloading mission in code?

by Greg Bassett · in General Discussion · 12/28/2006 (12:49 pm) · 3 replies

I am trying to change sky textures without reloading the mission, I can do this using the World Inspector, by loading a new dml file and click Load.

But I want to do this using torque script, does anyone know how to do this?

#1
12/28/2006 (1:14 pm)
Well you could try to replace the materialList parameter..
nameToId("Sky").materialList = "~/data/skies/sky_overcast.dml";

If that doesn't work, which is entirely possible you could write a function to delete the sky object and create a new one..

MissionGroup.swapSkies();

function SimGroup::swapSkies(%this)
{
   nameToID("Sky").delete();

   %sky = new Sky(Sky) {
      canSaveDynamicFields = "1";
      position = "336 136 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      materialList = "~/data/skies/sky_overcast.dml";
      cloudHeightPer[0] = "0.1";
      cloudHeightPer[1] = "0.2";
      cloudHeightPer[2] = "0";
      cloudSpeed1 = "0.001";
      cloudSpeed2 = "0.001";
      cloudSpeed3 = "0.001";
      visibleDistance = "900";
      fogDistance = "50";
      fogColor = "0.8 0.8 0.9 1";
      fogStorm1 = "0";
      fogStorm2 = "0";
      fogStorm3 = "0";
      fogVolume1 = "0 0 0";
      fogVolume2 = "0 0 0";
      fogVolume3 = "0 0 0";
      fogVolumeColor1 = "128 128 128 -2.22768e+038";
      fogVolumeColor2 = "128 128 128 0";
      fogVolumeColor3 = "128 128 128 -1.70699e+038";
      windVelocity = "5 1 0";
      windEffectPrecipitation = "1";
      SkySolidColor = "0.6 0.6 0.6 1";
      useSkyTextures = "1";
      renderBottomTexture = "0";
      noRenderBans = "0";
   };

   %group.add(%sky);
}

P.S. Ask tech questions in the Mod or programing etc. forums next time :)
#2
12/28/2006 (2:15 pm)
I will give that a try, many thanks!

And I will use the Mod or Programming forums next time, sorry! New member etc.

BTW, is there a way to search the forums? I cannot work out how to? might be being dumb...
#3
12/28/2006 (2:27 pm)
Anytime :)

Top of page, right hand side, after it searches it will give you the option of searching just the forums.