Arrow keys not move camera

Grags_1977

Ultra Cool Member
Reaction score
32
As the title says, I want to stop the camera from moving when the player presses an arrow key.

I did a little search and found someone had the same problem, but their answer was replied in Jass.

library Camera initializer init

globals
private trigger press = CreateTrigger()
private trigger release = CreateTrigger()
private player p
private boolean b = false
endglobals

private function onPress takes nothing returns nothing
local real x = GetCameraTargetPositionX()
local real y = GetCameraTargetPositionY()

loop
call PanCameraTo( x, y )
exitwhen b
endloop

set b = false
endfunction

private function onRelease takes nothing returns nothing
set b = true
endfunction

private function init takes nothing returns nothing
set p = GetLocalPlayer()

call TriggerRegisterPlayerEvent(press, p, EVENT_PLAYER_ARROW_LEFT_DOWN)
call TriggerRegisterPlayerEvent(press, p, EVENT_PLAYER_ARROW_RIGHT_DOWN)
call TriggerRegisterPlayerEvent(press, p, EVENT_PLAYER_ARROW_DOWN_DOWN)
call TriggerRegisterPlayerEvent(press, p, EVENT_PLAYER_ARROW_UP_DOWN)

call TriggerRegisterPlayerEvent(release, p, EVENT_PLAYER_ARROW_LEFT_DOWN)
call TriggerRegisterPlayerEvent(release, p, EVENT_PLAYER_ARROW_RIGHT_DOWN)
call TriggerRegisterPlayerEvent(release, p, EVENT_PLAYER_ARROW_DOWN_DOWN)
call TriggerRegisterPlayerEvent(release, p, EVENT_PLAYER_ARROW_UP_DOWN)

call TriggerAddAction( press, function onPress )
call TriggerAddAction( release, function onRelease )
endfunction

endlibrary

If someone can explain to me step by step what the above is doing, I’m absolutely certain I can reproduce it using GUI. I've tried and tried to use different add-ons like NEWGEN, EGUI etc, and failed every time. I outright refuse to put myself through the agony of trying ever again. So please don’t turn this into a topic on how to install NEWGEN I really don’t want to know. :)
 

Grags_1977

Ultra Cool Member
Reaction score
32
no, I want to stop the camera from moving when the user hits an arrow key. I thought that was clear in my first post.
 

TheOverWhelm

Member
Reaction score
16
It creates two triggers in the beginning, press and release, the events are added to the trigger for each player for each event, then adds the actions deigned by "TriggerAddAction" functions
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top