Tutorial – The Guide The Warcraft 3 Ability
This is decription to some of the hidden secrets in the Warcraft III object editor. Some of it might be common knowledge for many of you, some might be new. Anyway I didn’t find most of these things out myself. This is gathered knowledge from the whole site. Everyone who posts on wc3campaigns has contributed to this collection, I’ve simply put it all together. Please excuse bad spelling/wording and possible errors and please tell me if there’s something wrong with the description or if you have something to add to the list.
BTW, this tutorial is better viewed with Firefox, because IE requires a lot of horizontal scrolling …
- ANcl (Channel): Channel was made to be used as a dummy ability that has no real effect in the game. It can be used to trigger the effects. You can specify if it can target a unit, a point, an area of effect, a unit or if it has no target at all, if it shows an icon on the command card and if it shows an aoe targeting image. The spell also has physical spell, universal spell and unique cast options. The channelling behaviour can be changed by setting the follow through time and the disable other abilities option, which will black out the whole command card during the follow through time. You can alter the caster and target art fields as well, only buffs cannot be added. Because the base order id of a channel spell can be changed you can have more than one working channel spells on a single unit. The real effect of the spell will of course have to be triggered.
function Channel_Conditions takes nothing returns boolean return GetSpellAbilityId() == <channel ability id> endfunction function Channel_Actions takes nothing returns nothing endfunction function Channel takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST) call TriggerAddCondition(t, Condition(function Channel_Conditions)) call TriggerAddAction(t, function Channel_Actions) endfunction
Since the 1.18 patch channel also works well in spellbooks and in conjunction with the engineering upgrade. One possible problem is that channel spells get cancelled by stunning abilities. To avoid that replace your stunning abilities with spells based off of ANab (Acid Bomb) for example.
- Amrf (Raven Form): Allows to change the flying height of ground units.
call UnitAddAbility(u, 'Amrf') call UnitRemoveAbility(u, 'Amrf')
After having added and removed the ability you can use SetUnitFlyHeight to adjust the height of the unit u, even if it’s a ground unit. I couldn’t get this to work with buildings though.
- Sca1 (Chaos): Adding a chaos ability to a unit transforms it into the unit type specified in the target unit id field of the ability. This can be used to change any aspect like the proper name or the model of a unit in the game or simply in combination with channel to implement morphing spells. Don’t forget to remove the tech requirements from custom chaos abilities. One problem of Chaos is that it adds the morphed unit’s current armor, damage, health and mana bonus received from items, auras and srength, agility, intelligence to the stats of the resulting unit. That means it’s not a very good idea to morph heroes using chaos until Blizzard fixes those bugs. Ordinary units can’t be affected by items and hero stats, so the only problem are buffs received from auras. Those buffs can easily be removed before the conversion and are automatically added again afterwards so that’s not a real issue.
call UnitRemoveAbility(u, 'BHab') call UnitRemoveAbility(u, 'BUau') call UnitRemoveAbility(u, 'BUav') call UnitRemoveAbility(u, 'BEah') call UnitRemoveAbility(u, 'BHad') call UnitRemoveAbility(u, 'BEar') call UnitRemoveAbility(u, 'BOae') call UnitRemoveAbility(u, 'BOac') call UnitRemoveAbility(u, 'Bapl') call UnitRemoveAbility(u, 'Bplg') call UnitRemoveAbility(u, 'Boar') call UnitRemoveAbility(u, 'Babr') call UnitRemoveAbility(u, 'Bakb') call UnitAddAbility(u, <chaos ability id>)
This script will remove all aura buffs before applying the chaos upgrade. If you have custom buffs in your map, you’ll have to remove them here too.
- Aloc (Locust): A unit that is given locust becomes unselectable, untargetable and ignores any pathing limitations. This means it can only be controlled and ordered with triggers. It won’t show a life bar over its head too. Now to get rid of locust UnitRemoveAbility(u, ‘Aloc’) won’t work therefore you’ll need to chaos transform the unit into a different temporary unit type and immediately transform it back. However if the unit had been transformed with a chaos ability before then adding locust will make it unselectable but still targetable and it will also obey pathing rules. Another option to get rid of locust is the following hiding the unit, removing the ability and unhiding it again.
function UnitRemoveLocust takes unit u returns nothing local boolean backup = not IsUnitHidden(u) call ShowUnit(u, false) call UnitRemoveAbility(u, 'Aloc') call ShowUnit(u, backup) endfunction
This solution has some side effects. The health bar above the unit as well as the player name when you move your mouse over the unit will not be shown any more. So this would also be a trick to get rid of those tooltips and health bars.
- Amec (Mechanical Critter): Units that were summoned with this ability look and act like neutral passive units to all players except the owner who can control it like any other unit. The only exception is, when they right-click the unit their unit will attack it. Unfortunately you can’t change the summoned unit type, it will always be a random critter from the current tileset, but you can easily catch the summon event and use chaos to get the unit type you want.
function Transform_Conditions takes nothing returns boolean return GetUnitTypeId(GetSummoningUnit()) == <unit type that can cast mechanical critter> endfunction function Transform_Actions takes nothing returns nothing call DestroyEffect(AddSpecialEffect("Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl", GetUnitX(GetSummonedUnit()), GetUnitY(GetSummonedUnit()))) call UnitAddAbility(GetSummonedUnit(), <chaos ability id>) endfunction function Transform takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SUMMON) call TriggerAddCondition(t, Condition(function Transform_Conditions)) call TriggerAddAction(t, function Transform_Actions) endfunction
Changing the race of a unit to Critter and setting it to be used in the tileset of your map will also work instead of this script.
- AId1, AItg, AIlf, AImb, AIsi, Aamk, AIsr, AIdd, AIas, AIms, Arel, AIrm, AIcs (Defense, Damage, Life, Mana, Sight Range, Attribute Bonus, Runed Bracers, Defend Item, Attack Speed, Movement Speed, Life Regeneration, Mana Regeneration, Critical Strike Item): These item abilities can also be added as unit abilities to change defense, damage, life, mana, sight range, agility, strength and intelligence, magic resistance, damage deflection and damage reduction, attack speed, movement speed, life regeneration, mana regeneration and critical strike and evasion of a unit. Fortunately the effects of those abilities stack so you only need a few copies of them to get any bonus by using a bitflagging technique. Weaaddar and Blade have shown how it can be done with their BonusMod and AttributeMod systems. All of these abilities also work with negative values, so you can decrease stats with them. For sight range however, negative values only work if the unit doesn’t have any ability that detects hidden units. The ‘AIdd’ ability has the same fields as ‘Aegr’ (Elunes Grace), namely magic resistance, damage reduction and deflection. Unfortunately its attack speed factor and movement speed factor fields don’t work. This ability as well as critical strike, life and mana regeneration and attack and movement speed bonuses didn’t stack in older versions, but since the latest patch they finally do. A special bug allows you to to adjust the max mana and life of a unit without a permanent ability on that unit. Simply make a custom AIlf (Life Bonus) or AImb (Mana Bonus) ability and give it more than one level. Now set the bonus for level one to zero and the level two to the exact opposit you want to achieve. That would be -200 if you want to add 200. Now use UnitAddAbility and SetUnitAbilityLevel to add the ability at level two to your target. There’s a bug in those abilities that prevents the bonus from being applied correctly. Then immediately remove the ability again using UnitRemoveAbility. This time it will try to undo the -200 bonus (which hadn’t been applied due to a bug) and add 200 to the unit. That’s it, you’ve changed the life/mana without having to keep any abilities on the unit.
- ANvc (Volcano): This is the only ability that can create destructables/doodads so this might be useful in some cases.
- Absk, Adef, Amdf, ANms, AEim, AHds (Berserk, Defend, Magical Defense, Mana Shield, Immolation, Divine Shield): These abilities don’t stop the current order of the caster when used. The last five can be activated and deactivated (if that is enabled in the gameplay constants). The mentioned abilities can easily be customized by setting their effect to zero and catching their order and unorder string. You’ll eventually have to remove the buff with the ‘UnitRemoveAbility’ native after catching an order, if you don’t want buffs to show up on the unit. However the unorder is issued twice when these abilities are removed from a unit. Therefore you need a simple workaround to not catch these unorders.
function WasUnOrder takes nothing returns boolean return OrderId2String(GetIssuedOrderId()) == "undefend" or OrderId2String(GetIssuedOrderId()) == "magicundefend" or OrderId2String(GetIssuedOrderId()) == "unmanashield" or OrderId2String(GetIssuedOrderId()) == "unimmolation" or OrderId2String(GetIssuedOrderId()) == "undivineshield" endfunction function Defense_Condition takes nothing returns boolean return GetTriggerEventId() != EVENT_PLAYER_UNIT_ISSUED_ORDER or ((OrderId2String(GetIssuedOrderId()) == "defend" or OrderId2String(GetIssuedOrderId()) == "undefend") and GetUnitAbilityLevel(GetOrderedUnit(), 'Adef') > 0 and GetUnitState(GetOrderedUnit(), UNIT_STATE_LIFE) > 0) endfunction function TriggerRegisterDefenseEvent takes trigger t returns triggercondition call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER) return TriggerAddCondition(t, Condition(function Defense_Condition)) endfunction function MagicDefense_Condition takes nothing returns boolean return GetTriggerEventId() != EVENT_PLAYER_UNIT_ISSUED_ORDER or ((OrderId2String(GetIssuedOrderId()) == "magicdefend" or OrderId2String(GetIssuedOrderId()) == "magicundefend") and GetUnitAbilityLevel(GetOrderedUnit(), 'Amdf') > 0 and GetUnitState(GetOrderedUnit(), UNIT_STATE_LIFE) > 0) endfunction function TriggerRegisterMagicDefenseEvent takes trigger t returns triggercondition call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER) return TriggerAddCondition(t, Condition(function MagicDefense_Condition)) endfunction function ManaShield_Condition takes nothing returns boolean return GetTriggerEventId() != EVENT_PLAYER_UNIT_ISSUED_ORDER or ((OrderId2String(GetIssuedOrderId()) == "manashield" or OrderId2String(GetIssuedOrderId()) == "unmanashield") and GetUnitAbilityLevel(GetOrderedUnit(), 'ANms') > 0 and GetUnitState(GetOrderedUnit(), UNIT_STATE_LIFE) > 0) endfunction function TriggerRegisterManaShieldEvent takes trigger t returns triggercondition call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER) return TriggerAddCondition(t, Condition(function ManaShield_Condition)) endfunction function Immolation_Condition takes nothing returns boolean return GetTriggerEventId() != EVENT_PLAYER_UNIT_ISSUED_ORDER or ((OrderId2String(GetIssuedOrderId()) == "immolation" or OrderId2String(GetIssuedOrderId()) == "unimmolation") and GetUnitAbilityLevel(GetOrderedUnit(), 'AEim') > 0 and GetUnitState(GetOrderedUnit(), UNIT_STATE_LIFE) > 0) endfunction function TriggerRegisterImmolationEvent takes trigger t returns triggercondition call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER) return TriggerAddCondition(t, Condition(function Immolation_Condition)) endfunction function DivineShield_Condition takes nothing returns boolean return GetTriggerEventId() != EVENT_PLAYER_UNIT_ISSUED_ORDER or ((OrderId2String(GetIssuedOrderId()) == "divineshield" or OrderId2String(GetIssuedOrderId()) == "undivineshield") and GetUnitAbilityLevel(GetOrderedUnit(), 'AHds') > 0 and GetUnitState(GetOrderedUnit(), UNIT_STATE_LIFE) > 0) endfunction function TriggerRegisterDivineShieldEvent takes trigger t returns triggercondition call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER) return TriggerAddCondition(t, Condition(function DivineShield_Condition)) endfunction
These events are not compatible with other order with no target events because of the trigger condition that is used, but it’s compatible with all other possible events. In case you want to distinguish the order and unorder there’s a utility function WasUnOrder too. The worst of these abilities is ‘AHds’ because you can’t get rid of its invulnerability. The first one, namely ‘Absk’, doesn’t need this workaround because it can’t be activated/deactivated. If you don’t need the casting animation on your unit there’s an easy way to make almost every spell not stop the current order. Therefore simply set the fields Art – Animation Cast Point and Art – Animation Backswing Point for the unit to 0. That way it will immediately cast spells and resume the order it had before.
- Arpl, Arpm, Arpb, Afzy, Apsh, Amel, Arai, AUcb (Replenish Life, Replenish Mana, Replenish, Frenzy, Phase Shift, Raise Dead, Carrion Beetles): These are abilities that have autocast, but when left-clicked, don’t need you to select a target. Useful to make buttons that act different when left-clicked and right-clicked. Simply catch the order to detect a left-click and the turn-on and turn-off order to detect a right click. You’d probably also want to remove the glowing autocast art in the game interface screen. The effect of the first three can easily be removed, ‘Afzy’ can also be nullified with a duration of 0.01. However you can’t really get rid of the phase shift of ‘Apsh’. The last three require a corpse nearby to be clickable. To privide such corpses you could simply give the same unit a hidden spellbook with the ‘Amtc’ (Corpse Cargo Hold) and ‘Agyd’ (Create Corpses) abilities.
- Apit, Aneu, Aall, Asid (Purchase Item, Neutral, Allied Building, Sell Items): The combination of these abilities will give you a shop that sells items only to the owner of the shop just like the arcane vault. The difference is that AddItemToStock will also work. RemoveItemFromStock only works for items added with triggers, so you’ll simply have to clear the items sold and items made field of the shop and instead add the items with a trigger at map initialization. Replace the ‘Asid’ ability with ‘Asud’ if you want a shop that sells units and that works with AddUnitToStock and RemoveUnitFromStock. Remove the ‘Aall’ ability to make it a neutral shop. On a side note, the ‘Asud’ ability makes a unit visible and clickable on the map for all players, even if that player is an enemy. A side effect of ‘Aneu’ is also that it allows for shared abilities. Even an enemy can use the abilities of a unit that has ‘Aneu’.
- Ablo (Bloodlust): Increases the size of the unit it is cast on. You would usually use an invisible dummy caster to do this. To keep the size change for an unlimited amount of time simply set the duration to 0. Reverting the size to normal can easily be done with triggers by removing the bloodlust buff from the unit. By using a custom buff with no effects, no icon and a space as the tooltip you can also pretty well get rid of the special effects and the buff icon.
- Apiv, Agho, Aeth (Permanent Invisibility, Ghost, Ghost Visible): These abilities make units invisible without the tradeoffs of setting them invisible with triggers. Often this is a better solution than pausing units or adding locust. Units with permanent invisibility will lose their invisibility temporarily while they are attacking. So the ability can be used to create units like spirit wolfs at level three. Units that have both Permanent Invisibility and Ghost stay hidden, even while they are attacking. The Aeye (Sentry Ward) spell adds permanent invisibility to the summoned unit automatically by the way.
- Abur, Abdt (Burrow, Burrow Detection): All units that have the burrow ability are only visible to their owner. Abilities that are supposed to detect hidden units have a flag if they can detect burrowed units, unfortunately it seems Blizzard never really implemented the difference between burrowed and invisible.
- Aasl (Tornado Slow Aura): This aura is perfect to add buffs to units that have no effects at all. Just set the targets allowed to self and the effect of the aura to zero. The ability doesn’t have an icon. The best thing is that you can have more than one on a unit and the different buff icons will stack. Because ‘Aasl’ is normally a harming aura the buff tooltip will always be red, but you can change that by using color codes in the buff’s name. For example |cffff0000Badass Red Buff|r and |cff00ff00Beneficial Green Buff|r. If you ever find a limit for ‘Aasl’ you can also use other auras and hide them in a disabled spellbook.
- ANpi (Permanent Immolation): Perfect to implement life and mana drain and also to attach effects to the caster and nearby units. To implement mana drain set the damage and range to zero, to implement life drain set the targets allowed to only self. By editing the buff you can change/remove the effects shown on the caster and the targets. To get rid of the icon put the ability in a disabled spellbook. If you want it to show a buff icon you can alternatively use Atdg (Tornado Damage Aura) and AHab (Brilliance Aura). Especially if you want to attach effects to a unit repetitively this ability can be useful too because you can change the interval.
- ACnr (Life Regeneration Aura): Perfect to attach effects with team colour to units. Just set the amount of life regenerated to zero and targets to only self. Then add the model you want to attach to the target art field and specify the attachment point. This will attach the model to the unit that has this ability and the team colour parts of it will change according to the owner. This also works in conjunction with morph abilities. If the team colour happens to mess up in certain situations the following code should fix it.
call SetUnitColor(<unit>, GetPlayerColor(GetOwningPlayer(<unit>)))
- Aspi (Spiked Barricades): Simple ability to attach special effects to units without any side effects. You should always prefer this ability over Asph (Sphere) as it’s much more reliable.
- Atwa (Tornado Wanderer): Units that have this ability can follow other units much closer than ordinary units. You’ll just have to set the area of effect of the spell to a greatest possible value. A unit that has this ability will just have to be ordered to right-click another unit and it will follow the unit if it doesn’t have an attack.
- AIbf (Build Tiny Farm): Allows units to build a certain building. The unit doesn’t need a repair ability or whatsoever. You can also set the time it takes to build the structure on the ability.
- Aher (Hero): The hero ability specifies the level up effect of heroes in its caster art field. You’ll need a customized AbilityData.slk file in order to get this ability displayed in the editor. Simply set the useInEditor flag to 1 in that file.
- Amov (Move): The move ability specifies the warp effect that units show when they walk through a warp gate.
- AImo (Lure): Lure is pretty cool because it lures all neutral aggressive units within the specified range. You can also specify the time interval in which the units are lured.
- ANeg (Engineering Upgrade): The engineering upgrade finally solves the problem of not levelable trigger added hero skills. It allows to add hero skills with triggers and to still have them in the levelup menu. Therefore the hero needs to have dummy hero skills that can then be replaced by the actual skills. The placeholder skills need to have the same amount of levels and level skip requirements that’s why you will probably need one for ultimates and one for normal hero skills. I usually base my placeholder skills off of Arpb (Replenish) but the base skill really shouldn’t matter. The placeholder with 3 levels and 2 levels skip can simply be given to the hero several times. Then the placeholder skills must be disabled for all players at map initialization, so they don’t show up in the levelup menu at first. Then you will just need an adder ability based off of engineering upgrade for each skill that you might want to have on the hero. The upgrade will replace the skills in the order of their ability upgrade field when it’s added, and replace them backwards when it’s removed. So if you want to abuse the engineering upgrade but don’t want the passive upgrade icon on the unit you can simply have an engineering upgrade with the abilities B, A in the upgrade field and then when you add and remove it on a unit that has A it will then have B. That’s because adding it will do nothing as B is not there, but removing it will replace A with B. As soon as a hero ability has been added that way it will be learnable in the levelup menu. Note that replacing skills only works well for unlearned hero skills. Replacing learned skills or normal unit skills will not actually replace them, it will just update the fields like range, area of effect, duration, icon, targets allowed, and so on, but will not change the hardcoded part of the ability. For example changing an aura to the heal ability will only change the icon, tooltips, range and probably some other fields, but it will still be an aura. If the ability that is being replaced is disabled at the time the results become even weirder and you can never know what you will get. Also the engineering upgrade only works for heroes, adding it to normal units will crash the game for some reason. Another weird bug with it is, that you have to specify all four upgraded abilities, otherwise it might not work. If you only want to upgrade one ability, you can simply specify ability ids that the unit will never have for the rest. Also dynamic tooltips like <dataA5> are flawed above level 3. Also the default buff shouldn’t be replaced, but it doesn’t show up anyway, so that’s not really an issue.
- Aspb (Spellbook): The spellbook is basically a container for up to 11 other abilities. It can hold active spells as well as autocast and passive spells and even hero skills. The first wonderful thing about the spellbook is that it gives you the effect of passive abilities in it even if the spellbook ability itself is disabled for the player. So it can be used to hide the icon of whichever passive ability you want and to save slots on the command card. The other wonderful thing is that you can add spells to a spellbook at runtime and remove them again. That is done by giving the unit a second spellbook with the spell that should be added and disabling this second spellbook. That way the skill will show up on the first spellbook but the second one can’t be seen on the unit. To make this work both spellbook abilities must have the same base order id. For each skill you want to add at runtime you will need such an adder ability. The third cool thing is that hero abilities in spell books are levelable via the levelup menu. The problem is that they will start at level 1 and not at level 0 if they are in the spellbook from the beginning. That’s easy to fix with triggers. Just normally give them to the hero first in the object editor. Then catch when level 1 is learned, remove the skill and add it to the spellbook.
function Learn_Actions takes nothing returns nothing if GetLearnedSkillLevel() == 1 and GetLearnedSkill() == <hero skill> then call UnitRemoveAbility(GetTriggerUnit(), GetLearnedSkill()) call UnitAddAbility(GetLearningUnit(), <adder spellbook ability>) call MakeUnitAbilityPermanent(u, <adder spellbook ability>) call MakeUnitAbilityPermanent(u, <ability inside spellbook>) endif endfunction function Learn takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL) call TriggerAddAction(t, function Learn_Actions) endfunction
Of course the adder ability has to be disabled from the beginning for the owner of the unit. To prevent bugs the number of minimum skills in a spellbook should equal the maximum number of skills. Unfortunately there are also some tiny problems. Active abilities in spellbooks can’t be used from triggers it seems. Also the tome of retraining will totally mess your system up if you have hero skills in the spellbook. And spells added at runtime won’t turn the spellbook icon blue if there’s not enough mana. But these small drawbacks usually don’t matter.
- Abun (Cargo Hold): If added to a unit it disables the unit’s ability to attack other units. Even the attack icon and shortcut are removed from the command card. To enable the attack again simply remove the cargo hold ability. Together with orb abilities it should give you complete control over the attack indices of units.
- AIdf, AIll, AIsb (Black Arrow Attack Bonus, New Lightning Orb, Slowness Orb): These orb abilities all have the effect ability field, which lets you specify any unit targeted ability as effect ability. This means that the ability will automatically be cast on the target of an attack depending on a certain chance that can be specified. If the chance is set to 100 it will be cast for each attack that doesn’t miss the target. If one of these abilities is added as unit ability, the effect ability will automatically appear as a passive ability on the unit’s command card. Unfortunately you can’t get rid of the icon. The only way to have no icon is using an invisible channel spell as effect ability, but this will only allow you to add a visual effect to the attacks but not real ability effect. The index of the enabled attack should be set to 0 if you don’t want to enable ranged attacks for melee units. Due to a bug the ability won’t be cast when the target was automatically acquired by the unit, even if the chance is 100 percent. Orbs are generally pretty useful to attach effects, change the missiles of units and to enable attacks. While we’re at arrow abilities, ‘ANia’ (Incinerate Arrow) always uses the default values of ‘Anic’ (Incinerate), no matter how you try to change them, so it’s only possible to have on ability of that type in a map.
- Aroc (Barrage): Barrage allows unit to attack several targets with one attack and therefore it can be used for multishot abilities. The bonus damage field must be set to at least 1, because 0 will cause serious problems. Each target will be dealt the normal damage of the unit’s attack and the amount of bonus damage specified here. The number of targets is 1 plus the maximum number of targets field of barrage. The projectile art field can have more than 1 entry and will override the default projectile of the unit. The art for each shot will be chosen at random from this list. The area of effect is the range for the additional attacks. This doesn’t affect the main attack, only the extra attacks granted by barrage. Also set the maximum possible damage field to 0 if you don’t want to limit the damage dealt. Unfortunately combining barrage with other attack enhancing abilities is pretty difficult. Many of them will completely eliminate the effect of barrage like all arrow abilities on autocast except AHfa (Searing Arrows) and many orb abilities. Orb abilities that do have an effect ability field only disable barrage when this effect ability comes into action. All other abilities like critical strike slow poison, freezing breath, lightning attack, liquid fire and similar spells pretty much work with barrage but will always only affect the main target and never the additional barrage targets. Basic enhancements like damage bonus, attack speed bonus and the like however will affect all targets. The AHfa (Searing Arrows) spell is very special. It’s the only arrow ability that works with barrage and it even reenables barrage on autocast if it was disabled by an incompatible orb ability allowing to create an autocastable multishot ability.
- Apxf (Phoenix Fire): This ability gives units an additional multishot attack that is independent of its normal attack. It has its own cooldown, missile, damage and damage over time and is automatically cast on every enemy in range. The duration field of the spell determines how long units take damage over time and how long it takes to be able to reattack the same target again. For some reason it is possible to add several phoenix fire abilities to a unit via items, and all of them will work simultaneously.
- ANcs (Cluster Rockets): If you need an ability with multiple subsequent projectiles, especially for aoe damage spells, use cluster rockets. Simply set the number of rockets to the number of subsequent projectiles you need.
- ANab, AEsh (Acid Bomb, Shadow Strike): Acid bomb is very versatile and probably the best base for a direct damage ability. It has many nice features like slowing movement and attack speed, armor reduction, instant damage, damage over time, buffs, projectile art – yet all those effects can easily be removed if required. Also it doesn’t have stun or any limitations regarding the allowed targets. Shadow strike offers similar fields except armor reduction. Additionally it displays the initial damage with a green fading text above the target. To get rid of the little dude and the sound, simply replace the default buff with a custom empty buff.
- AItg (Damage Bonus): An attack bonus of -1 is often required for invisible casters if you want to cast attack enhancing abilities on units. Just set the base damage of the caster to 0, the number of dice to 1 and the sides per dice to 0 and give the caster your custom damage bonus ability. This way the caster won’t deal any damage but attack enhancing abilities will still come into effect. This comes in handy to add certain buffs or to add some unique effects like liquid fire, freezing breath, slow poison or arrow abilities. Higher negative numbers can be used to heal targets by the way.
- AOcr (Critical Strike): If you don’t know the exact damage of a unit beforehand but you still want to disable all its damage, simply use critical strike with 100 percent chance to do a negative damage multiplier. Because the damage will always be 0 it will not show the damage in red numbers and you’ll have your desired effect.
- AOcl, Amgl (Chain Lightning, Moon Glaive): These abilities grant multiple targets. Chain lightning is useful as a base for pure damage abilities with a lightning effect or a projectile that jumps from one target to the next. You can adjust the number of targets in the chain and the damage loss factor. The moon glaive on the other hand works completely different. The glaive ability itself does absolutely nothing and simply shows the passive icon in the command card. The bouncing attack comes from the unit field attack type which must be set to missile (bounce) and the number of targets field of the unit. The number of targets is then increased with upgrades later on.
- Ahrl (Ghul Harvest): Can be used to find out if a certain destructible is a tree.
function IsDestructableTree takes destructable d returns boolean local boolean i = IsDestructableInvulnerable(d) local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), <invisible caster>,GetWidgetX(d), GetWidgetY(d), 0) local boolean result = false call UnitAddAbility(u, 'Ahrl') if i then call SetDestructableInvulnerable(d, false) endif set result = IssueTargetOrder(u, "harvest", d) call RemoveUnit(u) if i then call SetDestructableInvulnerable(d, true) endif return result endfunction
- AIgu, AIgf (Glyph of Ultravision, Glyph of Fortification): Adding and removing these abilities to a unit applies the specified upgrade to all units of the owner of this unit. Glyph of ultravision will affect all units that are not heroes and not structures. Glyph of fortification will affect all structures of that player.
- Acoa, Acoh, Adec (Couple, Decouple): Just here to remind you of the existence of this ability. It’s of course useful for merge abilities or generally for any spell that involves two participants of a particular type because you can easily catch the ability being cast and intercept it.
- Awrp (Waygate): The portal ability can also be added at runtime to any unit. Then the WaygateSetDestination and WaygateActivate functions can be used to set up the waygate. Pathing blockers can be used to block the waygate for flying units for example. To get rid of the warp effect you can edit the special art field of the Amov (Move) ability.
function SetupWaygate takes unit u, unit target returns nothing call UnitAddAbility(u, <waygate ability>) call UnitAddAbility(u, 'Aivs') call UnitAddAbility(u, 'Agho') call UnitAddAbility(u, 'Aloc') call SetUnitScale(u, 0.01, 0.01, 0.01) call WaygateSetDestinationLocBJ(u, PolarProjectionBJ(GetUnitLoc(target), 96, AngleBetweenPoints(GetUnitLoc(u), GetUnitLoc(target)))) call WaygateActivate(u, true) endfunction function ConnectRects takes rect left, rect right returns nothing local unit lu = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'ncop', GetRectCenterX(left), GetRectCenterY(left), 0) local unit ru = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'ncop', GetRectCenterX(right), GetRectCenterY(right), 0) call SetupWaygate(lu, ru) call SetupWaygate(ru, lu) endfunction
- Unit Classifications:
- Ward: If a unit has ward classification its whole command card will be blacked out and also the shortcuts to its abilities will be disabled. Other than that ward doesn’t have any effects. The unit however can still be issued right click orders. If don’t want that you can block them with the following code.
function Catch_Order_Actions takes nothing returns nothing if GetIssuedOrderId() == OrderId("smart") then call PauseUnit(GetOrderedUnit(), true) call IssueImmediateOrder(GetOrderedUnit(), "stop") call PauseUnit(GetOrderedUnit(), false) endif endfunction function Catch_Order takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterUnitEvent(t, gg_unit_hpea_0006, EVENT_UNIT_ISSUED_TARGET_ORDER) call TriggerRegisterUnitEvent(t, gg_unit_hpea_0006, EVENT_UNIT_ISSUED_POINT_ORDER) call TriggerAddAction(t, function Catch_Order_Actions) endfunction
- Worker: Worker classification has two basic effects. It displays idle worker icons when the unit has nothing to do and it prevents the unit from acquiring any targets. However if you add the worker classification at runtime, it will only get the second effect and won’t show any idle worker icon at all. That’s how you can create units that ignore enemies.
call UnitAddType(u, UNIT_TYPE_PEON)
If you additionally set the unit field can flee to false it won’t even run away when attacked. To create a unit that ignores all enemies except when it is being attacked you can use ‘Apiv’ (Permanent Invisibility) with the duration set to -1 and auto acquire attack targets to false. Now the unit won’t be invisible but still not auto acquire targets.
- Suicidal/Sapper: Units that have a ‘Asds’ (Self Destruct) ability and are tagged suicidal will automatically self destruct on enemies with a right click. In many maps you probably don’t need that feature so you can abuse this unit classification to tag certain unit types. The classification can then be checked in the allowed targets field of your abilities. This can often save a lot of trigger work.
- Targeted As: With the targeted as field of units you can get another bunch of flags that can be excluded from the targets allowed of spells provided you don’t need the ground/air/hero classification that units would normally be targeted as.
- Ward: If a unit has ward classification its whole command card will be blacked out and also the shortcuts to its abilities will be disabled. Other than that ward doesn’t have any effects. The unit however can still be issued right click orders. If don’t want that you can block them with the following code.
- Adding Buffs: As mentioned above you can easily add buffs to units with custom auras that do not show icons like Aasl (Tornado Slow Aura) ability or custom auras in hidden spellbooks. Just set the effect of the aura to 0 and set the targets to only self.
- Hiding Buff Icons: Unfortunately getting rid of default buffs is not possible for many spells. Making the buff field of spells empty will usually only add the default buff of the spell. Also setting the icon to black and the tooltip to a space will not completely remove the buff, you still get an empty tooltip window popping up. The only way to sort of get rid of them is using a buff that doesn’t stack and that is already on every unit. Then casting the spell on a unit wouldn’t add any noticeable buff icon to the command card of the target because it already had that buff. Yes, it’s a pretty lame trick but the only way I know.
- Additive Buffs: Certain buffs like ‘Bpsd’ (Additive Poison) don’t get added to the target under certain conditions. In that case it doesn’t get added when the target doesn’t already have a poison buff before. This can be used to completely get rid of buffs in some cases, although it doesn’t work for all kinds of spells.
- User Interface: Often tooltips and buffs don’t show up correctly when a spell is updated to a higher level. In that case any ability can be added and removed to update the user interface. I usually base this ability off of Adis (Dispel Magic).
function UnitRefreshUI takes unit u returns nothing call UnitAddAbility(u, <refresher ability>) call UnitRemoveAbility(u, <refresher ability>) endfunction
- MakeUnitAbilityPermanent: This function enables you to make abilities stay on units when they use any kind of morphing spells. If you’re using chaos for example you should make all abilities permanent that should stay on the unit. For spells that have sub abilities like the spellbook or the effect ability of orbs you also have to make these sub abilities permanent if you don’t want to lose them.
- IssueInstantTargetOrder: The only use of this function is to make units give items from their inventory to other units. The order in this case would be smart, the target widget is the item and the instant target widget is the target unit. The ordered unit will then move towards the target unit and hand the item over.
- SetUnitX, SetUnitY: These functions are particularly useful for knockback abilities and similar stuff where you want to move units in a loop. They are a lot faster than SetUnitPosition because they omit most of the checks, which ensure that the target location is valid. That way you can create a much more fluid movement. The downside is that you’ll have to check yourself if the target location is outside the map bounds because if that’s the case the game will crash. Oh, and don’t use a loop + waits, use timers instead.
- Hidden Order Ids:
- 851971 (smart): This is a point or object targeted order that is like a right click.
- 852000 (skillmenu): This is an order with no target that opens the skill menu of heroes. If it is issued for a normal unit with triggers it will black out the command card for this unit, the command card will revert to normal after reselecting the unit.
- 851994 (buildmenu): This is an order with no target that opens up the build menu of a unit that can build structures.
- 852002 to 852007 (moveslot): These are item targeted orders that move the target item to a certain inventory slot of the ordered hero. The id 852002 will move it to slot 1, the id 852003 will move it to slot 2 and so on.
- 852008 to 852013 (useslot): These are orders that will make the ordered hero use the item in a certain inventory slot. If it’s an order with no target or object or point targeted depends on the type of item. The id 852008 will use the item in slot 1, the id 852009 will use the item in slot 2 and so on.
- 851976 (cancel): This is an order with no target that is like a click on a cancel button. We used to be able to catch cancel clicks with this id back then but this id doesn’t seem to work any more.
- 851973 (stunned): This order is issued to units that get stunned by a spell, for example War Stomp (AOws). This is probably a hold position + hold fire order. The ordered unit will be unable to move and attack.
Well I hope this will help the site, so our knowhow won’t get lost even if we lose valuable members