Tutorial 1–1 - funovus/editor-wiki GitHub Wiki
In this tutorial, we will be creating a new map and hero unit to be used for the rest of this tutorial series.
This tutorial will cover:
- 1. Creating A New Project
- 2. Creating A New Unit
- 3. Creating A Unit Actor
- 4. Getting The Unit In-Game
Start by clicking on "File" > "New" > "Project" (Shortcut CTRL+SHIFT+N).
You will be prompted to enter a name for the new project. I named mine "HeroTutorialMap" and then hit Create Game!
You should be looking at a blank map in the terrain editor.
To create a new unit, first we must open the Data Editor. To do this, press "Window" > "Data Window" (shortcut CTRL+SHIFT+D).
From here you'll see the Data Editor. Data is broken down by type in tabs along the top (Unit, Weapon, Ability, etc). The left panel displays the list of objects of that data type (in this case, a list of unit types). If you select a unit (such as the "Standard MeleeUnit" from the Core Demo map) you'll see its properties listed in the right panel.
You'll also see the Object Explorer in the bottom-left panel. This displays a hierarchy of the other object types associated to the selected object (our "Standard MeleeUnit" in this case).
Now, let's create our very own Unit!
To create a new unit, click the "+ New" button and give the unit a name (you can leave the Prefix blank). I named mine "Hero IceMage" since it will be a hero with an icy theme. Leave the Parent and Template fields set to "[None]" for now (you can change these field values later).
Press the "Add" button to create the new unit.
You should now see your new unit in the unit list.
Next we'll add some basic data to the unit by setting its Parent value, which lets it inherit data from another object. Change your unit's Parent value from "[None]" to "_CUnit".
When you do this, you should see some of data values change. Specifically:
- Radius = 0.125
- Max Health = 10
- Start Health = 10
- Move Speed = 2
- Turning Speed = 900
- Behavior Type = Generic Controllable Unit
This just sets up some basic data for the unit, inherited from the "_CUnit" unit type.
To make our hero more heroic, let's set its Max Health and Max Mana to 100. Note that the editor automatically sets the Start Health and Start Mana to 100 in order to match the new Max Health and Max Mana values we set.
The final step before being able to use our new unit in-game is to configure its Actor. All units use an actor to tell the game what it should look like and when to play animations, along with setting other visual and audio data for the unit. Actors can also be used to create and configure VFX and SFX for abilities, buffs, and more, but we'll get into that later.
Actors are automatically created for new units. You can navigate to a unit's actor by selecting the actor from the object explorer. A unit's actor will have the same name as the unit.
Now set your actor's Parent field to "_StandardUnit DecayOnDeath".
This is exactly the same as how we set the unit's "Parent" field, except you'll see a lot more data has been populated for our new actor (such as Walk Animation Speed). Actors are one of the most complicated (and powerful) pieces of the data editor so we won't go too deep into them just yet.
To get our mage hero looking like a mage, we'll need to set our Unit Actor's Resource to an elven mage model. By default our Parent field automatically selected the "goblin_green" model. Let's change that to the "elvenmage" model (under "Unit Actor > Resource > Name").
You'll notice there are two fields under Resource: "Type" and "Name". The "Type" field determines the category of assets we can choose from in the "Name" field. In this instance, "GpuAnimation" gives us a selection of models that have animations tied to them, such as our elvenmage model (you can start typing the name directly into the input text box to narrow the search in the dropdown menu).
Next, press the "+" next to "Event Macros", and set the new Event Macro to "Events StandardUnit Selectable". This sets up the actor to show a selection ring around the unit when it's selected.
You may have noticed the Object Explorer hierarchy getting bigger. This is a good way to quickly figure out what additional objects have been inherited from our Parent and Event Macro selections.
Lastly, let's set the "Walk Animation Speed" to "1.7". This controls how fast the walk animation is played on the unit, and 1.7 happens to look better than the default value. Don't worry about it too much.
Here's a screenshot of everything we set for our "Hero IceMage" UnitActor.
First, SAVE your map by pressing the "Save" button, pressing "File" > "Save", or using the shortcut (CTRL+S). Next go back to the terrain window and click on the "Units" tab.
A list of available units will appear in the "Edit Previewer". Search for your unit's name and select it.
Selecting a unit from the list will enter paint mode, so now you can spawn your selected unit anywhere on the map. Let's put our mage in the middle of the map.
Save again, and press "Play". If everything has gone according to plan, you should see your new unit! You should be able to select and issue commands to your unit.
Tutorial Map: Tutorial 1–1 Unit