Correct Movement With Keyboard

WackO_WilL

New Member
Reaction score
4
I know that there have been many threads about this, But I have been searching for about 5 hours now, And came up with a bunch of different triggers, Variables, that were rather Inaccurate. So here I will post what I have got so far.

Code:
Camera
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
            Loop - Actions
                Camera - Apply Camera 002 <gen> for Player 1 (Red) over 0.00 seconds
                Camera - Lock camera target for Player 1 (Red) to Rouge Male Nightelf 0012 <gen>, offset by (0.00, 20.00) using Default rotation
                Camera - Set Player 1 (Red)'s camera Rotation to (Facing of Rouge Male Nightelf 0012 <gen>) over 0.00 seconds


Code:
Forward
    Events
        Player - Player 1 (Red) Presses the Up Arrow key
    Conditions
    Actions
        Set Red_Hero_Point = (Position of Rouge Male Nightelf 0012 <gen>)
        Unit - Order Rouge Male Nightelf 0012 <gen> to Move To (Red_Hero_Point offset by 100.00 towards 0.00 degrees)

Code:
Left
    Events
        Player - Player 1 (Red) Presses the Left Arrow key
    Conditions
    Actions
        Set Red_Hero_Point = (Position of Rouge Male Nightelf 0012 <gen>)
        Unit - Order Rouge Male Nightelf 0012 <gen> to Move To (Red_Hero_Point offset by (0.00, -5.00))


Code:
Right
    Events
        Player - Player 1 (Red) Presses the Right Arrow key
    Conditions
    Actions
        Set Red_Hero_Point = (Position of Rouge Male Nightelf 0012 <gen>)
        Unit - Order Rouge Male Nightelf 0012 <gen> to Move To (Red_Hero_Point offset by (0.00, 5.00))

Code:
Turn around
    Events
        Player - Player 1 (Red) Presses the Down Arrow key
    Conditions
    Actions
        Set Red_Hero_Point = (Position of Rouge Male Nightelf 0012 <gen>)
        Unit - Order Rouge Male Nightelf 0012 <gen> to Move To (Red_Hero_Point offset by -10.00 towards 0.00 degrees)


Code:
Stop
    Events
        Player - Player 1 (Red) Releases the Left Arrow key
        Player - Player 1 (Red) Releases the Right Arrow key
        Player - Player 1 (Red) Releases the Down Arrow key
        Player - Player 1 (Red) Releases the Up Arrow key
    Conditions
    Actions
        Unit - Order Rouge Male Nightelf 0012 <gen> to Stop
        Custom script:   call RemoveLocation(udg_Red_Hero_Point)


I will tell you my results -
Forward Makes me head in the direction of east,
Left - Makes me turn right - Easy fix
Right - Works
Turn around, Makes me head west,
-------------------------------------------------------​
What is annoying -
Forward, Left, Right, turn around, Seem to work for their Desginated Degree, And distance, But It only works when you tap the key. If I hold down the key, Then it stops after it reaches the designation of the Trigger i put in, But I want it to keep going.

Left, Right, Turn too abruptly.
-------------------------------------------------------​
I want -
Left and right to slowly turn, Making it easy to move into the more Tighter places.

Forward to go in the direction of which the unit is facing.

Turn around to make the unit whip around for easy retreat.

Also it seems that there is a 5 second cooldown before I can tap agian, Any clue why?

All in all, It should be something like Jurassic park 3rd person veiw Mode.
-------------------------------------------------------​
It would be nice if some one could throw in a little extra work for finding out how to make a trigger that when a player Acuires a hero, it attachs camera to that hero it has chosen, There are 4 heros, If that will help.

If you are going to post a trigger with variables, please state the variables, What are their propertys. It saves time to figure it out, And wastes only a small amount of yours.

Not to bribe, But I will give rep to all of those who help contribute to make a Working, Functional Accurate Keyboard Movement Trigger. And may even Post it some where for future refrence to everyone so we don't have these threads poping up anymore.

