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

Reselect

Status
Not open for further replies.
Reselect makes deselection of your units less painful.
It saves the Units a player had selected when deselecting them.
After the deselection, when not selecting an new orderable Unit, a simple mouseclick on the map (not the Interface) will reselect them. A righclick will order the reselected group to do "smart" to the wanted position.

In the game this means one can select an enemy/shop inspect it, then simply left click on the gameScreen and the units are reselected.

Didn't tested in multiplayer, but theoretical the 0s timer should be MPI-save. If one can prove otherwise please do so. Wouldn't be much to rework to gain 100% MPI-save, but wanted to avoid the second group array.


  • Reselect Timer
    • Events
      • Time - Reselect_Timer expires
    • Conditions
    • Actions
      • -------- selected nothing? --------
      • -------- selected something unorderAble? --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Reselect_LastSelected[(Player number of Reselect_TimerPlayer)] is selected by Reselect_TimerPlayer) Equal to False
              • ((Owner of Reselect_LastSelected[(Player number of Reselect_TimerPlayer)]) is giving Reselect_TimerPlayer Shared units) Equal to False
        • Then - Actions
          • -------- Yes, save group --------
          • Unit Group - Pick every unit in Reselect_Group[0] and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to Reselect_Group[(Player number of Reselect_TimerPlayer)]
              • Unit Group - Remove (Picked unit) from Reselect_Group[0]
        • Else - Actions
          • -------- New orderAble one selected, purge temp group --------
          • Unit Group - Remove all units from Reselect_Group[0]
  • Reselect Select
    • Events
    • Conditions
    • Actions
      • Set Reselect_LastSelected[(Player number of (Triggering player))] = (Triggering unit)
  • Reselect DeSelect
    • Events
    • Conditions
      • ((Owner of (Triggering unit)) is giving (Triggering player) Shared units) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to Reselect_Group[0]
      • Unit Group - Remove (Triggering unit) from Reselect_Group[(Player number of (Triggering player))]
      • -------- The 0s timer will expire when all deselection events of this group ended --------
      • Set Reselect_TimerPlayer = (Triggering player)
      • Countdown Timer - Start Reselect_Timer as a One-shot timer that will expire in 0.00 seconds
  • Reselect
    • Events
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Mouse Position X for Triggered Mouse Event) Not equal to 0.00
          • (Mouse Position Y for Triggered Mouse Event) Not equal to 0.00
      • Or - Any (Conditions) are true
        • Conditions
          • ((Owner of Reselect_LastSelected[(Player number of (Triggering player))]) is giving (Triggering player) Shared units) Equal to False
          • (Reselect_LastSelected[(Player number of (Triggering player))] is selected by (Triggering player)) Equal to False
      • (Reselect_Group[(Player number of (Triggering player))] is empty) Equal to False
    • Actions
      • -------- Avoid (de)selection Events when reselecting --------
      • Auslöser - Turn off Reselect DeSelect <gen>
      • Auslöser - Turn off Reselect Select <gen>
      • Selection - Clear selection for (Triggering player)
      • Unit Group - Pick every unit in Reselect_Group[(Player number of (Triggering player))] and do (Actions)
        • Loop - Actions
          • Selection - Add (Picked unit) to selection for (Triggering player)
      • -------- If this is an right click give the units an order --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Trigger Mouse Button) Equal to Rechte MausTaste
        • Then - Actions
          • Custom script: call GroupPointOrder( udg_Reselect_Group[GetConvertedPlayerId(GetTriggerPlayer())], "smart", BlzGetTriggerPlayerMouseX(), BlzGetTriggerPlayerMouseY())
        • Else - Actions
      • Auslöser - Turn on Reselect DeSelect <gen>
      • Auslöser - Turn on Reselect Select <gen>
  • Reselect Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Custom script: local integer index = GetConvertedPlayerId(GetEnumPlayer())
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • -------- Event Creation --------
              • Auslöser - Add to Reselect <gen> the event (Player - (Picked player) issues Drückt MausTaste event)
              • Auslöser - Add to Reselect Select <gen> the event (Player - (Picked player) Auswählen a unit)
              • Auslöser - Add to Reselect DeSelect <gen> the event (Player - (Picked player) Abwählen a unit)
              • -------- Create None existing, but needed Groups --------
              • Custom script: if udg_Reselect_Group[index] == null then
              • Custom script: set udg_Reselect_Group[index] = CreateGroup()
              • Custom script: endif
            • Else - Actions


Edit: Does someone have a good Idea for a screenshot Explaining this?
 

Attachments

  • Reselect.w3x
    25.7 KB · Views: 46
Last edited:
Status
Not open for further replies.
Top