| 08-25-2004, 03:12 AM | #1 |
My triggers for arrow keys are working perfectly... unfortunatly there is a problem right now with attaching commands to arrows... the screen shifts. How can i stop it from shifting! Note: i dont want to freeze camera, u should still be able to scroll with mouse, just not with the arrow keys. (if i have to i will freeze the camera temporarily, but i think there should be a way to dissable arrow key movement... it must be in one of those bug files you guys are always refering too... i would be willing to figure out how to work them if u can point me in right direction) |
| 08-25-2004, 03:27 AM | #2 |
i dont think there is.. you can disable camera movement but that locks the mouse also. lol.. i just thought of the most impracticle solution using trackables.. but i wont tell because it would make your game crash and burn instantly |
| 08-25-2004, 08:08 PM | #3 |
Wow, uh, thanks for the help? right now im doing something that is kinda annoying because there isn't an easy way to deselect a unit, but i have it so that if u click on a building, it freezes camera and u can work the board, but if u dont have a building selected u can move your screen, and not use the board... its impractical and i hate it compared to just locking the keys... but it works for the moment... |
| 08-25-2004, 08:51 PM | #4 |
well... you could just detect when the arrow keys are hit, then shift the camera the opposite way, not sure if that would work htough, cause the player could hold em down... |
| 08-26-2004, 12:49 AM | #5 |
oh wait.. your system gave me an idea. ok.. so have a unit like on the side somewhere. it should be in a corner. then im pretty sure theres a way to assign units to unit groups through triggers (like ctrl 1 will assign a unit to 1 and select it when you click it.) then you have a trigger for when this special unit is selected you re-enable camara movement. then at the same time you assign the unit they previously had selected ( do this by assigning the players selected unit to a var every 1 second) and then when they select the old unit you disable camara movement and set the special unit to 1 again. so for this they just press 1 to disable\enable camara movement. |
| 08-26-2004, 02:25 AM | #6 |
or you could just use the escape key using player event - cinematic skipped, which goes off when ever the esc key is pressed hmm this system is going straight into my map =) |
| 08-26-2004, 05:30 AM | #7 |
Lord...Twister... Are u nuts.. that is a wacked idea... and yes fugly, i actually have esc as a last resort... but this is a melee game, and actually for anygame where micro is important, your left hand should not be on the esc key so u can start moving the camera again... think about it, it sucks. its best if i could just detect a click in empty space and have that deselect (and therefore reenable the camera), but there is no way to make it work like that to my knowledge. As for your new map, its not my idea, its coming strait from HeroRPG, but he did things in a nice ez way, the camera is locked on ur main unit, so u avoid this problem all together |
| 08-26-2004, 11:31 PM | #8 |
well, you never told us what kind of game it was. and also, there is a way to detect a click to a region. you use trackables. theyre a pretty much secret var type that show up as some model and you can detect when the mouse is over them and when they are clicked. but... you can destroy them, move them, nothing. all you can do is create them, check when the mouse goes over when it clicks and set it to a var. http://www.wc3campaigns.com/showthread.php?t=33730 check out that tread for more info to see if it would work. |
| 08-26-2004, 11:44 PM | #9 |
Just incase you decide to go with the the camera idea here is what i came up, since i was thinking about this issue in my map and decided to get it over with now... just make a trigger called Camera Lock, make it custum script and c'n'p the code and make a game cache global variable called cameralock, it'll make its on gamecache at game int don't worry =) just make a trigger called Camera Lock and C'n'P this suker right in, should fit like a glove =) =) gl/hf with your map EDIT: WAIT A FRIGGEN SECOND I COULD WORK THIS TO GET THE EFFECT THAT YOU WANT!, just it won't allow you to use the mouse and arrows keys at the same time =(, just change the event to player uses arrows, Code:
function T2I takes trigger x returns integer
return x
return 0
endfunction
function I2T takes integer x returns trigger
return x
return null
endfunction
function P2I takes player who returns integer
return GetPlayerId(who)
endfunction
function CS2I takes camerasetup which returns integer
return which
return 0
endfunction
function I2CS takes integer x returns camerasetup
return x
return null
endfunction
function Lock takes nothing returns nothing
call CameraSetupApplyForPlayer( true, I2CS(GetStoredInteger(udg_cameralock, I2S(T2I(GetTriggeringTrigger())), "camera")), Player(GetStoredInteger(udg_cameralock, I2S(T2I(GetTriggeringTrigger())), "player")), 0 )
endfunction
function Trig_Camera_Lock_Actions takes nothing returns nothing
local trigger t
local eventid triggerId = GetTriggerEventId()
if triggerId == EVENT_PLAYER_ARROW_RIGHT_UP or triggerId == EVENT_PLAYER_ARROW_LEFT_UP or triggerId == EVENT_PLAYER_ARROW_UP_UP or triggerId == EVENT_PLAYER_ARROW_DOWN_UP then
call DestroyTrigger(I2T(GetStoredInteger(udg_cameralock, I2S(P2I(GetTriggerPlayer())), "cameratrigger")))
else
set t = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( t, 0.01 )
call TriggerAddAction( t, function Lock )
call StoreInteger(udg_cameralock, I2S(T2I(t)), "player", P2I(GetTriggerPlayer()))
call StoreInteger(udg_cameralock,I2S(T2I(t)), "camera", CS2I(GetCurrentCameraSetup()))
call StoreInteger(udg_cameralock, I2S(P2I(GetTriggerPlayer())),"cameratrigger", T2I(t))
endif
endfunction
//================================================== =========================
function InitTrig_Camera_Lock takes nothing returns nothing
local integer n = 0
set udg_cameralock = InitGameCacheBJ("MapName.w3v")
set gg_trg_Camera_Lock = CreateTrigger( )
loop
exitwhen n>11
call TriggerRegisterPlayerKeyEventBJ( gg_trg_Camera_Lock, Player(n), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_LEFT )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_Camera_Lock, Player(n), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_RIGHT )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_Camera_Lock, Player(n), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_LEFT )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_Camera_Lock, Player(n), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_RIGHT )
set n = n + 1
endloop
call TriggerAddAction( gg_trg_Camera_Lock, function Trig_Camera_Lock_Actions )
endfunctionSAME THING BUT WITH THE ESC KEY Code:
function T2I takes trigger x returns integer
return x
return 0
endfunction
function I2T takes integer x returns trigger
return x
return null
endfunction
function P2I takes player who returns integer
return GetPlayerId(who)
endfunction
function CS2I takes camerasetup which returns integer
return which
return 0
endfunction
function I2CS takes integer x returns camerasetup
return x
return null
endfunction
function Lock takes nothing returns nothing
call CameraSetupApplyForPlayer( true, I2CS(GetStoredInteger(udg_cameralock, I2S(T2I(GetTriggeringTrigger())), "camera")), Player(GetStoredInteger(udg_cameralock, I2S(T2I(GetTriggeringTrigger())), "player")), 0 )
endfunction
function Trig_Camera_Lock_Actions takes nothing returns nothing
local trigger t
if GetStoredBoolean(udg_cameralock, I2S(P2I(GetTriggerPlayer())),"locked") then
call DestroyTrigger(I2T(GetStoredIntegerudg_cameralock, I2S(P2I(GetTriggerPlayer())), "cameratrigger")))
call StoreBoolean(udg_cameralock, I2S(P2I(GetTriggerPlayer())),"locked",false)
else
set t = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( t, 0.01 )
call TriggerAddAction( t, function Lock )
call StoreInteger(udg_cameralock, I2S(T2I(t)), "player", P2I(GetTriggerPlayer()))
call StoreInteger(udg_cameralock,cameralock, I2S(T2I(t)), "camera", CS2I(GetCurrentCameraSetup()))
call StoreInteger(udg_cameralock, I2S(P2I(GetTriggerPlayer())),"cameratrigger", T2I(t))
call StoreBoolean(udg_cameralock, I2S(P2I(GetTriggerPlayer())),"locked",true)
endif
endfunction
//===========================================================================
function InitTrig_Camera_Lock takes nothing returns nothing
set udg_cameralock = InitGameCacheBJ("MapName.w3v")
set gg_trg_Camera_Lock = CreateTrigger( )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(0) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(1) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(2) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(3) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(4) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(5) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(6) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(7) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(8) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(9) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(10) )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Camera_Lock, Player(11) )
call TriggerAddAction( gg_trg_Camera_Lock, function Trig_Camera_Lock_Actions )
endfunction
|
| 08-27-2004, 08:32 PM | #10 |
Hm, ok could u explain what that does? Cause right now, i just have it so that it freeze frames everytime u click on a building that will allow it (its now an ability, only important buildings get the ability). If they click on anything that is not another building that has the ability, then they get camera movement back, and cant use board. at same time, if they press esc, u get same effect So what im saying is ur way better than this? or no, cause the 1 benefit of the way i have it, is they can use arrows to scroll if they aren't messing with the board. |
| 08-28-2004, 12:59 AM | #11 |
well i wouldn't say that mine is way better but it just disables scrolling when you use the arrow keys or the esc key, simple as that, but since u need individual player control then go with your system |
| 08-28-2004, 05:10 PM | #12 |
Fugly, your function didnt work anyways. i tested it, and maybe i just dont get it enough.. but theres no I2T function and you didnt make one, same with T2I also.. you cant just make up your own handle type (camarsetup) without defining it somewhere.. or, i may be completely wrong :) edit: and i am using the new beta thing |
| 08-28-2004, 08:05 PM | #13 |
o crap forgot T2I and I2T... and camerasetup is a handle type *fixed* |
