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 II

Go down 

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

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

Hi guys, this is my second part of the story scripting tutorial. I recommend you read part 1 first, since I might refer to things mentioned there.

We'll be dealing with the following things in this tutorial:
1. A holo video message with screen text
2. Working with flags

1. A holo video message with screen text

Now I'll show you to play a holo video and display a screen text.
For this event we'll need the reward type MULTIMEDIA, a reward that allows you to show videos, screen text and play sounds. It's also capable of doing a few other things, but usually you don't need them too often.

Let's start:


<Event Name="A_Multimedia_Event">

Ok, so what does this do?
Parameter 1 of MULTIMEDIA specifies a text entry from the master text file that shall be displayed on the screen.
Parameter 2 tells EaW/FoC how long the text shall be displayed. -1 stands for infinite display duration.
Parameter 9 calls a movie from Movies.xml
Parameter 10 determines whether the movie shall be looped or not. 1= Loop, 0= do not loop

Perhaps you're wondering now why we set the display duration -1 and the loop to 1.
The reason is simple:
If the display duration of the text is longer or shorter than the length of the video then the text wouldn't disappear at the same time as the video. That wouldn't look too good of course, so we need to stop the screen text and the video with additional events.
Therefor we need two other events, one that triggers after a determined time after the MULTIMEDIA event and that uses the reward SCREEN_TEXT and another one with the reward STOP_COMMANDBAR_MOVIE with the SCREEN_TEXT event as prerequisite.
SCREEN_TEXT serves mainly for two purposes: 1. displaying screen text and 2. removing it.


<Event Name="A_Multimedia_Event">

<Event Name="Kill_the_screen_text">

<Event Name="Stop_the_commandbar_movie">

1. "Kill the screen text"
As soon as "A_Multimedia_Event" has been triggered this event will count to 10 (in EaW game seconds).
After reaching 10 the reward type will be activated.
Parameter 1 of SCREEN_TEXT contains the text entry from the master text file. In this case it's the name of the text entry we want to remove from the screen.
Parameter 4 is just there to tell the game that it has to remove that entry. The only valid command for this parameter is "remove".

2. "Stop_the_commandbar_movie"
Due to the event type STORY_TRIGGER and the prerequisite "Kill_the_screen_text" this event will be triggered as soon as the event "Kill_the_screen_text" has been triggered.
The reward type should be quite self-explaining: STOP_COMMANDBAR_MOVIE stops a commandbar movie. It doesn't have any reward parameters so it's really easy to use.

Now we've achieved what we wanted to do and the screen text will disappear at the same time as the video.

2. Working with Flags

Flags are useful to count stuff in game. They're also useable for a few other things, but we'll stick to the basics in this tutorial.
A flag has two attributes: 1. A name of your choice and 2. a value.

We will start with setting a flag at the beginning of the game:


<Event Name="Set_a_flag">

As you can probably (and hopefully) guess the reward type SET_FLAG creates a flag.
Parameter 1 defines the name of the flag. You can call it whatever you want.
Parameter 2 sets the start value of the flag, in this case 0.

Now there are basicly two things we can do with our new flag.
We can play around with its value or check its value.

First we'll play around with the value a bit:


<Event Name="Increment_the_flag">

What the reward type INCREMENT_FLAG does should be self-explaining.
Parameter 1 of INCREMENT_FLAG contains the name of the flag you want to increment. It has to be created with SET_FLAG just as we did above.
Parameter 2 determines the amount by which the flag is incremented. This amount can be positive or negative and can contain any number.

Now we'll check the value of the flag with the event type STORY_FLAG:


<Event Name="Check_if_flag_is_greater_than_1">

As said before STORY_FLAG checks the value of a flag.
Event parameter 1 contains again the name of the flag you want to check.
Parameter 2 determines a value.
Parameter 3 specifies a comparison method. This method is then used to compare the value specified in parameter 2 to the actual value of the flag. In our case the game will spawn a star destroyer if the flag value is greater than one.
Possible comparison methods for parameter 3 are:

Back to top Go down
View user profile
Tutorial: Basic Story Scripting Part II
Back to top 
Page 1 of 1
 Similar topics
» No-Face's Story Part 3 Action Man Kidnapped.
» Some very basic tips from a new user
» Karottenkrieg - A German Warhammer/Mordheim-Story
» [Tutorial] Taking Photos of your Miniatures (by Hyun)
» Crocheted Coin Purse (with Tutorial)

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