Post by Freedom-Fighter on Apr 30, 2006 8:11:44 GMT
Creating custom objectives are not as difficult as you think, but you need to know how to write an EEII script, otherwise this will make no sence to you at all. If you don't know how to, read the thread, [glow=red,2,300]READ HERE if you want to learn how to write script[/glow] This may help you to understand how it works.
Anyway, 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 aloso 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
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
STEP
AddPlayerResource(1, kResourceType_Gold, 4000);
END_SCRIPT
END_ACTION
Remember, if you want to make a rule/objective which includes area or groups, you need to create them first in the Map Editor and name them in Definitions and Intilizations section first. This is explained in the other thread.
The complete list of conditions and effects can be found in the Scripting Bible. If you have any questions just ask them here. Thanks for reading my post!
Anyway, 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 aloso 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
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
STEP
AddPlayerResource(1, kResourceType_Gold, 4000);
END_SCRIPT
END_ACTION
Remember, if you want to make a rule/objective which includes area or groups, you need to create them first in the Map Editor and name them in Definitions and Intilizations section first. This is explained in the other thread.
The complete list of conditions and effects can be found in the Scripting Bible. If you have any questions just ask them here. Thanks for reading my post!