WASD Movement Problem

Pritrostell

New Member
Reaction score
1
Ok, so I was going off of what i saw in a thread through search and copying his code pretty much down to a T. This is what i have so far...

Trigger:
  • Up Arrow Activated
    • Events
      • Player - Player 1 (Red) Presses the Up Arrow key
    • Conditions
    • Actions
      • Set UpBoolean[(Player number of (Triggering player))] = True


Trigger:
  • Up Arrow DeActivated
    • Events
      • Player - Player 1 (Red) Releases the Up Arrow key
    • Conditions
    • Actions
      • Set UpBoolean[(Player number of (Triggering player))] = False


Trigger:
  • Up Move
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to (Number of players), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UpBoolean[(Integer A)] Equal to True
            • Then - Actions
              • Set Temp_Point = (Position of Paladin 0000 <gen>)
              • Set Temp_Point_2 = ((Center of (Playable map area)) offset by 200.00 towards 90.00 degrees)
              • Unit - Order Paladin 0000 <gen> to Move To Temp_Point_2
              • Custom script: call RemoveLocation (udg_Temp_Point)
              • Custom script: call RemoveLocation (udg_Temp_Point_2)
            • Else - Actions


UpBoolean = Boolean Variable
Temp_Point = Point Variable
Temp_Point_2 = Point Variable

The only difference between my code and the one i copied is I have

Set Temp_Point_2 = ((Center of (Playable map area)) offset by 200.00 towards 90.00 degrees)

and he had

Set Temp_Point_2 = ((Center of (Playable map area)) offset by 200 towards "North").

After all that and doing some fiddling around all I get when i press up arrow is my screen scrolling. Is it possible i have the variable types wrong?

NOTE: Before that he posted a program that ran in the background that turned WASD into arrow keyes in EVERY program. Is this causing my problem as well?
 

Shura

New Member
Reaction score
45
Well firstly you should lock the camera to the unit so you can see if the unit is moving or not. Also, that code is just going to order the unit to move to the same point no matter where the unit is on the map. In the third trigger, when setting Temp_Point_2, it should be Temp_Point offset by 200.
 

Pritrostell

New Member
Reaction score
1
ok, my main problem now is how do i set is to Temp_Point_2 = Temp_Point offset by 200?

I've looked and all i see is point with offset and point with polar offset. The above was with polar offset, and with just offset i get:

Set Temp_Point_2 - Temp_Point offset by (0.00,200.00)

***0.00 being x, 200.00 being y***
 

Shura

New Member
Reaction score
45
You still use polar offset, I was just saying to use Temp_Point instead of center of playable map area.
 

Pritrostell

New Member
Reaction score
1
OMFG... i must have clicked cancel when changing that to Temp_Point... what a retarded mistake... makes sense since he was placed in the exact center of the map... by sheer coincidence at that... lemme try

Ugh works great now thanks a buch... always the stupid little things isn't it :)
 

Dirac

22710180
Reaction score
147
I would also add the movement order to the "presses the key" event trigger, because you have a to wait 0-1 s until the unit actually moves, same stuff for the "releases the key" event ordering the unit to stop, would make movement a lot nicer
 

Pritrostell

New Member
Reaction score
1
i have it changed to every.25 seconds so it isn't noticed very much, and with the game i am making it wont make much difference.

Also i had to make some adjustments to allow diagonal walking, and since there is no diagonal arrow keys it might make problems.

Thanks for the idea though, i might experiment and see if it works a little later on if i find i have problems with the slight delay
 

Pritrostell

New Member
Reaction score
1
Counts as my one bump :)

Anyways, do you know if there is a way to disable right click movement?

I have a unit selected, locked onto, and can move using the arrow keys, but i want to stop players from moving VIA right click. Any help is greatly appreciated :)
 

Shura

New Member
Reaction score
45
Well I can't think of any direct method, but you could do something like this.
Code:
trigger
    Events
        Unit - A unit Is issued an order targeting a point
        Unit - A unit Is issued an order targeting an object
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Issued order) Equal to (Order(smart))
                (Issued order) Equal to (Order(move))
                (Issued order) Equal to (Order(patrol))
                (Issued order) Equal to (Order(attack))
    Actions
        Unit - Pause (Triggering unit)
        Wait 0.01 seconds
        Unit - Unpause (Triggering unit)
        Unit - Order (Triggering unit) to Stop
Then disable this trigger when their going to move via arrow keys and re-enable it when your done. Though this will cause the player to lose control of their unit for a slight moment every time they try to manually move, and this may have to be adjusted to not interfere with anything else if your map.
 
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