Hello
Welcome to my free video tutorial.
The subject of this tutorial is related
to my previous tutorial
in that it looks at how to animate the color of a light
but
this tutorial will show you how to do that
using not Unreal Kismet,
which is what I looked at in my previous video.
but will show you how to animate a light using Unreal Script.
The light that you see in front of you here
changes from red
to green and to blue.
and this is the result of a new
light type
that I have created
in Unreal Script.
This tutorial will show you how to create this light in Unreal Script.
So, let's get started.
OK. So before we get started.
I just want to say a little bit about what the aim here is
uh... we're going to want to create a new light type.
uh... a light type that will animate its color over time.
I am going to create this new light type based on the Spotlight Toggleable
I am basing it on that type because the Spotlight Toggleable is dynamic.
Meaning that its color
can change over time
and changing color is exactly what we want to happen to our light.
In order to create that light, I am going to create a new class
in Unreal Script.
And to create a class in Unreal Script I am going to have to use some kind of
code editor.
Now, there are a number of ways in which you can create
and compile
Unreal Script code.
One way is to create the code in a text editor, such as Notepad,
and then to compile it manually using the UDK Compiler.
What I am using here however is the Microsoft Visual Studio 2010
editor.
And I'm using that with the nFringe plug-in. I am not going to explain the
details on how to install either Visual Studio or nFringe
because I'm going to assume that you have those things installed already.
uh...
There are a number of tutorials, both video tutorials and text-based
tutorials that explain to you how to get up and running.
One thing I do want to mention about the set up I have here though is
if we look in the Solution Explorer of Visual Studio here
you will see that I have a folder called Test > Classes.
Now all the folders listed in this pane
correspond
to folders that exist in the development\src directory in the UDK
installation folder.
Let's take a quick look at that folder, here.
If I click on this and bring up this folder here.
What you see in front of you is the UDK
installation folder.
you can see here that I have a range of
folders inside the UDK installation. One of them is called 'Development'.
If I double-click on the 'development' folder,
and I click on 'Src' to enter the source folder,
you will see all the source code
for the UDK.
Now, most of this code ships with the UDK. It comes with the UDK.
And these folders here correspond to folders
in the solution explorer here.
I have created a new folder called 'Test'.
And this folder will be used to contain the new class
that I'm going to create for my light type, and you can see the test
folder
listed in the solution explorer.
In order to make sure this folder, or that the source files in this folder
will compile
I also must make sure that I have appropriately edited the
UDKEngine.ini file.
That is, I have to make sure that I
uh... add the correct settings
to the UDKEngine.ini file.
I can find that file
by
moving back up the tree here to the UDK folder.
selecting UDKGame
entering the Config folder
and scrolling down until I find
UDKEngine.ini
If I double click that file
and scroll down
into the file
until I reach-
let's find it here-
Until I reach
[UnrealEd.EditorEngine]
Now, at the bottom of this section
you'll notice that I have added
ModEditPackages=Test
This line tells the
Unreal compiler that it should look for source files in a folder called
test.
And this corresponds to the folder here.
So, you need to have this uh...
setup in order to compile your source code correctly.
You may choose to name your folder something other than Test.
If you want to do that, that is fine.
I've just skimmed over these uh... details of setting up nFringe and
Visual Studio
and all the details necessary to compile Unreal Script.
I've not gone into much detail because
I assume you know how to do this already.
OK, so with that in mind let's get started and create a new class
for our light.
Now, I'm going to create a new class to represent my
new light type.
In Unreal Script
one class corresponds to one source file,
meaning that since I'm going to be creating only one class
I am going to be creating only one source file.
So I am going to right-click here on the folder 'Classes'.
And I am going to select
Add
New Item, from the context menu. I could also press the keyboard shorcut
Ctrl+Shift+A.
From the Add New Item Menu, I am going to select
Unreal Script File
and I am going to name this class:
MyAnimatedLight
and click the Add button.
Make sure that you select Unreal Script file in the list here.
You don't want to be creating
any of these other kinds of files.
And click the Add button
when ready.
Now this presents me with
a new class
uh... definition.
It's already filled in some values for me and they are not quite what I want.
You'll see the class here is named MyAnimatedLight, and that's correct.
But you will notice that it says: extends object.
meaning that the class
I am going to create here
currently extends or derives from the object class
and that is not what I want.
I want my class to extend upon the functionality of SpotLightToggleable.
So that is the class that is going to be the parent or ancestor
class- the superclass of the class that I am going to create.
So let's change this object to SpotLightToggleable.
And in the code completion dialog here
I can see that SpotLightToggleable is an option here.
So I am going to select that.
So we have class MyAnimatedLight extends SpotLightToggleable.
I want to add some extra properties here.
On a new line, make sure that
uh... you carry the semi-colon with you,
on a new line I am going to
insert the text 'Placeable'.
This will ensure that my animated light class
will be accessible
from the actors pane of the UDK editor.
We're going to see what that involves shortly.
On another line I am going to add the text ClassGroup
and then in brackets, I am going to add
'Test' and 'Lighting'.
OK
Whoops! It says Lighting... No, no. That's not quite what I want.
Now, you may wonder what this achieves.
Er, this is wrong as well.
OK
Now, you may ask what this is going to achieve.
uh... and one of the best ways to describe this is to exactly show you
the effects all of these lines in the UDK editor.
Here in the UDK Editor, let us see the effects of the code
we have created thus far.
By pressing Ctrl+Shift+F
on the keyboard to display the Content Browser.
In the actor's panel. Let us click the Actor's tab here,
and we'll scroll down and notice the option that says 'Test'
and
let's click the + arrow here
and see the lighting
category
and by clicking + again we can see
MyAnimatedLight Class.
So by making the MyAnimatedLight class
placeable
we ensure that it is listed in this panel
as an option
that can be dragged and dropped into the level.
Using the ClassGroup
statement we have categorized MyAnimatedLight
under the nodes of Test and Lighting.
Now, of course our class is not yet completed.
uh... if I click and drag my animated light into the scene
you can see that I'm presented with a standard SpotLightToggleable.
This will behave exactly the same as a standard SpotLightToggleable.
Because I haven't
added any further code to my class.
I haven't added further code
to customize
the behavior of the SpotLightToggleable.
So this class, right now, would act
identical
to the SpotLightToggleable.
So we are going to jumpt back into the Visual Studio editor
and code some more things to this
light class.