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

Player Click Event -- Moving units

Status
Not open for further replies.
Level 2
Joined
Aug 12, 2019
Messages
7
Hi, I'm a novice editor and this is my first map. Thank you anyone who responds. I don't know computer coding and I can't figure out how to use a tracking system I downloaded on HIVE because its all in JASS and is overwhelming for a noob like me, but I might be able to figure out something that's 2-15 lines or something that is explained to me with isolated info. The name is "System [Track]" by PurgeandFire if you know how to use it and care to explain. :p

Where thread starts:
I would like to create a way to move units instantly by selecting them and second clicking where they go. Seemed simple, but I am missing an important Trigger Event to do so. If the unit is in Region <P1> (overall area), is a hero, and is selected by player 1, then allow player 1 to move unit to <X region> inside <P1> by second clicking.

  • Moving Heroes in Starting Area P1
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set P1SelectedUnit = (Picked unit)
      • Trigger - Turn on Moving Heroes part 2 <gen>
^I have tried triggering unit and matching unit as well as picked unit. None work.
Here is where the issue is: Player 1 uses Mouse Down event. There is only Mouse up, Mouse down, and Mouse move. Now mouse move would run past too many other regions on the grid of characters in <P1> and idk what Mouse up or Mouse down does, but clicking doesn't work.

  • Moving Heroes part 2
    • Events
      • Player - Player 1 (Red) issues Mouse Down event
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (((Triggering unit) is A Hero) Equal to True) and (((Owner of (Picked unit)) Equal to Player 1 (Red)) and ((P1 <gen> contains (Picked unit)) Equal to True))
        • Then - Actions
          • Unit - Move P1SelectedUnit instantly to (Mouse Position for Triggered Mouse Event), facing 270.00 degrees
        • Else - Actions
