• 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] Movement System

Status
Not open for further replies.
Level 7
Joined
Apr 3, 2007
Messages
293
I can only find one tutorial on this subbject, but it sucks.... I can't find any good maps, or tutorials about keyboard movement systems. I remember a long time ago I found a realy good way to do it, but I lost the map, and I forgot the way that it showed me. Does anyone know of a good link, or tutorial on Movement key bindings?
 
Level 5
Joined
Apr 16, 2005
Messages
153
http://www.hiveworkshop.com/forums/showthread.php?t=35730&highlight=keyboard check out this thread,

To explain it, basically, you make an event that when Player 1 presses down the up arrow key, you turn on a trigger that tells your character to move forward every .2 seconds. Then a trigger set up so when you release the up arrow key it turns off the trigger.

For turning with arrow keys, Set the event for when player 1 presses left/right arrow key set the characters facing angle to (facing angle of (unit)) +5 or -5 depending on the direction you want him to move in.
 
Level 7
Joined
Apr 3, 2007
Messages
293
I already looked at that, what I REALY need is for the unit to not, move in a direction, but just to TURN. So, you just keep holding down the Up arrow key, then u press left, or right arrow keys to turn in different dirrections. Like, you hold down forward to go strait, and hold down left/right arrow key, untill you r all the way turned around so that you can go backwards.
 
Level 5
Joined
Apr 16, 2005
Messages
153
Alright, give me a second and ill write you a trigger, Im unpacking boxes from moving >.>

  • Select Hero
  • Events
    • Player - Player 1 (Red) Selects a unit
  • Conditions
    • (Owner of (Triggering unit)) Equal to (Triggering player)
  • Actions
    • Set MovingUnit = (Triggering unit)
    • Camera - Lock camera target for Player 1 (Red) to (Triggering unit), offset by (0.00, 0.00) using Default rotation
This allows you to select the person you want to move

  • Up Key
  • Events
    • Player - Player 1 (Red) Presses the Up Arrow key
  • Actions
    • Trigger - Turn on Turn <gen>
    • Trigger - Turn on Turn Copy <gen>
    • Trigger - Turn on Reverse <gen>
This turns on the turning triggers as you requested

  • Turn Left
  • Events
    • Player - Player 1 (Red) Presses the Left Arrow key
  • Actions
    • Set FacingAngle = (FacingAngle + 15.00)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • FacingAngle Greater than 360.00
      • Then - Actions
        • Set FacingAngle = (FacingAngle - 360.00)
      • Else - Actions
    • Unit - Make MovingUnit face FacingAngle over 0.20 seconds
  • Turn Right
  • Events
    • Player - Player 1 (Red) Presses the Right Arrow key
  • Actions
    • Set FacingAngle = (FacingAngle - 15.00)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • FacingAngle Less than 0.00
      • Then - Actions
        • Set FacingAngle = (FacingAngle + 360.00)
      • Else - Actions
    • Unit - Make MovingUnit face FacingAngle over 0.20 seconds
These triggers turn the unit slightly, you can rearrange the numbers for a more extreme turn

  • Reverse
    • Events
      • Player - Player 1 (Red) Presses the Down Arrow key
    • Conditions
    • Actions
      • Set FacingAngle = (FacingAngle + 180.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FacingAngle Greater than 360.00
        • Then - Actions
          • Set FacingAngle = (FacingAngle - 360.00)
        • Else - Actions
      • Unit - Make MovingUnit face FacingAngle over 0.60 seconds
This turns the hero complete around

  • Release Up Key
    • Events
      • Player - Player 1 (Red) Releases the Up Arrow key
    • Conditions
    • Actions
      • Trigger - Turn off Turn <gen>
      • Trigger - Turn off Turn Copy <gen>
      • Trigger - Turn off Reverse <gen>
This wraps it up by turning off the triggers when you release the up arrow key.
 
Last edited by a moderator:
Level 7
Joined
Apr 3, 2007
Messages
293
I've seen that tutorial b4 on other posts, but it's protected... And you didn't put in all the triggers Steel. Like, what trigger is Turn, and Turn Copy? Are those Turn Left, and Turn Right? Also that system doesn't let u move...
 
Last edited:
Level 5
Joined
Apr 16, 2005
Messages
153
Oh... lol I thought you just wanted a turning system... Ill get right on it lol

  • Movement
    • Events
      • Time - Every 0.99 seconds of game time
    • Conditions
      • ((This trigger) is on) Equal to True
    • Actions
    • Set Movespeed = (Current movement speed of (MovingUnit))
    • Set CurrentPoint = (Position of (MovingUnit))
    • Set Moveto = (Moveto offset by Movespeed towards (Facing of (MovingUnit)) degrees)
    • Unit - Order (MovingUnit) to Move To Moveto
    • Custom script: call RemoveLocation( udg_CurrentPoint )
    • Custom script: call RemoveLocation( udg_Moveto )
Add this trigger into your folder and add the action to turn on and off this trigger.
 
Status
Not open for further replies.
Top