Tutorial Data Editor - Morphing Abilities

Dave312

Censored for your safe viewing
Reaction score
269
INTRODUCTION
The aim behind this tutorial is to teach you how use morphing abilities to upgrade both units and structures into new ones. This tutorial has been split up into 2 sections. The first covers how to create a basic morph ability and the second covers adding special effects so you can make it look awesome. This tutorial assumes you have a basic understanding of the editor and that you can navigate your way around. In order to make following this tutorial easier, I recommend that you set your view settings within the data editor as follows:

View Raw Data: Off
Table View: On
Show Default Values: On
Show Advanced Values: On
Show Field Type Names: On
Combine Structure Values: On


SECTION 1: CREATING A BASIC MORPH ABILITY
This section of the tutorial covers the basic steps of creating a working morph ability. In doing so, I will be demonstrating the creation of a morph ability that will upgrade a Marine into its mercenary counterpart, the War Pig. Because the War Pig unit comes from Wings Of Liberty Campaign, we will need to make sure that the map has the Liberty (Campaign) dependency. If you are creating a new map, this can be done simply by setting the Dependencies property to Campaign (Liberty) in the New Document dialog (see image below). If you have already created your map and have forgotten to add the Liberty (Campaign) dependency, you can still do so by going File > Dependencies... and clicking on Add Standard....

attachment.php


Creating Buttons
As with anything I create, my first step is to create the button. This button will be shown in the Marine's command card and will start upgrading (morphing) the Marine into a War Pig. So open up the Data Editor and open up the Buttons data type. Now create a new button and set the Name to "Upgrade to War Pig". This will be the name shown when a player hovers over the button in the command card. Now hit Suggest to auto-generate an ID and set the Race to Terran. Your dialog to should be as below:

attachment.php


Now hit OK to create the button. Now we need to set a couple of properties on the button we have just created:

attachment.php


Hotkey: This is the shortcut key which can be pressed instead of using the mouse to press the button. Set this to W.
Icon: The icon shown for the button. Browse for and set to the following file Assets\Textures\btn-unit-terran-marinemercenary.dds.
Alert Icon: This is the icon displayed for alerts. Set this to the same icon as before.
Tint By Race: When set to Enabled, the icon will be tinted depending on the players race. This should only be used if using a "black and white" icon. Leave this as Disabled.
Tooltip: This is the information shown below the name when the button is highlighted in the command card. Set it to "Upgrades to an Elite Marine with upgraded equipment.".
*NOTE: The Alert Tooltip property will be automatically set to the value of the Tooltip property because they use the same Text Key. If you want to make them different, set the Text Key of one them to something else.


Now we need to create another button which can be used to cancel the morph while it is in progress. You can use one of the existing cancel buttons, but I prefer to make my own. Set the name of the button to "Cancel Upgrade", auto-generate an ID and set the Race to Terran. Now set the hotkey to Escape, Icon (and Alert Icon) to the file Assets\Textures\btn-command-cancel.dds and tooltip to "Cancels the upgrade and returns the unit to it's default state.".


Creating the Ability
The next step is to create the actual ability. So open up the Abilities data type and create a new Ability. Set the name to "War Pig Upgrade" and hit Suggest to auto-generate an ID. Set the Ability Type to Morph and Race to Terran. You dialog should be as below:

attachment.php


Now hit OK and you're ready to proceed. We need to edit the following properties on the ability:

attachment.php


