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!
I want to make a hero's leap over problems in the map. But I can’t disable the standard spacebar function - moving the camera to the ping point. Any ideas on how to solve the problem?
One common way to do it is to periodically set the camera "quick position" to the player's current camera position. This controls where the camera goes when the spacebar button is pressed. Here is an example of how you'd do that:
This does the same thing as "Camera - Set Spacebar-Point", but the custom script above is a lot more concise and works for all players. You can also feel free to tweak the interval (0.02 seconds) to your liking. I found that 0.02 seconds is a pretty good sweet spot--even when I'm panning the camera around while pressing the spacebar, I don't really notice any jitter.
Next, you'll need a trigger to detect when the spacebar is pressed. I don't think that function is available in GUI, so you'll need to use JASS or Lua (you can make a new trigger and go to the toolbar and hit Edit > Convert to Custom Text). Here is a sample trigger below:
JASS:
function Trig_Detect_Spacebar_Actions takes nothing returns nothing
call TriggerExecute(gg_trg_On_Spacebar_Press)
endfunction
//===========================================================================
function InitTrig_Detect_Spacebar takes nothing returns nothing
local integer i = 0
set gg_trg_Detect_Spacebar = CreateTrigger()
loop
exitwhen i == bj_MAX_PLAYER_SLOTS
if (GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER) then
call BlzTriggerRegisterPlayerKeyEvent(gg_trg_Detect_Spacebar, Player(i), OSKEY_SPACE, 0, true)
endif
set i = i + 1
endloop
call TriggerAddAction( gg_trg_Detect_Spacebar, function Trig_Detect_Spacebar_Actions )
endfunction
This will loop through all playing players controlled by a user and then register when the spacebar (OSKEY_SPACE) is pressed. The last argument in BlzTriggerRegisterPlayerKeyEvent is "true", which means it'll fire the trigger when the spacebar is pressed. If you want it to fire when the key is released, you can change that to "false" instead.
For the actions, I just have it execute another trigger. You can see a full playable example attached below, hope it helps!
One common way to do it is to periodically set the camera "quick position" to the player's current camera position. This controls where the camera goes when the spacebar button is pressed. Here is an example of how you'd do that:
This does the same thing as "Camera - Set Spacebar-Point", but the custom script above is a lot more concise and works for all players. You can also feel free to tweak the interval (0.02 seconds) to your liking. I found that 0.02 seconds is a pretty good sweet spot--even when I'm panning the camera around while pressing the spacebar, I don't really notice any jitter.
Next, you'll need a trigger to detect when the spacebar is pressed. I don't think that function is available in GUI, so you'll need to use JASS or Lua (you can make a new trigger and go to the toolbar and hit Edit > Convert to Custom Text). Here is a sample trigger below:
JASS:
function Trig_Detect_Spacebar_Actions takes nothing returns nothing
call TriggerExecute(gg_trg_On_Spacebar_Press)
endfunction
//===========================================================================
function InitTrig_Detect_Spacebar takes nothing returns nothing
local integer i = 0
set gg_trg_Detect_Spacebar = CreateTrigger()
loop
exitwhen i == bj_MAX_PLAYER_SLOTS
if (GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER) then
call BlzTriggerRegisterPlayerKeyEvent(gg_trg_Detect_Spacebar, Player(i), OSKEY_SPACE, 0, true)
endif
set i = i + 1
endloop
call TriggerAddAction( gg_trg_Detect_Spacebar, function Trig_Detect_Spacebar_Actions )
endfunction
This will loop through all playing players controlled by a user and then register when the spacebar (OSKEY_SPACE) is pressed. The last argument in BlzTriggerRegisterPlayerKeyEvent is "true", which means it'll fire the trigger when the spacebar is pressed. If you want it to fire when the key is released, you can change that to "false" instead.
For the actions, I just have it execute another trigger. You can see a full playable example attached below, hope it helps!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.