The units moving don't have movement, so issuing a move order doesn't work, but is there a way to create a dummy ability or trigger to grant 1 movement point after selection to be able to place a move order via second click which would teleport the unit? Then, I'd have to remove the 'Move' ability given from increasing movement from 0 to 1 (would that happen automatically after setting movement back to 0?). The order would have to be limited to one of the 30 regions within <P1> which are the character slots in my turn-based map. I can't get it to work either:
  • Moving Heroes in Starting Area P1
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set P1SelectedUnit = (Triggering Unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((P1SelectedUnit is A Hero) Equal to True) and (((Owner of P1SelectedUnit) Equal to Player 1 (Red)) and ((P1 <gen> contains P1SelectedUnit) Equal to True))
        • Then - Actions
          • Unit - Set P1SelectedUnit movement speed to 1.00
          • Trigger - Turn on Moving Heroes part 2 <gen>
          • Trigger - Turn on Moving Heroes Part 3p1 <gen>
        • Else - Actions
  • Moving Heroes part 2
    • Events
      • Unit - A unit owned by Player 1 (Red) Is issued an order targeting a point
    • Conditions
    • Actions
      • Set P1RearrangeLoc = (Target point of issued order)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((P1SelectedUnit is A Hero) Equal to True) and (((Owner of P1SelectedUnit) Equal to Player 1 (Red)) and ((P1 <gen> contains P1SelectedUnit) Equal to True))
          • (Issued order) Equal to (Order(move))
        • Then - Actions
          • Unit - Move P1SelectedUnit instantly to P1RearrangeLoc, facing 270.00 degrees
        • Else - Actions
  • Moving Heroes Part 3p1
    • Events
      • Player - Player 1 (Red) Deselects a unit
    • Conditions
    • Actions
      • -------- clear stuff, revert movement, etc --------
This last one works if i click the Move button icon and select a location but not from issuing the order via a second click of the mouse.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,012
  1. Don't use Track; it's effectively deprecated/useless now unless you want a specific model to be clickable. Track uses trackables which were the only way to get mouse position prior to the new mouse position natives. Now we can get mouse position directly with the events and responses you've written above. Mouse Move events are easily understood. Mouse Down is for clicking either left or right mouse button down, and Mouse Up is for releasing the clicked button. I believe there is a condition to check for the button type: left, right, middle.

  2. Something like "triggering unit" or "target unit of issued order" are event responses and thus only return an actual value when the trigger that uses it was triggered by the appropriate event. In general, use Triggering Unit wherever you can instead of the other more specific things. Picked Unit is only used within Unit Group - Pick... action loops and refers only to the unit currently being looped over. Matching Unit is only used in conditions where the keyword Matching <Condition> is used.

  3. In this specific instance I think TU does actually get a value from the player selection event, so it should work fine (and you were likely misusing something else when you tried it). Failing that you can use the unit group Units Currently Selected by (Triggering Player) and get the unit that way.

  4. Instead of having separate triggers and variables for each player, it will definitely be in your (long term) interest to use player-number-indexed-arrays. So SelectedUnit[1] is the unit selected by P1, and SelectedUnit[4] is the unit selected by P4. This means you can have 1 trigger and then just modify the appropriate index based on the player number of the triggering player.

  5. You should understand memory leaks: Things That Leak
  • Events
    • Time - Elapsed game time is 0.50 seconds
  • Conditions
  • Actions
    • Set PlayerRegion[1] = P1 <gen>
    • Set PlayerRegion[2] = P2 <gen>
    • Set PlayerRegion[3] = P3 <gen>
    • -------- etc --------
  • Events
    • Player - Player 1 (Red) issues a Mouse Down event
    • Player - Player 2 (Blue) issues a Mouse Down event
    • Player - Player 3 (Teal) issues a Mouse Down event
    • -------- etc --------
  • Conditions
    • -------- condition to check for button would go here --------
  • Actions
    • Set PN = (Player number of (Triggering Player))
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • SelectedUnit[PN] not equal to No Unit
        • (SelectedUnit[PN] is a Hero) equal to true
        • (PlayerRegion[PN] contains SelectedUnit[PN]) equal to true
      • Then - Actions
        • Set MovePoint = (Mouse Position for triggered mouse event)
        • Unit - Move SelectedUnit[PN] instantly to MovePoint
        • Custom script: call RemoveLocation(udg_MovePoint) //see the leak tutorial to understand this
      • Else - Actions
  • Events
    • Player - Player 1 (Red) selects a unit
    • Player - Player 2 (Blue) selects a unit
    • Player - Player 3 (Teal) selects a unit
    • -------- etc --------
  • Conditions
  • Actions
    • Set PN = (Player number of (Triggering Player))
    • Set SelectedUnit[PN] = (Triggering Unit)
  • Events
    • Player - Player 1 (Red) deselects a unit
    • Player - Player 2 (Blue) deselects a unit
    • Player - Player 3 (Teal) deselects a unit
    • -------- etc --------
  • Conditions
  • Actions
    • Set PN = (Player number of (Triggering Player))
    • Set SelectedUnit[PN] = No Unit //this means that drag selecting multiple units won't teleport them all, and they'll have to be reselected one by one after moving each one
 
Level 2
Joined
Aug 12, 2019
Messages
7
Thank you! Let me try to implement it and get back :D (faster response than expected with the age of this game)

EDIT: I recreated your triggers and it works with some issues:
1) Only the first unit ordered moves, and he only moves one time. Any subsequent clicks don't do anything.
2) #1 only works if the Hero is starting in the very first region: <P1Staging1>