Ability: Ability Classes Disabled +: This allows you to specify which ability types cannot be used while the morph is in progress. Leave this as the default as we will be using a flag to prevent the unit from using any ability during the morph.
Ability: Ability Classes Enabled +: This allows you to specify which ability types can be used while the morph is in progress. Leave this as the default.
Ability: Cancel Unit: The cancel unit is the unit which the caster will be turned into should be morph be canceled. If left as (None), the caster will default back to its original unit. Leave this as (None)
Ability: Commands +: Allows you to give the ability a command. Leave this for the moment as we will come back to it in greater detail.
Ability: Info +: This would have to be the most important property for this ability. Leave this for the moment as we will come back to it in greater detail.
Ability: Progress Button: When a morph ability is used, it can display a progress bar in the unit info panel (similar to when a building is training a unit). This property allows you to set the button it displays next to the progress bar. If this is left blank and the progress bar is set to be shown, it will display the icon for the unit that will be morphed in to. Set it to the Upgrade to War Pig button we created earlier.
Cost: Costs +: This property is the same as the other cost properties on any other ability. For the moment, I don't want the upgrade to have a cost associated with it so I will leave this as it is.
Stats: Flags +:
Auto Cast: Determines if the ability can be casted automatically when the Auto Cast conditions are met. Leave this unchecked.
Auto Cast (Idle Only): Determines if the ability can only be automatically casted while the unit is idle. Leave this unchecked.
Auto Cast (On): Determines in the Auto Cast feature is initially turned on. Leave this unchecked.
Automatic: Determines if the ability is automatically used when the requirements are met. Leave this unchecked.
Best Unit: Used for group casting. If checked, only the unit in the best position to cast the ability will use it. Leave this unchecked.
Birth: Causes the morphed unit to play its birth animation when created. Leave this unchecked.
Disable Abilities: Disables the use of all abilities during the morph. Check this flag.
Disable Collision: Disables the collision field for the unit during the morph. Leave this unchecked.
Fast Build: Determines if the fast build cheat affects the duration of the morph ability. Check this flag.
Ignore Facing: Non-turnable units will keep the original units facing direction instead of turning to its default facing. Leave this unchecked.
Ignore Food: Ignores the supply required by the new unit. Leave this unchecked.
Ignore Placement: Ignores the placement requirements of the new unit. Check this flag.
Ignore Unit Cost: When calculating the cost of the ability, determines if the cost of the new unit should be included. Check this flag.
Interruptible: Determines if the morph can be canceled. Because we plan on having a Cancel button, check this flag.
Move Blocking Units: Orders near by units to move out of the way during the morph. Leave this unchecked.
Produce: Determines if using the morph ability counts as "producing" the new unit for game score calculation purposes only. Leave this unchecked.
Rally Reset: Resets the rally point after the morph has been completed. Leave this unchecked.
Show Placeholder: Determines if the placeholder model is shown for the morph. Leave this unchecked.
Show Progress: Determines if the progress bar is shown in the unit info panel. Check this flag.
Suppress Movement: Determines if the unit will be unable to move during the morph process. Check this flag.
Wait Until Stopped: The unit must come to a complete stop (stationary position) before the morphing ability begins. This does not prevent the unit from stopping in order to use the ability. Check this flag.
You should have checked the following flags: Disable Abilities, Fast Build, Ignore Placement, Ignore Unit Cost, Interruptible, Show Progress, Suppress Movement and Wait Until Stopped.
UI: Activity: This is the text that is shown next to the progress bar in the units info panel. You need to be careful when editing this value because it uses a common Text Key. This means that if you alter this value, it will be altered for every property that references this Text Key. As such, if you want to change it, you either need to create your own text key or use an existing one with the value that you want. I want it to say "Upgrading" and there is an existing text key for that so change the Text Key to "UI/Upgrading". The value will automatically change to the value stored in the text key.
UI : Alert: This is the alert that plays when the morph ability is completed. I want an "Upgrade Complete" alert to play, so set it to UpgradeComplete_Terr.

Now let's edit the Ability: Commands + property. After opening it up, you will have two commands to edit. The Execute is required for all morph abilities so we will edit that one first. Double click on it to modify the command and set Commands - Default Button to the "Upgrade to War Pig button we created earlier. The rest of the fields relate to adding requirements to use the ability but we are not going to cover that in this tutorial so these fields as they are. So hit OK and edit the Cancel command. This command is optional but I want to have an option to cancel the morph so we will be using it. Set Commands - Default Button to the "Cancel Upgrade button we created earlier.

