Understanding the usage of Named Variables

In this recipe we'll introduce a way to simplify the connections of Object Variables. The reason to do so is because in the next recipe we'll introduce Sub-Sequences, which are a way to layer out sections of Kismet, and using Named Variables are often necessary when doing so. A good case for introducing the benefit of Named Variables is in the case of Bots. When a spawned actor is referenced by actions many times, you wind up with connections to it from multiple locations, which can get messy. We'll take steps to clean up a section of Kismet we've made in previous recipes to show how Named Variables are set up.

Getting ready

Open Packt_04_NamedVariable_Start.UDK or continue from where you were in the last recipe if you completed it. In this map the Bot handling is already set up, from previous recipes. Look at the section Bot Handling.

How to do it...

  1. In the top row of Kismet there is a means to set bookmarks of the Kismet canvas so you can jump around between areas you plan to work on a lot. Under the Window menu there is a little black downward triangle icon [ How to do it... ], which expands a roll-out menu for setting and jumping to bookmarks. Use this to jump to an existing bookmark. You can also set a bookmark with the hot keys Ctrl + 0, Ctrl + 1, and so on, and then jump between them using 0 and 1 and so on. Locate the section called Bot Handling and press Ctrl + 0 to bookmark it for later recall with 0.
  2. The hotkey for adding an Object Variable is to hold O and click in Kismet. This creates an unnamed Object Variable ???. Hold O and click, and in the new variable's properties, locate the Var Name field and type Boss (it can be any name you like so long as it is followed consistently). Boss will appear in red under the variable. Don't confuse this with an Obj Comment, which would appear above the variable in blue.
  3. A Var Name is a distinct name that is declared so we can identify it anywhere. This is one of the key lessons to learn for UDK. Highlight the Named Variables Boss, right-click on the canvas nearby and choose New Comment (Wrap) and enter Global Variables in the Obj Comment property for the comment box, as shown in the next screenshot. Global variables are kept aside from everything else so they're easy to find, and must be in the main sequence of Kismet, not in a Sub-Sequence (of which we'll talk more about in the next topic).
    How to do it...
  4. Notice that the other Object Variable ??? that comes from the Spawned nub of the Actor Factory in Bot Handling has many connections. This is where we can use a Named Variable to take up the strain on a single Object Variable node.
  5. Hold N and click to produce a Named Variable. It will have a big red cross over it. In its Find Var Name field type Boss. This will tell the Named Variable who it represents. When any variable with the Var Name Boss is found, the Named Variable Boss gets a green tick. We already set one up, so that should happen immediately.
  6. Copy and paste the Named Variable Boss and move it under an action that feeds the Object Variable ??? that has many wires. Press Alt on the action's nub and instead wire the nub to the Named Variable Boss. Paste the Named Variable Boss again and move it to the next action, and re-connect the wires. The next two images show a before and after comparison of the replaced nubs linked to the original variable. The first image shows the many connections to the Object Variable ???, which supplies us with an enemy Bot.
    How to do it...
  7. This is the result of replacing the connections to the Named Variable Boss. You'll notice that this frees up a lot of space to tidy and compact the Kismet layout too.
    How to do it...
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.247.188