User Guide
61
SCRIPTS
The Scripts facility is the mechanism for creating mission briefings, introductory sequences, ramping of
difficulty, behaviors of ambient objects, and the tactics of CPU-controlled opponents. Using a simple,
descriptive format, you can build very powerful scripts to govern game events, unit actions, and other
environmental variables in your map.
NOTE: Scripts are not the only way to change unit and team behavior. Setting the basic
aggressiveness level for a unit or team goes a long way towards creating worthy opposition.
❍
To open the Scripts tool, select SCRIPTS from the Edit menu.
In the Scripts window, you can see the Scripts library tree at the top of the screen, and a folder for every
player that you have created.
✯
You may end up creating up to 100 scripts for your mission, so the folders in the Script window become
an important organizational tool. For more information,
➤
Organizing Your Scripts on p. 64.
CREATING AND EDITING SCRIPTS
The structure of a script is fairly simple:
IF (condition), THEN (Action1) ELSE (Action2).
Conditions are triggered by various kinds of events in the game. So, you can trigger a script at a specific time
during the mission or when a trigger area has been breached. You can also trigger scripts when objects are
created or destroyed.
However, the results can have huge and sometimes conflicting effects on events during a mission. So, as you
learn to create scripts, start with very simple ones, and then slowly add complexity.
✯
It’s very important to test your scripts in the game as you develop them. If you write many scripts before
testing, then you may have difficulty figuring out which ones are creating problems.
TO CREATE A NEW SCRIPT
EA TIP: Avoid creating scripts that must occur after the start of the game. You want to keep
single-player missions as open as possible, and the outcome should always be determined by
user action.
1. To create a new script, click the folder in which you want to place the script.
2. Click NEW SCRIPT. In the Script Builder window, enter a name for the script in the Script Name textbox.
EA TIP: It’s a good habit to name your scripts in a logical and consistent manner. For
example, the names of scripts that apply to one player might all begin with the player’s name
followed by an underscore (_) and an identifier for the script.
3. Script Properties tab. you set the flags and difficulty settings that apply to the script.
✯
Subroutine. A subroutine script is referenced by another script. Until it is specifically called by another script,
a subroutine script is not executable and does not consume any CPU resources to check its conditions.
✯
Active. Active scripts can be triggered as soon as the mission starts. Scripts can be activated and
deactivated by other scripts.
✯
Deactivate upon success. After a script has been executed, you can prevent it from being executed again.
✯
Active in. Use the Active In settings to establish the difficulty levels in which the script can be used. For
more information on ramping difficulty,
➤
Ramping Difficulty on p. 63.
✯
Script Comment. This catch-all field is useful for writing notes to yourself about bugs, implementation
tricks, version control information, or tasks to complete related to this script.
4. Script Conditions tab. You define the condition or conditions to be tested and met before the script is
executed.
EA TIP: The default condition for a newly created script is TRUE. If this condition is not
changed, then the script actions are executed as soon as the map is loaded and the game
begins. Use a True condition to execute scripts at the beginning of the mission. If you are not
using the default condition, delete it.










