home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58b_TRIBES.iso / Tribes / base / scripts.vol / newMission.cs < prev    next >
Encoding:
Text File  |  1998-12-16  |  4.3 KB  |  153 lines

  1. //
  2. //
  3. //
  4. function newTeam(%teamNum)
  5. {
  6.    focusServer();
  7.    if(!isObject(MissionGroup))
  8.    {
  9.       echo("Must create a mission first.");
  10.       focusClient();
  11.       return;
  12.    }
  13.     newObject("Team" @ %teamNum, TeamGroup);
  14.     addToSet("MissionGroup\\Teams",  "Team" @ %teamNum);
  15.  
  16.     // Default team setup
  17.     //
  18.    newObject("DropPoints", SimGroup);
  19.     newObject("Start", SimGroup);
  20.     newObject("Random", SimGroup);
  21.     addToSet("DropPoints", "Start", "Random");
  22.     addToSet("MissionGroup\\Teams\\team" @ %teamNum, DropPoints);
  23.    focusClient();
  24. }
  25.  
  26. //
  27. //
  28. //
  29. function newMission(%missionName, %worldName, %timeOfDay)
  30. {
  31.    if(focusServer)
  32.    {
  33.        if(isObject(MissionGroup))
  34.       {
  35.            echo("Already running a mission");
  36.            focusClient();
  37.            return;
  38.       }
  39.    }
  40.    focusClient();
  41.    if(%timeOfDay == "")
  42.    {
  43.        echo("newFearMission: missionName worldName timeOfDay");
  44.       return;
  45.    }
  46.  
  47.    %worldVolName = strcat(%worldName, "World", ".vol");
  48.    %terrVolName = strcat(%worldName, "Terrain", ".vol");
  49.    %terrFileName = strcat(%missionName, ".dtf");
  50.    %rulesName = strcat(%worldName, ".rules.dat");
  51.    %dmlName = strcat(%worldName, ".dml");
  52.    %palName = strcat(%worldName, ".", %timeOfDay, ".ppl");
  53.    %gridName = strcat(%worldName, ".grid.dat");
  54.    %tedFileName = strcat(%missionName, ".ted");
  55.    %dscName = "base\\missions\\" @ %missionName @ ".dsc";
  56.    %missionName = strcat("base\\missions\\", %missionName, ".mis");
  57.  
  58.    // Default groups
  59.    //
  60.    echo("Default Groups");
  61.    newObject("MissionGroup", SimGroup);
  62.    newObject("Volumes", SimGroup);
  63.    newObject("World", SimGroup);
  64.    newObject("Landscape", SimGroup);
  65.    newObject("Lights", SimGroup);
  66.    addToSet("MissionGroup", "Volumes", "World", "Landscape", "Lights" );
  67.  
  68.    // Default volumes
  69.    //
  70.  
  71.    // entities.vol loading has been moved to console.cs
  72.    // newObject("Entities", SimVolume, "entities.vol");
  73.  
  74.    newObject("World", SimVolume , %worldVolName);
  75.    newObject("WorldTerrain", SimVolume , %terrVolName);
  76.    newObject("InterfaceVol", SimVolume, "interface.vol");
  77.    addToSet("MissionGroup\\Volumes", "InterfaceVol", "Entities", "World", "WorldTerrain");
  78.  
  79.    // Register the world's DML volumes (Contained in %terrVolName)
  80.    //
  81.    exec("createWorldVolumes.cs");
  82.  
  83.    // World palette
  84.    //
  85.    //echo("Default World palette");
  86.    newObject("Palette", SimPalette, %palName, true);
  87.    addToSet("MissionGroup\\World", "Palette");
  88.  
  89.    // Default Sky
  90.    //
  91.    //echo("Default Sky");
  92.    newObject("Sky", Sky);
  93.    addToSet("MissionGroup\\Landscape", "Sky");
  94.  
  95.    // Default sun light
  96.    //echo("Default Sun Light");
  97.    newObject("Sun", Planet, 0, 60, 0, T, F, 1, 1, 1, 0, 0, 0);
  98.    addToSet("MissionGroup\\Landscape", "Sun");
  99.  
  100.    // Default Team 0
  101.    //
  102.    newObject("Teams", SimGroup);
  103.    addToSet(MissionGroup, Teams);
  104.    newTeam(0);
  105.  
  106.    // Create flat sim terrain object
  107.    //
  108.    //echo("Default Terrain");
  109.    newObject("Terrain", SimTerrain, Create, %terrFileName, 3, 3, 256, 0, 0, -3072, -3072, 0, 0, 0, 0);
  110.     newObject("MissionCenter", MissionCenterPos, -1024, -1024, 2048, 2048);
  111.    setTerrainDetail(Terrain, 100, 120);
  112.    setTerrainVisibility(Terrain, 1500, 700);
  113.    SetTerrainContainer(Terrain,"0 0 -20.0",0,10000);  //  (Terrain,Gravity,Drag,Height)
  114.    LSCreate(1);
  115.    LSRules(%rulesName);
  116.    LSTextures(%dmlName, %gridName);
  117.    LSApplyLandScape();
  118.    LSApplyTextures();
  119.  
  120.    // Light the terrain and save it off
  121.    //
  122.    //echo("Light terrain here...");
  123.    //lightTerrain(Terrain);
  124.    saveTerrain(Terrain, "base\\missions\\" @ %tedFileName);
  125.  
  126.    // force resource manager to re-search its path.
  127.  
  128.    $MDESC::Type = "New Mission";
  129.    $MDESC::Planet = "unknown";
  130.    $MDESC::Weather = "Clear";
  131.    $MDESC::TimeOfDay = "Midday";
  132.    $MDESC::TeamCount = 1;
  133.    $MDESC::Desc = "Blah Blab Blah";
  134.  
  135.    export("$MDESC::*", %dscName);
  136.  
  137.    $ConsoleWorld::DefaultSearchPath = $ConsoleWorld::DefaultSearchPath;
  138.  
  139.    newObject("TedFile", SimVolume, "missions\\" @ %tedFileName);
  140.  
  141.    addToSet("MissionGroup\\Volumes", "TedFile");
  142.    addToSet("MissionGroup\\Landscape", "Terrain");
  143.    addToSet("MissionGroup\\World", "MissionCenter");
  144.  
  145.    // Save the mission file
  146.    //
  147.    //echo("Store Mission");
  148.     exportObjectToScript(MissionGroup, "", %missionName);
  149.    deleteObject( MissionGroup );
  150.    purgeResources();
  151.    echo("Done");
  152. }
  153.