• 🏆 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!

Double Pressed Key Events

Status
Not open for further replies.
Level 12
Joined
Feb 11, 2008
Messages
809
Alright as the title says I am having some problems making triggers to register double pressed key events.

I need someone to post an example trigger either in a Code wrapper or in a testmap showing how to register a player pressing the "D" key twice within a certain amount of time.

Please, thank you, and +rep with credits in my map.
 
Level 15
Joined
Sep 3, 2009
Messages
1,521
Ok i havent tested it but it should work.

2 triggers - one a periodic event and another a key press event for D.

  • KeyPress
    • Events
      • UI - Player Any Player presses D key Down with shift Allow, control Allow, alt Allow
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set Times Pressed = (Times Pressed + 1.0)
      • Trigger - Turn Periodic Event On
  • Periodic Event
    • Events
      • Timer - Every 0.2 seconds of Game Time
    • Local Variables
    • Conditions
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • Times Pressed > 0.0
        • Then
          • Variable - Set Times Pressed = (Times Pressed - 0.1)
        • Else
          • Trigger - Turn Periodic Event Off
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • Times Pressed > 1.0
        • Then
          • Comment - --------- PUT YOUR ACTIONS HERE --------------
        • Else
you can see that i only use 1 variable its pretty simple. havent tested it so im not sure if it works but it should. GL :)
 
Status
Not open for further replies.
Top