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?
 
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:
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
 
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).
 
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.
Back
Top