- Joined
- Jul 12, 2005
- Messages
- 764
Creating some basic abilities/spell-types
In this tutorial i’ll show how to make some basic, well-known abilities. This is not a step-by-step tutorial, and is not made to beginners, so don’t ask how to use variables and such. I only show a way how to make them to avoid those repeatative threads in the forums.
I attach a map that contains a sample for all abilities that are included here.
Basics needed:
1. Knowledge of the Object Editor.
2. Knowledge of the spell ’Channel’.
3. Knowledge of triggers/Trigger Editor, variables, removing leaks.
Contents:
I. Deal damage based on hero’s attribute points (GUI) – easy
II. A simple blink-strike spell (GUI) – easy
III. Custom auras (GUI) – medium
IV. Only day/night passive abilities (GUI) – hard
V. A simple knockback spell (GUI) – medium
VI. Activateable passive abilities (GUI) – medium
VII. Passive Mirror Image (GUI) - medium
I. Deal damage based on hero’s attribute points
It’s pretty easy but many people do not know how to make it. You have to use the action:
Unit – Damage target
After you declare the units that deals and takes the damage, you have to set the damage value. We want this to be one of the hero’s attribute points.
In this example, I preset this value in a variable first to make it clearer to understand.
Finally, you set the attack and damage types, and there you go.
II. A simple blink-strike spell
We want our hero to teleport to the target, and deal some damage to it. For teleporting, we use the action ‘Unit – Move Unit (Instantly)’.
Look at my trigger first:
And here, I found a bug: if I tried the combination move-and-damage, it did not deal damage, but if I changed the order to damage-and-move, it worked. Strange…
After that, we order the caster to attack the target.
Finally, we remove the location (leak).
III. Custom auras
What about making an aura that gives a special skill for nearby friendly/enemy units? In this example we’ll make an aura that gives 4%/8%/12% chance for nearby friendly units to regenerate 15/30/45 hit points on each attack. The trigger is simple but it has a problem:
Make separate buffs for each level!! That’s the key. This way, we can detect which buff the affected unit has, so we can get the exact level of the aura. Example:
Level 1 – Stats – Buffs Regen Aura (level 1)
Level 2 – Stats – Buffs Regen Aura (level 2)
Level 3 – Stats – Buffs Regen Aura (level 3)
The trigger must be modified this way:
IV. Only day/night passive abilities (not MUI!)
To those who don’t know what they are, these are passive abilities that have effects only at day (or at night).
In this example, we will make an aura that decreases nearby enemies’ armor by 1/2/3 at night!
The trigger part is not hard. The trick must be made in the object editor:
1. We need 2 (!) hero abilities. The first one will be a dummy “learning-ability” (based on Channel, and the second will make the effect (in this case, based on Devotion Aura).
2. The ability based on Channel is the main trick here. It has an option “Visible”, that makes its icon to appear if the hero learns the ability. If it’s not ticked, the icon will not appear, and will not take up space. Configure this ability (Icon - research, Hotkey - Learn, Tooltip – Learn (Extended) fields for sure), as it’ll be the ability that appears on the hero’s “learnable abilities” list. Make it look like a normal ability! Add THIS ability to the hero’s ability list (in the object editor of course).
3. Here it comes to the second ability, the one that appears on the hero’s “in-game ability-list”. This one must reduce armor, so we base it on Devotion Aura. Now for configuration:
If you want your ability to have N levels, make this ability to have N+1 levels, as it must have a level that does no effect (when it’s day). Let’s declare level 1 to be the one that makes no effect. In this example, our ability must look like this:
Level 1 – Data – Armor Bonus 0.00
Level 2 – Data – Armor Bonus -1.00
Level 3 – Data – Armor Bonus -2.00
Level 4 – Data – Armor Bonus -3.00
Set the icon, tooltip texts, targets allowed fields and such. An example:
Level 1 – Text – Tooltip – Normal – Extended It’s day! – No effect
Level 2 – Text – Tooltip – Normal – Extended Reduces armor by 1.
Level 3 – Text – Tooltip – Normal – Extended Reduces armor by 2.
Level 4 – Text – Tooltip – Normal – Extended Reduces armor by 3.
4. Now that we have both abilities, we arrived to the trigger part. We need 3 triggers. One for storing the learning hero into a variable, one for detecting day, and one for detecting night. When the hero learns the ability based on Channel (that disappears), we add the normal ability (with 4 levels) to the hero. At day, we want the ability to have no effect, so if it’s day, we set its level to 1. At night, we must set it back to its normal level. Here, the first ability will store the information about the exact level of the passive ability, as it was only learned by the hero, but its level hasn’t been modified. But remember, the passive ability has N+1 levels, because level 1 makes no effect, so we have to add 1 to the level of the “dummy-learning-ability”.
Here, ‘DayNight Passive’ is the ability based on Channel, and ‘DayNight Passive (for ability)’ is the normal one that makes the effect.
The trigger for detecting day:
Trigger for detecting night:
V. A simple knockback spell (not MUI!)
You need a unit-targeted spell only from the object editor, so I’ll describe the trigger part only.
We need two triggers for this:
LoopCounter is an integer variable that counts how many times the “movement-trigger” runs. Be sure to set it to 0 in this trigger!
Line-by-line description:
1. line: We store the location of the caster.
2. line: We store the location of the target.
3. line: We calculate the point where the unit should be moved. For this, we use ‘Point With Polar Offset’. It declares a point from the following parameters: a base point, an offset value, a degree.
4. line: With that action, we move the target to the next point (TempLoc[2]) in the slide movement.
5/6/7. line: Removing location leaks.
8. line: Add 1 to the counter variable (LoopCounter)
9. line: Checks if LoopCounter reached the appropriate value (here 50) and disables the movement-trigger to stop the unit sliding.
Each time this trigger runs (50 times a second), the target is moved away from the caster with 5 units. So we must count how many times this trigger should run:
max distance of the move / move-range per one trigger-run
(In this case: 250/5 = 50)
VI. Activateable passive abilities
For this, we use an activatable ability, Immolation seems to be the best, because it leaves a buff on the caster, and drains mana while it’s active.
The buff should be based on „Immolation” and not „Immolation (Caster)”. You can even delete the second one, there’s no need for it (and i don’t see if it had any effect btw).
In my sample, i named both the ability and the buff „Boost”.
The second thing we need is the desired passive ability. For this, I use a custom item ability based on „Item Armor Bonus”.
Let’s see the trigger part:
So when it’s activated, we add, when deactivated, we remove the passive ability.
But, there’s one thing that we must take care of. When the unit runs out of mana while the ability is active, the trigger does not fire, so the passive ability reamains on the hero. That’s why we have to include that buff-check. Tricky isn’t it?
VII. Passive Mirror Image
This ability allows our hero to passively create illusions of itself if it’s attacked.
We need:
-a pure passive ability (i used Evasion)
-a dummy spellcaster
-an item based on „Wand of Illusion” (it’s a charged item) - optional
-a modified item ability based on „Item Illusions” - optional
-a trigger
Unfortunately, a good „illusion-creating” unit ability does not exist, so we have to use an item (by a dummy unit) to create the illusion.
The new item is needed if you want to modify the normal Wand of Illusion’s stats. In my example, i used a custom item, because i want the illusions to deal damage, and i want them to have only a 20 second duration.
So modify the item, and its ability to fit your wishes.
We don’t have to do anything else in the object editor, so let’s go on to triggering. Here it is:
-We want to limit the number of illusions to 5, that’s why we count their number first.
-Illusions also have the hero ability, so we have to check if the attacked unit is an illusion or not, and calculate the proper chances to create a new illusion. (The hero and the illusions have different chances to create illusions!)
-If the „chance-check” was done, we create the dummy spellcaster. We have to give him an inventory - Inventory (Hero) -, otherwise we couldn’t give him the „illusion-creating” item. The actions ’Create item for unit’ and ’Order unit to use item’ are not under ’Unit’, but under ’Hero’!
-After it, we remove the leaks.
In this tutorial i’ll show how to make some basic, well-known abilities. This is not a step-by-step tutorial, and is not made to beginners, so don’t ask how to use variables and such. I only show a way how to make them to avoid those repeatative threads in the forums.
I attach a map that contains a sample for all abilities that are included here.
Basics needed:
1. Knowledge of the Object Editor.
2. Knowledge of the spell ’Channel’.
3. Knowledge of triggers/Trigger Editor, variables, removing leaks.
Contents:
I. Deal damage based on hero’s attribute points (GUI) – easy
II. A simple blink-strike spell (GUI) – easy
III. Custom auras (GUI) – medium
IV. Only day/night passive abilities (GUI) – hard
V. A simple knockback spell (GUI) – medium
VI. Activateable passive abilities (GUI) – medium
VII. Passive Mirror Image (GUI) - medium
I. Deal damage based on hero’s attribute points
It’s pretty easy but many people do not know how to make it. You have to use the action:
Unit – Damage target
After you declare the units that deals and takes the damage, you have to set the damage value. We want this to be one of the hero’s attribute points.
In this example, I preset this value in a variable first to make it clearer to understand.
-
AttributeDamage
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Attribute Damage
-
Actions
- Set TempReal = (Real((Strength of (Triggering unit) (Include bonuses))))
- Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing TempReal damage of attack type Spells and damage type Normal
-
Events
Finally, you set the attack and damage types, and there you go.
II. A simple blink-strike spell
We want our hero to teleport to the target, and deal some damage to it. For teleporting, we use the action ‘Unit – Move Unit (Instantly)’.
Look at my trigger first:
-
BlinkStrike
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Blink Strike
-
Actions
- Set TempLoc00 = (Position of (Target unit of ability being cast))
- Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 50.00 damage of attack type Spells and damage type Normal
- Unit - Move (Triggering unit) instantly to TempLoc00
- Unit - Order (Triggering unit) to Attack (Target unit of ability being cast)
- Custom script: call RemoveLocation(udg_TempLoc00)
-
Events
And here, I found a bug: if I tried the combination move-and-damage, it did not deal damage, but if I changed the order to damage-and-move, it worked. Strange…
After that, we order the caster to attack the target.
Finally, we remove the location (leak).
III. Custom auras
What about making an aura that gives a special skill for nearby friendly/enemy units? In this example we’ll make an aura that gives 4%/8%/12% chance for nearby friendly units to regenerate 15/30/45 hit points on each attack. The trigger is simple but it has a problem:
-
RegenAura
-
Events
- Unit - A unit Is attacked
-
Conditions
- ((Attacking unit) has buff <aura’s buff>) Equal to True
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- <chance> Greater than or equal to (Random integer number between 1 and 100)
-
Then - Actions
- Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + <regen bonus>)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
Make separate buffs for each level!! That’s the key. This way, we can detect which buff the affected unit has, so we can get the exact level of the aura. Example:
Level 1 – Stats – Buffs Regen Aura (level 1)
Level 2 – Stats – Buffs Regen Aura (level 2)
Level 3 – Stats – Buffs Regen Aura (level 3)
The trigger must be modified this way:
-
RegenAura
-
Events
- Unit - A unit Is attacked
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
- ((Attacking unit) has buff Regen Aura (level 1)) Equal to True
- ((Attacking unit) has buff Regen Aura (level 2)) Equal to True
- ((Attacking unit) has buff Regen Aura (level 3)) Equal to True
-
Conditions
-
Or - Any (Conditions) are true
-
Actions
- If (((Attacking unit) has buff Regen Aura (level 1)) Equal to True) then do (Set Level = 1) else do (Do nothing)
- If (((Attacking unit) has buff Regen Aura (level 2)) Equal to True) then do (Set Level = 2) else do (Do nothing)
- If (((Attacking unit) has buff Regen Aura (level 3)) Equal to True) then do (Set Level = 3) else do (Do nothing)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level x 4) Greater than or equal to (Random integer number between 1 and 100)
-
Then - Actions
- Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + ((Real(Level)) x 15.00))
- Else - Actions
-
If - Conditions
-
Events
IV. Only day/night passive abilities (not MUI!)
To those who don’t know what they are, these are passive abilities that have effects only at day (or at night).
In this example, we will make an aura that decreases nearby enemies’ armor by 1/2/3 at night!
The trigger part is not hard. The trick must be made in the object editor:
1. We need 2 (!) hero abilities. The first one will be a dummy “learning-ability” (based on Channel, and the second will make the effect (in this case, based on Devotion Aura).
2. The ability based on Channel is the main trick here. It has an option “Visible”, that makes its icon to appear if the hero learns the ability. If it’s not ticked, the icon will not appear, and will not take up space. Configure this ability (Icon - research, Hotkey - Learn, Tooltip – Learn (Extended) fields for sure), as it’ll be the ability that appears on the hero’s “learnable abilities” list. Make it look like a normal ability! Add THIS ability to the hero’s ability list (in the object editor of course).
3. Here it comes to the second ability, the one that appears on the hero’s “in-game ability-list”. This one must reduce armor, so we base it on Devotion Aura. Now for configuration:
If you want your ability to have N levels, make this ability to have N+1 levels, as it must have a level that does no effect (when it’s day). Let’s declare level 1 to be the one that makes no effect. In this example, our ability must look like this:
Level 1 – Data – Armor Bonus 0.00
Level 2 – Data – Armor Bonus -1.00
Level 3 – Data – Armor Bonus -2.00
Level 4 – Data – Armor Bonus -3.00
Set the icon, tooltip texts, targets allowed fields and such. An example:
Level 1 – Text – Tooltip – Normal – Extended It’s day! – No effect
Level 2 – Text – Tooltip – Normal – Extended Reduces armor by 1.
Level 3 – Text – Tooltip – Normal – Extended Reduces armor by 2.
Level 4 – Text – Tooltip – Normal – Extended Reduces armor by 3.
4. Now that we have both abilities, we arrived to the trigger part. We need 3 triggers. One for storing the learning hero into a variable, one for detecting day, and one for detecting night. When the hero learns the ability based on Channel (that disappears), we add the normal ability (with 4 levels) to the hero. At day, we want the ability to have no effect, so if it’s day, we set its level to 1. At night, we must set it back to its normal level. Here, the first ability will store the information about the exact level of the passive ability, as it was only learned by the hero, but its level hasn’t been modified. But remember, the passive ability has N+1 levels, because level 1 makes no effect, so we have to add 1 to the level of the “dummy-learning-ability”.
Here, ‘DayNight Passive’ is the ability based on Channel, and ‘DayNight Passive (for ability)’ is the normal one that makes the effect.
-
DayNightLearn
-
Events
- Unit - A unit Learns a skill
-
Conditions
- (Learned Hero Skill) Equal to DayNight Passive
-
Actions
- Set DayNightHero = (Triggering unit)
- Unit - Add DayNight Passive (for ability) to DayNightHero
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (In-game time of day) Greater than or equal to 6.00
- (In-game time of day) Less than 18.00
-
Then - Actions
- Unit - Set level of DayNight Passive (for ability) for DayNightHero to 1
-
Else - Actions
- Unit - Set level of DayNight Passive (for ability) for DayNightHero to ((Level of DayNight Passive for DayNightHero) + 1)
-
If - Conditions
-
Events
The trigger for detecting day:
-
Day
-
Events
- Game - The in-game time of day becomes Greater than or equal to 6.00
-
Conditions
- (In-game time of day) Less than 18.00
-
Actions
- Unit - Set level of DayNight Passive (for ability) for DayNightHero to 1
-
Events
Trigger for detecting night:
-
Night
-
Events
- Game - The in-game time of day becomes Less than 6.00
- Game - The in-game time of day becomes Greater than or equal to 18.00
- Conditions
-
Actions
- Unit - Set level of DayNight Passive (for ability) for DayNightHero to ((Level of DayNight Passive for DayNightHero) + 1)
-
Events
V. A simple knockback spell (not MUI!)
You need a unit-targeted spell only from the object editor, so I’ll describe the trigger part only.
We need two triggers for this:
-
Knockback
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Knockback
-
Actions
- Set Caster = (Triggering unit)
- Set Target = (Target unit of ability being cast)
- Set LoopCounter = 0
- Trigger - Turn on KnockbackMove <gen>
-
Events
LoopCounter is an integer variable that counts how many times the “movement-trigger” runs. Be sure to set it to 0 in this trigger!
-
KnockbackMove
-
Events
- Time - Every 0.02 seconds of game time
- Conditions
-
Actions
- Set TempLoc00 = (Position of Caster)
- Set TempLoc01 = (Position of Target)
- Set TempLoc02 = (TempLoc01 offset by 5.00 towards (Angle from TempLoc00 to TempLoc01) degrees)
- Unit - Move Target instantly to TempLoc02
- Custom script: call RemoveLocation(udg_TempLoc00)
- Custom script: call RemoveLocation(udg_TempLoc01)
- Custom script: call RemoveLocation(udg_TempLoc02)
- Set LoopCounter = (LoopCounter + 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- LoopCounter Greater than 50
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
Events
Line-by-line description:
1. line: We store the location of the caster.
2. line: We store the location of the target.
3. line: We calculate the point where the unit should be moved. For this, we use ‘Point With Polar Offset’. It declares a point from the following parameters: a base point, an offset value, a degree.
4. line: With that action, we move the target to the next point (TempLoc[2]) in the slide movement.
5/6/7. line: Removing location leaks.
8. line: Add 1 to the counter variable (LoopCounter)
9. line: Checks if LoopCounter reached the appropriate value (here 50) and disables the movement-trigger to stop the unit sliding.
Each time this trigger runs (50 times a second), the target is moved away from the caster with 5 units. So we must count how many times this trigger should run:
max distance of the move / move-range per one trigger-run
(In this case: 250/5 = 50)
VI. Activateable passive abilities
For this, we use an activatable ability, Immolation seems to be the best, because it leaves a buff on the caster, and drains mana while it’s active.
The buff should be based on „Immolation” and not „Immolation (Caster)”. You can even delete the second one, there’s no need for it (and i don’t see if it had any effect btw).
In my sample, i named both the ability and the buff „Boost”.
The second thing we need is the desired passive ability. For this, I use a custom item ability based on „Item Armor Bonus”.
Let’s see the trigger part:
-
Boost
-
Events
- Unit - A unit Is issued an order with no target
-
Conditions
- (Level of Boost for (Triggering unit)) Greater than 0
-
Or - Any (Conditions) are true
-
Conditions
- (Issued order) Equal to (Order(immolation))
- (Issued order) Equal to (Order(unimmolation))
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Issued order) Equal to (Order(immolation))
-
Then - Actions
- Unit - Add BoostArmor (+7) to (Triggering unit)
- Unit - Set level of BoostArmor (+7) for (Triggering unit) to (Level of Boost for (Triggering unit))
- Wait 0.50 seconds
- Wait until (((Triggering unit) has buff Boost ) Equal to False), checking every 0.50 seconds
- Unit - Remove BoostArmor (+7) from (Triggering unit)
-
Else - Actions
- Unit - Remove BoostArmor (+7) from (Triggering unit)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
So when it’s activated, we add, when deactivated, we remove the passive ability.
But, there’s one thing that we must take care of. When the unit runs out of mana while the ability is active, the trigger does not fire, so the passive ability reamains on the hero. That’s why we have to include that buff-check. Tricky isn’t it?
VII. Passive Mirror Image
This ability allows our hero to passively create illusions of itself if it’s attacked.
We need:
-a pure passive ability (i used Evasion)
-a dummy spellcaster
-an item based on „Wand of Illusion” (it’s a charged item) - optional
-a modified item ability based on „Item Illusions” - optional
-a trigger
Unfortunately, a good „illusion-creating” unit ability does not exist, so we have to use an item (by a dummy unit) to create the illusion.
The new item is needed if you want to modify the normal Wand of Illusion’s stats. In my example, i used a custom item, because i want the illusions to deal damage, and i want them to have only a 20 second duration.
So modify the item, and its ability to fit your wishes.
We don’t have to do anything else in the object editor, so let’s go on to triggering. Here it is:
-
PassiveMirrorImage
-
Events
- Unit - A unit Is attacked
-
Conditions
- (Level of Passive MI for (Triggering unit)) Greater than 0
-
Actions
- Set TempGroup = (Units owned by (Owner of (Triggering unit)) matching ((((Matching unit) is an illusion) Equal to True) and ((Level of Passive MI for (Matching unit)) Greater than 0)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in TempGroup) Less than 5
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Triggering unit) is an illusion) Equal to False
-
Then - Actions
- Set Chance = ((Level of Passive MI for (Triggering unit)) x 10)
-
Else - Actions
- Set Chance = ((Level of Passive MI for (Triggering unit)) x 6)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Chance Greater than or equal to (Random integer number between 1 and 100)
-
Then - Actions
- Set TempLoc00 = (Position of (Triggering unit))
- Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempLoc00 facing 0.00 degrees
- Unit - Add Inventory (Hero) to (Last created unit)
- Hero - Create Item Passive MI and give it to (Last created unit)
- Hero - Order (Last created unit) to use (Last created item) on (Triggering unit)
- Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
- Custom script: call RemoveLocation(udg_TempLoc00)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
- Custom script: call DestroyGroup(udg_TempGroup)
-
Events
-We want to limit the number of illusions to 5, that’s why we count their number first.
-Illusions also have the hero ability, so we have to check if the attacked unit is an illusion or not, and calculate the proper chances to create a new illusion. (The hero and the illusions have different chances to create illusions!)
-If the „chance-check” was done, we create the dummy spellcaster. We have to give him an inventory - Inventory (Hero) -, otherwise we couldn’t give him the „illusion-creating” item. The actions ’Create item for unit’ and ’Order unit to use item’ are not under ’Unit’, but under ’Hero’!
-After it, we remove the leaks.
Attachments
Last edited: