Part 5: Triggered events

TriggerDisasterEffect(int inType)

This method can be used to trigger a one-off disaster. Example use:

    Int32 mEarthquake = IDMaker.FromString("Short earthquake");
    game.TriggerDisasterEffect(mEarthquake);

The only other disaster effect is "Long earthquake". A "short earthquake" is usually quite enough!

TriggerWeatherEffect(int inName)

This method can be used to trigger a one-off weather event such as a blizzard, thunderstorm or sandstorm. For example, to create a sandstorm:

    Int32 mSandStorm = IDMaker.FromString("SANDSTORM");
    game.TriggerWeatherEffect(mSandStorm);

The other weather effects you can use are "RAIN_SHOWER", "RAIN_STORM", "SNOW_FLURRY", "BLIZZARD" and "THUNDERSTORM".

TriggerFireDamage(int inBuildingType, int inNumBuildingsAffected, int inAmountOfDamage)

This method can be used to set a number of buildings of the specified type on fire. The inAmountOfDamage variable affects the chances that the building will collapse as a result of the fire. For example, setting two luxury markets on fire, with 80% damage:

    Int32 mIDLuxury = IDMaker.FromString("C4b Market Luxury");
    game.TriggerFireDamage(mIDLuxury, 2, 80);

See Part 10 for a list of building IDs that can be used. Use this with caution, however, as not all buildings can be set on fire (particularly some decorative items such as trees), and use in those cases can cause Caesar IV to crash.

TriggerStructureDamage(int inBuildingType, int inNumBuildingsAffected, int inAmountOfDamage)

This method can be used to cause structural damage to a number of buildings of the specified type. The inAmountOfDamage variable affects the chances that the building will collapse as a result. For example, causing 90% structural damage to the forum:

    Int32 mIDForum = IDMaker.FromString("C4b service Forum");
    game.TriggerStructureDamage(mIDForum, 1, 90);

See Part 10 for a list of building IDs that can be used (but see the cautionary note above).

< Previous: UI Controls | Editor Guide | Next: Other event methods >