- 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.
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
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
- 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.
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