Creating a Unit from Scratch
Author: Cardinal (staredit.net)Tags: intermediate data unit  
Source: http://www.staredit.net/w2/index.ph...Added 13 years ago 

The modular way that the Data Editor (and much of the Galaxy Editor) functions adds a lot of functionality to the way you can do things.
In plain english, it is easy to think of the Galaxy Editor as a box of puzzle pieces. Once created, you can slot these pieces together to create pretty much whatever you can think of...

In the World Editor:
For example and comparison, in the World Editor of Warcraft3 - you created a Unit. This unit had everything a unit has, it had a model, a scale, tinting, stats: like life, mana, regeneration, projectiles (if applicable), attack types, damage range, attack speed, movement speed, movement type, if it was a hero or not, it's attributes etc... and an endless array of other settings. It was a simple case of creating the unit, and then changing it to suit your needs. If you wanted a Tower (in your Tower Defence) you would copy a Cannon Tower and edit it endlessly... If you wanted a new unit, you would recreate a Grunt or a Footman and edit it endlessly...

In the Galaxy Editor:
If you want to create a Unit, it is very simple. Open the Data Editor, go to the Unit layer and press Ctrl+= to create a new object. There, you have your unit. Here you can decide things like the unit's name and it's ID. These fields are very important for how this piece of the puzzle looks. As a handy sort of 'wizard' function you can opt to 'copy' the unit from data held by another already created unit.


Creating a Unit from Scratch
So, lets open up the Data Editor [F7]. I am a massive fan of 'hot-keys', they make you work 10x faster. Fact.

Next up, let's make sure we're all learning from the same page. There are a couple things you have to do - 'customizing' your data editor to make it look like mine. Note: This is just a matter of preference, but I find this setup is the most efficient.




In your Data editor, you will see these buttons, just to the centre-right of the upper part of the screen. You will want to click the ones highlighted in red down. I am also a massive fan of high-lighting.
With this complete, lets get down to brass tax. Due to the Galaxy Editor being modular, it works in layers. Sort of like an onion. We want to enter the 'Unit Layer' now.




You should see a list of all the units in Starcraft 2 now. Right Click there and say 'Add Object'... Or, even better, use the 'hot-key' of 'Ctrl + ='.
So, let's create a unit and call it Soldier. Hit 'Suggest', this will (or should) auto-fill the ID field as Soldier.
The next thing you want to do, change the 'Object Type' field to a Unit.
You can fiddle with the Race and Object Family options too. My Soldier is a Terran unit and belongs in the Melee category.




Creating your Unit's Actor from Scratch (Sort of)
A Unit requires an Actor. An actor is what used to be the 'Art' fields in Warcraft 3.

Now you can go back to your Terrain layer, and open up the Unit's tab (Right click on the terran and press 'U'), if you search for Soldier, it will be there - because you just created it. However, if you were to place this Unit on the Terrain, nothing would show up. Yes, it would be there, but you wouldnt be able to see it. That is because, this Unit you created does not yet have an Actor...

Head back to the Data Editor and venture into the Actor layer. Hit "Ctrl + =" to create a new object here. Call it Soldier and hit suggest. You want the next field to be set to 'GenericActorBase' - I am not entirely sure, this is just the category you want it to be in - OTHERWISE, it WONT WORK! And for speed and efficiency (a rare commodity in the Galaxy Editor) you can base this Actor off of the Marine actor (which already exists).

The 'copy from:' field is extremely useful. Some map-makers will say it is a cheap short-cut. But they lie. All map-makers use this. What this will do, is instead of creating a completely new actor (which would in effect be nothing to start with). It will create an Actor Object called a Soldier Actor - but it will pretend that this Soldier Actor is a Marine. And so we will have a new Actor, which is identical to the Marine.





Now you have your Soldier (Actor) but, since we based it off of the Marine (Actor), it is still 'linked' to the Marine. To follow the analogy of a puzzle, this piece of the puzzle that we just created Soldier (Actor) is shaped so that it can only fit to the Marine (Unit) piece. We want to change that. At the very top of the field on the right, you will see something like 'Token Unit:' and then Marine. Go ahead and edit this field, you will see a list of all the units in the game, try and find your Soldier there. Once you have done this, the panel beneath should look like this:




But, all of those highlighted instances are now incorrect. Because, when you change the Token value - or what the Puzzle Piece can attach to, the piece doesn't automatically move itself to the correct place. So right now, we have a square shaped (Soldier) puzzle piece, which is still attached to a circle shaped (Marine) piece. Edit what I have highlighted in Red to point to the Marine unit. The Galaxy Editor thinks, that because we have a Soldier Actor, that there must be a Soldier Sound-Set and a Soldier Model and a Solder Portrait and so on... But, since our Soldier is effectively a Marine - all we need to do is change those fields to point back to the Marine.

If you placed the Soldier in the Terrain Layer previously, but didn't see anything there, go look again. Now that your Soldier has an Actor (which is essentially a copy of the Marine), you should see a shiny marine model standing there, albeit, now called a Soldier...


Adding Movement & Statistics
For those with keen observational skills - you will notice that our Marine has no attack, he cannot move and only has 1 hit-point. In this section we will modify our unit so that he can run around and survive a couple of hits!

Remember before, I showed you how to alter the way your data editor looks. We will want to change it into the Table View & also show Advanced Fields. Since our Unit was created from scratch, he doesn't know how to use his legs and has no abilities.

To be as efficient as possible while navigating around the Data Editor - you will want to frequently switch between Table View and display/hide the Advanced Fields. Over time you will learn when you need to see all the Advanced Fields for a unit, and when the Table View is more effective than the List view. It is a matter of preference.

Now that you are in the Table View, and you have added the Advanced Fields - you should see EVERY possible thing there is to a Unit. These include Behaviours (like Buffs from Warcraft 3), Abilities, Combat etc...

We want to start off in the Movement section. Note: You can do this in the List View, but it is sometimes easier to have everything categorised as it does in the Table View.








Star Depot
Contact      Login