Tutorial General - Melee Weapons

Dave312

Censored for your safe viewing
Reaction score
269
INTRODUCTION
The aim behind this tutorial is to teach you how to create basic melee weapons and add them to your unit. This tutorial can also be used for creating ranged weapons provided they don't use missiles. For this tutorial, I will be creating a Punch weapon from scratch. This tutorial assumes you know the layout of the Data Editor and can navigate your way around the different data types. Before we get started, I recommend you set your view settings to the same as mine.

My settings are as follows:

View Raw Data Off
Table View On
Default Values Shown
Advanced Fields Shown
Show Field Type Names On
Combine Structure Values On​


CREATING THE DAMAGE EFFECT
Now the first step is to create the Damage Effect. Navigate your way over to the effects tab and create a new effect as follows:

attachment.php


Now we need to set a few values on the Damage effect we have just created. First we need to set the amount of damage this weapons deals. Go to the Combat - Amount property and set it to 10. Now go the the Armor - Armor Reduction property and set it to 1. This property determines how much damage your weapon is reduced by per 1 armor. Now scroll down to the Effect - Kind property. This property determines the type of damage. For the most part it won' thave any affect on your weapon, but it will affect other abilities which rely on damage types. We are creating a Melee weapon, so I'm going to set it to Melee. Finally I'm going to set the Editor - Editor Suffix property to "(Damage)". This property won't have any affect on your weapon, but it does make using the data editor easier if everything has self explaining labels. The other property that is worth mentioning is the Effect - Death property. This is used in cases where if a unit dies by this weapon, then a special death animation can be played (for example being burned to death). I just want it to play the normal death animation so I'm going to leave it as Normal.

CREATING THE WEAPON
Now we need to create the actual weapon. There are three basic types of weapons which are explain below:

Generic: used for creating dummy weapons
Legacy: Standard weapon type for most units
Strafe: Weapons which force the unit to continually move while firing (eg Protoss Carrier Interceptor)

In most cases you will just need to create a Legacy weapon which is what I am going to do. Open up the Weapon data type and create your new weapon as follows:

attachment.php


