Author Topic: Creating an active shape in a mission file  (Read 1062 times)

Awhile ago Packer helped me by figuring out how to create working shapes within a mission file. Below is the code he provided.

Code: [Select]
datablock StaticShapeData(flyingboardblade)
{
   category = "Packer";
   shapeFile = "base/data/interiors/flyingboardblade.dts";
};

function flyingboardblade:: onAdd(%this,%obj)
{
   %obj.playThread(0,"ambient");
}

Unfortunately, I seem to have forgotten how to use it correctly. I altered the file names and locations as appropriate and then placed the code at the end of my mission file but now the mission won't even load.

Any help you can provide is appreciated. Mission file is pasted below...


Code: [Select]
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {

   new ScriptObject(MissionInfo) {
         name = "Worlds";
         saveName = "Worlds";
   };
   new MissionArea(MissionArea) {
      Area = "-360 -648 720 1296";
         flightCeilingRange = "20";
         locked = "true";
         flightCeiling = "300";
   };
   new Sky(Sky) {
      position = "336 136 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      materialList = "~/Map_Slate_Desert/cloudy02.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 = "0.850000 0.800000 0.600000 1.000000";
      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 = "1 1 0";
      windEffectPrecipitation = "1";
      SkySolidColor = "0.000000 0.000000 0.100000 1.000000";
      useSkyTextures = "1";
      renderBottomTexture = "1";
      noRenderBans = "0";
         locked = "true";
   };
   new Sun() {
      azimuth = "153";
      elevation = "45";
      color = "0.700000 0.650000 0.500000 1.000000";
      ambient = "0.300000 0.250000 0.200000 1.000000";
         position = "0 0 0";
         rotation = "1 0 0 0";
         locked = "true";
         direction = "0.57735 0.57735 -0.57735";
         scale = "1 1 1";
   };
   new SimGroup(PlayerDropPoints) {

      new SpawnSphere() {
         position = "0 0 0";
         rotation = "0 0 1 130.062";
         scale = "0.940827 1.97505 1";
         dataBlock = "SpawnSphereMarker";
         canSetIFLs = "0";
         radius = "100";
         sphereWeight = "1";
         indoorWeight = "1";
         outdoorWeight = "1";
            RayHeight = "150";
      };
   };
   new InteriorInstance() {
      position = "0 0 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      interiorFile = "~/Map_Slate/slate.dif";
      useGLLighting = "1";
      showTerrainInside = "1";
   };
   new WaterBlock(Water) {
      position = "0 0 -1";
      rotation = "1 0 0 0";
      scale = "2048 2048 1";
      UseDepthMask = "1";
      RepeatTerrain = "1";
      surfaceTexture = "~/Map_Tutorial/SAND";
      ShoreTexture = "~/Map_Tutorial/SAND";
      envMapOverTexture = "~/Map_Tutorial/SAND";
      envMapUnderTexture = "~/Map_Tutorial/SAND";
      submergeTexture[0] = "~/Map_Tutorial/SAND";
      submergeTexture[1] = "~/Map_Tutorial/SAND";
      specularMaskTex = "~/Map_Tutorial/SAND";
      liquidType = "OceanWater";
      density = "0";
      viscosity = "0";
      waveMagnitude = "0";
      surfaceOpacity = "0";
      envMapIntensity = "0";
      TessSurface = "50";
      TessShore = "60";
      SurfaceParallax = "0";
      FlowAngle = "0";
      FlowRate = "0";
      DistortGridScale = "0";
      DistortMag = "0";
      DistortTime = "0.5";
      ShoreDepth = "20";
      DepthGradient = "1";
      MinAlpha = "0.03";
      MaxAlpha = "1";
      removeWetEdges = "0";
      specularColor = "1.000000 1.000000 1.000000 1.000000";
      specularPower = "6";
      waterColor = "0.200000 0.600000 0.600000 0.300000";
      useCustomFog = "0";
      customFogDistance = "800";
      customVisibilityDistance = "1000";
         params1 = "0.63 -2.41 0.33 0.21";
         params0 = "0.32 -0.67 0.066 0.5";
         extent = "100 100 10";
         params3 = "1.21 -0.61 0.13 -0.33";
         textureSize = "32 32";
         floodFill = "1";
         params2 = "0.39 0.39 0.2 0.133";
         envMapTexture = "Add-Ons/Map_Tutorial/SAND";
         seedPoints = "0 0 1 0 1 1 0 1";
   };
datablock StaticShapeData(grassatmosphere)
{
   category = "Reactor_Worker";
   shapeFile = ".../Add-Ons/Map_Worlds/grassatmosphere.dts";
};

function grassatmosphere:: onAdd(%this,%obj)
{
   %obj.playThread(0,"ambient");
}


};
//--- OBJECT WRITE END ---

You need to put the code at the very bottom - after the closing };

That fixed the mission loading issue, and the object does appear in the 'shape' list under my alias as specified. A new issue came up; the object isn't visible when I spawn it. The three axis appear and can be manipulated, but no shape is visible.

Console errors?

Your shapeFile path also makes no sense. It should begin "Add-Ons/" not ".../Add-Ons/"

Ah, the file path was wrong as you indicated. The shape now shows up.

Unfortunately the transparency I was hoping to achieve did not. I should have taken some notes when I originally achieved working DTS transparency.

Wouldn't that code need to go at the top if you plan on spawning one when the map loads? Otherwise you'll just get a "datablock not there" error.

Wouldn't that code need to go at the top if you plan on spawning one when the map loads? Otherwise you'll just get a "datablock not there" error.
Smart thinking, I think you're right.