Secret Weapons of the Empire

The forum for the Star Wars Empire at War: Forces of Corruption mod
 
HomePortalFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

 Tutorial: Basic Story Scripting Part I

View previous topic View next topic Go down 
AuthorMessage
SmallPox
Admin
avatar

Male Number of posts : 62
Age : 27
Location : Germany
Registration date : 2008-01-28

PostSubject: Tutorial: Basic Story Scripting Part I   Sat Jul 16, 2011 12:09 pm

Hey guys this is my try of a story scripting tutorial. Since most of the people think that the one that came
with the map editor is too difficult I'll try to make this easier.

Let's start:

1. Basic Structure of a story event:

Code:

<Event Name="Whateveryouwant">
   <Event_Type></Event_Type>
   <Event_Param1></Event_Param1>
   <Event_Param2></Event_Param2>
   ...
   <Reward_Type></Reward_Type>
   <Reward_Param1></Reward_Param1>
   <Reward_Param2></Reward_Param2>
   ...
   <Prereq></Prereq>
   <Branch></Branch>
   <Perpetual></Perpetual>
</Event>

Story Events follow an If - Then principle.
The Event_Type checks if something has happened, the Reward_Type performs a specified action if the conditions of the Event_Type are met.



In this case we will be using STORY_CONQUER as our Event_Type. That means that somebody has to conquer something. What and who has to conquer is defined in the Event Parameters.
The parameters allow us to specify more detailed conditions for the Event_Type.

Example:

Code:

<Event Name="Player_Conquer_Hoth">
   <Event_Type>STORY_CONQUER</Event_Type>
   <Event_Param1>Hoth</Event_Param1>
   <Event_Param3>FILTER_FRIENDLY_ONLY</Event_Param3>
        ...
        ...
</Event>

The first parameter of STORY_CONQUER defines the planet that has to be conquered, the second sets the filter to
make sure that the event fires only when the specified factions conquer the planet.
FILTER_FRIENDLY_ONLY fires only when a faction that is allied with the player conquers the planet. Since there are usually no allied factions in a Galactic Conquest in Empire at War, this event will only trigger when the player conquers the planet(the player is obviously considered an ally of his own faction by the game).

Other options for this parameter are:
FILTER_NEUTRAL_ONLY
FILTER_ENEMY_ONLY
FILTER_FRIENDLY_AND_NEUTRAL
FILTER_ENEMY_AND_NEUTRAL
FILTER_FRIENDLY_AND_ENEMY

Those should be pretty much self-explanatory.


So, now we have completed the "If"-part, so we still need the "then"-part.
As mentioned above the Reward_Type takes care of this.
The Reward_Type also has Reward_Parameter tags, just like the Event_Type. They also help to specify the conditions for the event.


So let's say IF the player conquers Hoth THEN he
gets a Star Destroyer.

Example:

Code:

<Event Name="Player_Conquer_Hoth">
   <Event_Type>STORY_CONQUER</Event_Type>
   <Event_Param1>Hoth</Event_Param1>
   <Event_Param3>FILTER_FRIENDLY_ONLY</Event_Param3>

   <Reward_Type>UNIQUE_UNIT</Reward_Type>
   <Reward_Param1>Star_Destroyer</Reward_Param1>
   <Reward_Param2>Hoth</Reward_Param2>
   <Reward_Param3>1</Reward_Param3>

As you can see, the structure is pretty much the same as in the Event_Type part.
First, choose your Reward_Type. In this case we are using UNIQUE_UNIT, which will spawn a unit or building for your faction.
Then let's have a look at the reward parameters.
In the first one we specify the unit we would like to spawn, with the second one we choose our spawn location and the third one contains the amount of units we want to spawn.


NOTICE!:
The meaning and also the amount of parameters depends on the Event/Reward Type you use!
E.G. for the Reward Type SCREEN_TEXT which makes a text appear in the top-left corner you can't use
Star_Destroyer as first parameter entry, in this case you'd have to choose a text entry from the master text
file.


Now we're getting to the <Prereq> tag. Prereq is the abbreviation of Prerequisite and does exactly what it says.
In this tag you can specify the name of another Story Event that must have already been triggered, before the event with the prereq tag can be executed.


Example:
Code:


<!-- This is a STORY_ELAPSED event that triggers after the amount of seconds you have set in the first parameter have passed. -->
<Event Name="Universal_Story_Start">
   <Event_Type>STORY_ELAPSED</Event_Type>
   <Event_Param1>10</Event_Param1>