If you need anymore information, I will be accurate to tell you everybit of anything related to the question. All you have to do is ask
!

Thank you in advance. I hope this attempt at finding a good, Clean arrow key movement will not be in vain!
 

Tinki3

Special Member
Reaction score
418
Have you tried looking at this map?

From what I can see, the whole system is leaky.

For instance:

Leaks are in red.

How to fix this one? Set another point variable that offsets "Red_Hero_Point" by 100, then order your unit to move to that offset point, set by the second variable.

Code:
Forward
    Events
        Player - Player 1 (Red) Presses the Up Arrow key
    Conditions
    Actions
        Set Red_Hero_Point = (Position of Rouge Male Nightelf 0012 <gen>)
        Unit - Order Rouge Male Nightelf 0012 <gen> to Move To (Red_Hero_Point [COLOR="red"]offset by 100.00[/COLOR] towards 0.00 degrees)

You should fix those offset leaks for all your triggers, otherwise your map could get unbearably laggy.

As for your problem - I don't really want to go through your whole system and look for something that might be making it malfunction.

I suggest looking at the demo map I gave you, and maybe modifying it.
 

WackO_WilL

New Member
Reaction score
4
No no no no, THis one is what my triggers are kinda like, He moves according to the direction of the key and a Camera that doesnt rotate around the unit, And ive already seen this Map, But I couldn't change the triggers into my favor.

What I need is, Something like world of warcraft, Here let me put in my Map incase some one would want to look at it.

I thought this Would remove leaks.

Code:
Stop
    Events
        Player - Player 1 (Red) Releases the Left Arrow key
        Player - Player 1 (Red) Releases the Right Arrow key
        Player - Player 1 (Red) Releases the Down Arrow key
        Player - Player 1 (Red) Releases the Up Arrow key
    Conditions
    Actions
        Unit - Order Rouge Male Nightelf 0012 <gen> to Stop
        Custom script:   call RemoveLocation(udg_Red_Hero_Point)
 

Attachments

  • Wills land tft~.w3x
    390.6 KB · Views: 84

Evote

New Member
Reaction score
4
to make a non leaking point with offset use your knowage of trigg and edit this
Unit Group - Pick every unit in All_Units and do (Actions)
Loop - Actions
Set point[(Player number of (Owner of (Picked unit)))] = (Position of (Picked unit))
Set X[(Player number of (Owner of (Picked unit)))] = (X of point[(Player number of (Owner of (Picked unit)))])
Set Y[(Player number of (Owner of (Picked unit)))] = (Y of point[(Player number of (Owner of (Picked unit)))])
Set THETA[(Player number of (Owner of (Picked unit)))] = (Facing of (Picked unit))
Set THETA[(Player number of (Owner of (Picked unit)))] = (THETA[(Player number of (Owner of (Picked unit)))] - 90.00)
Set THETA[(Player number of (Owner of (Picked unit)))] = (THETA[(Player number of (Owner of (Picked unit)))] x -1.00)
Set X[(Player number of (Owner of (Picked unit)))] = (X[(Player number of (Owner of (Picked unit)))] + (Frame_Rate[(Player number of (Owner of (Picked unit)))] x (Sin(THETA[(Player number of (Owner of (Picked unit)))]))))
Set Y[(Player number of (Owner of (Picked unit)))] = (Y[(Player number of (Owner of (Picked unit)))] + (Frame_Rate[(Player number of (Owner of (Picked unit)))] x (Cos(THETA[(Player number of (Owner of (Picked unit)))]))))
Set point[(Player number of (Owner of (Picked unit)))] = (Point(X[(Player number of (Owner of (Picked unit)))], Y[(Player number of (Owner of (Picked unit)))]))
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
Oh my freaking giddy aunt! Evote.... that is not a good trigger.

@WackO_WilL: I think... you'd do better to learn a little Jass. Then you could use coordinates that don't leak at all, and don't need removing. Give it a go. It's easy.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top