1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  4. The Secrets of Warcraft 3 have revealed interesting works. The RESULTS for Abelhawk's Mini-Mapping Contest #15 have come out!
    Dismiss Notice
  5. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  6. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  7. Night Rider gained several songs for his journey. The poll for the 12th Music Contest has started. Check it out!
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Movement System

Discussion in 'Triggers & Scripts' started by DredLord2, Aug 1, 2007.

  1. DredLord2

    DredLord2

    Joined:
    Apr 3, 2007
    Messages:
    290
    Resources:
    0
    Resources:
    0
    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?
     
  2. Steel_Cold

    Steel_Cold

    Joined:
    Apr 16, 2005
    Messages:
    154
    Resources:
    0
    Resources:
    0
    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.
     
  3. DredLord2

    DredLord2

    Joined:
    Apr 3, 2007
    Messages:
    290
    Resources:
    0
    Resources:
    0
    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.
     
  4. Steel_Cold

    Steel_Cold

    Joined:
    Apr 16, 2005
    Messages:
    154
    Resources:
    0
    Resources:
    0
    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: Aug 1, 2007
  5. DredLord2

    DredLord2

    Joined:
    Apr 3, 2007
    Messages:
    290
    Resources:
    0
    Resources:
    0
    What variables r u using?
     
  6. Steel_Cold

    Steel_Cold

    Joined:
    Apr 16, 2005
    Messages:
    154
    Resources:
    0
    Resources:
    0
    Just two, a unit variable named MovingUnit and a real variable named Facing Angle
     
  7. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,414
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    my system DOES turn units when issued, but it was made ages ago xD
     
  8. DredLord2

    DredLord2

    Joined:
    Apr 3, 2007
    Messages:
    290
    Resources:
    0
    Resources:
    0
    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: Aug 1, 2007
  9. Steel_Cold

    Steel_Cold

    Joined:
    Apr 16, 2005
    Messages:
    154
    Resources:
    0
    Resources:
    0
    So, is my system satisfactory or do you need me to change anything?
     
  10. DredLord2

    DredLord2

    Joined:
    Apr 3, 2007
    Messages:
    290
    Resources:
    0
    Resources:
    0
    It doesn't let u move...
     
  11. Steel_Cold

    Steel_Cold

    Joined:
    Apr 16, 2005
    Messages:
    154
    Resources:
    0
    Resources:
    0
    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.