Now it it time to edit the Ability: Info + property. Opening this up gives the dialog shown below. You need to add a value to edit by right clicking and going Add....

attachment.php


This dialog allows you add multiple values. These values are used for additional levels of the ability. So for example, you could have a morph ability which for the first level, it upgrades into a War Pig, but for the second level it upgrades into a Marauder. For our purposes, we only want to have one level. Once selecting Add.., a new window opens to select the unit your ability will morph into. Find and select the War Pig unit and hit OK. The unit will then be added to the previous window. There are more options we can edit so double click on the unit in this window to open up the dialog below:

attachment.php


There are a couple of properties here that you should be aware of. The first (and most important) is the Info - Sections - Durations property. Simply put, this allows you to set the time it takes to complete the morph. What makes things complicated is that you can specify different durations for different aspects of the unit. The unit is split into Abilities, Actor, Collision, Facing, Mover and Stats aspects. For each aspect you can specify two values: the Delay and Duration. The Delay is how much time passes before the unit takes on the aspect of the final unit. The Duration is how much time the morph continues after the aspect of the final unit has been taken. For example, I want my morph to last 10 seconds and for the first 7 seconds, the life of the unit will match the life of the original unit, and for the last 3 seconds the life will match the life of the final unit. The units life falls under the Stats aspect so I would set the Delay to 7 and the Duration to 3. The total duration of the morph is the longest Delay + Duration value for all the aspects. The other important point I need to make is about Actor Events (which we will look at editing later). With the Events, there are 3 points that you can specify: Cancel, Start and Finish. Cancel obviously occurs when the morph ability is canceled, but Start only occurs after the Delay period has passed. Finish occurs after the entire morph process finishes (not the end of the Duration period for the Actor aspect). I want the morph to take 10 seconds and the properties of the final unit to be applied only at the end so set the delay for every aspect except Actor to 10 seconds. For the Actor aspect set the duration to 10 seconds. This is because we want the Actor to realize that the morph process has started when the button is pressed and finish when the morph process is complete.

The next property of interest is Info - Sections - Effects. This property allows you to create effects during particular stages of the morph, such as dealing damage to nearby enemies etc. At this point, I'm going to leave my ability as being rather simple and not have any effects created. The next property of interest is Info - Random Delay - Minimum and Info - Random Delay - Maximum. These properties allow you to specify a random delay between pressing the button to execute the ability on the command card and the morph taking place. Ability classes the that have been disabled/enabled will be done prior to this random delay taking place. Leaves these values at 0.


Adding the Ability to the Unit
Now that our ability is created, we can add it to our unit. Go to the Units data type and select the Marine. First we need to edit the Ability: Abilities + property. So open this up and click on the green "x" icon to add a new value and set it to our War Pig Upgrade ability that we just created.

attachment.php


Finally we just need to add the buttons to use the ability to the command card. To do this, open up the Ability: Command Card + property. First Select the position on the command card where you want the Upgrade to War Pig button to be located, then Right-Click in the Buttons field and Add Button... (or alternatively you can press the green "x" to add a button).

attachment.php


In the dialog that opens, find and select the Upgrade to War Pig button and hit OK. Now in the previous window, set the Command Type to Ability Command, Ability to War Pig Upgrade and Ability Command to Upgrade to War Pig.

attachment.php


Now we need to add a cancel button. The process is the same except select the Cancel Upgrade button and set the Ability Command to Cancel Upgrade.


Adding Actor Events
If you tried to test your morph ability at this point, you would find that the unit changes into your new unit, but the model displayed would still be the one from your original unit. This is because the ability does not change the actor. To solve this, we need to add a couple of events to the actors. First find the actor for the Marine unit and edit the Event: Events + property. Scroll all the way to the bottom and Right-Click to add a new event. Set the Msg Type to Ability Morph, leave the Source Name as (Any) and set the Sub Name to Finish. Now Right-Click on the event you have just created and go Add Term

