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

Dialog Buttons Help

Status
Not open for further replies.
Level 19
Joined
Apr 10, 2010
Messages
2,789
I just need to ask some help for this trigger. Basically a dialog menu pops up after you click attack and then you select the targets which are units 1,2 and 3 for 3 units, units 1 and 2 for 2 units and unit 1 for a single unit.


  • Button Click Attack Target
    • Events
      • Dialog - A dialog button is clicked for AttackDialog
    • Conditions
    • Actions
      • Set ForestWarpLoc[1] = (Center of Unit1Forest <gen>)
      • Set ForestWarpLoc[2] = (Center of Unit2Forest <gen>)
      • Set ForestWarpLoc[3] = (Center of Unit3Forest <gen>)
      • Set ForestWarpLoc[4] = (Center of Unit4Forest <gen>)
      • Set ForestWarpLoc[5] = (Center of Unit5Forest <gen>)
      • Set ForestWarpLoc[6] = (Center of BossForest <gen>)
      • Set ForestWarpLoc[7] = (Center of ForestSpawn <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButton[1]
        • Then - Actions
          • Set DistanceAttack = (Distance between ForestWarpLoc[7] and ForestWarpLoc[1])
          • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[1]
          • Wait until (DistanceAttack Less than or equal to 100.00), checking every 1.00 seconds
          • Unit - Order Mountain King 0009 <gen> to Stop
          • Unit - Order Mountain King 0009 <gen> to Attack BattleTarget_Forest[1]
          • Wait 0.50 seconds
          • Unit - Order Mountain King 0009 <gen> to Stop
          • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[7]
          • Unit - Make Mountain King 0009 <gen> face ForestWarpLoc[6] over 0.00 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to DialogButton[2]
            • Then - Actions
              • Set DistanceAttack = (Distance between ForestWarpLoc[7] and ForestWarpLoc[2])
              • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[2]
              • Wait until (DistanceAttack Less than or equal to 100.00), checking every 1.00 seconds
              • Unit - Order Mountain King 0009 <gen> to Stop
              • Unit - Order Mountain King 0009 <gen> to Attack BattleTarget_Forest[2]
              • Wait 0.50 seconds
              • Unit - Order Mountain King 0009 <gen> to Stop
              • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[7]
              • Unit - Make Mountain King 0009 <gen> face ForestWarpLoc[6] over 0.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Clicked dialog button) Equal to DialogButton[3]
                • Then - Actions
                  • Set DistanceAttack = (Distance between ForestWarpLoc[7] and ForestWarpLoc[3])
                  • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[3]
                  • Wait until (DistanceAttack Less than or equal to 100.00), checking every 1.00 seconds
                  • Unit - Order Mountain King 0009 <gen> to Stop
                  • Unit - Order Mountain King 0009 <gen> to Attack BattleTarget_Forest[3]
                  • Wait 0.50 seconds
                  • Unit - Order Mountain King 0009 <gen> to Stop
                  • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[7]
                  • Unit - Make Mountain King 0009 <gen> face ForestWarpLoc[6] over 0.00 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Clicked dialog button) Equal to DialogButton[4]
                    • Then - Actions
                      • Set DistanceAttack = (Distance between ForestWarpLoc[7] and ForestWarpLoc[4])
                      • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[4]
                      • Wait until (DistanceAttack Less than or equal to 100.00), checking every 1.00 seconds
                      • Unit - Order Mountain King 0009 <gen> to Stop
                      • Unit - Order Mountain King 0009 <gen> to Attack BattleTarget_Forest[4]
                      • Wait 0.50 seconds
                      • Unit - Order Mountain King 0009 <gen> to Stop
                      • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[7]
                      • Unit - Make Mountain King 0009 <gen> face ForestWarpLoc[6] over 0.00 seconds
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Clicked dialog button) Equal to DialogButton[5]
                        • Then - Actions
                          • Set DistanceAttack = (Distance between ForestWarpLoc[7] and ForestWarpLoc[5])
                          • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[5]
                          • Wait until (DistanceAttack Less than or equal to 100.00), checking every 1.00 seconds
                          • Unit - Order Mountain King 0009 <gen> to Stop
                          • Unit - Order Mountain King 0009 <gen> to Attack BattleTarget_Forest[5]
                          • Wait 0.50 seconds
                          • Unit - Order Mountain King 0009 <gen> to Stop
                          • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[7]
                          • Unit - Make Mountain King 0009 <gen> face ForestWarpLoc[6] over 0.00 seconds
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Clicked dialog button) Equal to DialogButton[6]
                            • Then - Actions
                              • Set DistanceAttack = (Distance between ForestWarpLoc[7] and ForestWarpLoc[6])
                              • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[6]
                              • Wait until (DistanceAttack Less than or equal to 100.00), checking every 1.00 seconds
                              • Unit - Order Mountain King 0009 <gen> to Stop
                              • Unit - Order Mountain King 0009 <gen> to Attack BattleTarget_Forest[6]
                              • Wait 0.50 seconds
                              • Unit - Order Mountain King 0009 <gen> to Stop
                              • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[7]
                              • Unit - Make Mountain King 0009 <gen> face ForestWarpLoc[6] over 0.00 seconds
                            • Else - Actions
      • Custom script: call RemoveLocation (udg_ForestWarpLoc[1])
      • Custom script: call RemoveLocation (udg_ForestWarpLoc[2])
      • Custom script: call RemoveLocation (udg_ForestWarpLoc[3])
      • Custom script: call RemoveLocation (udg_ForestWarpLoc[4])
      • Custom script: call RemoveLocation (udg_ForestWarpLoc[5])
      • Custom script: call RemoveLocation (udg_ForestWarpLoc[6])
      • Custom script: call RemoveLocation (udg_ForestWarpLoc[7])

BattleTarget_Forest is just basically a unit.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
I posted a reply on wc3c.net for this:

Bribe said:
  • Set DistanceAttack = (Distance between ForestWarpLoc[7] and ForestWarpLoc[1])
  • Unit - Order Mountain King 0009 <gen> to Move To ForestWarpLoc[1]
  • Wait until (DistanceAttack Less than or equal to 100.00), checking every 1.00 seconds
It will basically keep waiting forever. DistanceAttack is only set once, unless some other unit is also ordered to attack (re-setting the variable and well that should key you in that it's not MUI nor MPI). You can use custom script to design your own loop that periodically resets DistanceAttack, but there are better ways. A periodic timer, combined with a decent indexing technique, can detect when the two units get within 100 distance of each other.

You also will leak all of these locations if the event happens again before all the waits can complete themselves, meaning it probably needs an entire overhaul.
 
Level 19
Joined
Apr 10, 2010
Messages
2,789
No really when you click attack. I am trying to make a turn based system for my pokemon map. I dont want to download some since I want to learn. That trigger makes them move to the target area then attack them but I am using the mountain king because I want to use it for my other maps.

EDIT:
@Bribe: I think I understand a bit.
 
Status
Not open for further replies.
Top