• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Spell] Generic buff recognition

Level 12
Joined
Jul 5, 2014
Messages
527
Is it possible to have the game be alert for a buff without giving a specific target? The only trigger I know is a boolean which checks a specific unit's buff. However, since "target of ability" is bugged as hell, I struggle to have the game recognize units with this buff.
 
Level 12
Joined
Jul 5, 2014
Messages
527
The event response Target unit of ability being cast is only valid for as long as the ability is actually being cast. Setting the unit to a variable right at the start of the event should fix any issues with it.
Setting the unit how? Potentially, the target is any enemy and the buff recognition doesn't seem to allow unit groups to be recognized.
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,527
Setting the unit how? Potentially, the target is any enemy and the buff recognition doesn't seem to allow unit groups to be recognized.
A unit can have a buff. A unit group is a group of units. Therefore a unit group has access to any and all buffs along with the unit they're attached to.

But what are you trying to accomplish exactly? It sounds like you're entering the territory of indexing and tracking data over time.
 
Level 12
Joined
Jul 5, 2014
Messages
527
A unit can have a buff. A unit group is a group of units. Therefore a unit group has access to any and all buffs along with the unit they're attached to.

But what are you trying to accomplish exactly? It sounds like you're entering the territory of indexing and tracking data over time.
It's a hero skill that causes a debuff, and also meant to make the unit share its vision with the caster while affected. However, that would be a pretty big group, since almost all enemies can be the victims of that spell.
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,527
It's a hero skill that causes a debuff, and also meant to make the unit share its vision with the caster while affected. However, that would be a pretty big group, since almost all enemies can be the victims of that spell.
That sounds like Faerie Fire with no armor reduction.

If that doesn't work, you'll want to use Unit Indexing if it's MUI, otherwise you can do it without a Unit Indexer. The idea is that each hero with the skill has their own Unit Group (indexed in an array). When you cast the ability you would grant shared vision of the target and add it to the caster's Unit Group. Then you turn on a Loop trigger which is a trigger with a short Periodic Interval that will constantly loop over the units inside the Unit Groups and check the status of their Buffs. If a unit doesn't have the buff then you can remove the shared vision from them and remove them from the Unit Group. Turn off the trigger once the group is empty.

Variables needed:

If multiple casters:
Caster_Group = Unit Group
Enemy_Group = Unit Group Array (relying on a Unit Indexer)

If one caster:
Enemy_Group = Unit Group (no array needed)

Triggers needed in both cases:
1 Cast Trigger
1 Loop Trigger (Initially off and is toggled on/off as needed)
 
Last edited:
Level 12
Joined
Jul 5, 2014
Messages
527
That sounds like Faerie Fire with no armor reduction.

If that doesn't work, you'll want to use Unit Indexing. Each hero with the skill has their own Unit Group (or just one Unit Group if only hero exists). When you cast the ability you add (Target unit of ability being cast) to the Unit Group and grant Shared vision of it. Then you turn on a Loop trigger, this is a trigger with a short Periodic Interval that will constantly loop over the units inside and check the status of their Buffs. If a unit doesn't have the buff then you can remove the shared vision and remove it from the Unit Group.
Crap. It does have armor reduction, so it's literally fairy fire. I didn't realize fairy fire gives vision. Now I'll have to find something else, I want to avoid that close resemblance to existing spells.
 
Level 43
Joined
Feb 27, 2007
Messages
5,429
Setting the unit how? Potentially, the target is any enemy and the buff recognition doesn't seem to allow unit groups to be recognized.
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • ??
  • Actions
    • Set UnitVariableYouOnlyUseForThisTrigger = (Target unit of ability being cast)
    • //do whatever you want with that variable now
To understand why it seems “bugged as hell” to you, peruse this repository of knowledge: Event Response Myths

You can also shadow the global variable locally which will allow it to work after waits without being overwritten by concurrent trigger firings. This method is detailed here: local udg_
Now I'll have to find something else, I want to avoid that close resemblance to existing spells.
In my opinion I don’t think you should worry about this. There are many WC3 effects that are just basic building blocks of abilities. Paradoxically, trying to only think outside the box may be more limiting than it is liberating. Are you going to not have any abilities that increase attack speed just because Bloodlust exists? Are heals out because Holy Light exists?

Obviously you do you, but that’s my input. It’s okay to be generic; trying not to be generic can also lead to unnecessarily complex effects that are hard to understand or to properly use.
 
Level 12
Joined
Jul 5, 2014
Messages
527
To understand why it seems “bugged as hell” to you, peruse this repository of knowledge: Event Response Myths
I've read it but I don't recall it explained why it's bugged.
Are heals out because Holy Light exists?
I'm not against having abilities that are similar to others. But my original idea turned out to be literally fairy fire with different name, animation and was supposed to be not auto-cast. It would need serious triggering to have a completely unique spell but I'm trying to be at least a little distinct, if nothing else. Even if it's something like shield bash, which is a melee version of firebolt with lower damage, higher stun and a requirement.
 
