Designing an Ability
Author: (wiki) (staredit.net)Tags: data ability  
Source: http://www.staredit.net/w2/index.ph...Added 13 years ago 

In this "exercise", we'll create a Speed Boost ability that we'll apply on a Zealot, replacing its current Charge ability.

Ability's characteristics:

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 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 +'.


Give energy
There's 3 fields we have to set from the Zealot's Unit tab:

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

Setting its ability
Now is the time we start to work on trying to apply those 3 characteristics named at start on our ability.

Cooldown and Energy
Select your newly created ability and double click on "Cost +". From there, click on the little green button ("Add value").

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 cast (it doesn't wait for it to end).

No interruption
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.

Stay under the "Abilities" tab and keep your ability selected. From there, you want to select "Flags".

Effects and Behaviors
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:

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
From "Speed Boost - Beh", set these fields:

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:

The command button should now be complete.


Giving the ability
Return to the "Units" tab and find the Zealot.


Conclusion (generalization)
1. Create a new ability
2. Create the proper Effect and Behavior
3. Link everything together properly
4. Give the ability to the units you want

And some "tips":







Star Depot
Contact      Login