• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Any arrow key movement system that matches this description?

Status
Not open for further replies.
Level 7
Joined
Oct 8, 2008
Messages
200
Hello I tried many arrow key systems so far and for some reason none of them work. The thing is I need an arrow key system that just orders your unit to go to the point not one that like teleports because the ones that uses jass makes your unit look weird when it stops because it stays on the walk animation and on bridges and stuff it doesn't work well since it can't go on the bridge path or like invisible platforms. Also it kinda needs to be able to use by multiple players
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I don't really understand what's so special about what you're looking for. For what I read, you just want the unit to move where it can move, right? Then you simply do:

  • Up
    • Events
      • Player 1 (Red) presses Up Arrow Key
    • Conditions
    • Actions
      • Set Up[1] = True
  • Up
    • Events
      • Player 1 (Red) presses Down Arrow Key
    • Conditions
    • Actions
      • Set Down[1] = True
  • Up
    • Events
      • Player 1 (Red) presses Left Arrow Key
    • Conditions
    • Actions
      • Set Left[1] = True
  • Up
    • Events
      • Player 1 (Red) presses Right Arrow Key
    • Conditions
    • Actions
      • Set Right[1] = True
  • Up
    • Events
      • Player 1 (Red) releases Up Arrow Key
    • Conditions
    • Actions
      • Set Up[1] = False
  • Up
    • Events
      • Player 1 (Red) releases Down Arrow Key
    • Conditions
    • Actions
      • Set Down[1] = False
  • Up
    • Events
      • Player 1 (Red) releases Left Arrow Key
    • Conditions
    • Actions
      • Set Left[1] = False
  • Up
    • Events
      • Player 1 (Red) releases Right Arrow Key
    • Conditions
    • Actions
      • Set Right[1] = False
  • Move
    • Events
      • Time - Every 0.50 seconds of the game time
    • Conditions
    • Actions
      • For Integer A from 1 to 12 (12 is the max amount of players)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Up[Integer A] equal to True
            • Then - Actions
              • Move UNIT (which unit you want) to move to ((Position of UNIT), offset of 300 towards 90 degrees)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Down[Integer A] equal to True
                • Then - Actions
                  • Move UNIT (which unit you want) to move to ((Position of UNIT), offset of 300 towards 270 degrees)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Left[Integer A] equal to True
                    • Then - Actions
                      • Move UNIT (which unit you want) to move to ((Position of UNIT), offset of 300 towards 180 degrees)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Up[Integer A] equal to True
                        • Then - Actions
                          • Move UNIT (which unit you want) to move to ((Position of UNIT), offset of 300 towards 0 degrees)
                        • Else - Actions
 
Level 7
Joined
Oct 8, 2008
Messages
200
Well its ok but can you make it a bit more smooth also is it possible to add diagonal movement? Also there's leaks
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
For diagonal movement add these actions to the 'list' of If/Then/Else commands in the last trigger. Make sure you put 1 If/Then/Else command in the Else of the previous. This to prevent 2 If/Then/Else commands to be executed at the same time, which will result in very weird behaviour. Also these new If/Then/Else commands must be placed before the ones in the previously posted If/Then/Else commands. The last 'Else - Actions' of these additional commands should contain the If/Then/Else of the If/Then/Else's in the previously posted trigger.

  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Up[Integer A] equal to True
        • Right[Integer A] equal to True
      • Then - Actions
        • Move UNIT (which unit you want) to move to ((Position of UNIT), offset of 300 towards 45 degrees)
      • Else - Actions
Do this for all 4 diagonal directions.


You can't make these triggers any smoother, except by reducing the 'Time - Every 0.50 seconds of the game time' to a faster repeating time. However, that's not an option, since it would cause major lag. Just keep it like this and it's just fine.
 
Status
Not open for further replies.
Top