attachment.php


If done correctly, the Term will be added underneath the event you have just created. Select the Term and set the Term Type to MorphFrom and Unit Link to Marine. Now create another Term under the same event and set the Term Type to MorphTo and Unit Link to Merc - War Pig (Merc Marine). Finally edit the action and set the Msg Type to Destroy. If this has been done correctly, your event should be as follows:
Code:
AbilMorph.*.Finish
   MorphFrom Marine
   MorphTo WarPig
   Destroy
What we have just created is an event that says when the morph process between the Marine and the War Pig has finished, remove the actor for the Marine. Now we just need to create another event that tells the new actor to be created. To do this, find the actor for the War Pig unit and again edit the Event: Events + property. As before, create a new event and set the Msg Type to Ability Morph, leave the Source Name as (Any) and set the Sub Name to Finish. Create a new Term and set the Term Type to MorphFrom and Unit Link to Marine. Now create another Term under the same event and set the Term Type to MorphTo and Unit Link to Merc - War Pig (Merc Marine). Finally edit the action and set the Msg Type to Create. If this has been done correctly, your event should be as follows:
Code:
AbilMorph.*.Finish
   MorphFrom Marine
   MorphTo WarPig
   Create

Congratulations. You have successfully created a basic morph ability which is ready for testing. Add the Marine unit to the map and give it a whirl. If you're happy with the result, you can stop reading. However if you're thinking that it looks a bit plain and dull, take a read through the next section of the tutorial where we will go through adding some sound and visual effects to it.


SECTION 2: ADDING SPECIAL EFFECTS TO MORPH ABILITIES
Ok so now the ability has been created, it is time to add some special effects to it in terms of sound and a visual animation/model. For this tutorial, I have decided to have an explosion occur around the unit when the morph ability is used, and when the smoke clears, the War Pig will be left standing.

ADDING SOUNDS
For our first step, we will create a sound that will be played for the explosion. Fortunately there is already a Sound object called Terran_ExplosionLarge which will be suitable for this so there is no need to create a new object in the Sounds data type. All we need to do is create an actor which will host the sound object and play it when required. So go to the Actors data type and create a new object. Set the Name to War Pig Upgrade Sound and auto-generate an ID. Set the Actor Type to Sound, Based On to SoundOneShot and Doodad Type to Not Doodad. Your dialog should look the same as mine:

attachment.php


Now hit OK and it is time to edit a couple of properties. The first property to edit is Sound: Sound. This property references the sound object that we want to play. So set this property to Terran_ExplosionLarge. So now that we have linked the sound object we want to play with the actor, we need to create an event which instructs the actor to be created when the morph ability is used. To do this, we need to edit the Event: Events + property. In here we need to create a new event (Right-Click > Add Event) and set the Msg Type to Ability Morph, leave the Source Name as (Any) and set the Sub Name to Start. Create a new Term and set the Term Type to MorphFrom and Unit Link to Marine. Now create another Term under the same event and set the Term Type to MorphTo and Unit Link to Merc - War Pig (Merc Marine). Finally edit the action and set the Msg Type to Create. If this has been done correctly, your event should be as follows:
Code:
AbilMorph.*.Start
   MorphFrom Marine
   MorphTo WarPig
   Create
And that's it! You have just attached a sound to your morph ability.

ADDING VISUAL EFFECTS
Now we just need to add the visual effects to our morph ability. I want to use the TerranBuildingDeath model which already has a model object created so there is no need to create a new one. So go to the Actors data type and create a new Actor. Set the Name to War Pig Upgrade Model and auto-generate an ID. Set the Actor Type to Model, Based On to ModelAnimationStyleOneShot and Doodad Type to Not Doodad. Your dialog should look the same as mine:

