UDK Scripting Series by Pete Bottomley:
Intro to Kismet
How to Pick Up and Place Item
How to Trigger Material Instances
How to Spawn Bots in Kismet - Part 1
How to Add Functionality to the Bot - Part 2
Bot Functionality Final Touches - Part 3
Bools - Puzzle Design and Interaction
Cinematics Introduction Part 1/2
Cinematics Introduction Part 2/2
Using Console Commands as Gameplay Elements
How to Prototype Quick Time Events in Kismet
In this Console Commands tutorial we will look at how to use the functionality of console commands in our levels as gameplay elements. We will also look into a few new actions that haven't previously been used.
In this Console Commands video you'll learn:
- How to use console commands
- How to spawn and possess bots
- How to hide the player HUD
- How to use Material Instances
- How to use remote events
- How to use Dynamic Trigger and Physics volumes
1. Firstly we need to set up our level in preparation for our Kismet. We need a primary Player Start (this could have already been made at the start of your level).
You also need a Pathnode_Dynamic in your level (found in actor classes) but you don't need to change any of these properties. Check to make sure the Movement is set to Interpolating.
Next you need another player start with Primary Start and Enabled unchecked. You also need a Note (found in actor classes) in the level.
We now need some way to kill the player. For this I have used a doorway StaticMesh 'LT_Doors .SM.Mesh. S_LT_Doors_SM_Door04' along with a plane across the door StaticMesh 'dwStaticMeshes. Plane' . The plane should have no collision and have a translucent material applied to it. I used Material 'Prototype_Content. Materials. MAT_InteractableObject' in the custom prototype package.
We also need a Dynamic Physics Volume over the door which is pain causing and some amount of damage per second.
Next, we need to add the static mesh StaticMesh 'GenericFoliage01 .Ruins.Mesh. SM_UDK_Torch_Pillar02' and create a copy of the material it uses. You can find this in the static mesh editor. Create a copy into your Prototype_Content package and double click it. Make sure Fire is ticked and change the value to 0 to turn the fire off.
Once you have created the new material, override the new material on the static mesh. You also need a MaterialInstanceActor from Actor Classes along with a PointlightMoveable (or Toggleable). We also need a Dynamic Trigger Volume surrounding the area of where the fire will be.
Be sure to assign the new material to the MaterialInstanceActor and change the light settings to something you are happy with. Also make sure the DynamicTriggerVolume is disabled.
2. Next we can open Kismet and start setting up our gameplay. Firstly, create a Player Spawned Event from New Event - Player - Player Spawned. You will also need an Attach to Actor found in New Action - Actor - Attach to Actor. Right click on the Instigator of Player Spawned to get an empty variable and connect the Target of the Attach to Actor to it. With the Pathnode_Dynamic selected in your level right click on the Attachment of Attach to actor and add that property.
Optional: You can add a Toggle HUD (New Action - Toggle - Toggle HUD) to hide the player HUD.
Now we will use our first console command. Right click - New Action - Misc - Console Command and hook it up to the Out of the Player Spawned. The target will be the Player Variable. We can give this empty variable a Var Name of Player so that we can reference it later in the scene. In the Console Command we can give a command of setspeed 2.0. This will make the player move twice as quickly as they should do.
Next we need to be able to detect when the player has died. For this we use a New Event - Pawn - Death. The Attachee of the Attach to Event should be two named Variables (LMB+N) named Player and Possess. Your Possess variable will have a red cross on it at this point. Don't worry about that.
We now need an Actory Factory with UTActorFactoryAI selected. Pawn class is UTBot and Controllerclass is UTBot. The Spawn Point of the Actor Factory will be the Pathnode_Dynamic that you added to the Attach to Actor action. You don't need to change anything else. After this we need to use our Possess Pawn action found in New Action - Pawn - Posses Pawn. The Target will be the Player named Variable. The Pawn Target can be created from the Spawned output of the Actor Factory. Right click on the Spawned output of Actor Factory and create a new variable then connect it to the Pawn Target. Give it a Var Name of Spawned.
Next we create another Console Command with two commands of God in (0) and Fly in (1). This is all you need for the initial setup of how to detect the player death and then spawn as a spirit.
3. The next set up will be of the Fire mesh ready to swallow the spirit up. For this we need to select the MaterialInstanceActor in the level and create a new Matinee. Create a new Empty Group and name it MI. Next create a new Float Material Param track. You need a new Key (Enter) on 0 seconds and however many seconds you want it to complete in. I have the next Key at 1 second. On the Param name in the properties at the bottom named the box 'Fire' and then right click on the second key you created and choose Set Value. Give it a new value of 1 and see the Fire come on in the viewport of the Static Mesh. If it didn't come on, check you have your material assigned to the Mesh, the MaterialInstanceActor and connected to the Matinee.
You can then hook up the Player of the Matinee from the 'Death' output of the previous sequence you have just created. Create a Toggle (LMB+T) and assign your Point Light to the Target. From the completed output connect Turn On. And from Reverse set that to Turn Off. Your point light should be disabled by default.
4. Now we can start working on the next part of the setup. With the Dynamic Trigger Volume selected in the level (Disabled by default) create a new Touch event using the volume. Create a Destroy action from New Action - Actor - Destroy. Create a new named variable of Spawned and connect it to the target. You should rarely use this action as once something is destroyed you cannot call it again unless you re-start the game. Next we need a toggle (LMB+T) and you need to connect your two player starts to the Target. Connect the Out of the Destroy to the Toggle input. This will make the player spawn from the second location instead of the first.
Next we need a Matinee with a Camera group. Add a Camera Actor to the scene that is positioned just behind the static mesh statue.
Create a new Camera group in the Matinee and create a camera track that goes from the start position down to where the note and player start are located. This is to represent the player being thrown out and landing on the ground.
Be sure to add a Director Group to the Matinee and have your Camera Group as the main object on the timeline.
Now we need another Actor Factory with the Spawn Point as the Note above the second player start. A Spawned variable named Possess and UTActorFactoryAI selected in the properties of the Matinee along with UTPawn as the Pawn class and UTBot as the Controllerclass. You can also give your player a weapon at this stage if you don't want them to lose it from when they died.
Next we need another Possess Pawn action with the Target as the Player named variable and the Pawn Target as the newly spawned bot named Possess. We also need a new Console Command firing off the Out of the Actor Factory with the command as God. This turns off God mode for the player. Next we need two Remote Events (LMB+R,), one named PlayerSpawned and the other named Reverse. Connect both Inputs to the Out of the Console command.
The Out of the PlayerSpawned remote event needs to hook up to the Attach to Actor action at the start (you can copy and paste the inputs from the previous PlayerSpawedEvent) along with attaching to the ConsoleCommand. Give the Instigator a named variable of Posses so we know who we are talking to. The Reverse Remote Event needs to the hooked up to the Reverse of the top Matinee you created with the Material Instance. (See completed image).
5. Lastly we need to make sure the Dynamic Volumes are correctly triggered. We need two Toggle Events (LMB+T) with the DynamicTriggerVolume near the Static mesh on one and the two doorway Physics volumes on the other.
The Dynamic Trigger Volume should Turn On from the Death event and Turn Off from the Finished of the Actor Factory of the 'Possess' bot. The toggle of the two physics volumes needs to Turn Off from the Death of the first sequence and Turn On from the Finished of the Possess bot Actor Factory (opposite to the other toggle).
You should now have a completed setup which looks like this:
Keep in mind that this is not a perfect system and is mainly used for Prototyping ideas. If the player gets killed sideways then the controlling of the 'Spirit' bot will be a bit tricky. Also once the player dies you will have to spawn a new object for it to attach to and teleport it to the player location. This is purely used as a demonstration and idea of what gameplay ideas are possible.
All content on this website is copyrighted ©2008-2022 World of Level Design LLC by Alex Galuzin. All rights reserved.
Duplication and distribution is illegal and strictly prohibited.
World of Level Design LLC is an independent company. World of Level Design website, its tutorials and products are not endorsed, sponsored or approved by any mentioned companies on this website in any way. All content is based on my own personal experimentation, experience and opinion. World of Level Design™ and 11 Day Level Design™ are trademarks of Alex Galuzin.
Template powered by w3.css