Please read the Beginner Scripting Manual first
before reading this one, otherwise the
information here might not make any sence to
you!
Making EEII objectives is actually pretty similar to the old EE1 trigger system, except it is
written in a script. An objective is made up of Conditions and Effects . If you have played EE1
and created scenarios before you may be familiar to this.
How to make the objective(s) display on the Mission Objectives Screen
First you need to name it in the Rules section. Before making the objective(s), just write the
heading "SCENARIO".
Now you can make your objective! Here is what you need to do:
//NAME(This is only to make it easier to identify which objective is which)
OBJECTIVE (Objective Code Name. Just name it something like "Obj_SCENARIO_1" )
name = "DISPLAY NAME FOR YOUR OBJECTIVE"
desc = "DESCRIPTION."
type = (OBJECTIVE TYPE: If it is a primary objective, write
kScenarioObjectiveType_Primary starthidden = (0 or 1)
END_OBJECTIVE
The "starthiddin" is for you to decide whether you can see the objective straight after you start
the scenario, or you trigger it your self. If you want to trigger it make it 1, otherwise, make it 0.
Here is an example from one of my scenarios:
//Protect Your people
OBJECTIVE Obj_BFME_2
name = "Protect Your People"
desc = "You lose if all your units and buildings are lost."
type = kScenarioObjectiveType_Lose
starthidden = 0
END_OBJECTIVE
After you have done that, you also need to write it in the definitions and intilizations sections. In
the definitions section, write:
// OBJECTIVES
constant string ( Code Name of the objective: Just write a name that you can easily
remember, like "OBJ_PROTECT_PEOPLE" )
Here is an example:
constant string OBJ_PROTECT_PEOPLE
In the Intilizations section, write:
//Objectives
(Scenario NAME IN DEFINITION SECTION ="SCENARIO CODE NAME IN RULES
SECTION";
Example:
//Objectives
OBJ_PROTECT_PEOPLE ="Obj_SCENARIO_1";
Making the objective(s) work (The trigger bits)
In order to make the objective work, you need to make another section for them. For example, if
you have 3 objectives you may want to make 3 sections. These sections are to be written after the
Run After Cinematics section. They should look something like this:
////////////////////////////////////////////////////////////
// NAME(Doesn't matter what it is, something you can remember)
////////////////////////////////////////////////////////////
RULE ruleNAME ONESHOT
if (The Condition: You can find the conditions list in the Scripting Bible)
then actionNAME
END_RULE
ACTION actionNAME
SCRIPT WORLD
(You can do delay in here, which means the time in seconds the objective works after the
condition(s) come true. Just write " DoDelay( THE NUMBER OF SECONDS );
STEP
(EFFECTS, can be found in the Scripting Bible)
END_SCRIPT
END_ACTION
"ONESHOT" means that the rule happens only once if the condition(s) come true. If you want it
to happen all the time when the condition(s) come true, just take out "ONESHOT".
It look like it is very complicated, but it works just like the triggers system in EE1. Here is an
example, now let's say you want an objective which player 1 wins if he has captured the territory
called "Wonderland". And we will make a delay of 2 seconds:
////////////////////////////////////////////////////////////
// Wonderland Captured
////////////////////////////////////////////////////////////
RULE ruleWonderland_Captured ONESHOT
if (GetOwningPlayerForTerritory("Wonderland" ) == 1)
then actionWonderland_Captured END_RULE
ACTION actionWonderland_Captured
SCRIPT WORLD
DoDelay( 2 );
STEP
WinScenario();
END_SCRIPT
END_ACTION
Remember, if you want to make a custom victory condition, you need to set the victory condition
of that scenario to "Script says so". Just go to EDIT in the Map Editor, then go to Victory
Conditions to change it.
Here is another example, this time let's say if pleyer 1 has built a group called "groupPathenon",
he will recieve 4000 gold:
////////////////////////////////////////////////////////////
// Pathenon Captured
////////////////////////////////////////////////////////////
RULE rulePathenon_Captured ONESHOT
if (AddUnitsByTypeToGroup( "groupPathenon", "WonderWestern_01",
HUMAN_PLAYER, kPlayerMode_Self, NULL )
&& ( NumUnitsInGroup( "groupPathenon" ) >= 1 ))
then actionPathenon_Captured
END_RULE
ACTION actionPathenon_Captured
SCRIPT WORLD
AddPlayerResource(1, kResourceType_Gold, 4000);
END_SCRIPT
END_ACTION
Now if you want to include individual units into your script, you must name them in the Map
Editor. To do this, double click on the unit, then type it in the "Script name" catagory. It doesn't
really matter what name it is, so it's good to try to make it simple so you can remember it easily.