Basic Conversations in UT3
In this tutorial we will make it possible to communicate with a static NPC through a list of possibilities you can choose from. The NPC will handle accordingly.
Before we start, we have to know what we want to communicate about with an NPC.
In this tutorial we will use the following conversation. The conversation will start the moment we walk up to the NPC.
NPC: “Hi there stranger, want something from me?”
You:
1) I would like some banana’s (he will start laughing)
2) I would like to kill you….. (he will kill you with his Rocket Launcher)
3) I want a rocket launcher (he will keep talking, we’ll use this to start with)
NPC: A Rocket Launcher huh? It will cost you €100,-
You:
1) I don’t have that, never mind then (conversation end)
2) Screw you, give it here! (he kills you)
3) Ok, here you go… Thank you! (you get a rocket launcher)
Now, let’s get to work!
Create a new subtractive level
Right-click the Cube icon in the toolbar
Create a new cube with the following dimensions:
X 1024
Y 1024
Z 512
Subtract the cube by clicking the subtract button in the toolbar
Apply some texturing on it (In image 1 is to be seen what my cube looks like after texturing, use your own textures from the standard UT3 packages)
(Image 1)
Insert a player start in it, and a lightpoint
Insert a static actor by selecting “PhysAnimTestActor” in your generic browser under the tab “Actor Classes”, followed by right clicking on your surface and select “AddPhysAnimTestActer here” Result is to be seen in Image 2
(Image 2)
Create a new UIscene by opening your generic browser, select the tab “Generic” select “new” and apply the data in the tab as seen in Image 3.
(Image 3)
A new folder named Test will be made in your generic browser containing the UIscene.
To make it visible select UI scenes in the upper left corner of your generic browser, as seen in Image 4
(Image 4)
Open your UI scene by double clicking on it.
On the right side of the editor, we will turn off “bDisplay Cursor” because we are going to work with simple numeric selection keys to start with (making clickable buttons is more advanced, clicking buttons will do for now.)
also make sure that the checkbox “bPauseGameWhileActive” is selected, to avoid being shot in the back by another mobster. (image 5)
(Image 5)
Now we are going to place some Labels in the screen. Inside these labels our conversation text is shown.
Right-click in the big empty area, select Place Widget à Label and name it Quest1Welcome
If you make a large amount of conversations, be sure you write the out in advance, and label them individually. If you don’t you cannot assign the proper conversation in Kismet.
Resize the Label to be 400x256
Insert the text that has to be shown inside the Label. You can insert it under the tab: Data à DataSource à MarkupString.
You can align the text under the tab Data à StringRenderComponent àStyleOverride à TextStyleCustomization
Example can be seen in Image 6
(Image 6)
Position the label in the left bottom corner.
Now we add three more labels, size them 256x50 and fill them with the three questions you can state in the welcome screen. Name them Q1A1, Q1A2, Q1A3 (for Quest 1, Answer 1 etc) Example in Image 7
(Image 7)
For the conversation that is started after selecting option 3 we make a new UI scene and name it “Quest1Option3” The bigger label in my example is named “Q1Sub3RocketLauncher”. The three smaller labels are named Q1Sub3A1, Q1Sub3A2, Q1Sub3A3.
Now it’s time for some Kismet!
Click anywhere in the blank screen in the UI scene editor from (not the labels) to make sure everything is deselected.
Right-click in the blank screen and select “Unreal KismetEditor”
In the Enabled state double click on the diamond called “State Imput Events” (Image 8)
(Image 8)
In the now shown menu you can select the options that Kismet will use for different choices. We will use 1 pressed, 2 pressed and 3 pressed. (for our three choices) (See Image 9 for result)
(Image 9)
Now we need to get the three possible questions to work. In this example we want to get a rocket launcher, so we make choice number 3 the one that leads to the next UIscene
Richt click in the UI Kismet and select New Action à UI à Close Scene (you can CTRL click the elements to organize them on the screen) Do this for all three choices (This UIscene has to close
For the first two questions in our conversation we can stop the conversation. In those two cases we need to activate a level event (kill and laugh)
Right click the UI Kismet, select New Action à Level à Activate Level Event.
For option 3 we need to open a new UIscene. Right click the UI Kismet and select New Action à UI à Open Scene
Your Kismet will look like the one in Image 10.
(Image 10)
The “Close Scene” elements need to know what scene needs to be closed. To do this Right-click the little square under “Scene” and select “Create New Object Variable” In the box Object Value insert the name of your first UI scene, in this case Quest1Welcome and press enter. A line like this “UILabel'Test.Quest1Welcome:Quest1Welcome'” will now appear.
Do this for all the close scene objects.
The Open Scene object needs to know what scene to open. Insert a new object variable underneath the arrow at “Opened Scene”, type the name of your second UI scene in the Object Value box, and link the square under “Scene” with the newly created Object Variable (click and drag a line from the little square to the big circle)
Your Kismet should look like Image 11 now.
(Image 11)
We do the same inside Kismet for the second UI scene with the exception of opening a new scene at option 3. Your Kismet of the second UI scene should like the one in image 12.
(Image 12)
Inside the Kismet of the second UI scene, select the “Activate Level Event” object at the third option, and type in Rocket in the Event Name box (Image 13)
(Image 13)
Now close all Kismet windows, and save your package.
To activate the conversation, insert a normal touch trigger underneath your inserted character (right click the floor, add actor à add trigger) and position it under your character. (image 14)
(Image 14)
Keep the trigger selected, and open Kismet (big green K in the top of your screen). Right click anywhere in the blank screen and select New Event using Trigger_0 à Touch
Right click again in the blank area and select New Action à UI à Open Scene
Connect the connectors as seen in image 15, and add an object variable underneath “Opened Scene” and link it to the first UI scene named “Quest1Welcome”
(Image 15)
Now we need to set up the receiving of the rocket launcher.
Right click again and select New Event à Remote Event
Right click again and select New Action à Pawn à Give Inventory
Right click again and select New Variable à Object à Player
Link this with the square underneath “Target” in the Give inventory box.
Select the “Give Inventory” box, and add an inventory item by clicking on the green + sign and select RocketLauncher from the drop down menu. (Image 16)
(Image 16)
Select the Remote event object, and insert “Rocket” in the EventName box. The ActivateLevelEvent from the second UI scene will now refer to this Event. (Image 17)
(Image 17)
Save your level, make sure the name of your level looks like something like this:
DM-levelname (DM- makes it a DeathMatch mape, and lets you use weapons)
Rebuild all and play!
Have Fun!