Level 43
Joined
Feb 27, 2007
Messages
5,429
It’s not really a bug, that’s why. Ability Being Cast is not wait-safe (it functions like a global variable that is updated any time any ability is cast), and so things that depend on it also don’t work after a wait. Since the ability casts are tracked effectively globally rather than ‘local’ to each cast, in order to avoid returning questionable information the functions don’t return anything at all after a wait.

All I’m saying is that rebranded Faerie Fire is perfectly okay in my books. You came to the conclusion that an ability that does that specifically is a good fit for whatever part of your map you’re working on. I think re-theming an basic wc3 ability is a perfectly fine thing to do; instead of magically removing their armor you could stick the target with a tracking/homing device, shoot them with an arrow that illuminates them, enrapture them to confuse their allegiance, etc..

There’s just no need to trigger the abilities if you can re-theme with just Object Editor tweaks, as you’ve discovered here. My friend Kyrbi0 was fond of such techniques for many years and he has produced a wide array of cool melee-adjacent stuff without it feeling repetitive/stolen from base wc3.
 
Level 12
Joined
Jul 5, 2014
Messages
527
It’s not really a bug, that’s why. Ability Being Cast is not wait-safe (it functions like a global variable that is updated any time any ability is cast), and so things that depend on it also don’t work after a wait. Since the ability casts are tracked effectively globally rather than ‘local’ to each cast, in order to avoid returning questionable information the functions don’t return anything at all after a wait.
There's no wait in my trigger and "finished casting" still doesn't work.

One of the problems with the ability is that I want it to be manual, rather than autocast. And as far as I know, autocast spells can't be turned non-autocast unless relying on channel. Plus, having it reveal the enemy alone is not a very useful hero skill which is why it meant to irritate the target and causing debuff.

Retheming with object editor? So far, I just used it for tracking if my things are in use. Can it redesign stuff?
 
Level 43
Joined
Feb 27, 2007
Messages
5,429
There's no wait in my trigger and "finished casting" still doesn't work.
I guess I can see this feeling unintuitive but in my mind that makes perfect sense. The ability is finished/done/over, so it doesn’t really ‘have’ a target point/unit any more. (“But it did have one before it finished so why can’t it just return that?” Probably something connected internally to the globalness of the ‘ability being cast’ response—the ability cast information is being or has already been garbage collected.)

In any case the issue here is really the event you’re using. 99.5% of the time you should use Starts the Effect as your spell cast event, since that is the point at which mana is spent, pre-cast animations have played, cooldown is active, and whatever the spell does is happening (storm bolt projectile is in flight, for example). The other events are for catching specific parts of the spell cast sequence that mostly apply to channeled spells (like Tranquility).
  • Order events occur when the unit is ordered, which occur even if the unit is out of range to cast.
  • Begins casting is the start of the cast sequence when in range, which I believe is when cast animations start.
  • Begins Channeling is something specific to channeled spells, and honestly I don’t know how it’s different from Begins Casting. Something to do with pre-channeling animations. I have never once used this event.
  • Effect occurs as described above.
  • Stops only applies to channeled spells, and only fires if the channel is interrupted before reaching its full duration. (By being issued another order prematurely or stopped via crowd control effects.)
  • Finishes occurs at the end of a successful cast after any associate animations have played, and for channeled spells only fires if the full channel duration is held without interruption.
No, there’s no real way to prevent autocast from being activated. You can catch the autocast orders by ID and order the unit to turn it off again, but the player would still hear the click sound effect and perhaps see the animation briefly. Using a fake unit/hero ability based on channel and then dummy-casting the actual spell is the only real way. That being said, knowing how to do that is an absolutely vital skill for mapmaking and you should become familiar with it; there are a variety of other reasons you may wish to do a spell cast that way, too.
Retheming with object editor?
I just mean changing ability/buff/projectile art, manipulating some of the unused data fields for a given ability, adding animation names/tags or using a dummy to cast the right spell from the right location. Small tweaks that change how the spell feels.
 
Level 12
Joined
Jul 5, 2014
Messages
527
I guess I can see this feeling unintuitive but in my mind that makes perfect sense. The ability is finished/done/over, so it doesn’t really ‘have’ a target point/unit any more. (“But it did have one before it finished so why can’t it just return that?” Probably something connected internally to the globalness of the ‘ability being cast’ response—the ability cast information is being or has already been garbage collected.)

