• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Simple(er) use of Key Pressed?

Status
Not open for further replies.
Level 4
Joined
Aug 7, 2012
Messages
63
SO for my map Key pressed event is used many times. I need to fin out what player pressed the key and would like not to have to create 8 different triggers.
Got any ideas?:goblin_boom:
 
You could switch the event key to Any and use the Key Pressed native to get the pressed key.

  • HerpDerp
    • Events
      • UI - Player Any Player presses Any key Down with shift Allow, control Allow, alt Allow
    • Local Variables
      • player = (Triggering player) <Integer>
      • key = (Key Pressed) <Key>
    • Conditions
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • key == Tab
        • Then
          • ------- Do something meaningful
        • Else
 
Level 4
Joined
Aug 7, 2012
Messages
63
Thanks for the feedback, but i dont know if you get what im saying.
I am making a WASD movement system, which is easy... for one player.
But I wish to make it for 8 players. But i do not want 8 triggers.
The problem is i cant get "triggering player" the native is greyed out.
 
Level 9
Joined
Dec 21, 2006
Messages
490
i can offer half of a solution.
create 8 triggers and 1 custom action with param Player. Inside those 8 triggers you call the custom action with the player number of the event as param. So you won't have to change the code 8 times each time a change occurs.
 
Status
Not open for further replies.
Top