********************************************************************************************
                                   MAP SUPPORT PACKAGE
			               Version 2.0
********************************************************************************************


Date: 9/25/02
Tested with Tribes 2 version: 24834 - *

Installation - Windows
----------------------
Simply unzip into your "/Tribes2/GameData/base/" directory (make sure "Use Folder Names" is checked in WinZip).
If you wish to disable this set of scripts simply add the following to your serverPrefs.cs file if it does not 
already exist:

$Host::AllowMapScript = 0;

Setting to 1 enables this support package.




DESCRIPTION
-----------
This is a server plugin script to make it easier for mappers to include 
custom functions, datablocks and packages for their maps. The support 
file is "mapGame.cs". In this file are functions that give mappers a 
subfolder "/mapscripts/" under the /missions/ directory in Tribes 2 that 
auto executes all *.cs files within it. This set of scripts was designed
for use by novice scripters, inexperienced scripters should seek the help 
of someone experienced in scripting to utilize this support package. This
package was designed for use in BASE TRIBES 2, no other type is supported.


USAGE
-----
Create a .cs file which has the same name as your maps .mis file. Inside this file, 
make a package to contain all of your scripts, and specially written altered base functions. 
Name this package the same name as your map file. Also include within the package 
these 3 functions:

MapName::PreLoad()
MapName::InitMap()
MapName::DeactivateMap()

So you would have a setup resembling this:

mission file:
katabatic.mis

script file:
katabatic.cs

which contains:
package katabatic
{
   katabatic::PreLoad()
   {
   
   }
   katabatic::InitMap()
   {
   
   }
   katabatic::DeactivateMap()
   {
   
   }
   // other scripts would go here inside of package
};

With this system there is no need to use the activatepackage command inside you mis file. 
In fact its far better if there is nothing inside your .mis file except the actual map 
definition code. When a map is loaded with this system, a check is made for the existance 
of a package with the same name, if it exists, it is activated before the map is loaded. 
Also, shortly after activating the package, the MapName::PreLoad() function is called for 
the map. Use this function to activate any other packages the map needs, or to setup any 
special varibles. once the mission is finished loading, the MapName::InitMap() function is 
called, this may not prove usefull, but exists if needed. (it is best to activate needed 
packages before the map loads, due to the timing issues of this system). Once the map is 
finished, or the server is reset, the MapName::DeactivateMap() function is called, allowing 
for the cleanup of map globals and packages. This system automatically deactivates your package.
DO NOT DEACTIVATE PACKAGES from your scripts. With these three functions it 
will not be neccesary to alter any base functions for activation or cleanup. Also if it 
is ever needed, the MapName::PreLoad() function has a variable passed to it, %firstMission. 
If it is true, then this is the first map the server has run, otherwise it is not.

--------------------------------------------------------------------------

We have also added a function "getruleset()" that will return what mod is 
running on the server. This can be used to bypass certain things you may 
know will conflict with specific server modifications. getRuleSet is located 
in mapGame.cs if you would like to see how it works. As an example:

function myScript()
{
   if(getRules() $= "Shifter")
      return;
   else
      return "Run my stuff";
}

Now if the server is not running a mod, this function with return one of 
the startup arguments instead like "-dedicated" or "-Online". This is an 
unfortunate but unavoidable thing.

UPDATE. We have added a global to the getRuleSet function which contains
        the paths currently active on the server. getRuleSet() will not
        return the value of the gloabl, you must manually tap into it.
        The global contains currently executed folder names seperated by ;

Example:

   if(getSubStr($ModPaths, 0, 6) $= "base++")
      %doSomething = false;

Syntax of getSubStr:
getSubStr(string, start, numCharsInFromStart)

--------------------------------------------------------------------------

If you intend on changing vehicle and turret limits within your map.cs, use 
the following method of capturing the old values so that you can reset them
in ::DeactivateMap(). Simple reverse it there.

$Map::OldSpiderClampMax = $TeamDeployableMax[TurretIndoorDeployable];
$Map::OldLandSpikeMax = $TeamDeployableMax[TurretOutdoorDeployable];
$Map::OldSpiderClampMin = $TeamDeployableMin[TurretIndoorDeployable];
$Map::OldLandSpikeMin = $TeamDeployableMin[TurretOutdoorDeployable];

$Map::OldVehicleRespawn = $VehicleRespawnTime;

$Map::OldWildcatMax = $Vehiclemax[ScoutVehicle];
$Map::OldTankMax = $VehicleMax[AssaultVehicle];
$Map::OldMpbMax = $VehicleMax[MobileBaseVehicle];
$Map::OldScoutMax = $VehicleMax[ScoutFlyer];
$Map::OldBomberMax = $VehicleMax[BomberFlyer];
$Map::OldHapcMax = $VehicleMax[HAPCFlyer];




HOW TO ALTER BASE FUNCTIONS
---------------------------
If you intend to use modified base functions in your scripts for use with this
support package there is a specific method you must use in order to keep the 
sever operating properly. The first thing is you must set a global with your 
maps name inside of your map.cs file BEFORE any activating of packages in 
the function:

mapname::preLoad(%firstMission) // mapname is the exact name of your map.

The global is:

$Map::MyMap = "mapname"; // replace mapname with the exact name of your map.

Next you will want to empty this global in the function:

function mapname::DeactivateMap() // mapname is the exact name of your map.

You do it like so:

$Map::MyMap = "";

This is so that if the server has a memory glitch the contents of this global 
will not carry over to the next map.

This is the proper syntax of an overloaded base function for use with mapSupport:

   function basefunction::whatever(%data, %obj)
   {
      if($MissionName !$= $Map::MyMap)
      {
         Parent::whatever(%data, %obj);
      }
      else
      {
         Your modified version of the base code goes in here.
      }
   }



CREDITS
-------
Founder - Author of the Mechina Tribes 2 server modification. http://www.mechina.com

ZOD - Author of the Syrinx Tribes 2 server modification. http://connect.to/tos

TseTse - Mapper who knows no limitations and does not settle for the word NO.