In any case the issue here is really the event you’re using. 99.5% of the time you should use Starts the Effect as your spell cast event, since that is the point at which mana is spent, pre-cast animations have played, cooldown is active, and whatever the spell does is happening (storm bolt projectile is in flight, for example). The other events are for catching specific parts of the spell cast sequence that mostly apply to channeled spells (like Tranquility).
  • Order events occur when the unit is ordered, which occur even if the unit is out of range to cast.
  • Begins casting is the start of the cast sequence when in range, which I believe is when cast animations start.
  • Begins Channeling is something specific to channeled spells, and honestly I don’t know how it’s different from Begins Casting. Something to do with pre-channeling animations. I have never once used this event.
  • Effect occurs as described above.
  • Stops only applies to channeled spells, and only fires if the channel is interrupted before reaching its full duration. (By being issued another order prematurely or stopped via crowd control effects.)
  • Finishes occurs at the end of a successful cast after any associate animations have played, and for channeled spells only fires if the full channel duration is held without interruption.
No, there’s no real way to prevent autocast from being activated. You can catch the autocast orders by ID and order the unit to turn it off again, but the player would still hear the click sound effect and perhaps see the animation briefly. Using a fake unit/hero ability based on channel and then dummy-casting the actual spell is the only real way. That being said, knowing how to do that is an absolutely vital skill for mapmaking and you should become familiar with it; there are a variety of other reasons you may wish to do a spell cast that way, too.

I just mean changing ability/buff/projectile art, manipulating some of the unused data fields for a given ability, adding animation names/tags or using a dummy to cast the right spell from the right location. Small tweaks that change how the spell feels.
With that, I just don't see the point even having things like "finished casting" among the triggers because the reference can't recognize it.

Oh, Object Editor. I read Object Manager for some reason. Yeah I've been tinkering with that. Problem is, Channel dislikes missile art. I wanted to create an ability that shoots an arrow to a targeted point, causing and explosion with area effect stun. I had to use healing spray in the end for the animation.
 
Level 43
Joined
Feb 27, 2007
Messages
5,429
Yeah channel does not have any missile properties. The best visual solution is to use an Acid Bomb based ability that is dummy cast onto an invisible, locusted target dummy unit. You can detect damage dealt to this dummy as an ‘event’ for when the projectile reaches its destination.

Did you look at Inferno? That’s an AoE stun with a delay, so it may serve your purposes. I don’t recall if the missile travels horizontally towards the location but I believe it does? Might not have an arc, though. You can make it summon an invisible locust unit with minimal duration.
 
Level 12
Joined
Jul 5, 2014
Messages
527
Yeah channel does not have any missile properties. The best visual solution is to use an Acid Bomb based ability that is dummy cast onto an invisible, locusted target dummy unit. You can detect damage dealt to this dummy as an ‘event’ for when the projectile reaches its destination.

Did you look at Inferno? That’s an AoE stun with a delay, so it may serve your purposes. I don’t recall if the missile travels horizontally towards the location but I believe it does? Might not have an arc, though. You can make it summon an invisible locust unit with minimal duration.
Inferno was suggested to me for that spell in earlier thread (I since had to give it to another hero). So, the healing spray is the dummy spell, that shoots out a searing arrow and with some inferno delay comes an area stun with another trigger that makes a Doom special effect. It was a nightmare to design but eventually I could make it activate the stun and animation exactly when the arrow reaches the ground.
 
Level 24
Joined
Feb 27, 2019
Messages
783
  • Order events occur when the unit is ordered, which occur even if the unit is out of range to cast.
  • Begins casting is the start of the cast sequence when in range, which I believe is when cast animations start.
  • Begins Channeling is something specific to channeled spells, and honestly I don’t know how it’s different from Begins Casting. Something to do with pre-channeling animations. I have never once used this event.
  • Effect occurs as described above.
  • Stops only applies to channeled spells, and only fires if the channel is interrupted before reaching its full duration. (By being issued another order prematurely or stopped via crowd control effects.)
  • Finishes occurs at the end of a successful cast after any associate animations have played, and for channeled spells only fires if the full channel duration is held without interruption.
Begins channeling occurs before Begins casting and is valid for any ability that has the Begins casting event.
F.e. Begins channeling can be used to interrupt an ability without interrupting a unit. Start the cooldown of the ability over 0.01 seconds and voila, the unit is interrupted and will go on about its business.
Stops casting is valid for any spell that Begins channeling. It occurs when the cast is interrupted before Finishes casting or after Finishes casting if successful.
Finishes casting can for some reason occur even if the spell is unsuccessful but this knowingly to me only happens when interrupting an order during the Begins channeling phase. This is what happens in the example I gave, these events trigger in this order: Begins channeling -> Finishes casting -> Stops casting
 
Top