• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

I don't understand why this trigger isn't working for me...

Level 8
Joined
Apr 16, 2025
Messages
160
I reduced the trigger to the maximum for better demonstration. Why doesn't it work? If it worked, the unit's illusions would have crits, but no. (as a test, I added crits via the object editor = and illusions had crits).

I set both variables appropriately, one was set via map initialization. But it doesn't work...

p.s. I have 300 types of units on the map. I can't add this ability to each one through the object editor.

  • TEST
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set VariableSet TempUnit = (Triggering unit)
      • Unit - Add Critical Strike (Difficulty) to (Triggering unit)
      • Custom script: call UnitMakeAbilityPermanent(udg_TempUnit, true, udg_DifficultySpell)
 
A good way to debug something is to use text messages:
  • TEST
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set VariableSet TempUnit = (Triggering unit)
      • Unit - Add Critical Strike (Difficulty) to (Triggering unit)
      • Custom script: call UnitMakeAbilityPermanent(udg_TempUnit, true, udg_DifficultySpell)
      • Game - Display to (All players) for 30.00 seconds the text: (Name of (Triggering unit))
If we see the unit's name then we know that the trigger is running, particularly when the illusions enter.

So after ruling that potential issue out, I would assume the next issue is that you cannot use this "Add Ability" action on illusions:
  • Unit - Add Critical Strike (Difficulty) to (Triggering unit)
But then you'd think that doesn't matter since they inherit this ability from the real unit.

Which means that either:
1) Illusions cannot inherit "added" abilities.
2) DifficultySpell is set to the wrong ability or is being set too late.
3) You're somehow misusing UnitMakeAbilityPermanent() but I don't see how.

I believe this used to work, so a recent patch may have broken this functionality.
 
Last edited:
A good way to debug something is to use text messages:
  • TEST
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set VariableSet TempUnit = (Triggering unit)
      • Unit - Add Critical Strike (Difficulty) to (Triggering unit)
      • Custom script: call UnitMakeAbilityPermanent(udg_TempUnit, true, udg_DifficultySpell)
      • Game - Display to (All players) for 30.00 seconds the text: (Name of (Triggering unit))
If we see the unit's name then we know that the trigger is running, particularly when the illusions enter.

So after ruling that issue out, I would assume the next issue is that you cannot use this "Add Ability" action on illusions:
  • Unit - Add Critical Strike (Difficulty) to (Triggering unit)
But then you'd think that doesn't matter since they would simply inherit this ability from the real unit.

Which means that either:
1) Illusions cannot inherit "added" abilities.
2) DifficultySpell is set to the wrong ability or is being set too late.
3) You're somehow misusing UnitMakeAbilityPermanent() but I don't see how.

I believe this used to work, so a recent patch may have broken this functionality.
Yes, the question is not trivial. My hero just has such an ability = to create an illusion of an enemy that he hits. And each enemy on the map has crits. Those that are given initially are transferred to illusions, and those that are added by trigger = not.

The problem is clearly not in the trigger unit or in the ability code, since I wrote it even through "AC06", the probability that Blizzard broke the function is also insignificant, so, most likely, this is the 3 option. This is where the whole mystery lies, because I dug through the entire Internet.
 
Last edited:
At least an ability can be added to an illusion and enabled.
  • TEST
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set VariableSet TempUnit = (Triggering unit)
      • Unit - Add Critical Strike (Neutral Hostile) to TempUnit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit is an illusion) Equal to True
        • Then - Actions
          • Unit - For TempUnit, Ability Critical Strike (Neutral Hostile), Disable ability: False, Hide UI: False
        • Else - Actions
 
At least an ability can be added to an illusion and enabled.
  • TEST
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set VariableSet TempUnit = (Triggering unit)
      • Unit - Add Critical Strike (Neutral Hostile) to TempUnit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit is an illusion) Equal to True
        • Then - Actions
          • Unit - For TempUnit, Ability Critical Strike (Neutral Hostile), Disable ability: False, Hide UI: False
        • Else - Actions
Holy shit! It turns out that illusions get passive abilities, but they're hidden... That solves my problem, thank you very much!
 
Back
Top