• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How to find clicked dialog button?

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,149
Hello everyone. In my map i am using this system for years but i want to simply pass "action" when someone clicks one of these boxes.
It is confusing to me and i never understand how it works.
When players selected hero, this screen appears (check the attachment)
And sometimes it gives the item in here, and sometimes not. For example just tried with my friend. He gets the item but i am not. Item name "ITEMITEMITEMITEM"

Since 3 days me and my friends tested minimum 100 times. And finally i have decided to create topic about it.

I just want to detect who clicked button 1 (top of the picture, it says orman) and start actions.

  • Heroes Sent
    • Events
      • Unit - A unit enters Altars <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Level of (Triggering unit)) Equal to 1
      • ((Owner of (Triggering unit)) slot status) Equal to Is playing
    • Actions
      • Unit Group - Add (Triggering unit) to HerolarALL
      • Set HeroOyuncu[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Set TPUnit[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Player Group - Add (Owner of (Triggering unit)) to PG_Claw
      • Wait 1.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) is in ClanDevilPlayers) Equal to True
        • Then - Actions
          • Unit Group - Add (Triggering unit) to DevilHerolariPlayer
          • Unit Group - Add (Triggering unit) to HerolarDevilAll
          • Set HeroCountDevil = (HeroCountDevil + 1)
          • Set PlayerCountDevil = (PlayerCountDevil + 1)
          • Wait 0.20 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of GOD_Ability[1] for (Triggering unit)) Greater than or equal to 1
            • Then - Actions
              • Hero - Create ITEMITEMITEMITEM and give it to (Triggering unit)
              • Player - Set (Owner of (Triggering unit)) Current gold to 0
              • Unit - Move (Triggering unit) instantly to (Center of GameGuideDevil <gen>)
            • Else - Actions
              • Unit - Move (Triggering unit) instantly to (Center of GameGuideDevil <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) is in ClanReaperPlayers) Equal to True
        • Then - Actions
          • Unit Group - Add (Triggering unit) to ReaperHerolariPlayer
          • Unit Group - Add (Triggering unit) to HerolarReaperALL
          • Set HeroCountReaper = (HeroCountReaper + 1)
          • Set PlayerCountReaper = (PlayerCountReaper + 1)
          • Wait 0.20 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of GOD_Ability[1] for (Triggering unit)) Greater than or equal to 1
            • Then - Actions
              • Hero - Create ITEMITEMITEMITEM and give it to (Triggering unit)
              • Player - Set (Owner of (Triggering unit)) Current gold to 0
            • Else - Actions
          • Unit - Move (Triggering unit) instantly to (Center of GameGuideReaper <gen>)
        • Else - Actions