attachment.php


Hit OK. Now we need to edit a couple of things on the Actor to get it working. The first is to set the Art: Model property to Terran Building Death. The second is to create an event in the Event: Events + property to create the actor. This is exactly the same as what we did for the Sound Actor, so just go back if you can't remember how.

If you try to test your morph ability now, you should notice that the sound is played and the explosion model is created. However you should also notice that the timing is out as far as when the Marine turns into a War Pig. We need the morph to take about 3 seconds, but the explosion to only occur after 2.5 seconds. To change this we need to find our morph ability and edit the Ability: Info + property. For the Info - Sections - Duration sub property, set the Delay to 3 seconds for every aspect except Actor. For this one, set the Delay to 2.5 seconds and Duration to 0.5 seconds. It should look like this:

attachment.php


Now just hit OK and your done. You have successfully added sound and visual effects to your morph ability. That is it as far as the main part of this tutorial goes. I have however included some bonus information which I believe is well worth a read for when you are creating your own custom Morphing Abilities.

MORPH ACTORS
You have probably noticed that some units have custom morph animations. The perfect example is the Seige Tank when it changes between Tank and Sieged modes. The Siege Tank is split into two different units: one in Tank Mode and one in Siege Mode. A morph ability is then used change between the two. The morph animations are then applied by creating another actor (the Morph Actor which is of the type Unit and based on GenericUnitBaseMorphTransition) whose model has two animations; one animation for each direction of the morph (from and to Siege Mode). The way this is achieved is by using Actor Events. When the morph is started, the actor for the original unit is destroyed and the Morph Actor is created and told to play the correct morph animation. Then when the morph ability finishes, The Morph Actor is destroyed and the actor for the new unit is created. Below is the actor events for the Siege Tank morphing into Sieged Mode.
Event for destroying the Tank Mode actor (located on the Tank Mode Actor):
Code:
AbilMorph.*.Start
   MorphFrom SiegeTank
   Destroy
Event for creating the Morph Actor (located on the Morph Actor):
Code:
AbilMorph.*.Start
   MorphTo SiegeTankSieged
   Create
Event for playing the correct morph animation (located on the MOrph Actor):
Code:
AbilMorph.*.Start
   MorphTo SiegeTankSieged
   AnimPlay Start Morph,Start
Event for destroying the Morph Actor (located on the Morph Actor):
Code:
AbilMorph.*.Finish
   MorphFrom SiegeTank
   Destroy
Event for creating the Siege Mode actor (located on the Seige Mode Actor):
Code:
AbilMorph.*.Finish
  MorphTo SiegeTankSieged
  Create

BUILD ACTORS
If your creating morph abilities to upgrade buildings, you probably want the buildings to play their construction animations. Fortunately this is fairly easy to set up as in most cases it is just a matter of adding a couple of events to existing actors. The following are the actors you need to modify depending on which race's construction model you wish to play:
Terran
- TerranBuildingBuild (the standard construction animation)
- TerranBuildingBuildSmall (the addon construction animation)
*NOTE: These are parent actors. It is highly recommended that you do not edit these under any circumstances. Instead modify an actor which has this as its Parent or create your own actor of the type Model based on one of these build actors.
Zerg
- Zerg Building Build
*NOTE: This is a parent actor. It is highly recommended that you do not edit these under any circumstance. Instead modify an actor which has this as its Parent or create your own actor of the type Model based on this build actor.
Protoss (You only need to select one, depending on the size on the building)
- ProtossBuildingBirthSmall (for 2x2 sized footprints)
- ProtossBuildingBirth (for 3x3 sized footprints)
- ProtossBuildingBirthLarge for 5x5 sized footprints)
*NOTE: The footprint sizes are recommendations only and do not need to be adhered to.

