Thursday, 22 March 2012

Vampire Feeding Health system in UDK kismet

Since i had a lot of trouble finding any tutorials that showed how to make a Kismet sequence for this mechanic, I've decided to make a tutorial myself for the version i was able to implement into my Final Year Major Project.

Spawning the enemy actor)
First off we need an actor to be our victim. To do this, first do the following

Right click > Add Actor > Add PathNode
The above will be the result

Next, the kismet window should be opened, and following nodes added

New Event > Level loaded
New Action > Actor > Actor Factory

Link the "loaded and visible" output node from Level loaded into the "spawn actor" input of the Actor Factory.
Now create a path node object in kismet like so

Right Click >  New object var using pathnode_0 (or whatever pathnode you have selected)

Connect this to the purple "spawn point" output of the actor factory

The final node required is an empty object (labelled "???"), create this by:
New Variable > Object > Object

Your kismet window should now look like this



To ensure the right character is spawned, the properties of the Actor Factory need to be edited. The first step is to choose the factory (the type of actor we want to spawn). To do this, select the Actor Factory, and click the blue triangle to the far right of the "Factory" tab, and scroll down to "UTActorFactoryAI", then, in the "PawnClass" tab, select "UTPawn" (unless you are using a custom character, in which case, select that character's PawnClass. If you want ranged combat, tick the "ForceDeathmatchAI" and "GiveDefaultInventory" boxes. Your Actor Factory propertierss should look like this.


Test the sequence by unning the game in the editor, a scene similar to the one below should show, the only difference should be the spawned enemy (i'm using a version of UDk where i've edited the script to show a custom enemy


Now, we move onto setting up the health change. The first thing to do here is create an "attach to event" node, found under

New Action > Event > Attach To Event

attach the "Finished" output from the Actor Factory into the "in" input in the Attach To Event. The "attachee" output needs to be connected to the empty object created early, as this acts as the enemy indicator in kismet. Next, create a Death event, found in

New Event > Pawn > Death

Attach the red "event" square from "Attach to Event" to this new node. This now tells Kismet to initiate any nodes connected to the output of "Death" on the death of the spawned actor. Set the Max trigger count to 0 so it can run infinite times

Next, create a "Modify Health" node

New Action > Actor > Modify Health

Connect the "Out" output from Death to the "In" input of modify health, then create a player object

New Variable > Player > player

uncheck the "all players" tickbox in this node and leave the Player Idx as 0, this indicates it only affects the player character. Connect this object to the "Taget" output of the modify health node. Now create a float or Random float object


New variable > float > float / random float

Using float will alway heal the player the specified amount, whereas random float will heal the player randomly between the two values assigned to the object. Connect this object to the "Amount" output of the modify health node
.
Your kismet should now look like this:

Test this in the editor, you should now recieve health every time the enemy dies.

Thursday, 8 March 2012

Initial ramblings

This blog will effectively be a timeline of my work as it occurs, as well as discussion of events in the games industry that I find particularly interesting. There will most likely be some posts highlighting the good & bad parts of games that I play for the benefit of understanding these ideas and why they may exist within the game.