November
17
2013

We’re using Equipment Viewers to display our player’s equipment in the game.

Equipment Viewers are used to display the weapons and armors a combatant currently has equipped on the combatant’s game object. Each equipment viewer will display one Equipment Part.

This tutorial focuses on setting up the equipment viewers. You can learn more about them (and equipment) in this how-to.

Setting up the Equipment Viewers

We will set up the equipment viewers on the player combatant’s prefab. To do this, drag the prefab (Brow Pants, found in Assets/Tutorial Resources/Prefabs/Combatants/) into a scene.

gametutorial_26_displaying_equipment1

We want to display two equipment parts:

  • Helmet
  • Right Hand

This means we need two equipment viewers.

Displaying Helmet

Create a new game object and name it Helmet. Now, we parent the new game object on our player’s head, since we want it to follow the head’s movement.

Drag the game object on Brown Pants > skeleton > main_mover > spine > head > head_endHelmet is now a child object of head_end.

In the inspector of the game object, change the following setting in Transform.

  • Position
    Set to X=-0.0006, Y=0.001, Z=0.

Now, add an equipment viewer to the game object using the ORK Scene Wizard: Add Component > Equipment Viewer. Change the following settings in the equipment viewer’s inspector.

  • Equipment Part
    Select Helmet.

You can leave the rest of the settings as they are – all Required Game States should be set to Ignore and the four battle system types enabled. This means the equipment will always be displayed.

Displaying Right Hand

Create a new game object and name it Right Hand. and place it on our player’s right hand (weapon).

Drag the game object on Brown Pants > skeleton > main_mover > spine > arm_hi_right > arm_lo_right > weapon. Right Hand is now a child object of weapon.

In the inspector of the game object, change the following setting in Transform.

  • Position
    Set to X=0, Y=0, Z=0.
  • Rotation
    Set to X=0, Y=-90, Z=0.

Now, add an equipment viewer to the game object using the ORK Scene Wizard: Add Component > Equipment Viewer. Change the following settings in the equipment viewer’s inspector.

  • Equipment Part
    Select Right Hand.
  • In Battle
    Select Yes.
  • Turn Based, Active Time, Real Time, Phase
    Enable this settings.

The equipment on Right Hand will be displayed in all battles.

The player will now look like this.

gametutorial_26_displaying_equipment2

And the hierarchy of the prefab looks like this.

gametutorial_26_displaying_equipment3

Good – select Brown Pants and click on Apply in the inspector to apply the changes we made to the prefab.

Let’s test again

Open the main menu scene (0 Main Menu) and hit Play. Walk outside of the town and into the battle – you’ll see Brown Pants holding his sword in hand when the battle starts.

gametutorial_26_displaying_equipment4

This means there is only one more thing to do to animate our battles – displaying the player’s status (using HUDs).

And that’s it for now – the next lesson will cover be a quick introduction to HUDs.

Too short? Do more!

Since this was such a short tutorial, here’s some extra homework for you:

  • Add equipment viewers to the enemy’s prefab.
  • Add some start equipment to the enemy.

Tip!

Having trouble positioning your Equipment Viewers on your combatant’s prefab to look good? Here’s how to do this quick and easy!

  • Play your game.
  • Hit pause when your player (or whatever combatant you’re having trouble with) is displayed.
  • Change the equipment viewer(s) settings to always be displayed (i.e. set all Game States to Ignore).
  • Unpause the game.
  • Your equipment will now be displayed.
  • Pause the game again.

Now, you can move and rotate the equipment viewer(s) until it looks the way you want it to. Once you’re satisfied, write down the position and rotation of the equipment viewer(s).

You can now end the game and change the equipment viewers on your combatant’s prefab with the settings you just found out.

And remember – you can always change the combatant’s start equipment if you want to display some special equipment.