Also, thank you for the array variable info

  • Player Hero Slots
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Set PlayerRegion[1] = P1Staging1 <gen>
      • Set PlayerRegion[2] = P1Staging2 <gen>
      • Set PlayerRegion[3] = P1Staging3 <gen>
      • Set PlayerRegion[4] = P1Staging4 <gen>
      • Set PlayerRegion[5] = P1Staging5 <gen>
      • Set PlayerRegion[6] = P1H1 <gen>
      • Set PlayerRegion[7] = P1H2 <gen>
      • Set PlayerRegion[8] = P2H3 <gen>
      • Set PlayerRegion[9] = P1H4 <gen>
      • Set PlayerRegion[10] = P1H5 <gen>
      • Set PlayerRegion[11] = P1H6 <gen>
      • Set PlayerRegion[12] = P1H7 <gen>
      • Set PlayerRegion[13] = P1H8 <gen>
      • Set PlayerRegion[14] = P1H9 <gen>
      • Set PlayerRegion[15] = P1H10 <gen>
      • Set PlayerRegion[16] = P1H11 <gen>
      • Set PlayerRegion[17] = P1H12 <gen>
      • Set PlayerRegion[18] = P1H13 <gen>
      • Set PlayerRegion[19] = P1H14 <gen>
      • Set PlayerRegion[20] = P1H15 <gen>
      • Set PlayerRegion[21] = P1H16 <gen>
      • Set PlayerRegion[22] = P1H17 <gen>
      • Set PlayerRegion[23] = P1H18 <gen>
      • Set PlayerRegion[24] = P1H19 <gen>
      • Set PlayerRegion[25] = P1H20 <gen>
      • Set PlayerRegion[26] = P1H21 <gen>
      • Set PlayerRegion[27] = P1H22 <gen>
      • Set PlayerRegion[28] = P1H23 <gen>
      • Set PlayerRegion[29] = P1H24 <gen>
      • Set PlayerRegion[30] = P1H25 <gen>
      • Set PlayerRegion[31] = P2Staging1 <gen>
      • Set PlayerRegion[32] = P2Staging2 <gen>
      • Set PlayerRegion[33] = P2Staging3 <gen>
      • Set PlayerRegion[34] = P2Staging4 <gen>
      • Set PlayerRegion[35] = P2Staging5 <gen>
      • Set PlayerRegion[36] = P2H1 <gen>
      • Set PlayerRegion[37] = P2H2 <gen>
      • Set PlayerRegion[38] = P2H3 <gen>
      • Set PlayerRegion[39] = P2H4 <gen>
      • Set PlayerRegion[40] = P2H5 <gen>
      • Set PlayerRegion[41] = P2H6 <gen>
      • Set PlayerRegion[42] = P2H7 <gen>
      • Set PlayerRegion[43] = P2H8 <gen>
      • Set PlayerRegion[44] = P2H9 <gen>
      • Set PlayerRegion[45] = P2H10 <gen>
      • Set PlayerRegion[46] = P2H11 <gen>
      • Set PlayerRegion[47] = P2H12 <gen>
      • Set PlayerRegion[48] = P2H13 <gen>
      • Set PlayerRegion[49] = P2H14 <gen>
      • Set PlayerRegion[50] = P2H15 <gen>
      • Set PlayerRegion[51] = P2H16 <gen>
      • Set PlayerRegion[52] = P2H17 <gen>
      • Set PlayerRegion[53] = P2H18 <gen>
      • Set PlayerRegion[54] = P2H19 <gen>
      • Set PlayerRegion[55] = P2H20 <gen>
      • Set PlayerRegion[56] = P2H21 <gen>
      • Set PlayerRegion[57] = P2H22 <gen>
      • Set PlayerRegion[58] = P2H23 <gen>
      • Set PlayerRegion[59] = P2H24 <gen>
      • Set PlayerRegion[60] = P2H25 <gen>
I have 180 more regions to go, but I don't suppose there's a faster way.
  • Moving
    • Events
      • Player - Player 1 (Red) issues Mouse Down event
      • Player - Player 2 (Blue) issues Mouse Down event
      • Player - Player 3 (Teal) issues Mouse Down event
      • Player - Player 4 (Purple) issues Mouse Down event
      • Player - Player 5 (Yellow) issues Mouse Down event
      • Player - Player 6 (Orange) issues Mouse Down event
      • Player - Player 7 (Green) issues Mouse Down event
      • Player - Player 8 (Pink) issues Mouse Down event
    • Conditions
      • (Trigger Mouse Button) Equal to Right Mouse Button
    • Actions
      • Set PlayerNumber = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SelectedUnit[PlayerNumber] Not equal to No unit
          • (SelectedUnit[PlayerNumber] is A Hero) Equal to True
          • (PlayerRegion[PlayerNumber] contains SelectedUnit[PlayerNumber]) Equal to True
        • Then - Actions
          • Set MovePoint = (Mouse Position for Triggered Mouse Event)
          • Unit - Move SelectedUnit[PlayerNumber] instantly to MovePoint
          • Custom script: call RemoveLocation(udg_MovePoint)
        • Else - Actions
  • Selection
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
    • Conditions
    • Actions
      • Set PlayerNumber = (Player number of (Triggering player))
      • Set SelectedUnit[PlayerNumber] = (Triggering unit)
  • Selection Safeties
    • Events
      • Player - Player 1 (Red) Deselects a unit
      • Player - Player 2 (Blue) Deselects a unit
      • Player - Player 3 (Teal) Deselects a unit
      • Player - Player 4 (Purple) Deselects a unit
      • Player - Player 5 (Yellow) Deselects a unit
      • Player - Player 6 (Orange) Deselects a unit
      • Player - Player 7 (Green) Deselects a unit
      • Player - Player 8 (Pink) Deselects a unit
    • Conditions
    • Actions
      • Set PlayerNumber = (Player number of (Triggering player))
      • Set SelectedUnit[PlayerNumber] = No unit




