Reviewed for SDK 2.1

All disasters in Outpost 2 are fully supported by the SDK. This section covers Meteors, Electrical Storms, Earthquakes, and Vortices. Volcanoes are handled in the Volcano Section here: Volcanoes.

When setting a disaster, you are setting when the first warning that the disaster will occur. No disaster can occur at mark 0 (when a scenario first starts). Even if you set a disaster to immediately occur, it actually will not happen until about mark 10-15. The exception is a vortex which can be set to occur immediately.

static void __fastcall SetMeteor(int tileX, int tileY, int size);

There are 3 sizes of meteors available.

static void __fastcall SetLightning(int startTileX, int startTileY, int duration, int endTileX, int endTileY);

An electrical storm will disappear once its duration has expired. Duration is set as number of marks. If the electrical storm reaches its end tile before the duration expires, it will continue on past the end point.

static void __fastcall SetEarthquake(int tileX, int tileY, int magnitude);

Magnitude 0 Earthquakes do the least amount of damage. Earthquake magnitudes above about 7 become extremely dangerous. Setting the magnitude to -1 will make the Earthquake last indefinitely but it will not cause any damage.

static void __fastcall SetTornado(int startTileX, int startTileY, int duration, int endTileX, int endTileY, int bImmediate);

If a vortex duration is set to 0, it will continue indefinitely.

If the vortex reaches its endpoint before its duration expires, it will slightly wobble around the end location for the remainder of its duration.

If immediate is set to true, the vortex can be made to appear immediately when the scenario starts.

Create a randomized disaster. Note, this code will require Hacker's Function Library (HFL) to run. If not using HFL, replace the functions GeTMapWidth and GetMapHeight with the actual width and height of the map.

LOCATION getRandMapLoc()
    return LOCATION(
	TethysGame::GetRand(GameMapEx::GetMapWidth()) + 31,
	TethysGame::GetRand(GameMapEx::GetMapHeight()) - 1);
void CreateMeteor()
    LOCATION disasterLoc = getRandMapLoc();
    int size = TethysGame::GetRand(3);
    if (size = 3)
	size = TethysGame::GetRand(3);
    TethysGame::SetMeteor(disasterLoc.x, disasterLoc.y, size);
void CreateStorm()
    LOCATION startLoc = getRandMapLoc();
    LOCATION endLoc = getRandMapLoc();
	startLoc.x, startLoc.y, TethysGame::GetRand(55), endLoc.x, endLoc.y);
void CreateEarthquake()
    LOCATION loc = getRandMapLoc();
    TethysGame::SetEarthquake(loc.x, loc.y, TethysGame::GetRand(5));
void CreateVortex()
    LOCATION startLoc = getRandMapLoc();
	TethysGame::GetRand(45) + 5,
	startLoc.x + TethysGame::GetRand(15),
	startLoc.y + TethysGame::GetRand(15),
SCRIPT_API void CreateRandomDisaster()
    //Set a disaster. This uses a weighted random. Picking a random number 0 to 100:
    //0-19 = no action
    //20-69 = meteor
    //70-84 = quake
    //85-94 = electrical storm
    //95-100 = vortex
    int randNum = TethysGame::GetRand(100);
    if (randNum < 20)
    if (randNum < 70)
    else if (randNum < 85)
    else if (randNum < 95)
int InitProc()

- Go Back to Programming a Scenario
- Go Back to Outpost 2 Mapmaking
- Go Back to Outpost 2 Main page
- Go Back to Wiki Home Page

  • op2_sdk/disasters.txt
  • Last modified: 2016/12/29 17:55
  • by vagabond