• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger Help

Status
Not open for further replies.
Level 3
Joined
May 23, 2015
Messages
19
Hey,

I was wondering if there is a way to make a ability/buff be cast only on a specific type of unit. To be more exact, in units that have mana.

Like: cast Inner Fire only on units that have mana. Nothing exceptional.

If yes, can someone help me? My triggering skills are really terrible, any help would be greatly appreciated.

Thank you!!!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
If you don't need the Autocast functionality then you could try to use two abilities, the first being the ability that your unit casts and the second being a "dummy" ability which is cast through triggers.

The first ability would be based on something like Siphon Mana which already has hardcoded requirements for mana. The second ability would be what you want the actual effect/buff to be, so Inner Fire for example.

Then you trigger it so when your unit casts Siphon Mana:
  • Events:
  • Unit - A unit Starts the effect of an ability
  • Conditions:
  • (Ability being cast) Equal to Siphon Mana

You create a Dummy unit, Add Inner Fire to it, and order it to cast Inner Fire on the target:
  • Actions:
  • Unit - Create 1 Dummy for Triggering Player at Position of Triggering unit
  • Unit - Add a 0.50 second Generic Expiration Timer to Last created unit
  • Unit - Add Inner Fire to Last created unit
  • Unit - Order Last created unit to Human Priest - Inner Fire Target unit of ability being cast

Obviously you'd want to modify the Siphon Mana ability so that it doesn't actually do anything. It's just there to mimic the effects of a real ability -> go on cooldown, cost mana, run the trigger, etc. You may have to mess around with it's values to get it to work properly, I assume something like a 0.001 second Duration and a Mana Drain value of 0.


Otherwise, you can do something like this:
  • Events:
  • Unit - A unit Begins casting an ability
  • Conditions:
  • (Ability being cast) Equal to Your Ability
  • (Max Mana of (Target unit of ability being cast)) Equal to 0
  • Actions:
  • Unit - Order Triggering unit to Stop
This will interrupt the cast of the ability if the target has 0 max mana.

Keep in mind that if you were to use something like Inner Fire as your ability and it had Autocast toggled on, nothing would really stop your unit from trying again and again to target a mana-less unit. The AI doesn't know any better since we can't modify that.
 
Last edited:
Status
Not open for further replies.
Top