• 🏆 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] Can you detect a button click?

Status
Not open for further replies.
Level 3
Joined
Nov 25, 2014
Messages
24
I want to be able to detect when a player clicks a button in the gui. For example,

if Some player clicks (button:Chain Lightning)
then... do this... (in addition to whatever the button would normally cause to happen)

or something very similar at least...

How can I do it? Will this require JASS? I feel like this is a novice question, but I've struggled in determining a solution through tinkering or forum scouring!

Edit: Here's the answer. (Assuming we want to detect an ability being pressed, this is similar to an ability being used. A separate trigger will be needed for other GUI.) Use the "channel" ability to have max control over the customization of your ability. To use multiple channel abilities on the same unit, simply change the "Date - Base Order ID" for each one so that the ID is unique per ability. In triggers then put...
  • Events
    • Unit - A unit Begins channeling an ability
  • Conditions
    • (Ability being cast) Equal to [Your Ability]
    • (Whatever conditions you want)
  • Actions
    • (Whatever actions you want)
    • Refer to the unit as "Triggering Unit"
 
Last edited:
Level 3
Joined
Nov 25, 2014
Messages
24
Okay, it appears to be working sometimes depending on the ability I use. For example, if I repurpose "Flare Gun," then whenever I use this ability in game, the trigger runs its effects successfully. However, when I repurpose a spell like "Magic Defense" nothing happens. (Ideally, I'd like to reuse an ability that requires only a single click instead of click, select target.)

What's going on here?

I have carefully tracked my changes so that all objects and triggers are referring to the appropriate things over my tests.
 
Level 3
Joined
Nov 25, 2014
Messages
24
Okay! Finally got everything to work! :infl_thumbs_up:

Thank you soo much. I guess "Magic Defense" is buggy? Or maybe just different. I ended up using "War Stomp" and everything works perfect.

Thank you again for your help! I'll edit my first post to give the answer to the problem just in case anyone else comes wondering the same thing.
 
Level 3
Joined
Nov 25, 2014
Messages
24
Cool! :xxd: Now using channel- required some tweaking in the triggers- and everything is working. One last question and we can call this discussion a wrap.

I'll need six instances of this channel ability. What is the best way to go about doing this so that all six don't try to fire simultaneously?
 
Status
Not open for further replies.
Top