I'm not sure I can ask this here as well because it's also something more that I didn't ask about before, but
1) how would I limit the number of units able to be in moved into any region to 1 (so that no 2 units can be in the same region at a time)?
2) Also, Is there a way to limit another player, say player 2 from moving units into Player 1's regions (<P1H1 - P1H25>, <P1Staging1-P1Staging5>) and vice versa?
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,012
Only the first unit ordered moves
Set SelectedUnit[PN] = No Unit //this means that drag selecting multiple units won't teleport them all, and they'll have to be reselected one by one after moving each one
If you want them all to move to the same point (honestly that could look kinda weird) then instead of storing SelectedUnit as a unit variable it will need to be SelectedUnits as a unit group variable (which you will assign to Units currently selected by (Triggering Player) in the selection event). Then instead of moving just that one unit you'll have to loop through the group (Unit Group - Pick...) and move them all.
he only moves one time. Any subsequent clicks don't do anything.
That shouldn't be the case. The trigger you have should constantly teleport the unit on right click as long as no units are deselected at some point in the process. The issue likely comes from this:
#1 only works if the Hero is starting in the very first region: <P1Staging1>
This is because of the (PlayerRegion[PlayerNumber] contains SelectedUnit[PlayerNumber]) Equal to True condition. I just copied the conditions you'd already written. Once it moves out of this region it will fail the condition check and not be able to move.
how would I limit the number of units able to be in moved into any region to 1 (so that no 2 units can be in the same region at a time)?
You could use some sort of "count units in region" condition check, which would fail if > 0. I don't really understand how you would want to limit units in a region but also have all selected units teleport with one click; they seem to be entirely at odds with one another.
Also, Is there a way to limit another player, say player 2 from moving units into Player 1's regions (<P1H1 - P1H25>, <P1Staging1-P1Staging5>) and vice versa?
I have 180 more regions to go, but I don't suppose there's a faster way.
It sounds to me like you're building some sort of grid-based FFA strategy map, and if you could be more specific about your map/vision it would help in suggesting best courses of action/solutions that will be useful for you. I think in general you probably shouldn't be using regions for this. Why? Because you can't bind any data to regions easily. There is clearly some important information about the regions that you will want to be storing: who 'owns' the region, what unit is present in it at any given time, where on the map is it located. (Perhaps there is more info?). If you could use a region as an array index you'd probably be fine, or if GUI had 2D arrays... but you can't and it doesn't. To this end I think you would benefit from storing this relevant information inside a hashtable.

Basically, you'd want to divide your play area into some sort of XY grid, and then use that grid's coordinates as a string key for the hashtable. Save stuff like Owner, Occupied, OccupyingUnit, etc. as necessary. Then when a unit wants to move there you get the coordinates of the clicked location, convert it into grid coordinates, then look up the information from the hashtable. I can be more specific with more details about you map. Can you post a screenshot of your terrain/region layout or just upload the map?
 
Level 2
Joined
Aug 12, 2019
Messages
7
Thanks for the response and fixes! I must've miscommunicated. I don't want more than 1 unit to move at once, and sorry I should've said what I was doing. I just didn't want to clutter my help request with annoying superfluous info :p Spot on with the guess, though! It is a FFA grid-based strategy map. Its really early in development, but terrain layout and regions are finished enough to post it, so here it is (hate the title, huge work in progress :p):

