Hey, my first tutorial here. I'm going to show you how to do something like this:
You can customize it any way you wish, for example you may want to have extra damage after every 5th attack.
This tutorial assumes you know your way around the Data Editor and have some basic knowledge of effects, actors etc.
What we will need
In total we are going to be using:
Of course your version may use less or more, depending on the effect you want after every so many attacks. I chose to show quite an extensive use of this effect so there are a lot of extra things in here. A simple effect which would do extra damage every 3rd attack would use a lot less resources.
Start up a new Arcade Map (or Mod I guess), whatever size and tile set you want. I like to use Heart of the Swarm dependencies and include campaign data.
Making our Unit
You can skip this section if you already have a unit or are adding the weapon to an existing unit in the game.
I'm going to use a Zealot as my base. Find Zealot in the Units tab and duplicate it, ticking off the Zealot actor, Zealot Attack actor and Psi Blades weapon to also duplicate.
Double-click your copied unit and rename it, I'm going to call mine Paragon. Click Suggest for the ID.
Now the next part is optional but I like to clean up the unit before adding any new things.
Go into the (Basic) Ability: Abilities + field of your unit and remove the abilities Warpable, Progress Rally and Zealot - Charge.
Go into the (Basic) Ability: Command Card + field of your unit and remove the buttons Charge and Set Rally Point.
Go into the (Basic) Stats: Supplies field of your unit and set it to 0.
Leave all other fields unchanged for now.
This section is also optional but I like to have something telling you what your unit can do.
Go into the Buttons tab and create a new button. Name it whatever you wish, I will use Mirror Image for mine. Hit Suggest for the ID.
Set the (Basic) UI: Tooltip field of your button to a description of whatever effect you are trying to create. For mine I put in:
After every 3rd consecutive attack against the same target, the Paragon will cloak for 0.5 seconds and summon a Paragon Shade which lasts for 5 seconds.
Pick an icon for your button and put it in the (Basic) UI: Icon field. I used Assets\Textures\btn-ability-protoss-permanentlycloaked-darktemplar-color.dds.
We don't need a hotkey as this button will not be clickable.
Head back to the unit we created earlier and open up the (Basic) Ability: Command Card + field. On the bottom row, add your Mirror Image button and set the Command Type to Passive.
We're going to need a few behaviors to get this working. First off we will make our stacking counter to see how many consecutive attacks our unit has made against the target.
Create a new behavior in the behaviors tab and name it Mirror Image Stack. Suggest for the ID. (Get into the habit of suggesting IDs. From now on I will expect you to hit suggest). Set the Behavior Type to Buff.
Make the following changes:
In the (Basic) Behavior: Buff Flags + field, tick Refresh Stack.
Set the (Basic) Stats: Duration field to 5 seconds. (Or however long you want the counter to last. After the 5 seconds are up the counter will reset forcing your unit to start the 3 attack cycle again).
In the (Basic) Stats: Flags field, tick Hidden.
The next 2 fields will determine the number of attacks you need to trigger your bonus effect. The thing to remember here is that the value you put in must be one less than your desired number. So if you wanted to do bonus damage on every 7th attack, you would enter 6, for 50 you would put 49 and so on. In the (Basic) Stats: Maximum Stack Count and (Basic) Stats: Maximum Stack Count Per Caster fields, enter 2. This will mean the effect will trigger after every 3rd attack.
If you want a bar showing you how long the counter has left, tick Ally, Self and Enemy in the UI: Display Countdown + field. Otherwise leave it blank.
Next we will make the 0.5 second Cloak behavior. Create a new behavior called Mirror Image Cloak and set the Behavior Type to buff.
Change the following fields:
In the (Basic) Behavior: Modification + field, click the Behavior tab and scroll down to State Flags. Tick Cloak.
2. Set the (Basic) Stats: Duration field to 0.5 seconds.
3. Tick Hidden in the (Basic) Stats: Flags field.
The final Behavior we need will be the timed life for the spawned unit to make it die after its time is up. Create a new behavior called Paragon Shade Timed Life with Behavior Type as Buff.
Change the following fields:
Set the (Basic) Effect: Effect - Final field to Timed Life Fate. (This effect is already in the game).
Set the (Basic) Stats: Duration field to 5 seconds.
Tick Hidden in the (Basic) Stats: Flags field.
Again, if you would like a bar showing you how long the spawned unit has left, tick Self and Ally in the UI: Display Countdown + field. Otherwise leave it blank.
The validators will be checking if the target unit has either 2 stacks of the counter buff, or not 2. (The value is 2 here, although it procs every 3rd attack. The reason is the same as before).
Create a new validator called Mirror Image 3 with the Validator Type as Unit Compare Behavior Count.
Make the following changes:
Change the (Basic) Validator: Behavior field to Mirror Image Stack, the counter buff we made from earlier.
Set the (Basic) Validator: Value field to 2.
Make sure the (Basic) Validator: Compare field is set to Equal To. It should be by default.
Next we will be making the validator that will check if the stack count is not equal to 2. It is essentially the same validator we just created, with the (Basic) Validator: Compare field changed to Not Equal To. Duplicate the Mirror Image 3 validator and rename it to Mirror Image Not 3. Change the (Basic) Validator: Compare field to Not Equal To.
This section is quite long and possibly quite involved. Please pay close attention to make sure everything hooks up right. We will be leaving some fields blank and filling them up later once we have created the appropriate values.
Our weapon still needs to do some damage, so we'll create our Damage effect first. Go to the effects tab and create a new effect called Mirror Image (Damage) with the Effect Type as Damage. Change the following fields:
Set the (Basic) Combat: Amount field to however much damage you want your weapon to do, I will use 25.
For the (Basic) Combat: Armor Reduction field you may set this to 1 if you wish. This will make each point of armor your target has reduce the damage of your weapon by 1.
Tick Notification in the (Basic) Effect: Flags + field.
Change the (Basic) Effect: Kind to Melee. (Or ranged if your unit is ranged).
Tick Hurt Enemy in the Effect: AI Notify Flags + field.
We're going to need 2 Apply Behavior effects, 1 to apply a stack of our counter buff and 1 to apply the cloak behavior to our caster on the 3rd attack. We'll make the counter buff one first.
Create a new effect called Mirror Image (Apply Stack) with the Effect Type as Apply Behavior. Make the following changes:
Set the (Basic) Effect: Behavior field to Mirror Image stack, the counter buff we made earlier.
That's it for this one. The default values are all we need.
Now we will make the effect to apply the cloak to our unit. Create a new effect called Mirror Image (Apply Cloak) with the Effect Type as Apply Behavior. Change the following values:
Set the (Basic) Effect: Behavior field to Mirror Image Cloak, the cloak behavior we made earlier.
Change the (Basic) Effect: Unit + field to Caster.
We will also need a Remove Behavior effect to reset the stacks of our counter after the unit procs the 3rd attack. Create a new effect called Mirror Image (Remove Stack) with the Effect Type as Remove Behavior. Change these fields:
Set the (Basic) Effect: Behaviors field to Mirror Image Stack.
Set the (Basic) Effect: Count field to 2.
Next we will need a Create Unit effect to spawn our Paragon Shade on the 3rd attack. Currently we haven't made the Paragon Shade unit so we can't fill this effect in yet, but we can still create it. Make a new effect called Mirror Image (Create Unit) with the Effect Type as Create Unit. Don't make any changes yet, we will come back to this later.
Now we are going to create a Set effect to apply the Damage and Apply Stack effects on every attack that is not a 3rd consecutive hit. Create a new effect called Mirror Image (Set 1) with the Effect Type as Set. Make the following changes:
Open up the (Basic) Effect: Effects + field. Add our Mirror Image (Damage) and Mirror Image (Apply Stack) effects here.
We are going to need another Set effect which will be run on every 3rd hit. This will cloak our Paragon unit, create our Paragon Shade unit (which we have still to create), reset our stack counter to 0 and apply the usual damage. Create a new effect called Mirror Image (Set 2) with the effect type as Set. Add these values:
Open up the (Basic) Effect: Effects + field. Add our Mirror Image (Apply Cloak), Mirror Image (Create Unit), Mirror Image (Damage) and Mirror Image (Remove Stack) effects here.
The last effect we will be needing is the Switch effect to change what Set we run depending on how many stacks of the counter buff our target has. Here are where the validators we made earlier will be used. Create a new effect called Mirror Image (Switch) with the Effect Type as Switch. Change these fields:
Open up the (Basic) Effect: Cases + field. Add a new case. Set the effect to Mirror Image (Set 1) and the validator to Mirror Image Not 3. This will make the switch effect run our first set effect if the target unit does not have 2 stacks of our counter buff. The 2s and 3s are slightly confusing but I'm sure you can get your head around it.
Add another case with the effect set to Mirror Image (Set 2) and the validator as Mirror Image 3. This will make the switch effect run our second set effect when our target unit does have 2 stacks of our counter buff.
That's all the effects we will need for now.
Of course we're going to need something to call this Switch effect, in our case we will be using a weapon. Head over to the Weapons tab. You should already have the copied Zealot weapon from earlier. Double-click it and rename it to whatever you want. I will call mine Phase Blades (very original, I know). Change these fields:
Set the (Basic) Effect: Effect field to our Mirror Image (Switch) effect.
Change the (Basic) UI: Damage Display Effect field to Mirror Image (Damage).
Set the (Basic) UI: Display Attack Count field to 0.
Set the Editor: Editor Prefix field to nothing.
The range, period, icon and target filters are all up to you. The period is the length of time in between each attack and the target filters determine what units can be attacked by the weapon. The other 2 are fairly self explanatory.
We will also need a weapon for our Paragon Shade unit. Create a new weapon called Shade Phase Blades with the Weapon Type as Legacy. Make these changes:
Set the (Basic) Effect: Effect field to whatever damage effect you want your Shade unit to have. I will duplicate my Mirror Image (Damage) effect and rename it Shade Phase Blades (Damage) changing the damage amount to 15, and input that effect here.
You may decide on a period for the weapon. I set my (Basic) Stats: Period field to 1.2.
For a melee unit, 0.1 is the value you would put in for (Basic) Stats: Range.
Set the (Basic) UI: Damage Display Effect field to your damage effect, in my case I will use Shade Phase Blades (Damage).
Pick an icon for the (Basic) UI: Icon field.
You can also pick your target filters in the (Basic) Weapon: Target Filters field. For a ground only weapon, I would set Air, Dead, Hidden, Invulnerable, Item, Missile, Resource (Harvestable), Resource (Raw), Self and Stasis to Excluded and Ground and Visible to Required.
That's all we need for weapons.
Cleaning up our Paragon's Actors
We'll need to clean up those copies we made earlier to get our Paragon attacking smoothly.
Find the Zealot Copy actor in the Actors tab and rename it to Paragon. Next find the Zealot Attack Copy actor and rename it to Paragon Attack. Set the Attack Effect in the Token section to Mirror Image (Damage).
Paragon Shade Unit
Now we will make the Paragon Shade unit which will be spawned by our 3rd consecutive hit. Head over to the units tab and duplicate our Paragon unit, making sure to tick off the Paragon and Paragon Attack actors, but not the Phase Blades weapon.
Rename the Paragon Copy unit to Paragon Shade. Change these fields:
Set the (Basic) Combat: Weapons + field to our Shade Phase Blades weapon we made earlier.
Add our Paragon Shade Timed Life behavior to the (Basic) Behavior: Behaviors + field.
You may wish to mess around with the life and shield values, perhaps make your shade slightly weaker than your main unit.
Now let's head back to the Actors tab. Rename the Paragon Copy actor to Paragon Shade. Open up the (Basic) Event: Events + field. Add a new event with the message type as Actor Creation. Set the message part to Set Opacity and have the opacity as 0.5. This will make your Shade unit look slightly faded out.
Find the Paragon Attack Copy actor and rename it to Paragon Shade Attack. Set the Attack Effect field of the Token section to your Shade's weapon's damage effect, in my case I will use Shade Phase Blades (Damage).
Some Extra Actors
These next 2 actors are optional and will create a model and play a sound when the Paragon Shade is spawned.
Create a new actor called Paragon Shade Spawn Model with the Actor Type as Model and the Parent set to ModelAnimationStyleOneShot.
Set the (Basic) Art: Model field to a model of your choice, I will use Zeratul Blink Out. Now open up the (Basic) Event: Events + field and add a new event. Set the Msg Type to Unit Birth and the Source Name to Paragon Shade. Set your message to Create.
Create another actor called Paragon Shade Spawn Sound with the Actor Type as Sound and the Parent set to SoundOneShot.
Change the (Basic) Actor: Sound field to a sound of your choosing. I will use Stalker_Blink. Open up the (Basic) Event: Events + field and add the same event as we did for the model.
Create Unit Effect
Head back over to the Effects tab and find our Mirror Image (Create Unit) effect. Set its (Basic) Effect: Spawn Unit field to your Paragon Shade unit.
All done! Your unit will now cloak and spawn a new unit after every 3rd consecutive attack. Thank you for reading my tutorial, I hope it has helped you in some way and improved your knowledge of the Data Editor. I remember when I first started out in the editor learning from tutorials and I wanted to give something back to the community. All feedback and constructive criticism is welcome.
See if you can figure out how to limit the counter buff to only one unit at a time. ;)