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

[Trigger] Glitchy Selection Detector

Status
Not open for further replies.
Level 2
Joined
Aug 17, 2005
Messages
22
In my map, units fight on a grid, and use dummy abilities to move. However it used to be that you could only move one unit at a time, which was slow, and looked rather stupid. I changed it to do all units selected by the player, and that worked, kind of. There were random bugs, like units getting more mana, or not moving, or units that weren't selected moving, etc. Here's my trigger.

  • Move North
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Move North waterelemental
    • Actions
      • Set TEMP_UGROUP = (Units currently selected by (Triggering player))
      • Unit Group - Pick every unit in TEMP_UGROUP and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • Or - Any (Conditions) are true
                • Conditions
                  • (Mana of (Picked unit)) Greater than or equal to 1.00
                  • (Picked unit) Equal to (Casting unit)
            • Then - Actions
              • Set TEMP_POINT = (Position of (Picked unit))
              • Set TEMP_POINT = (TEMP_POINT offset by (0.00, 128.00))
              • Set TEMP_UGROUP2 = (Units within 50.00 of TEMP_POINT)
              • Set TEMP_INT = (Number of units in TEMP_UGROUP2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TEMP_INT Equal to 0
                • Then - Actions
                  • Unit - Pause (Picked unit)
                  • If ((Picked unit) Not equal to (Casting unit)) then do (Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 1.00)) else do (Do nothing)
                  • Unit - Make (Picked unit) face TEMP_POINT over 0.00 seconds
                  • Animation - Play (Picked unit)'s walk animation
                  • Unit - Set the custom value of (Picked unit) to 0
                  • Unit Group - Add (Picked unit) to MOVE_GROUP_NORTH
                • Else - Actions
                  • Unit - Set mana of (Picked unit) to ((Mana of (Casting unit)) + 1.00)
                  • Set TEMP_POINT = (Position of (Picked unit))
                  • Floating Text - Create floating text that reads Cannot move there. at TEMP_POINT with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
            • Else - Actions
      • Game - Enable selection and deselection functionality (Enable selection circles)
The unit group it's added to near the end is moved North every 0.02 seconds.

The units currently selected by triggering player seems to be causing all kinda of problems, including making random bugs without a pattern I can see. Some units will move but not have any mana subtracted, some unselected units will move and lose all their mana.

Is there a better way to do this?
 
Level 2
Joined
Aug 17, 2005
Messages
22
Ugh, I feared as much. I was thinking up other ways, such as making battalions of units, but they all seemed too "bulky" in game. I also have to think up how I'd do that, because I can't use custom values, since I use them for movement.
 
Status
Not open for further replies.
Top