Creating complex abilities
This tutorial shows how to link multiple effects, behaviors, units and abilities together, to create an ability with a very complex effect, stretching the data editor to it's maximum.
General tips and tricks
If you want to create more interesting abiltities than just "+X bonus for Y seconds", you will need to use multiple effects, and some other catalog types as well. The most common effect you will use is create persistent, that allows you to offset or delay effects, and, most important, to launch multiple effects from it. You can "schedule" multiple other effects to happen in precise times at any place.
A useful technique is using "hidden" abilties: any ability that doesn't have a command button can't be used by player, but can be ordered to by triggers/appropriate effect. For example changeling uses this technique: It has three hidden morph abilities (for the three units it can change to), and his ability simply determines which one to use and orders the changeling to use it.
Example: Air strike
In this example we will try to create an Air Strike ability: Three banshees will apper, fly by the give location and release couple of missiles. Completely with the data editor, of course. <youtube>vT2PKHGprSc</youtube>
So, what do we need to do:
- Spawn banshees
- Make them move
- Launch the bombs
- Remove them
So the first effect, that will wrap the entire ability up, will be a persistent effect, that spawns banshees and launches missiles. Move order will be administered by the Create unit effect, removing bashees by a behavior they have.
- AirStrike Main (Effect - Create Persistent)
- Spawn Banshee (Effect - Create Unit)
- Banshee - airstrike (Unit)
- Banshee timed death (Buff)
- Banshee Airstrike order offset (create persistent)
- Banshee Airstrike order (Issue order)
- Banshee - airstrike (Unit)
- AirStrike bombard persistent
- Airstrike search (search area)
- Airstrike Launch (launch missile)
- Airstrike damage
- Airstrike Launch (launch missile)
- Airstrike search (search area)
- Spawn Banshee (Effect - Create Unit)
(The purpose of adding AirStrike persistent is to randomize impact locations.)
Now we have the main effect tree, we can start creating them. Start by duplicating banshee (check only the unit actor, launch and damage effects). Then modify the banshee by adding untargetable, unselectable and invulnerable flags. Remove weapons, the launch missile effects will be done by other effects. The timed death is extremely easy. Create a new buff, set duration to 10 seconds and Final effect to suicide (remove), then just add this buff to the duplicate banshee's starting behaviors.
Then, we start with the spawning and moving. Create the AirStrike main persistent, leaving all settings as they are for now. Then create a Create unit effect that creates the new, duplicate banshee (Spawn Unit field). Now just change the "Location" to Target point and uncheck the "Uses food" flag (either that, or change the duplicate banshee's supply use to 0).
The move order uses an advanced effect targeting technique. What we want is to order the banshee to fly over the target point. Start by creating the order offset effect (persistent). Set Location, Location offset end and Location offset start to Target Unit (this effect will be cast by the "Create unit effect" directly on the banshee). Then set Offset facing fallback to Target Unit of the Airstike main effect (the field should read Airstrike main: target unit). This will make sure the offset is calculated using the casting unit's facing, same as the offset calculated for spawn (we will add it later). Then set Period count to 1, period duration to 1 and periodic offset to 20,20.
Finally create an Issue order effect, that orders the Move ability (order ID 0). Target is target point, Player should be Caster and Unit is Banshee Airstrike order offset:Target unit' ( the issue order is executed upon a location, so we need to determine the unit this way ). That is all for the order effect, so just add it as periodic effect of the Banshee Airstrike order offset, and add the Banshee Airstrike order offset as Effect - spawn of the Create Unit effect.
To link all this to the main effect, create a new persistent effect, set it's period count to 3, periodic effect to "Spawn banshee" and periodic offsets to someting around -10,-10 (In the video I used -10,-10; -10,-12; and -12,10 - this way banshees fly in a formation).
That concludes the move part. To test it out, create new Effect - Target ability, set the effect to Airstike main, Default button for Excecute command to anything and add the ability to some unit to test it out. It should create banshees, that fly over targeted point and then disappear.
The bombardment part is trickier. There are multiple ways to achieve this effect, I have chosen following: one main persistent effect will launch missiles from a random banshee to a random point, multiple times.
Start by creating the Airstrike bombard persistent. That effect will randomize impact locations. Set it's period count to 15 (this is the number of bombs), periodic durations to 0.1 (this executes the entire bombardment in 1.5 seconds), periodic offset to a couple of random offsets (from -1,-1 to +1,+1), and check "Random offset" flag. The periodic effect will be empty for now, we will make that in a while.
Second part is the Search Area effect, which will randomize which banshee releases the current bomb. Set are to 5, effect to Banshee backslash rocket launch (the one you duplicated with banshee). Maximum count will be 1, and Target Sorts TSRandom - this will select one random banshee. Then add this effect as periodic effect of Airstike persistent.
Lastly, modify Banshee backslash rockets launch: Launch location' will be Target unit (this effect is used by the "Seach area" effect, so the found banshee is marked as target) and Impact Location is Airstike Search:Target point. (Airstike search is executed with random offset by the airstike bombard persistent - it's target marks the bomb target), and Validators to a new validator (Unit type that checks whether the target is the duplicate Banshee). Also make Banshee backslash rockers damage cause area effect (add something in the "Area+" field).
The final change is incorporating Airstrike bombard peristent in the main effect. Change the period count to 4, period effects to 3xSpawn banshee and 1xAirstrike bombard(first theree are spawn, the last effect is bombard), period durations to 3x0 and 1x5 (first three instanteniously, the last one with a delay) and add one 0,0 offset (there are three already).
Congratulations, if you did everything right, artillery strike should look like the one in video.
(The attack actor is not working, if someone find a fix that would be appreciated)