• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Keyboard Movement Problems

Status
Not open for further replies.
Level 4
Joined
Jun 22, 2009
Messages
36
Hi again,
I have been having a lot of trouble with my keyboard movement triggers... when I try to use them, the unit, instead of walking forward continuously, kind of stands there and slowly jerks forward. The unit's movement is supposed to be used with an over-shoulder camera view.
So, basically, how can I fix this problem, if anyone else has ever encountered it? If not, what is some good keyboard movement code?

Also, in a mildly unrelated note, how can you stop a unit from playing a certain animation?
Thanks

Edit: Oops, sorry, I guess this should go to triggers and scripts. Sorry
 
Level 7
Joined
May 21, 2009
Messages
289
Hi again,
I have been having a lot of trouble with my keyboard movement triggers... when I try to use them, the unit, instead of walking forward continuously, kind of stands there and slowly jerks forward. The unit's movement is supposed to be used with an over-shoulder camera view.

Can you show us (THW) this trigger?
 
Level 8
Joined
Jan 8, 2010
Messages
493
what Pharaoh meant was - after doing the Copy As Text - post your trigger here by typing (without the spaces on the T RIGGERS)

[ T RIGGERS ]
--paste here. paste here!--
[ / T RIGGERS ]

or if there are too many triggers try showing the map using the pastebin. then it can be checked thoroughly :eek:
 
Level 7
Joined
May 21, 2009
Messages
289
You can also "Go Advanced" and click the little gear in the upper right of your posting options and then paste inside the
  • pastehere[TRIGGER]
  • Its the same thing as typing it, but its easier and more lazy to hit the button =p
 
Level 4
Joined
Jun 22, 2009
Messages
36
Ok, well, here's the code:

  • Move Up
    • Events
      • Player - Player 1 (Red) Presses the Up Arrow key
    • Conditions
    • Actions
      • Trigger - Turn on Turning on turning on Up <gen>
  • Up
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Order Fighter 0002 <gen> to Move To ((Position of Fighter 0002 <gen>) offset by 190.00 towards (Facing of Fighter 0002 <gen>) degrees)
  • Move Up Copy
    • Events
      • Player - Player 1 (Red) Releases the Up Arrow key
    • Conditions
    • Actions
      • Trigger - Turn off Still Turning On Up <gen>

Does this help?

Edit: Oh, yeah, here's my trigger for turning right:

  • Move Right
    • Events
      • Player - Player 1 (Red) Presses the Right Arrow key
    • Conditions
    • Actions
      • Trigger - Turn on Right <gen>
and

  • Right
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
      • Temp_Boolean_Right Equal to True
    • Actions
      • Unit - Order Fighter 0002 <gen> to Move To ((Position of Fighter 0002 <gen>) offset by 20.00 towards ((Facing of Fighter 0002 <gen>) - 10.00) degrees)
By the way, any thoughts as to how to keep a unit's animation from playing? I guess you guys have probably moved on by now, but, hey, worth a shot...
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Use SetUnitX() and SetUnitY() instead. They won't interrupt the current order of the unit like move unit instantly does. They will cause troubles with pathing though, but you can add a check there.

Also moving a unit with an offset of 190 every 0.01 seconds will move it to the edge of the map very quickly, use an offset of about 10 or even less.

Maybe I'll just create this system if one doesn't exist yet.
 
Level 3
Joined
Feb 23, 2010
Messages
73
just do this:
  • Events
    • Player - Player 1 (Red) Presses the Up Arrow key
  • Conditions
  • Actions
    • Unit - Order Fighter 0002 <gen> to Move To ((Position of Fighter 0002 <gen>) offset by 190.00 towards (Facing of Fighter 0002 <gen>) degrees)
  • Events
    • Player - Player 1 (Red) Releases the Up Arrow key
  • Conditions
  • Actions
    • Unit - Order Fighter 0002 <gen> to Stop
This way he just keeps walking smoothly until you let go of the key.
 
Level 3
Joined
Feb 23, 2010
Messages
73
also, when you turn, try making the press of the right key just change the angle that you move towards slightly, like this:
  • RIGHT_ARROW_PRESS
  • Events
    • Player - Player 1 (Red) Presses the Right Arrow Key
  • Conditions
    • Boolean_RightArrowPressed is Equal to False
  • Actions
    • Trigger - Turn (TURN_RIGHT_TRIG) on
    • Set Boolean_RightArrowPressed = True
  • TURN_RIGHT_TRIG
  • Events
    • Time - Every 0.10 seconds of the game
  • Conditions
    • Boolean_RightArrowPressed Equal to True
  • Actions
    • Set Movement_Angle = (Movement_Angle + 3)
  • RIGHT_ARROW_RELEASE
  • Events
    • Player - Player 1 (Red) Releases the Right Arrow Key
  • Conditions
    • Boolean_RightArrowPressed Equal to True
  • Actions
    • Trigger - Turn off (TURN_RIGHT_TRIG)
    • Set Boolean_RightArrowPressed = False
  • MOVE_FORWARD
  • Events
    • Player - Player 1 (Red) Presses the Up Arrow Key
  • Conditions
  • Actions
    • Set TEMP_LOC_1 = Position of (Your_Hero)
    • Unit - Order (Your_Hero) to Move to TEMP_LOC_1 offset by 500 towards Movement_Angle
    • Camera - Set Player 1 (Red)'s camera Rotation to (Movement_Angle) over 0.00 seconds
  • STOP_MOVEMENT
  • Events
    • Player - Player 1 (Red) Releases the Up Arrow Key
  • Conditions
  • Actions
    • Unit - Order (Your_Hero) to Stop
 
Status
Not open for further replies.
Top