• 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.

How to: Up button = Unit moves a bit up

Status
Not open for further replies.
Level 2
Joined
Jan 20, 2009
Messages
11
How to I do this?

Event
Condition
-Player 1 press the Up button
-Player 1 holds the Up button
Action
-Set x=Position of unit, x
-Set y=Position of unit, y
-Set x2= x , y + 50.00

Cause I'm making a game where you use the keyboard, making laptop players easy to play.
 
Level 2
Joined
Jan 20, 2009
Messages
11
hmm... it looks like through the way you do it, doees it apply to all units of red, all units of all players, or just red 1 unit?

if so, what should i do?
 
Level 2
Joined
Jan 20, 2009
Messages
11
i was thiking, not lots of people like some units, so imma make them choose which sprite they want (all of them have the same skill), so the move buttton applies to any unit for 1 player.

so in other words...

i want move up for Unit A / B / C /D / E for player 1... and if i change unit, it still works.

and yes.. sumthing like a rpg, just moving.
 
  • Events
    • Player - Player 1 (Red) Presses the Up Arrow key
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Owner of (Picked unit)) Equal to Player 1 (Red)
          • Then - Actions
            • Unit - Order (Picked unit) to Move To ((Position of (Picked unit)) offset by 50.00 towards (Facing of (Picked unit)) degrees)
          • Else - Actions
            • Do nothing
That is what you're looking for yes..? But if the player is selecting more than one unit it will make them all move.. soo.. fix it up but thats what it should look like.. =D

As for holding the up arrow key i dont think that possible..
 
Level 12
Joined
Mar 16, 2006
Messages
992
What I would use is 3 triggers. One to track when you press the button. One to track when you release the button. And one to constantly cycle while the button is pressed.

Player Presses up:
Start Movement TRIGGER

Player Releases up:
Stop Movement TRIGGER

Movement TRIGGER:
Every .X seconds
Set POINT = point offset by X, (facing angle or whatever direction)
Order UNIT to move to POINT
Destroy POINT
 
Status
Not open for further replies.
Top