C&C Generals: World Builder: Tutorials: Using Markers as Script Conditions, Instead of Flags

By DrumminCommand & Conquer Generals: Zero Hour: World Builder

There are times when you would like to communicate between player folders when writing scripts. Unfortunately, this is not possible. This tutorial explains how placing invisible civilian "markers" on your map can allow you to achieve the same effect in your scripts. The presence of a marker is used as a script condition, instead of the more typical flags.

Note: This tutorial applies to both Generals and Zero Hour.


In case you don't understand how a Marker could be used, let me explain by example. Let's say you have a four player map but only want supply docks to appear where a person or computer AI is actually playing. (You hate the scramble for those extra supplies, or something.)

Note: You need to load skirmish scripts into your map for this to work.

1. Name your supply piles. (You've probably done that already to adjust their cash amount.)

2. In the Combat Zone, place a civilian, non-moving unit for each start position. Name them something like 1NotPlaying, 2NotPlaying, etc.

3. In each AI folder, make a script that would remove this marker if the AI is playing.

*** IF ***
Player '<This Player>' starting position is 1 .
*** THEN ***
Unit '1NotPlaying' is removed from the world.

4. Make a script like this for each start position in each AI folder.

5. Then, in your civilian folder, make a script to look for these markers.

*** IF ***
Unit '2NotPlaying' is inside area 'CombatZone'
*** THEN ***
Unit 'Supply2' is removed from the world.
Unit '2NotPlaying' is removed from the world.

6. Also make a script to remove the marker associated with where the local player is playing.

*** IF ***
Player '<Local Player>' starting position is 1 .
*** THEN ***
Unit '1NotPlaying' is removed from the world.

Be sure to cover all start locations for each of these scripts.

The effect of these scripts is that all markers are removed from the map along with their associated supplies at the locations where no one is playing.


NOTE: The removal of supplies from a non-active location could also be done a different way. The supply docks could be spawned underground and removed as conditions change. This was just an example. I find that markers are more reliable than flags for setting conditions because -- and this is the key point -- they work across Player folders.