The idea with the move grid is a way to organize characters with 25 available ones per player and 5 slots for staging entering an arena or dungeon when a battle timer goes off (e.g. <P1Staging1>). I changed a ton of constants (which is pretty much all I've done so far), but the map idea was from the mobile APP "Raid: Shadow Legends." I also have to do or use another person's buff/debuff system for various unstackable and stackable buffs, but this map is a way for me to learn some basic computer logic before I go back to school for programming while I feel the Warcraft 3 nostalgia prior to the Reforged launch (learned how to use a USB like 3 years ago, so I'm really behind, haha).

I will re-post the map once I finish fixing the trigger you responded to. Unfortunately, I can't work until late tonight or tomorrow evening, but I am excited to figure this out. I'm so excited to finally be making a map since WC3 was my favorite childhood game :D. Thank you again for all the help with it!
 

Attachments

  • Raid Gauntlet.w3x
    61.8 KB · Views: 31
Last edited:
Level 2
Joined
Aug 12, 2019
Messages
7
Tried tampering with it, but I still need to read some tutorials and tinker. Minimal progress
 

Attachments

  • Raid Gauntlet.w3x
    68.3 KB · Views: 27
Level 39
Joined
Feb 27, 2007
Messages
5,012
So you have 25 total slots for units the player can use for organization. Then you choose 5 of them to go into the staging area at a time and when the timer goes off those 5 units are teleported to the actual battle arenas, right? I think in this case regions is actually totally fine; I was envisioning some sort of massive Turn-Based grid.

I fixed the script so it only allows you to teleport between the regions, swaps units already there with the one that's moving, and also only runs to check which region you clicked in if you at the very least click in the big region that covers each player's area. The heroes have movement so that kinda mucks with it and I wasn't able to issue an immediate order to stop.
 

Attachments

  • Raid Gauntlet.w3x
    69.3 KB · Views: 33
Last edited:
Level 2
Joined
Aug 12, 2019
Messages
7
So you have 25 total slots for units the player can use for organization. Then you choose 5 of them to go into the staging area at a time and when the timer goes off those 5 units are teleported to the actual battle arenas, right? I think in this case regions is actually totally fine; I was envisioning some sort of massive Turn-Based grid.

I fixed the script so it only allows you to teleport between the regions, swaps units already there with the one that's moving, and also only runs to check which region you clicked in if you at the very least click in the big region that covers each player's area. The heroes have movement so that kinda mucks with it and I wasn't able to issue an immediate order to stop.

You're the best! Thank you! Don't worry about the stop order. None of the heroes will have any movespeed in the object editor

Oh and that swap feature you added to the trigger is awesome!
 
Last edited:
Level 2
Joined
Aug 12, 2019
Messages
7
Works great! I'm going to post the trigger you added in case anyone else has this a similar issue:
  • Events
    • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Set PlayerArea[1] = P1 <gen>
      • Set PlayerArea[2] = P2 <gen>
      • Set PlayerRegion[1] = P1Staging1 <gen>
      • Set PlayerRegion[2] = P1Staging2 <gen>
      • Set PlayerRegion[3] = P1Staging3 <gen>
      • Set PlayerRegion[4] = P1Staging4 <gen>
      • Set PlayerRegion[5] = P1Staging5 <gen>
      • Set PlayerRegion[6] = P1H1 <gen>
      • Set PlayerRegion[7] = P1H2 <gen>
      • Set PlayerRegion[8] = P2H3 <gen>
      • Set PlayerRegion[9] = P1H4 <gen>
      • Set PlayerRegion[10] = P1H5 <gen>
      • Set PlayerRegion[11] = P1H6 <gen>
      • Set PlayerRegion[12] = P1H7 <gen>
      • Set PlayerRegion[13] = P1H8 <gen>
      • Set PlayerRegion[14] = P1H9 <gen>
      • Set PlayerRegion[15] = P1H10 <gen>
      • Set PlayerRegion[16] = P1H11 <gen>
      • Set PlayerRegion[17] = P1H12 <gen>
      • Set PlayerRegion[18] = P1H13 <gen>
      • Set PlayerRegion[19] = P1H14 <gen>
      • Set PlayerRegion[20] = P1H15 <gen>
      • Set PlayerRegion[21] = P1H16 <gen>
      • Set PlayerRegion[22] = P1H17 <gen>
      • Set PlayerRegion[23] = P1H18 <gen>
      • Set PlayerRegion[24] = P1H19 <gen>
      • Set PlayerRegion[25] = P1H20 <gen>
      • Set PlayerRegion[26] = P1H21 <gen>
      • Set PlayerRegion[27] = P1H22 <gen>
      • Set PlayerRegion[28] = P1H23 <gen>
      • Set PlayerRegion[29] = P1H24 <gen>
      • Set PlayerRegion[30] = P1H25 <gen>
      • Set PlayerRegion[31] = P2Staging1 <gen>
      • Set PlayerRegion[32] = P2Staging2 <gen>
      • Set PlayerRegion[33] = P2Staging3 <gen>
      • Set PlayerRegion[34] = P2Staging4 <gen>
      • Set PlayerRegion[35] = P2Staging5 <gen>
      • Set PlayerRegion[36] = P2H1 <gen>
      • Set PlayerRegion[37] = P2H2 <gen>
      • Set PlayerRegion[38] = P2H3 <gen>
      • Set PlayerRegion[39] = P2H4 <gen>
      • Set PlayerRegion[40] = P2H5 <gen>
      • Set PlayerRegion[41] = P2H6 <gen>
      • Set PlayerRegion[42] = P2H7 <gen>
      • Set PlayerRegion[43] = P2H8 <gen>
      • Set PlayerRegion[44] = P2H9 <gen>
      • Set PlayerRegion[45] = P2H10 <gen>
      • Set PlayerRegion[46] = P2H11 <gen>
      • Set PlayerRegion[47] = P2H12 <gen>
      • Set PlayerRegion[48] = P2H13 <gen>
      • Set PlayerRegion[49] = P2H14 <gen>
      • Set PlayerRegion[50] = P2H15 <gen>
      • Set PlayerRegion[51] = P2H16 <gen>
      • Set PlayerRegion[52] = P2H17 <gen>
      • Set PlayerRegion[53] = P2H18 <gen>
      • Set PlayerRegion[54] = P2H19 <gen>
      • Set PlayerRegion[55] = P2H20 <gen>
      • Set PlayerRegion[56] = P2H21 <gen>
      • Set PlayerRegion[57] = P2H22 <gen>
      • Set PlayerRegion[58] = P2H23 <gen>
      • Set PlayerRegion[59] = P2H24 <gen>
      • Set PlayerRegion[60] = P2H25 <gen>
IMPORTANT ONE


  • Moving
    • Events
      • Player - Player 1 (Red) issues Mouse Down event
      • Player - Player 2 (Blue) issues Mouse Down event
      • Player - Player 3 (Teal) issues Mouse Down event
      • Player - Player 4 (Purple) issues Mouse Down event
      • Player - Player 5 (Yellow) issues Mouse Down event
      • Player - Player 6 (Orange) issues Mouse Down event
      • Player - Player 7 (Green) issues Mouse Down event
      • Player - Player 8 (Pink) issues Mouse Down event
    • Conditions
      • (Trigger Mouse Button) Equal to Right Mouse Button
    • Actions
      • Set PlayerNumber = (Player number of (Triggering player))
      • Set MovePoint = (Mouse Position for Triggered Mouse Event)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (PlayerArea[PlayerNumber] contains MovePoint) Equal to True
          • SelectedUnit[PlayerNumber] Not equal to No unit
          • (SelectedUnit[PlayerNumber] is A Hero) Equal to True
        • Then - Actions
          • Set ValidPoint = False
          • Set SwapPoint = (Position of SelectedUnit[PlayerNumber])
          • For each (Integer A) from ((PlayerNumber - 1) x 30) to (PlayerNumber x 30), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (PlayerRegion[(Integer A)] contains MovePoint) Equal to True
                • Then - Actions
                  • Custom script: call RemoveLocation(udg_MovePoint)
                  • Set MovePoint = (Center of PlayerRegion[(Integer A)])
                  • Set SwapGroup = (Units in PlayerRegion[(Integer A)])
                  • Set ValidPoint = True
                • Else - Actions
          • For each (Integer A) from ((PlayerNumber - 1) x 30) to (PlayerNumber x 30), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (PlayerRegion[(Integer A)] contains SwapPoint) Equal to True
                • Then - Actions
                  • Custom script: call RemoveLocation(udg_SwapPoint)
                  • Set SwapPoint = (Center of PlayerRegion[(Integer A)])
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ValidPoint Equal to True
            • Then - Actions
              • Set TempPoint = (Center of PlayerArea[PlayerNumber])
              • Unit - Move SelectedUnit[PlayerNumber] instantly to TempPoint
              • Unit Group - Pick every unit in SwapGroup and do (Actions)
                • Loop - Actions
                  • Unit - Move (Picked unit) instantly to SwapPoint
              • Unit - Move SelectedUnit[PlayerNumber] instantly to MovePoint
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_SwapPoint)
          • Custom script: call DestroyGroup(udg_SwapGroup)
        • Else - Actions
      • Custom script: call RemoveLocation(udg_MovePoint)
  • Selection
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
    • Conditions
    • Actions
      • Set PlayerNumber = (Player number of (Triggering player))
      • Set SelectedUnit[PlayerNumber] = (Triggering unit)
  • [trigger]
  • Deselection
    • Events
      • Player - Player 1 (Red) Deselects a unit
      • Player - Player 2 (Blue) Deselects a unit
      • Player - Player 3 (Teal) Deselects a unit
      • Player - Player 4 (Purple) Deselects a unit
      • Player - Player 5 (Yellow) Deselects a unit
      • Player - Player 6 (Orange) Deselects a unit
      • Player - Player 7 (Green) Deselects a unit
      • Player - Player 8 (Pink) Deselects a unit
    • Conditions
    • Actions
      • Set PlayerNumber = (Player number of (Triggering player))
      • Set SelectedUnit[PlayerNumber] = No unit
 
Status
Not open for further replies.
Top