And here is the role and ability selection screen

  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set GOD_ButtonNumber = 8
    • Set GOD_Buton_Name[1] = |cff00ff00Orman|r
    • Set GOD_Buton_Name[2] = |cff87cefaDestek|r
    • Set GOD_Buton_Name[3] = |cffff8c00+120 Can, +80 Mana|r
    • Set GOD_Buton_Name[4] = |cffff8c00+3 Zirh, +100 Can|r
    • Set GOD_Buton_Name[5] = |cffff8c00+10 hasar, %15 vurus hizi|r
    • Set GOD_Buton_Name[6] = |cffff8c00+7 Strength|r
    • Set GOD_Buton_Name[7] = |cffff8c00+8 Intelligence|r
    • Set GOD_Buton_Name[8] = |cffff8c00+10 Agility|r
    • Set GOD_Ability[1] = GOD Orman
    • Set GOD_Ability[2] = GOD Destek
    • Set GOD_Ability[3] = God 3 // LifeMana
    • Set GOD_Ability[4] = God 4 // ARMOR
    • Set GOD_Ability[5] = God 5 // DAMAGE AS
    • Set GOD_Ability[6] = God 6 // str
    • Set GOD_Ability[7] = God 7 // int
    • Set GOD_Ability[8] = God 8 // agi
    • Set GOD_Sub_Ability[1] = GOD ORMAN REAL
    • Set GOD_Sub_Ability[2] = GOD DESTEK REAL
    • Set GOD_Sub_Ability[3] = GOD AS 15
    • Set GOD_Sub_Ability[4] = GOD ARMOR (+3)
    • Set GOD_Sub_Ability[5] = GOD DAMAGE 10
    • Set GOD_Sub_Ability[6] = Item Hero Stat Bonus (+6 Strength) YES
    • Set GOD_Sub_Ability[7] = Item Hero Stat Bonus (+6 Intelligence) YES
    • Set GOD_Sub_Ability[8] = Item Hero Stat Bonus (+6 Agility) YES
    • Set GOD_Sub_Ability[9] = stat int 8//
    • Set GOD_Sub_Ability[10] = stat agi 8//
    • Set GOD_Nick[1] = |cff87cefaOrman|n
    • Set GOD_Nick[2] = |cff87cefaDestek|r|n
    • Set GOD_Nick[3] = |cff87cefaMANA|r|n
    • Set GOD_Nick[4] = |cff87cefaDEF|r|n
    • Set GOD_Nick[5] = |cff87cefaDMG|r|n
    • Set GOD_Nick[6] = |cff87cefaSTR|r|n
    • Set GOD_Nick[7] = |cff87cefaINT|r|n
    • Set GOD_Nick[8] = |cff87cefaAGI|r|n
  • Ability Setup
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Triggering unit) is A Hero) Equal to True
          • (Level of (Triggering unit)) Equal to 1
          • (Unit-type of (Triggering unit)) Not equal to Storm Walker Swift Strike Dummy
    • Actions
      • Set MB_Bool[(Player number of (Owner of (Triggering unit)))] = True
      • Set GOD_PlayerNumber = (Player number of (Owner of (Triggering unit)))
      • Set GOD_Hero[GOD_PlayerNumber] = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • mod_test Equal to False
        • Then - Actions
          • Player - Limit training of Heroes to 0 for (Owner of (Triggering unit))
        • Else - Actions
      • For each (Integer GOD_B) from 1 to GOD_ButtonNumber, do (Actions)
        • Loop - Actions
          • Dialog - Change the title of GOD_Dialog[GOD_PlayerNumber] to |cffff8c00Bonus yet...
          • Dialog - Create a dialog button for GOD_Dialog[GOD_PlayerNumber] labelled GOD_Buton_Name[GOD_B]
          • Set GOD_DialogButton[(((GOD_PlayerNumber - 1) x 8) + GOD_B)] = (Last created dialog Button)
      • Dialog - Show GOD_Dialog[GOD_PlayerNumber] for (Player(GOD_PlayerNumber))
  • Dialog Button
    • Events
      • Dialog - A dialog button is clicked for GOD_Dialog[1]
      • Dialog - A dialog button is clicked for GOD_Dialog[2]
      • Dialog - A dialog button is clicked for GOD_Dialog[3]
      • Dialog - A dialog button is clicked for GOD_Dialog[4]
      • Dialog - A dialog button is clicked for GOD_Dialog[5]
      • Dialog - A dialog button is clicked for GOD_Dialog[6]
      • Dialog - A dialog button is clicked for GOD_Dialog[7]
      • Dialog - A dialog button is clicked for GOD_Dialog[8]
      • Dialog - A dialog button is clicked for GOD_Dialog[9]
      • Dialog - A dialog button is clicked for GOD_Dialog[10]
      • Dialog - A dialog button is clicked for GOD_Dialog[11]
      • Dialog - A dialog button is clicked for GOD_Dialog[12]
    • Conditions
    • Actions
      • For each (Integer GOD_A) from 1 to 96, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to GOD_DialogButton[GOD_A]
            • Then - Actions
              • Set GOD_TempInteger[1] = GOD_A
              • Set GOD_TempInteger[2] = (Player number of (Triggering player))
              • Set GOD_TempInteger[3] = (GOD_TempInteger[2] - 1)
              • Set GOD_TempInteger[4] = (GOD_TempInteger[3] x 8)
              • Set GOD_TempInteger[5] = (GOD_TempInteger[1] - GOD_TempInteger[4])
              • Game - Display to (Player group((Triggering player))) the text: (|cffb4b4b4Seçtigin özellik |r + (GOD_Buton_Name[GOD_TempInteger[5]] + |cffb4b4b4 Basarılar...|r))
              • Unit - Add GOD_Ability[GOD_TempInteger[5]] to GOD_Hero[(Player number of (Triggering player))]
              • -------- --------
              • Custom script: call UnitMakeAbilityPermanent(udg_GOD_Hero[GetConvertedPlayerId(GetTriggerPlayer())], true, udg_GOD_Ability[udg_GOD_TempInteger[5]])
              • Custom script: call UnitMakeAbilityPermanent(udg_GOD_Hero[GetConvertedPlayerId(GetTriggerPlayer())], true, 'A03Y')
              • For each (Integer B) from 1 to 12, do (Actions)
                • Loop - Actions
                  • Custom script: call UnitMakeAbilityPermanent(udg_GOD_Hero[GetPlayerId(GetTriggerPlayer()) + 1], true, udg_GOD_Sub_Ability[bj_forLoopBIndex])
              • -------- --------
              • Multiboard - Set the text for (Last created multiboard) item in column 8, row Table_PlayerLine[(Player number of (Triggering player))] to GOD_Nick[GOD_TempInteger[5]]
              • Set StartingAbility[(Player number of (Triggering player))] = GOD_Ability[GOD_TempInteger[5]]
              • Player - Disable GOD_Ability[GOD_TempInteger[5]] for (Triggering player)
            • Else - Actions
      • Dialog - Clear GOD_Dialog[(Player number of (Triggering player))]