There are few properties here that need to be explained, not all of which we need to modify for this example. The most important one is the Effect - Effect property. This is the effect that occurs when your weapon is used, so set it to the damage effect you just created (if it hasn't been automatically added). Next we need to set the Stats - Period property. This is how fast the weapon is used (how long it takes between using the weapon and being able to use it again). I'm going to set mine to 0.6. Next we need to set the Stats - Range property. This is a measure of how far away the target is allowed to be from the unit. Since we are creating a melee weapon, we should use a small number. I'm going to use 0.1. Now go to the Stats - Range Slop property. This is a measure of how far the target can move away after the weapon has started firing before the target is lost. Set it to 1. The next property to look at is UI - Damage Display Effect. This is the the damage effect that the weapon uses to display the amount of damage in the UI. Set it to your damage effect created previously (if it has not been automatically set). Now go to the UI - Icon property. This is the icon that is displayed in the command bar. I'm going to set mine to "Assets\Textures\btn-research-zerg-cellularreactor.dds". Now we need to set the tooltip displayed when you hover over the weapon in the command bar. Go to the UI - Tooltip property and I'm going to set it to "A might punch". Next go to the weapon property and open it up. There should be several options here already checked, so we only need to check the "Melee" property since we are creating a melee weapon. The other important options to be aware of are:

Can Initiate Attack: Allows the unit to start attacking a target with this weapon for offensives purposes.
Linked Cooldown: If your unit has multiple copies of the same weapon, then this option forces all the weapons to use the same cooldown.
Only Fire At Target: Forces the weapon to attack the unit's current target.
Only Fire While Attacking : Forces the weapon to be used only when the unit is attacking a target (ie the weapon cannot be used while the unit is doing something else, like moving).

The next property that you should be aware of is the Weapon - Scan Filters property. These filters determine the criteria for the unit to automatically seek out a nearby enemy unit (one the is within the scanning range) and attack them with this weapon. In most cases you can leave this field blank. Finally the last property to look at is Weapon - Target Filters. This property allows you to specify which units can be targeted with this weapon. In most cases, you will want to set Visible as Required, mark Dead, Hidden, Invulnerable, Missile and Stasis as Excluded. I also want to make my weapon only able to target ground units so I will mark Ground as Required.

CREATING ATTACK SOUNDS
Now lets add some sounds to our weapon. There are two types of sounds to add to weapons. The first is the Launch Sound which is played when the attack is used. The second is the Impact Sound which plays when a unit is hit by your weapon. First lets create the launch sounds. Open up the Sounds data type an create a new sound as follows:

attachment.php


Now there are plenty of options here that you can play around with to get your sound playing perfectly, but for today, the only property we will be looking at is Sound - Assets +. Opening up this property will allow you to add multiple sounds which can be played when this sound object is played. You can even change the chance of each sound playing. I'm going to be using the Assets\Sounds\Zerg\SharedEffects\Attacks\Zerg_AttackLaunchSmallSwing.wav series of sounds (items 0-3) and am not going to change anything else. Now you can create another sound object the same as before except call it Impact instead of Launch. Do the same as before and open up the Sound - Assets + property and add your impact sounds. I will using the Assets\Sounds\Zerg\SharedEffects\Attacks\Zerg_AttackImpactSmallPiercing.wav series (items 0-4). Now that it is for creating sounds (nice and simple). If there are already pre-existing sound objects that you want to use for your weapon, you don't need to bother about creating any new ones (unless you want to make changes to it) so you can skip this step.

CREATING AN ATTACK ACTOR
This next step is about tying together your weapon and sounds such that they will work properly when attached to a unit. To do this, we will have to create an Action Actor. These special types of actors are used combine multiple objects to run nicely together in a single event. Now open up the Actors data type and create a new actor as shown below.

attachment.php


Now after creating your actor, you should notice the Token fields. These fields are very important for actors. For a melee weapon (or a weapon that doesn't use missiles), you only need to worry about setting the Attack Effect token. This should be set to the damage effect you previously created. Now find the Art - Shield Flash Type property. This property is used to determine how the shields will appear when a unit is hit by this weapon and has these possible values:

Facer: The shield will only appear in the direction the attack is coming from.
Full: The shield will appear around the entire unit.
Header: Similar to the facer option but will appear around the head of the unit.

For my weapon, I'm going to leave it as Facer. Next find the Combat - Launch Assets + property. Here you can define the which assets are created when the weapon starts. In our case, we want our launch sound to be played, so open it up, and go across to the Sound section and select your launch sound object you created previously. Now go to the Event - Events property. Here you need to make sure that the actor is created when the damage effect is created. So open up the property and find the event Effect.##EffectAttack##.Start.Note that ##EffectAttack## may have been replaced with the name of your damage effect. In this case, the editor has already filled in the Soure Name for you and you don't need to worry about filling it in. If it hasn't been filled out, you need to select this event and change the Source Name to the damage effect, and reset the Sub Name back to Start. Finally go to the Target - Impact Map + property. This section allows you to specify which assets are created when the weapon hits its target. We want our impact sound to be played, so open it up and select the index None, and go the the sound section and select your impact sound.

ADDING THE WEAPON TO A UNIT
Finally your weapon is finished, and all you need to do is attach it to a unit. To do this, you must ensure that the unit has the Attack ability and an Attack button in their command card. If they don't, open up the Ability - Abilities + property and press the green 'x' on the left hand side to a new ability, and set it to Attack. Now to add an attack button to the command card, open up the Ability - Command Card + property and select Command Card 1, and select an empty box. Now press the green 'x' to add a new button and choose a button. Then set the Command Type to Ability Command, leave the Requirements as (None), set Ability to Attack and set Ability Command to Attack. Now it is time to add the weapon to the unit. Go down to the Combat - Weapons + property and add/replace the existing weapon with the weapon you have created. Now you can hit save and test it out. If you have any problems completing this tutorial. Please leave a post below and I'll do what I can to assist you.
 

Attachments

  • SC2Tutorial-MeleeWeapons-1.png
    SC2Tutorial-MeleeWeapons-1.png
    18.3 KB · Views: 3,249
  • SC2Tutorial-MeleeWeapons-2.png
    SC2Tutorial-MeleeWeapons-2.png
    20 KB · Views: 3,257
  • SC2Tutorial-MeleeWeapons-3.png
    SC2Tutorial-MeleeWeapons-3.png
    19.6 KB · Views: 3,257
  • SC2Tutorial-MeleeWeapons-4.png
    SC2Tutorial-MeleeWeapons-4.png
    19.3 KB · Views: 3,196
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top