</Event>



<Event Name="Player_Conquer_Hoth">
   <Event_Type>STORY_CONQUER</Event_Type>
   <Event_Param1>Hoth</Event_Param1>
   <Event_Param3>FILTER_FRIENDLY_ONLY</Event_Param3>

   <Reward_Type>UNIQUE_UNIT</Reward_Type>
   <Reward_Param1>Star_Destroyer</Reward_Param1>
   <Reward_Param2>Hoth</Reward_Param2>
   <Reward_Param3>1</Reward_Param3>
   <Prereq>Universal_Story_Start</Prereq>
</Event>

As you can see we have set "Universal_Story_Start" as prerequisite for the "Player_Conquer_Hoth" Event. This means this event can only be triggered if the 10 seconds we have specified in "Universal_Story_Start" have passed. If you conquered Hoth before 10 seconds have passed nothing would happen.



Now for the <Branch> tag. Branches are used to group events together. This is especially useful if you want to to disable or reset several events at once. You can name your branch whatever you like.

Example:

Code:

<Event Name="Universal_Story_Start">
   <Event_Type>STORY_ELAPSED</Event_Type>
   <Event_Param1>10</Event_Param1>
   <Branch>Branch_01</Branch>
</Event>



<Event Name="Player_Conquer_Hoth">
   <Event_Type>STORY_CONQUER</Event_Type>
   <Event_Param1>Hoth</Event_Param1>
   <Event_Param3>FILTER_FRIENDLY_ONLY</Event_Param3>

   <Reward_Type>UNIQUE_UNIT</Reward_Type>
   <Reward_Param1>Star_Destroyer</Reward_Param1>
   <Reward_Param2>Hoth</Reward_Param2>
   <Reward_Param3>1</Reward_Param3>
   <Prereq>Universal_Story_Start</Prereq>
   <Branch>Branch_01</Branch>
</Event>

So, both events belong to the same branch now.
If you wanted to disable both of them you could do this with a Story Event that uses the Reward_Type DISABLE_BRANCH

Example:
Code:

<Event Name="Disable_Branch_01">
<Event_Type>STORY_ELAPSED</Event_Type>
<Event_Param1>20</Event_Param1>
<Reward_Type>DISABLE_BRANCH</Reward_Type>
<Reward_Param1>Branch_01</Reward_Param1>
</Event>

As you have probably already guessed this Event disables every Event that belongs to the branch "Branch_01" after 20 seconds have passed.

It is also possible to reset all events by using the Reward_Type RESET_BRANCH.



And now the last tag in this tutorial <Perpetual>. This tag tells the game if an event can be repeated.

Example:
Code:

<Event Name="Player_Conquer_Hoth">
   <Event_Type>STORY_CONQUER</Event_Type>
   <Event_Param1>Hoth</Event_Param1>
   <Event_Param3>FILTER_FRIENDLY_ONLY</Event_Param3>

   <Reward_Type>UNIQUE_UNIT</Reward_Type>
   <Reward_Param1>Star_Destroyer</Reward_Param1>
   <Reward_Param2>Hoth</Reward_Param2>
   <Reward_Param3>1</Reward_Param3>
   <Prereq>Universal_Story_Start</Prereq>
   <Branch>Branch_01</Branch>
   <Perpetual>true</Perpetual>
</Event>

If the perpetual tag is set to true the event will always trigger when the player conquers Hoth. If set to false the event would only trigger the first time the planet is conquered.

That's all I wanted to show you in this tutorial. I hope I was could help you understand the basic structure of Story Events in Empire at War Smile

If you want to know more about the other Event/Reward Types and how exactly their parameters are used then download the Empire at War Map editor and have a look Petroglyph's Story Scripting Tutorial. It contains a list with detailed information about most of the Event/Reward Types as well as their parameters.

_________________
Back to top Go down
View user profile http://secretweapons.heavenforum.com
 
Tutorial: Basic Story Scripting Part I
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» [Tutorial] Tom''s basic painting tutorial
» No-Face's Story Part 3 Action Man Kidnapped.
» Custom Tutorial Thread
» Some very basic tips from a new user
» Dipped Undead Warband (Updated Tutorial Oct 20th)

Permissions in this forum:You cannot reply to topics in this forum
Secret Weapons of the Empire :: General Modding :: XML/LUA Modding-
Jump to: