![Page 1: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/1.jpg)
Sega 500
Scripted events and
Sequences
Jeff “Ezeikeil” [email protected]://gamestudies.cdis.org/~jgiles
![Page 2: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/2.jpg)
Thus far
We’ve played lots with the game dynamics to change how UT2003 runs.
But, we’ve done little to nothing on how to cause a chain or sequence of events.
![Page 3: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/3.jpg)
Today
This, boys and girls is the land of the scripted sequence.
We’re going to look at what it takes to include one in our game.
![Page 4: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/4.jpg)
“I’m a programmer Jim, not a level designer”
What are they and why do I care?
Scripted Sequences are great tools to that allow the game to tell a story, set a mood or have something happen that “makes sense”.
![Page 5: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/5.jpg)
“I’m a programmer Jim, not a level designer”
Look a some of the other games that have used them to great effect…
![Page 6: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/6.jpg)
Half-life
![Page 7: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/7.jpg)
Max Payne
![Page 8: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/8.jpg)
Max Payne
![Page 9: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/9.jpg)
And of course…UT2003
![Page 10: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/10.jpg)
UT2003
![Page 11: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/11.jpg)
Fine, Fine…
Enough about the story…why do I care…Me programmer!
As programmers, we should and do care about these sequences since we could quite realistically be asked to build tools for them.
![Page 12: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/12.jpg)
Our Goal
For the next few lessons is to look at and develop an understanding of how these work.
Then, develop a action sequence or two of our very own.
![Page 13: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/13.jpg)
Oh, yeah
You can also use the AIScript component of the scripted sequence to affect to behaviour of a bot in game.
Thus changing it’s AI properties…
e.g. it’s behaviour.
![Page 14: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/14.jpg)
Getting started
Today, our play in UScript is going to be minimal. We’re back in the Editor.
But first, some set up info…
![Page 15: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/15.jpg)
Getting started
All bots in the game derive from Scripted controller, which is what allows our bots to follow other scripts.
It is the AI controller which is the “brains” for the pawn. Achieved through a scripted sequence specified by an AIScript .
![Page 16: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/16.jpg)
Getting started
These work in close conjunction with AIScript’s which are placeable into the level.
Used by Level Designers to specify special AI scripts for pawns placed in a level, and to change which type of AI controller to use for a pawn.
![Page 17: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/17.jpg)
Getting started
AIScripts can be shared by one or many pawns.
Game specific subclasses of AIScript will have editable properties defining game specific behavior and AI.
![Page 18: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/18.jpg)
Getting started
The one we’re interested in is the UnrealScriptedSequence.
This derives from ScriptedSequence provides the core functionality for setting up scripted sequences for pawns.
A ScriptedController is spawned to carry out the scripted sequence.
![Page 19: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/19.jpg)
Getting started
Lastly, we have our actions list…
It’s a rather long list of scripted actions available to the scripted controller
These are the Actions that are used by a ScriptedSequence script which are the commands that tell the script what to do.
![Page 20: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/20.jpg)
Getting started
For a really good look and description of these actions, consult the wiki.
http://wiki.beyondunreal.com/wiki/ScriptedSequence
![Page 21: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/21.jpg)
Getting started
Now that’s out of the way, time to build our own basic sequence.
In short, we’ll get a bot to run around the room and then do something at each corner.
![Page 22: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/22.jpg)
Getting started
Start off with a simple test level, a box.
Then add a XPawn and an UnrealScriptedSequence.
![Page 23: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/23.jpg)
Simple Script
At this point, the Script and Bot have no knowledge of each other, they need to be linked.
If we run it now, the game will run as normal with this xPawn spawning in with us.
![Page 24: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/24.jpg)
Linking the xPawn to the Script
To link a pawn to a UnrealScriptedSequence, you need to set the pawn's AIScriptTag to the Tag of the UnrealScriptedSequence.
This will cause the sequence to start executing as soon as the pawn is active in the level (usually as soon as the level begins).
![Page 25: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/25.jpg)
Linking the xPawn to the Script
AIScript tag must match the xPawns events Tag.
![Page 26: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/26.jpg)
Linking the xPawn to the Script
If all goes well, when the xPawn is selected a blue line will link the pawn to it’s script.
![Page 27: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/27.jpg)
Linking the xPawn to the Script
Lastly, we need to tell the UnrealScriptedSequence which controller this script affects.
For now, just set it to ScriptedController so that we have total control over our pawn. It will have no brain of its own.
![Page 28: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/28.jpg)
Linking the xPawn to the Script
If you run the level now, you should have a dumb bot that simply stands there playing it’s idle animation.
![Page 29: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/29.jpg)
Add some actions In your UnrealScriptedSequence actor,
under AIScript is a dynamic array of Actions.
These actions determine how the bot will behave.
Notice that it starts with a default set of actions.
![Page 30: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/30.jpg)
Add some actions
Initially, your Actions array will be empty. To add a new action, click on Add.
This will create an empty element in the array (Add will always create elements at the end of the array).
![Page 31: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/31.jpg)
Add some actions
Caution: If, at any point, you click on Empty, it will clear the whole array, and you will lose any data that was in it.
We don’t want the default actions, so empty the list.
![Page 32: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/32.jpg)
Add some actions
Once you have an empty element in the array, you can expand it, and get a drop-down box which lists all the items which can be added into the array.
To create a specific item for the array, select the item you wish to use from the drop-down-box, and click on New.
The item that has been created can then be expanded to allow access to its variables.
![Page 33: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/33.jpg)
Getting our dude to move
So in the AIScript pull down, add an action from the pull down menu.
In this case ACTION_MoveToPoint and hit new.
Lastly set the destination tag.
![Page 34: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/34.jpg)
Getting our dude to move
Of course we need a destination. I’m going to use pathnodes. But really, we could use anything.
Place one in the far corner and give its tag the same name as the destinationTag in the ACTION_MoveToPoint
![Page 35: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/35.jpg)
Getting our dude to move
And our dude springs into action, running to the path node of matching tag.
![Page 36: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/36.jpg)
Getting our dude to move
Now, if we place a node in each corner and string them together, we can make our bot do laps.
Simply by adding new move to actions and pathnodes with matching tags.
![Page 37: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/37.jpg)
Doing laps
![Page 38: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/38.jpg)
Doing laps
Cool! Your very first scripted sequence. The bot does one lap of the room and then
runs in place at the last node.
We can get him to stop that by adding another action at the end of the list, say ACTION_TurnTowardPlayer
![Page 39: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/39.jpg)
Doing laps
But, better idea, there’s a goto action where we can jump to any action in the list.
I’m going to jump to the first on so he goes in circles….forever.
![Page 40: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/40.jpg)
Doing laps
Let’s make the circuit a bit more interesting and make him do something unique at each corner.
![Page 41: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/41.jpg)
Doing laps
Corner 1: Jump
Easy to set up, Just insert the Action_Jump, select the jump type and move to corner 2.
![Page 42: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/42.jpg)
Doing laps
Corner 2: play a sound
Like above, real easy. Select a sound from the list.
![Page 43: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/43.jpg)
Doing laps
Corner 3: pause then seek the player
A bit different, but still easy to set up. But there are 2 Actions here, ACTION_WaitForTimer and ACTION_MoveToPlayer
![Page 44: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/44.jpg)
Doing laps
Once the player is touched, the bot will return to its circuit.
![Page 45: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/45.jpg)
Doing laps
Corner 4: Wait for an event, repeat the circuit.
The bot will remain at this location until an event is received.
We’ll just set up a trigger to broadcast one.
![Page 46: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/46.jpg)
Doing laps
And use ACTION_WaitForEvent to hold until the event is broadcast.
![Page 47: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/47.jpg)
Doing laps
Now, setting up the trigger is a bit different as it’s looking for an event an not the usual broadcast tag.
This causes an error to be generated but it works fine.
You can make the error go away by using the tag in the triggers event also.
![Page 48: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/48.jpg)
That’s a wrap
This is only scraping the surface of what can be done via scritped sequences.
But it’s a good starting point.
And remember, these can be used to influence / over ride regular bot AI too.
![Page 49: Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles](https://reader036.vdocuments.mx/reader036/viewer/2022062806/5697c0301a28abf838cda742/html5/thumbnails/49.jpg)
Next Day…
We’ll be looking at another item know as the scripted trigger which functions in a similar manner to the scripted sequences.
But can be used for timing / triggering or setting off a series of sequential events .