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

GUI Movement System v1.6

I created this system for a map im working on and thought it would be useful since 90% of the arrow key movement systems on here either "needs fixed" or "rejected".

This is a simple arrow-key movement system that can be imported into any map with extreme ease unlike most other systems of its kind.

Triggers

  • Movement Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Setup the units using the system. --------
      • Set GMS_PlayersHero[0] = Footman 0001 <gen>
      • Set GMS_PlayersHero[1] = Footman 0002 <gen>
      • Set GMS_PlayersHero[2] = Footman 0003 <gen>
      • Set GMS_PlayersHero[3] = Footman 0004 <gen>
      • -------- Setting the direction for each arrow key used in degrees. --------
      • Set GMS_UpDegree = 90.00
      • Set GMS_DownDegree = 270.00
      • Set GMS_LeftDegree = 180.00
      • Set GMS_RightDegree = 0.00
      • Set GMS_UpLeftDegree = 135.00
      • Set GMS_UpRightDegree = 45.00
      • Set GMS_DownLeftDegree = 225.00
      • Set GMS_DownRightDegree = 315.00
      • -------- Setting the distance for the units to move each time in each direction. --------
      • -------- Do not set the offset to anything less than 16.00 --------
      • Set GMS_UpOffset = 50.00
      • Set GMS_DownOffset = 50.00
      • Set GMS_LeftOffset = 50.00
      • Set GMS_RightOffset = 50.00
      • Set GMS_UpLeftOffset = 50.00
      • Set GMS_UpRightOffset = 50.00
      • Set GMS_DownLeftOffset = 50.00
      • Set GMS_DownRightOffset = 50.00
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set GMS_TempPlayer = (Picked player)
          • Custom script: set udg_GMS_TriggerPlayer = GetPlayerId(GetEnumPlayer())
          • -------- Locking the camera so it doesn't move from the unit. --------
          • Camera - Lock camera target for GMS_TempPlayer to GMS_PlayersHero[GMS_TriggerPlayer], offset by (0.00, 0.00) using Default rotation
          • -------- Add the events to the Movement Controller trigger. --------
          • Trigger - Add to Movement Controller <gen> the event (Player - GMS_TempPlayer Presses the Left Arrow key)
          • Trigger - Add to Movement Controller <gen> the event (Player - GMS_TempPlayer Releases the Left Arrow key)
          • Trigger - Add to Movement Controller <gen> the event (Player - GMS_TempPlayer Presses the Right Arrow key)
          • Trigger - Add to Movement Controller <gen> the event (Player - GMS_TempPlayer Releases the Right Arrow key)
          • Trigger - Add to Movement Controller <gen> the event (Player - GMS_TempPlayer Presses the Down Arrow key)
          • Trigger - Add to Movement Controller <gen> the event (Player - GMS_TempPlayer Releases the Down Arrow key)
          • Trigger - Add to Movement Controller <gen> the event (Player - GMS_TempPlayer Presses the Up Arrow key)
          • Trigger - Add to Movement Controller <gen> the event (Player - GMS_TempPlayer Releases the Up Arrow key)
  • Movement Controller
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_GMS_id = GetHandleId( GetTriggerEventId() ) - 260
      • Set GMS_TempPlayer = (Triggering player)
      • Custom script: set udg_GMS_TriggerPlayer = GetPlayerId(udg_GMS_TempPlayer)
      • Player Group - Add GMS_TempPlayer to GMS_TriggerPlayerGroup
      • -------- Updating key status --------
      • Custom script: if udg_GMS_id / 2 * 2 != udg_GMS_id then
      • -------- If pressing keys --------
      • Set GMS_Keys[(((GMS_id / 2) + 1) + (GMS_TriggerPlayer x 12))] = True
      • Custom script: else
      • -------- If releasing keys --------
      • Set GMS_Keys[((GMS_id / 2) + (GMS_TriggerPlayer x 12))] = False
      • Custom script: endif
      • -------- If no arrow keys are pressed then it removes the player from the system. --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • GMS_Keys[(1 + (GMS_TriggerPlayer x 12))] Equal to (==) False
            • GMS_Keys[(2 + (GMS_TriggerPlayer x 12))] Equal to (==) False
            • GMS_Keys[(3 + (GMS_TriggerPlayer x 12))] Equal to (==) False
            • GMS_Keys[(4 + (GMS_TriggerPlayer x 12))] Equal to (==) False
          • Then - Actions
            • Player Group - Remove GMS_TempPlayer from GMS_TriggerPlayerGroup
          • Else - Actions
  • Movement System
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in GMS_TriggerPlayerGroup and do (Actions)
        • Loop - Actions
          • Custom script: set udg_GMS_TriggerPlayer = GetPlayerId(GetEnumPlayer())
          • Set GMS_TempPoint = (Position of GMS_PlayersHero[GMS_TriggerPlayer])
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • GMS_Keys[(4 + (GMS_TriggerPlayer x 12))] Equal to (==) True
              • Then - Actions
                • Set GMS_TempPoint2 = (GMS_TempPoint offset by GMS_UpOffset towards GMS_UpDegree degrees)
                • Unit - Order GMS_PlayersHero[GMS_TriggerPlayer] to Move To GMS_TempPoint2
                • Custom script: call RemoveLocation(udg_GMS_TempPoint2)
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • GMS_Keys[(3 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                  • Then - Actions
                    • Set GMS_TempPoint2 = (GMS_TempPoint offset by GMS_DownOffset towards GMS_DownDegree degrees)
                    • Unit - Order GMS_PlayersHero[GMS_TriggerPlayer] to Move To GMS_TempPoint2
                    • Custom script: call RemoveLocation(udg_GMS_TempPoint2)
                  • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • GMS_Keys[(1 + (GMS_TriggerPlayer x 12))] Equal to (==) True
              • Then - Actions
                • Set GMS_TempPoint2 = (GMS_TempPoint offset by GMS_LeftOffset towards GMS_LeftDegree degrees)
                • Unit - Order GMS_PlayersHero[GMS_TriggerPlayer] to Move To GMS_TempPoint2
                • Custom script: call RemoveLocation(udg_GMS_TempPoint2)
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • GMS_Keys[(2 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                  • Then - Actions
                    • Set GMS_TempPoint2 = (GMS_TempPoint offset by GMS_RightOffset towards GMS_RightDegree degrees)
                    • Unit - Order GMS_PlayersHero[GMS_TriggerPlayer] to Move To GMS_TempPoint2
                    • Custom script: call RemoveLocation(udg_GMS_TempPoint2)
                  • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • GMS_Keys[(4 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                • GMS_Keys[(1 + (GMS_TriggerPlayer x 12))] Equal to (==) True
              • Then - Actions
                • Set GMS_TempPoint2 = (GMS_TempPoint offset by GMS_UpLeftOffset towards GMS_UpLeftDegree degrees)
                • Unit - Order GMS_PlayersHero[GMS_TriggerPlayer] to Move To GMS_TempPoint2
                • Custom script: call RemoveLocation(udg_GMS_TempPoint2)
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • GMS_Keys[(4 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                    • GMS_Keys[(2 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                  • Then - Actions
                    • Set GMS_TempPoint2 = (GMS_TempPoint offset by GMS_UpRightOffset towards GMS_UpRightDegree degrees)
                    • Unit - Order GMS_PlayersHero[GMS_TriggerPlayer] to Move To GMS_TempPoint2
                    • Custom script: call RemoveLocation(udg_GMS_TempPoint2)
                  • Else - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • GMS_Keys[(3 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                        • GMS_Keys[(1 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                      • Then - Actions
                        • Set GMS_TempPoint2 = (GMS_TempPoint offset by GMS_DownLeftOffset towards GMS_DownLeftDegree degrees)
                        • Unit - Order GMS_PlayersHero[GMS_TriggerPlayer] to Move To GMS_TempPoint2
                        • Custom script: call RemoveLocation(udg_GMS_TempPoint2)
                      • Else - Actions
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • GMS_Keys[(3 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                            • GMS_Keys[(2 + (GMS_TriggerPlayer x 12))] Equal to (==) True
                          • Then - Actions
                            • Set GMS_TempPoint2 = (GMS_TempPoint offset by GMS_DownRightOffset towards GMS_DownRightDegree degrees)
                            • Unit - Order GMS_PlayersHero[GMS_TriggerPlayer] to Move To GMS_TempPoint2
                            • Custom script: call RemoveLocation(udg_GMS_TempPoint2)
                          • Else - Actions
          • Custom script: call RemoveLocation(udg_GMS_TempPoint)
Change-Log


-Initial release.


-Removed all point leaks.


-Removed the second point leaks.


-Made the offsets to be set individually.
-Updated the comments and how to import.


-Reduced the movement controller trigger to increase efficiency.


-Greatly increased efficiency in setup trigger.
-Increased efficiency of movement controller trigger.


-Changed the way the system worked so it uses array
[0] also and is not wasted now.

Keywords:
movement, system, gui, CHA_Owner, arrow key, controller, offset.
Contents

GUI Movement System v1.6 (Map)

Reviews
17:30 Dec 3, 2012 Magtheridon96: Approved. This is a useful and robust system.

Moderator

M

Moderator

17:30 Dec 3, 2012
Magtheridon96: Approved.
This is a useful and robust system.
 
Level 33
Joined
Apr 24, 2012
Messages
5,113
Maybe ,you can cache those uncached variables like picked player and stuff.
Also,You have 8 leaks,all locations.

If i am right,you can actually remove the other events because they have already the same.So you are running to events at the same time,w/c is ugly.

I suggest put some camera rotations and angle of attack because it will be good for you system,just like The_Witchers movement system.

This system needs to be marked as needs fix.
 
Level 12
Joined
Feb 11, 2008
Messages
809
Maybe ,you can cache those uncached variables like picked player and stuff.
Also,You have 8 leaks,all locations.

If i am right,you can actually remove the other events because they have already the same.So you are running to events at the same time,w/c is ugly.

I suggest put some camera rotations and angle of attack because it will be good for you system,just like The_Witchers movement system.

This system needs to be marked as needs fix.

Updated all leaks now fixed and this is just a simple movement system so i am not including any type of camera system along with it.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
You must create 2 points when using offsets to clean up both point leaks, because offset is also a point which leaks.

Set GMS_TempPoint = position of unit
Set GMS_TempPoint2 = ((Position of (GMS_TempPoint)) offset by GMS_MovementOffset towards GMS_DownDegree degrees)


Then you should be a bit closer to approval.
 
You must create 2 points when using offsets to clean up both point leaks, because offset is also a point which leaks.

Set GMS_TempPoint = position of unit
Set GMS_TempPoint2 = ((Position of (GMS_TempPoint)) offset by GMS_MovementOffset towards GMS_DownDegree degrees)

Then you should be a bit closer to approval.[/QUOTE]

He's wrong; Position of TempPoint????
:D
  • Set GMS_TempPoint2 = GMS_TempPoint offset by GMS_MovementOffset towards GMS_DownDegree degrees
This is the Correct trigger :D
 
Level 12
Joined
Feb 11, 2008
Messages
809
Okay now all the point leaks should be taken care of and also on the next version i was thinking of making it to were you can change the movement offset to w/e for each arrow key instead of just 1 offset for all sound like a good idea?

EDIT*

common guys i need some suggestions should i make each offset changeable seperately or should it remain how it is?

if i changed it then you would be able to customize how far the unit could move with each arrow key seperately but if i did that then there would be 7 more variables added to the list and the question is that too much overhead? if not ill definitely update but other than that i think this system is good to go at this point!

EDIT 2*

New version now uploaded with the offsets being set individually and all comments and the how to import updated!
 
Last edited:
Geries was able to make your trigger shorter:

  • Movement Controller
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_GMS_id = GetHandleId( GetTriggerEventId() ) - 260
      • Set GMS_TempPlayer = (Triggering player)
      • Set GMS_TriggerPlayer = (Player number of GMS_TempPlayer)
      • -------- Updating key status --------
      • Custom script: if udg_GMS_id / 2 * 2 != udg_GMS_id then
      • -------- If pressing --------
      • Set GMS_Keys[((( GMS_id / 2 ) + 1 ) + ( GMS_TriggerPlayer * 12 ))] = True
      • Player Group - Add GMS_TempPlayer to GMS_TriggerPlayerGroup
      • Custom script: else
      • -------- If releasing --------
      • Set GMS_Keys[(( GMS_id / 2 ) + ( GMS_TriggerPlayer * 12 ))] = False
      • -------- If no arrow keys are pressed then it removes the player from the system. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GMS_Keys[( GMS_TriggerPlayer * 12 )] Equal to (==) False
          • GMS_Keys[( 1 + ( GMS_TriggerPlayer * 12 ))] Equal to (==) False
          • GMS_Keys[( 2 + ( GMS_TriggerPlayer * 12 ))] Equal to (==) False
          • GMS_Keys[( 3 + ( GMS_TriggerPlayer * 12 ))] Equal to (==) False
        • Then - Actions
          • Player Group - Remove GMS_TempPlayer from GMS_TriggerPlayerGroup
        • Else - Actions
      • Custom script: endif
He used the same method that Bribe used in ArrowKeyEvent.

This way, you only use 1 array.
I'd recommend speaking to him about it :p
 
Level 12
Joined
Feb 11, 2008
Messages
809
Geries was able to make your trigger shorter:

  • Movement Controller
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_GMS_id = GetHandleId( GetTriggerEventId() ) - 260
      • Set GMS_TempPlayer = (Triggering player)
      • Set GMS_TriggerPlayer = (Player number of GMS_TempPlayer)
      • -------- Updating key status --------
      • Custom script: if udg_GMS_id / 2 * 2 != udg_GMS_id then
      • -------- If pressing --------
      • Set GMS_Keys[((( GMS_id / 2 ) + 1 ) + ( GMS_TriggerPlayer * 12 ))] = True
      • Player Group - Add GMS_TempPlayer to GMS_TriggerPlayerGroup
      • Custom script: else
      • -------- If releasing --------
      • Set GMS_Keys[(( GMS_id / 2 ) + ( GMS_TriggerPlayer * 12 ))] = False
      • -------- If no arrow keys are pressed then it removes the player from the system. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GMS_Keys[( GMS_TriggerPlayer * 12 )] Equal to (==) False
          • GMS_Keys[( 1 + ( GMS_TriggerPlayer * 12 ))] Equal to (==) False
          • GMS_Keys[( 2 + ( GMS_TriggerPlayer * 12 ))] Equal to (==) False
          • GMS_Keys[( 3 + ( GMS_TriggerPlayer * 12 ))] Equal to (==) False
        • Then - Actions
          • Player Group - Remove GMS_TempPlayer from GMS_TriggerPlayerGroup
        • Else - Actions
      • Custom script: endif
He used the same method that Bribe used in ArrowKeyEvent.

This way, you only use 1 array.
I'd recommend speaking to him about it :p

hmmmm thanks for showing me this im looking into it now.
 
Level 4
Joined
Sep 9, 2010
Messages
12
Hello, first off I'd like to say that this is probably the most smooth GUI arrow key movement system I've come across so far.

However, there seems to be a problem with handling collision. Whenever my unit bumps into anything that has collision except units (pathing blocker, tree, cliff, etc.), the unit gets stuck for a few seconds. You have to release all arrow keys and then wait until the 'stop' order is issued before you can do anything at all again. For some reason this does not happen when you collide with other units. I suggest spawning a few trees, a cliff and a wall of pathing blockers for yourself to test it out. It can get really frustrating at times.

I just figured to put it out there if you have any intention of further improving an already great system. Thanks! :D
 
Top