Creating Zealot Charge as an Instant Effect
In this "exercise", we'll create a Speed Boost ability that we'll apply on a Zealot, replacing its current Charge ability.
- Has a cooldown
- Increases temporary the caster's speed
- Doesn't interfere with any current order (to prevent the unit from stopping to Move/Attack when the ability is triggered); Transient
- Costs 5 energy
- 1 Setting our Zealot
- 2 Creating the new ability
- 3 Setting the ability
- 4 Conclusion (generalization)
- 5 See Also
Setting our Zealot
First of all, we must set our Zealot so it is ready to welcome our ability. We basically have 2 things to do:
- Remove the Zealot's Charge ability
- Give our Zealot some energy
Remove default ability
In order to replace the current 'Charge' ability, we must open the Data Editor and search for "Zealot" under the 'Units' tab.
Under Abilities +, delete "Zealot - Charge". Do the same under Command Card +.
There's 3 fields we have to set from the Zealot's Unit tab:
- Energy Starting Amount: 30
- Energy Regeneration Rate: 0.5
- Energy Maximum: 50
Since the names of these fields are pretty explicit, I will not explain what are their respective effects. Moreover, the Galaxy Editor provides you tooltips.
Creating the new ability
- Go under the 'Abilities' tab and right-click to select "Add Object". We'll name our ability "Speed Boost". Now click on "Suggest".
- Select Effect - Instant as the Ability Type. Leave the rest as it is and press Ok.
Setting its ability
Now is the time we start to work applying the characteristics we want our custom ability to have.
Cooldown and Energy
Select your newly created ability and double click on Cost +. From there, click on the little green button ("Add value").
- Under the "Cooldown" category, set the value of Time Use to 6.
- Under "Vitals" category, select Energy set its value to 5.
This will force the caster to wait 6 seconds before being able to cast the spell again. This'll also make the ability cost 5 energy.
Note: The cooldown timer starts as soon as the ability is casted (it doesn't wait for it to end).
If you omit this step, when you will activate the ability on your Zealot while it is running, the ability will effectively trigger, though it'll order your Zealot to stop, which isn't what we want (it thus will overwrite the current order).
Stay under the "Abilities" tab and keep your ability selected. From there, you want to select "Flags".
- Check the "Transient" Flag.
Now, we need a bit of theory.
Increasing a unit's speed can be done either via the "Units" tab (which would be a permanent change), or from the "Behaviors" tab. The problem is that there isn't any field that allows you to apply a Behavior on an ability directly. Solution? Create an "Apply Behavior" Effect since we can link Abilities with Effects:
- Open the "Effects" tab. Again, you'll need to right-click and select "Add Object". We'll name our effect "Speed Boost - Eff" (Eff for Effect).
- Click "Suggest" and select Apply Behavior as the Effect Type. Don't touch the rest and press Ok.
- Open the "Behaviors" tab. Add a new object, name it "Speed Boost - Beh" (Beh for Behavior) and select Buff as the Behavior Type.
- Set the "Effect - Initial" field to "Speed Boost - Eff".
- Return select "Speed Boost - Eff" and set the Behavior field to "Speed Boost - Beh".
Note: Under the "Effects" tab, the "Unit +" field determines on which unit the Behavior will be applied (in the case of an "Apply Behavior" type Effect). In our case "Caster" is the right input since we want the Speed Boost to apply on the caster, in occurrence our Zealot.
Temporary speed boost
Within "Speed Boost - Beh", set these fields:
- Duration: 2.5
- Modification +: Movement tab (at the top) -> "Movement Speed Bonus": 2
Setting the ability
It would be impossible to use the charge ability without first giving it a button, which is the icon use click when you want the Zealot to use it's newly created Charge ability. We'll copy the existing button, and edit it to our use:
- Go to the "Buttons" tab and find the "Charge" button
- Right click "Charge" and hit "Duplicate Object" (Ctrl + U)
- Double click the "Charge Copy", rename it "Speed Boost", and hit the "Suggest" button
- First we will reset the hotkey. Find the Hotkey field and edit it, and click on the grey box with the "C", and then press "D", which will reset the hotkey to activate when the player presses "D". You could also set this to any other key.
- Now change the "Alert Tooltip" and "Tooltip" fields to
Gives the Zealot a 100% speed boost for 2.5 seconds. Costs 5 energy. 6 Second Cooldown
The command button should now be complete.
Giving the ability
Return to the "Units" tab and find the Zealot.
- Go to its Abilities and "Add value" (the little green button!). Find "Speed Boost".
- Go to its Command Card and select a spot where you want the abilities' button to appear. "Add value" and select your button.
- Set the "Command Type" to "Ability Command". Leave the "Requirements" as (None). Set the "Ability" as "Speed Boost" (you must find the ability through the list, though it should normally be at the very top).
- Create a new Ability
- Create the proper Effects and Behaviors
- Link everything together properly
- Properly set-up a custom button
- Give the ability to the units you want
And some "tips":
- Set a spell's cooldown under the "Abilities" tab
- The "Effect" is mostly used to be able to apply the Behavior
- Set the spell's duration and effects under the "Behaviors" tab