• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

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