Now once you have worked out which actor you need to modify, go to its Event: Events + property and add two new events. On the first event, set Msg Type to Ability Morph, Source Name to your morph ability, Sub Name to Start and set the action to Create. On the second event, set Msg Type to Ability Morph, Source Name to your morph ability, Sub Name to Finish and set the action to Destroy. You should have the following result:
Code:
AbilMorph.YOUR_MORPH_ABILITY.Start
   Create
AbilMorph.YOUR_MORPH_ABILITY.Finish
   Destroy

And that is it! You may want to play around with some of the properties on the morph ability to get things looking the way you want it.

ONE FINAL POINT
If you're finding that the actors created by your morph abilities are not looking quite right, then chances are that your issue is located in the Properties: Accepted Property Transfers + and/or Properties: Accepted Transfers properties located on the Actor that is looking looking right.

attachment.php


These properties tend to cause issues if not set correctly because they determine which properties will be transfered from the old actor to the new one during a morph. Try unchecking the flags that are related to your issue to see if that helps solve the problem.



And that finally brings us to the end of this tutorial. Hopefully I have been able to teach you something useful and please, if you have any comments, suggestions or are having trouble completing the tutorial, post a reply and I will do what I can to assist you. Thanks
 

Attachments

  • SC2Tutorial-Morph-1.png
    SC2Tutorial-Morph-1.png
    49.6 KB · Views: 5,348
  • SC2Tutorial-Morph-2.png
    SC2Tutorial-Morph-2.png
    19.7 KB · Views: 5,197
  • SC2Tutorial-Morph-3.png
    SC2Tutorial-Morph-3.png
    15.3 KB · Views: 5,175
  • SC2Tutorial-Morph-4.png
    SC2Tutorial-Morph-4.png
    25.2 KB · Views: 5,246
  • SC2Tutorial-Morph-6.png
    SC2Tutorial-Morph-6.png
    13.8 KB · Views: 5,117
  • SC2Tutorial-Morph-7.png
    SC2Tutorial-Morph-7.png
    38.9 KB · Views: 5,199
  • SC2Tutorial-Morph-8.png
    SC2Tutorial-Morph-8.png
    18.9 KB · Views: 5,237
  • SC2Tutorial-Morph-9.png
    SC2Tutorial-Morph-9.png
    36.5 KB · Views: 5,165
  • SC2Tutorial-Morph-10.png
    SC2Tutorial-Morph-10.png
    38.3 KB · Views: 5,252
  • SC2Tutorial-Morph-11.png
    SC2Tutorial-Morph-11.png
    55.6 KB · Views: 5,230
  • SC2Tutorial-Morph-12.png
    SC2Tutorial-Morph-12.png
    25.8 KB · Views: 5,106
  • SC2Tutorial-Morph-13.png
    SC2Tutorial-Morph-13.png
    23.9 KB · Views: 5,242
  • SC2Tutorial-Morph-14.png
    SC2Tutorial-Morph-14.png
    9.4 KB · Views: 5,094
  • SC2Tutorial-Morph-15.png
    SC2Tutorial-Morph-15.png
    12.1 KB · Views: 5,046
  • SC2Tutorial-Morph-5.png
    SC2Tutorial-Morph-5.png
    53.3 KB · Views: 5,222

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
nice tutorial
very thorough/easy to follow
was wondering when someone would make a morphing tutorial
have you looked into attaching turrets + morph abilities, im sure that could create some fun gameplay
 

Dave312

Censored for your safe viewing
Reaction score
269
Thanks guys.

No I haven't looked into turrets + morphing abilities. I know there are bugs when it comes to re-initializing turrets on an actor (destroying a turret and then trying to recreate it doesn't seem to work properly) so this issue might come into play.
 

Dave312

Censored for your safe viewing
Reaction score
269
Attached is a test map for the above tutorial.
 

Attachments

  • MorphingAbilitiesTutorial.zip
    8.4 KB · Views: 566
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top