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

Gamespeed Keys

Level 5
Joined
Jun 26, 2007
Messages
63
SpeedKeys

Have you ever wanted to have more detectable keys without using a third-party program?
Well here is a single-player solution that uses the game-speed increase and decrease keys, "+" and "-".
Just put the trigger in your map, your preference GUI or JASS and then put your trigger actions after the marked point.
With the Demo it adds gold with the "+" key and subtracts gold with the "-" key.


GUI
  • SpeedKeys GUI
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current game speed) Equal to Normal
        • Then - Actions
          • Game - Set game speed to Slow
          • -------- Put your actions for the "+" key after this point --------
          • Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + 1)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current game speed) Equal to Slowest
            • Then - Actions
              • Game - Set game speed to Slow
              • -------- Put your actions for the "-" key after this point --------
              • Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) - 1)
            • Else - Actions
              • Do nothing
Add this to your initialization trigger
  • Game - Set game speed to Slow


JASS
JASS:
function Trig_SpeedKeys_JASS_Actions takes nothing returns nothing       
    if GetGameSpeed() == MAP_SPEED_NORMAL then
        call SetGameSpeed(MAP_SPEED_SLOW)
        //Put your actions for the "+" key after this point
        call SetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(0),PLAYER_STATE_RESOURCE_GOLD)+1)  
    elseif GetGameSpeed() == MAP_SPEED_SLOWEST then  
        call SetGameSpeed(MAP_SPEED_SLOW)
        //Put your actions for the "-" key after this point
       call SetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(0),PLAYER_STATE_RESOURCE_GOLD)-1)    
    endif              
endfunction

function InitTrig_SpeedKeys_JASS takes nothing returns nothing
    set gg_trg_SpeedKeys_JASS = CreateTrigger()
    call TriggerRegisterTimerEventPeriodic(gg_trg_SpeedKeys_JASS, 0.3)
    call TriggerAddAction(gg_trg_SpeedKeys_JASS, function Trig_SpeedKeys_JASS_Actions)
    call SetGameSpeed(MAP_SPEED_SLOW)
endfunction

NOTE: Game-speeds are a little strange in Wc3
Fast In-game == Normal in WE
Normal In-game == Slow in WE
Slow In-game == Slowest in WE
That is why the setting are as they are. :wink:


Due to the unique nature of the game-speed change keys you can actually hold down the + or - key
and it will keep on doing the triggered action over and over, unlike ability hot keys.
But again, this is only usable in single player.

Have fun,
-Saitek
 

Attachments

  • SpeedKeys.w3x
    17 KB · Views: 452
Top