Update: I have solved my issue with 2 different ways.
First one is putting 2 seconds wait after hero enters map
Second one is sending entering units different locations, then their bases because both of the triggers detects entering unit in same location.

But still i prefer understand the logic behind this trigger
 

Attachments

  • 1.png
    1.png
    443.3 KB · Views: 9
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Edit: Removed.

Also, this is unnecessary:
  • And - All (Conditions) are true
You'll rarely need to use And seeing as how it's the default behavior of Conditions.

Also, careful with putting Actions in your Loops that shouldn't be there:
  • Dialog - Change the title of GOD_Dialog[GOD_PlayerNumber] to |cffff8c00Bonus yet...
You're changing the title multiple times for no reason.

Occasionally a trigger needs a 1 frame delay (0.00 second timer) to work properly because of the timing of the Event. It can be confusing but things don't always happen the way you'd expect. Alternatively, you can use a Wait like you're doing, just note that Waits can't go below ~0.25 seconds. By using a 0.00 second Wait you'll be saying "the shortest possible Wait time".
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,149
@Uncle I made changes and
  • Ability Setup 2 Copy
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Level of (Triggering unit)) Equal to 1
      • (Unit-type of (Triggering unit)) Not equal to Storm Walker Swift Strike Dummy
    • Actions
      • Set MB_Bool[(Player number of (Owner of (Triggering unit)))] = True
      • Set GOD_PlayerNumber = (Player number of (Owner of (Triggering unit)))
      • Set GOD_Hero[GOD_PlayerNumber] = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • mod_test Equal to False
        • Then - Actions
          • Player - Limit training of Heroes to 0 for (Owner of (Triggering unit))
        • Else - Actions
      • For each (Integer GOD_B) from 1 to GOD_ButtonNumber, do (Actions)
        • Loop - Actions
          • DELETED THIS ONE FROM HERE DELETED THIS ONE FROM HERE
          • Dialog - Change the title of GOD_Dialog[GOD_PlayerNumber] to |cffff8c00Bonus yet...
          • DELETED THIS ONE FROM HERE DELETED THIS ONE FROM HERE
          • Dialog - Create a dialog button for GOD_Dialog[GOD_PlayerNumber] labelled GOD_Buton_Name[GOD_B]
          • Set GOD_DialogButton[(((GOD_PlayerNumber - 1) x 8) + GOD_B)] = (Last created dialog Button)
      • Dialog - Show GOD_Dialog[GOD_PlayerNumber] for (Player(GOD_PlayerNumber))
And now it looks like this (attachment)

It is not important to me. But is there a way to add it again?

By the way about your question (why 1 to 96 for 8 dialogs) i was created topic about that Please help me with this mathematic. and dear @Nichilus, you and me we're talked about it. Still it is a mystery to me. I am thinking like "do not touch it if it is works"
 

Attachments

  • Untitled.png
    Untitled.png
    539.6 KB · Views: 4

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
1 to 96 is correct (8*12 = 96), I was looking at the the 12 Events thinking those were 12 buttons and forgot what was actually happening here.

Anyway, that trigger looks exactly the same as before so I'm not sure what you're trying to show me.
 
Last edited:
Status
Not open for further replies.
Top