• 🏆 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!

Problem with Functions

Status
Not open for further replies.
Level 2
Joined
Jan 25, 2011
Messages
25
Hey Guys

I have a problem, what’s the Function of the Event: Game - The 'Hero Abilitys' button is clicked?:goblin_jawdrop:

  • Event
    • Game - The 'Hero Abilities' button is clicked
  • Conditions
    • (Unit-type of (???)) Equal to Unit1
I think it’s not possible in GUI i try it many Times and it didn’t work.

Is there a way to do this in JASS or in other ways?
 
Level 2
Joined
Jan 25, 2011
Messages
25
I didn’t work it look like this:

  • Event
    • Unit - A unit Is issued an order with no target
  • Conditiones
  • Actions
    • Custom script: If GetIssuedOrderId() = 852000 then
    • Add Ability1 to (Ordered unit)
    • Custom script: endif
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
1. Is order ID 852000 the order of the dummy ability used for the button? It sounds like you do not understand the code he gave you (which generally is bad as if there is a bug in it you will not be able to fix it).
2. Is the ability no target? Targeting abilites need a different event.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
1. Is order ID 852000 the order of the dummy ability used for the button?

If you issue an immediate order with that id to a unit, it will open up the skill menu.

However detecting when the button is clicked must be done with
call TriggerRegisterGameEvent(whichTrigger, EVENT_GAME_SHOW_SKILL)

So in GUI:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: call TriggerRegisterGameEvent(gg_trg_HeroButton, EVENT_GAME_SHOW_SKILL)
  • HeroButton
    • Events
    • Conditions
    • Actions
      • Game - Display to Player Group - Player 1 (Red) the text: Clicked
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
OrderId("thunderclap") returns a constant and reliable value (the same integer number) every time it is evaluated in every session. Thus each time the trigger runs you are not only re-evaluating a statement with a constant and reliable value but also allocating it to the stack.

Instead it would be more efficient if the value was stored in a global constant (which GUI can not do... sadly.) which gets computed only once at map initialization.

Currently how it is done is probably no more efficient than just getting the issued order string and comparing it with the order string directly (saves a local allocation).
 
Level 2
Joined
Jan 25, 2011
Messages
25
I want when the Hero skill button is pressed i gives the hero an ability.

  • Events
    • what ever works
  • Conditions
    • what ever works
  • Actions
    • Unit - Add Ability1 to (Function)
 
Status
Not open for further replies.
Top