Приветствую тех, кому до сих пор не безразличен варкрафт.
Как то недавно выкладывалась наработка по отлову координат мышки, что могло бы решить много прикольных задач, таких как 3D камера как в WoW, создание шутеров от 1 лица.
Но там использовалось 10000+ фреймов, из-за чего игра начинала жутко лагать. То бишь использовать такую системку в итак неоптимизированной игре ну не ок.
Суть наработки: создается 36 фреймов в центре экрана по кругу (например в 3 ряда, в 1 ряд мышка может вылетать за пределы созданного круга фреймов при резких движениях мышки, также 1 ряд будет вращать камеру с постоянной скоростью, 3 ряда так или иначе имеют градацию скорости), каждому фрейму регистрируем событие FRAMEEVENT_MOUSE_ENTER. Позицию курсора мышки мы можем всегда устанавливать в центре с помощью функции BlzSetMousePos (странно, в экранных координатах установить позицию мышки можно, а узнать нельзя...). Каждый раз, когда мышка будет отклоняться от центра, она неизбежно будет попадать в какой-нибудь фрейм. Заранее зная позиции фреймов, отклоняем камеру, мышку возвращаем в центр.
В этой наработке уже есть управление на WASD, также:
Как то недавно выкладывалась наработка по отлову координат мышки, что могло бы решить много прикольных задач, таких как 3D камера как в WoW, создание шутеров от 1 лица.
Но там использовалось 10000+ фреймов, из-за чего игра начинала жутко лагать. То бишь использовать такую системку в итак неоптимизированной игре ну не ок.
Суть наработки: создается 36 фреймов в центре экрана по кругу (например в 3 ряда, в 1 ряд мышка может вылетать за пределы созданного круга фреймов при резких движениях мышки, также 1 ряд будет вращать камеру с постоянной скоростью, 3 ряда так или иначе имеют градацию скорости), каждому фрейму регистрируем событие FRAMEEVENT_MOUSE_ENTER. Позицию курсора мышки мы можем всегда устанавливать в центре с помощью функции BlzSetMousePos (странно, в экранных координатах установить позицию мышки можно, а узнать нельзя...). Каждый раз, когда мышка будет отклоняться от центра, она неизбежно будет попадать в какой-нибудь фрейм. Заранее зная позиции фреймов, отклоняем камеру, мышку возвращаем в центр.
В этой наработке уже есть управление на WASD, также:
- зажатая левая кнопка мышки просто вращает камеру
- зажатая правая кнопка мышки вращает камеру + героя, позволяет бегать боком
- зажатые обе кнопки мышки регулируют дальность камеры до юнита (двигаем мышку либо вверх-вниз, либо вправо-влево)
- камера следует вдоль рельефа
- ничего не тупит
Инициация:
function Trig_INITIAL_Copy_Actions takes nothing returns nothing
set udg_Unit[0] = gg_unit_Hblm_0000
call SetCameraTargetControllerNoZForPlayer( Player(0), udg_Unit[0], 0, 0, false )
call SCS_Associate(udg_Unit[0],Player(0),2,false)
call SCS_SetControl(Player(0),true)
call UnitAddTypeBJ( UNIT_TYPE_PEON, udg_Unit[0] )
endfunction
//===========================================================================
function InitTrig_INITIAL_Copy takes nothing returns nothing
set gg_trg_INITIAL_Copy = CreateTrigger( )
call TriggerAddAction( gg_trg_INITIAL_Copy, function Trig_INITIAL_Copy_Actions )
endfunction
Управление WASD:
library SCS initializer init
globals
constant integer COUNT_OF_PLAYERS = 1
constant integer INVERSE = 1
public unit array Units[COUNT_OF_PLAYERS]
private boolean array Up[COUNT_OF_PLAYERS] //Нажата ли клавиша вперед
private boolean array Down[COUNT_OF_PLAYERS] //Нажата ли клавиша назад
private boolean array Left[COUNT_OF_PLAYERS] //Нажата ли клавиша влево
private boolean array Right[COUNT_OF_PLAYERS] //Нажата ли клавиша вправо
private boolean array Bok[COUNT_OF_PLAYERS] //Нужно ли бежать боком
private boolean array ApplyControl[COUNT_OF_PLAYERS]
private integer array Anims[COUNT_OF_PLAYERS]
private boolean array FlagArround[COUNT_OF_PLAYERS]
private boolean array ResetFlag[COUNT_OF_PLAYERS]
private location l
endglobals
private function ConditionToMove takes unit u returns boolean
return (GetUnitState(u, UNIT_STATE_LIFE)>=0.45)and(GetUnitAbilityLevel(u, 'BSTN')==0)and(GetUnitAbilityLevel(u,'BPSE')==0)and(GetUnitAbilityLevel(u,'BUsl')==0)and(GetUnitAbilityLevel(u,'BUst')==0)and(GetUnitAbilityLevel(u,'BUim')==0)and(GetUnitAbilityLevel(u,'Bwea')==0)and(GetUnitAbilityLevel(u,'Bweb')==0)and(GetUnitAbilityLevel(u,'Bmlt')==0)
endfunction
public function Associate takes unit u, player p, integer a, boolean b returns nothing
if(Units[GetPlayerId(p)]!=null)then
call SetUnitTimeScale(Units[GetPlayerId(p)],1)
call SetUnitAnimation(Units[GetPlayerId(p)], "stand")
endif
set Units[GetPlayerId(p)] = u
set Anims[GetPlayerId(p)] = a
set FlagArround[GetPlayerId(p)] = false
endfunction
public function SetControl takes player p, boolean b returns nothing
local integer i = GetPlayerId(p)
set ApplyControl[i] = b
endfunction
private function Up_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
if (BlzGetTriggerPlayerIsKeyDown()) then
set Up[i] = true
if (GetUnitState(Units[i],UNIT_STATE_LIFE)>=0.45 and ApplyControl[i] and not(Down[i])) then
if(Anims[i]!=-1)then
call SetUnitAnimationByIndex(Units[i],Anims[i])
endif
call SetUnitTimeScale(Units[i], GetUnitMoveSpeed(Units[i])/GetUnitDefaultMoveSpeed(Units[i]))
endif
else
set Up[i] = false
if GetUnitState(Units[i],UNIT_STATE_LIFE)>=0.45 then
call SetUnitTimeScale(Units[i], 1)
call SetUnitAnimation(Units[i], "stand")
endif
if ResetFlag[i] then
set ResetFlag[i] = false
if GetUnitState(Units[i],UNIT_STATE_LIFE)>=0.45 and ApplyControl[i] and Anims[i]!=-1 then
call SetUnitAnimationByIndex(Units[i],Anims[i])
endif
endif
endif
endfunction
private function Down_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
if (BlzGetTriggerPlayerIsKeyDown()) then
set Down[i] = true
if GetUnitState(Units[i],UNIT_STATE_LIFE)>=0.45 and ApplyControl[i] and Anims[i]!=-1 and not(Up[i]) then
call SetUnitAnimationByIndex(Units[i],Anims[i])
endif
call SetUnitTimeScale(Units[i], -GetUnitMoveSpeed(Units[i])/GetUnitDefaultMoveSpeed(Units[i]))
else
set Down[i] = false
if GetUnitState(Units[i],UNIT_STATE_LIFE)>=0.45 then
call SetUnitTimeScale(Units[i], 1)
call SetUnitAnimation(Units[i], "stand")
endif
if ResetFlag[i] then
set ResetFlag[i] = false
if GetUnitState(Units[i],UNIT_STATE_LIFE)>=0.45 and ApplyControl[i] then
if(Anims[i]!=-1)then
call SetUnitAnimationByIndex(Units[i],Anims[i])
endif
call SetUnitTimeScale(Units[i], GetUnitMoveSpeed(Units[i])/GetUnitDefaultMoveSpeed(Units[i]))
endif
endif
endif
endfunction
private function Right_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
if (BlzGetTriggerPlayerIsKeyDown()) then
set Right[i] = true
else
set Right[i] = false
if GetUnitState(Units[i],UNIT_STATE_LIFE)>=0.45 and (AOskey_isRight) and not(Right[i]) then
call SetUnitTimeScale(Units[i], 1)
call SetUnitAnimation(Units[i], "stand")
endif
if (not Up[i])and(not Down[i]) then
call IssueImmediateOrder( Units[i], "stop" )
endif
set Bok[i] = false
endif
endfunction
private function Left_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
if (BlzGetTriggerPlayerIsKeyDown()) then
set Left[i] = true
else
set Left[i] = false
if GetUnitState(Units[i],UNIT_STATE_LIFE)>=0.45 and (AOskey_isRight) and not(Right[i]) then
call SetUnitTimeScale(Units[i], 1)
call SetUnitAnimation(Units[i], "stand")
endif
if (not Up[i])and(not Down[i]) then
call IssueImmediateOrder( Units[i], "stop" )
endif
set Bok[i] = false
endif
endfunction
private function Move_Actions takes nothing returns nothing
local real X
local real Y
local real Xh
local real Yh
local boolean bx
local boolean by
local real Angle
local integer i = 0
local integer iflag = 0
local boolean bflag = false
loop
exitwhen i >= COUNT_OF_PLAYERS
if (Units[i] != null)and(ApplyControl[i]) then
if (Up[i] or Bok[i]) and (not Down[i]) and ConditionToMove(Units[i]) then
set bflag = true
set iflag = 1
elseif (not Up[i]) and Down[i] and ConditionToMove(Units[i]) then
set bflag = true
if(FlagArround[i])then
set iflag = 1
else
set iflag = -1
endif
else
set bflag = false
endif
if bflag then
set Angle = GetUnitFacing(Units[i])
set X = GetUnitX(Units[i])+iflag*(GetUnitMoveSpeed(Units[i])/100)*Cos(Angle*bj_DEGTORAD)
set Y = GetUnitY(Units[i])+iflag*(GetUnitMoveSpeed(Units[i])/100)*Sin(Angle*bj_DEGTORAD)
set Xh = GetUnitX(Units[i])
set Yh = GetUnitY(Units[i])
call SetUnitPosition(Units[i],X,Y)
if(RAbsBJ(GetUnitX(Units[i])-X)>0.5)or(RAbsBJ(GetUnitY(Units[i])-Y)>0.5)then
call SetUnitPosition(Units[i],X,Yh)
set bx = RAbsBJ(GetUnitX(Units[i])-X)<=0.5
call SetUnitPosition(Units[i],Xh,Y)
set by = RAbsBJ(GetUnitY(Units[i])-Y)<=0.5
if bx then
call SetUnitPosition(Units[i],X,Yh)
elseif by then
call SetUnitPosition(Units[i],Xh,Y)
else
call SetUnitPosition(Units[i],Xh,Yh)
endif
endif
endif
if Right[i] and (not Left[i]) and ConditionToMove(Units[i]) then
set bflag = true
set iflag = 1
elseif (not Right[i]) and Left[i] and ConditionToMove(Units[i]) then
set bflag = true
set iflag = -1
else
set bflag = false
endif
if bflag then
if Down[i] then
//Скорость поворота можно регулировать где 8
if (not(AOskey_isLeft) and AOskey_isRight) then
if (iflag == 1) then
if (Down[i]) then
call SetUnitFacingTimed( Units[i], AOskey_MouseAngle2+45, 0.0 )
else
call SetUnitFacingTimed( Units[i], AOskey_MouseAngle2+90, 0.0 )
endif
else
if (Down[i]) then
call SetUnitFacingTimed( Units[i], AOskey_MouseAngle2-45, 0.0 )
else
call SetUnitFacingTimed( Units[i], AOskey_MouseAngle2-90, 0.0 )
endif
endif
else
call SetUnitFacingTimed( Units[i], (GetUnitFacing(Units[i])+iflag*INVERSE*(12.00)), 0.01 )
endif
else
if (not(AOskey_isLeft) and AOskey_isRight) then
set Bok[i] = true
if (iflag == 1) then
if (Up[i]) then
call SetUnitFacingTimed( Units[i], AOskey_MouseAngle2-45, 0.01 )
//call BlzSetUnitFacingEx( Units[i], AOskey_MouseAngle2-45 )
else
call BlzSetUnitFacingEx( Units[i], AOskey_MouseAngle2-90 )
endif
else
if (Up[i]) then
call SetUnitFacingTimed( Units[i], AOskey_MouseAngle2+45, 0.01 )
//call BlzSetUnitFacingEx( Units[i], AOskey_MouseAngle2+45 )
else
call BlzSetUnitFacingEx( Units[i], AOskey_MouseAngle2+90 )
endif
endif
else
call SetUnitFacingTimed( Units[i], (GetUnitFacing(Units[i])-iflag*(12.00)), 0.01 )
endif
endif
endif
endif
set i = i + 1
endloop
endfunction
private function Animation_Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen i >= COUNT_OF_PLAYERS
if Up[i] and Down[i] and not ResetFlag[i] then
set ResetFlag[i] = true
call SetUnitAnimation(Units[i],"stand")
endif
if not ResetFlag[i] then
if (Up[i] or Down[i] or (AOskey_isRight and Right[i]) or (AOskey_isRight and Left[i]) and ConditionToMove(Units[i]) and Anims[i]!=-1) then
call SetUnitAnimationByIndex(Units[i],Anims[i])
endif
endif
set i = i + 1
endloop
endfunction
private function init takes nothing returns nothing
local integer Count = 0
local trigger Up = CreateTrigger( )
local trigger Down = CreateTrigger( )
local trigger Right = CreateTrigger( )
local trigger Left = CreateTrigger( )
set l = Location(0,0)
loop
exitwhen Count>=COUNT_OF_PLAYERS
call BlzTriggerRegisterPlayerKeyEvent( Up, Player(bj_forLoopAIndex), OSKEY_W, 0, true )
call BlzTriggerRegisterPlayerKeyEvent( Up, Player(bj_forLoopAIndex), OSKEY_W, 0, false )
call BlzTriggerRegisterPlayerKeyEvent( Down, Player(bj_forLoopAIndex), OSKEY_S, 0, true )
call BlzTriggerRegisterPlayerKeyEvent( Down, Player(bj_forLoopAIndex), OSKEY_S, 0, false )
call BlzTriggerRegisterPlayerKeyEvent( Right, Player(bj_forLoopAIndex), OSKEY_D, 0, true )
call BlzTriggerRegisterPlayerKeyEvent( Right, Player(bj_forLoopAIndex), OSKEY_D, 0, false )
call BlzTriggerRegisterPlayerKeyEvent( Left, Player(bj_forLoopAIndex), OSKEY_A, 0, true )
call BlzTriggerRegisterPlayerKeyEvent( Left, Player(bj_forLoopAIndex), OSKEY_A, 0, false )
set Count = Count + 1
endloop
//create actions
call TriggerAddAction( Up, function Up_Actions )
call TriggerAddAction( Down, function Down_Actions )
call TriggerAddAction( Right, function Right_Actions )
call TriggerAddAction( Left, function Left_Actions )
call TimerStart(CreateTimer(),0.01,true,function Move_Actions)
call TimerStart(CreateTimer(),0.2,true,function Animation_Actions)
endfunction
endlibrary
Управление камерой:
library AOskey initializer init
globals
private framehandle gameUI //главный фрейм игры, отвечающий за интерфейс
private framehandle frameWheel //фрейм, под которым спрятанный курсор не виден
private framehandle array but //1 ряд фреймов
private framehandle array butRam //2 ряд фреймов
private framehandle array butThird //3 ряд фреймов
private string TypeFrame = "SCROLLBAR" //тип фреймов, отлавливающих мышку
private unit Units //юнит, в отношении которого происходит управление камерой
private real MouseAngle1 = 0 //угол места
public real MouseAngle2 = 0 //азимут
private real Dist = 600 //дистанция до цели (изменяется с помощью одновременного нажатия 2 кнопок мыши)
private real TekDist = 400 //текущая дистанция до цели (уменьшается, если камера заходит под рельеф, и восстанавливается до значения Dist)
public boolean isLeft = false //нажата ли левая кнопка мыши
public boolean isRight = false //нажата ли правая кнопка мыши
private location l
endglobals
private function mouseDown takes nothing returns nothing
local integer i = 0
call ForceUICancelBJ( Player(0) )
if (BlzGetMouseFocusUnit()==null /*and BlzGetTriggerFrame()!=null*/ ) then
call BlzEnableCursor(false)
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
if (BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_LEFT) then
set isLeft = true
elseif (BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_RIGHT) then
set isRight = true
call IssueImmediateOrderBJ( gg_unit_Hblm_0000, "stop" )
endif
loop
exitwhen i > 15
call BlzFrameSetEnable(but[i], true)
call BlzFrameSetEnable(butRam[i], true)
call BlzFrameSetEnable(butThird[i], true)
set i = i + 1
endloop
call BlzFrameSetEnable(frameWheel,true)
endif
endfunction
private function mouseUp takes nothing returns nothing
local integer i = 0
if (BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_LEFT) then
set isLeft = false
endif
if (BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_RIGHT) then
set isRight = false
endif
if (not(isLeft) and not(isRight)) then
loop
exitwhen i > 15
call BlzFrameSetEnable(but[i], false)
call BlzFrameSetEnable(butRam[i], false)
call BlzFrameSetEnable(butThird[i], false)
set i = i + 1
endloop
call BlzFrameSetEnable(frameWheel,false)
endif
endfunction
private function cameraSetter0 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 50
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 6
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraSetter1 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 50
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 3
set MouseAngle2 = MouseAngle2 - 3
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraSetter2 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 50
elseif (isLeft or isRight) then
set MouseAngle2 = MouseAngle2 - 6
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraSetter3 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 50
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 3
set MouseAngle2 = MouseAngle2 - 3
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraSetter4 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 50
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 6
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraSetter5 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 50
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 3
set MouseAngle2 = MouseAngle2 + 3
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraSetter6 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 50
elseif (isLeft or isRight) then
set MouseAngle2 = MouseAngle2 + 6
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraSetter7 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 50
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 3
set MouseAngle2 = MouseAngle2 + 3
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast0 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 15
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast1 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 10
set MouseAngle2 = MouseAngle2 - 8
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast2 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 8
set MouseAngle2 = MouseAngle2 - 10
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast3 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 100
elseif (isLeft or isRight) then
set MouseAngle2 = MouseAngle2 - 15
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast4 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 8
set MouseAngle2 = MouseAngle2 - 10
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast5 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 10
set MouseAngle2 = MouseAngle2 - 8
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast6 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 15
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast7 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 10
set MouseAngle2 = MouseAngle2 + 8
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast8 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 8
set MouseAngle2 = MouseAngle2 + 10
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast9 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 100
elseif (isLeft or isRight) then
set MouseAngle2 = MouseAngle2 + 15
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast10 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 8
set MouseAngle2 = MouseAngle2 + 10
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFast11 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 100
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 10
set MouseAngle2 = MouseAngle2 + 8
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster0 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 30
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster1 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 22
set MouseAngle2 = MouseAngle2 - 14
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster2 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 30
set MouseAngle2 = MouseAngle2 - 30
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster3 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 14
set MouseAngle2 = MouseAngle2 - 22
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster4 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 150
elseif (isLeft or isRight) then
set MouseAngle2 = MouseAngle2 - 30
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster5 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 14
set MouseAngle2 = MouseAngle2 - 22
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster6 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 30
set MouseAngle2 = MouseAngle2 - 30
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster7 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 22
set MouseAngle2 = MouseAngle2 - 14
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster8 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 30
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster9 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 22
set MouseAngle2 = MouseAngle2 + 14
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster10 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 30
set MouseAngle2 = MouseAngle2 + 30
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster11 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 - 14
set MouseAngle2 = MouseAngle2 + 22
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster12 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 150
elseif (isLeft or isRight) then
set MouseAngle2 = MouseAngle2 + 30
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster13 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 14
set MouseAngle2 = MouseAngle2 + 22
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster14 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist + 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 30
set MouseAngle2 = MouseAngle2 + 30
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraFaster15 takes nothing returns nothing
if (isLeft and isRight) then
set Dist = Dist - 150
elseif (isLeft or isRight) then
set MouseAngle1 = MouseAngle1 + 22
set MouseAngle2 = MouseAngle2 + 14
endif
call BlzSetMousePos(BlzGetLocalClientWidth()/2,BlzGetLocalClientHeight()/2)
call BlzEnableCursor(false)
endfunction
private function cameraSetter takes nothing returns nothing
local real d = GetCameraField(CAMERA_FIELD_TARGET_DISTANCE)
local real Z1 = 0
local real Z2 = 0
local real H = 100
local real offset = 0
local real ZUnit = 100 //высота юнита
if (MouseAngle2>359) then
set MouseAngle2 = 0
elseif (MouseAngle2<0) then
set MouseAngle2 = 359
endif
if (not(isLeft) and not(isRight)) then
call BlzEnableCursor(true)
set MouseAngle2 = GetUnitFacing(gg_unit_Hblm_0000)
elseif (not(isLeft) and isRight) then
call SetUnitFacingTimed( gg_unit_Hblm_0000, MouseAngle2, 0 )
endif
call MoveLocation(l,GetUnitX(Units),GetUnitY(Units))
set Z1 = GetLocationZ(l)*1.0
call MoveLocation(l,GetUnitX(Units)-TekDist*Cos(MouseAngle2*bj_DEGTORAD)*Cos(-MouseAngle1*bj_DEGTORAD),GetUnitY(Units)-TekDist*Sin(MouseAngle2*bj_DEGTORAD)*Cos(-MouseAngle1*bj_DEGTORAD))
set Z2 = GetLocationZ(l)
set offset = (Z1+ZUnit)
set H = (TekDist*Sin(MouseAngle1*bj_DEGTORAD)-offset+Z2)*(-1)
if (Dist < 100) then
set Dist = 100
elseif (Dist > 1000) then
set Dist = 1000
endif
if (H<0 and TekDist-50 > 0 ) then
set TekDist = TekDist - 50
elseif (TekDist<Dist and H>30) then
set TekDist = TekDist + 50
elseif (TekDist>Dist) then
set TekDist = TekDist-50
endif
//call DisplayTimedTextToForce( GetPlayersAll(), 5.00, "Угол атаки: "+R2S(MouseAngle1)+", Азимут: "+R2S(MouseAngle2))
//call DisplayTimedTextToForce( GetPlayersAll(), 5.00, "Текущая дальность: "+R2S(TekDist)+", Дальность: "+R2S(Dist)+", Высота: "+R2S(H))
call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ZOFFSET,offset,0.2)
call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ANGLE_OF_ATTACK, MouseAngle1, 0.2)
call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ROTATION, MouseAngle2, 0.2)
call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_FIELD_OF_VIEW,100,0.2)
call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_TARGET_DISTANCE,TekDist,0.2)
endfunction
private function editChanged takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, BlzFrameGetText(frameWheel))
endfunction
private function init takes nothing returns nothing
local trigger clickDown = CreateTrigger()
local trigger clickUp = CreateTrigger()
local trigger mouse0 = CreateTrigger()
local trigger mouse1 = CreateTrigger()
local trigger mouse2 = CreateTrigger()
local trigger mouse3 = CreateTrigger()
local trigger mouse4 = CreateTrigger()
local trigger mouse5 = CreateTrigger()
local trigger mouse6 = CreateTrigger()
local trigger mouse7 = CreateTrigger()
local trigger maus0 = CreateTrigger()
local trigger maus1 = CreateTrigger()
local trigger maus2 = CreateTrigger()
local trigger maus3 = CreateTrigger()
local trigger maus4 = CreateTrigger()
local trigger maus5 = CreateTrigger()
local trigger maus6 = CreateTrigger()
local trigger maus7 = CreateTrigger()
local trigger maus8 = CreateTrigger()
local trigger maus9 = CreateTrigger()
local trigger maus10 = CreateTrigger()
local trigger maus11 = CreateTrigger()
local trigger missis0 = CreateTrigger()
local trigger missis1 = CreateTrigger()
local trigger missis2 = CreateTrigger()
local trigger missis3 = CreateTrigger()
local trigger missis4 = CreateTrigger()
local trigger missis5 = CreateTrigger()
local trigger missis6 = CreateTrigger()
local trigger missis7 = CreateTrigger()
local trigger missis8 = CreateTrigger()
local trigger missis9 = CreateTrigger()
local trigger missis10 = CreateTrigger()
local trigger missis11 = CreateTrigger()
local trigger missis12 = CreateTrigger()
local trigger missis13 = CreateTrigger()
local trigger missis14 = CreateTrigger()
local trigger missis15 = CreateTrigger()
local real width = 0.02
local real height = 0.02
set gameUI = BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0)
call TriggerRegisterPlayerMouseEventBJ(clickDown, Player(0), bj_MOUSEEVENTTYPE_DOWN )
call TriggerRegisterPlayerMouseEventBJ(clickUp, Player(0), bj_MOUSEEVENTTYPE_UP )
//call BlzTriggerRegisterFrameEvent(clickDown, gameUI, FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(clickDown, function mouseDown)
call TriggerAddAction(clickUp, function mouseUp)
//фрейм, скрывающий курсор при его нажатии
set frameWheel = BlzCreateFrameByType("SCROLLBAR", "", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(frameWheel, 0.4, 0.4)
call BlzFrameSetPoint(frameWheel, FRAMEPOINT_CENTER, gameUI, FRAMEPOINT_CENTER, 0.0, 0.0)
call BlzFrameSetEnable(frameWheel,false)
set but[0] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(but[0], width, height)
call BlzFrameSetPoint(but[0], FRAMEPOINT_BOTTOM, gameUI, FRAMEPOINT_CENTER, 0.0, 0.003)
call BlzFrameSetTexture(but[0], "ReplaceableTextures\\CommandButtons\\BTNScrollOfRegenerationGreen.blp", 0, true)
set but[1] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(but[1], width, height)
call BlzFrameSetPoint(but[1], FRAMEPOINT_BOTTOMLEFT, gameUI, FRAMEPOINT_CENTER, 0.001, 0.001)
call BlzFrameSetTexture(but[1], "ReplaceableTextures\\CommandButtons\\BTNScrollOfRegenerationGreen.blp", 0, true)
set but[2] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(but[2], width, height)
call BlzFrameSetPoint(but[2], FRAMEPOINT_LEFT, gameUI, FRAMEPOINT_CENTER, 0.003, 0.0)
call BlzFrameSetTexture(but[2], "ReplaceableTextures\\CommandButtons\\BTNScrollOfRegenerationGreen.blp", 0, true)
set but[3] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(but[3], width, height)
call BlzFrameSetPoint(but[3], FRAMEPOINT_TOPLEFT, gameUI, FRAMEPOINT_CENTER, 0.001, -0.001)
call BlzFrameSetTexture(but[3], "ReplaceableTextures\\CommandButtons\\BTNScrollOfRegenerationGreen.blp", 0, true)
set but[4] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(but[4], width, height)
call BlzFrameSetPoint(but[4], FRAMEPOINT_TOP, gameUI, FRAMEPOINT_CENTER, 0.0, -0.003)
call BlzFrameSetTexture(but[4], "ReplaceableTextures\\CommandButtons\\BTNScrollOfRegenerationGreen.blp", 0, true)
set but[5] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(but[5], width, height)
call BlzFrameSetPoint(but[5], FRAMEPOINT_TOPRIGHT, gameUI, FRAMEPOINT_CENTER, -0.001, -0.001)
call BlzFrameSetTexture(but[5], "ReplaceableTextures\\CommandButtons\\BTNScrollOfRegenerationGreen.blp", 0, true)
set but[6] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(but[6], width, height)
call BlzFrameSetPoint(but[6], FRAMEPOINT_RIGHT, gameUI, FRAMEPOINT_CENTER, -0.003, 0.0)
call BlzFrameSetTexture(but[6], "ReplaceableTextures\\CommandButtons\\BTNScrollOfRegenerationGreen.blp", 0, true)
set but[7] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(but[7], width, height)
call BlzFrameSetPoint(but[7], FRAMEPOINT_BOTTOMRIGHT, gameUI, FRAMEPOINT_CENTER, -0.001, 0.001)
call BlzFrameSetTexture(but[7], "ReplaceableTextures\\CommandButtons\\BTNScrollOfRegenerationGreen.blp", 0, true)
set butRam[0] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[0], width, height)
call BlzFrameSetPoint(butRam[0], FRAMEPOINT_BOTTOM, gameUI, FRAMEPOINT_CENTER, 0.0, 0.02)
call BlzFrameSetTexture(butRam[0], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[1] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[1], width, height)
call BlzFrameSetPoint(butRam[1], FRAMEPOINT_BOTTOMLEFT, gameUI, FRAMEPOINT_CENTER, 0.004, 0.014)
call BlzFrameSetTexture(butRam[1], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[2] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[2], width, height)
call BlzFrameSetPoint(butRam[2], FRAMEPOINT_BOTTOMLEFT, gameUI, FRAMEPOINT_CENTER, 0.014, 0.004)
call BlzFrameSetTexture(butRam[2], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[3] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[3], width, height)
call BlzFrameSetPoint(butRam[3], FRAMEPOINT_LEFT, gameUI, FRAMEPOINT_CENTER, 0.02, 0.0)
call BlzFrameSetTexture(butRam[3], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[4] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[4], width, height)
call BlzFrameSetPoint(butRam[4], FRAMEPOINT_TOPLEFT, gameUI, FRAMEPOINT_CENTER, 0.014, -0.004)
call BlzFrameSetTexture(butRam[4], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[5] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[5], width, height)
call BlzFrameSetPoint(butRam[5], FRAMEPOINT_TOPLEFT, gameUI, FRAMEPOINT_CENTER, 0.004, -0.014)
call BlzFrameSetTexture(butRam[5], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[6] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[6], width, height)
call BlzFrameSetPoint(butRam[6], FRAMEPOINT_TOP, gameUI, FRAMEPOINT_CENTER, 0.0, -0.02)
call BlzFrameSetTexture(butRam[6], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[7] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[7], width, height)
call BlzFrameSetPoint(butRam[7], FRAMEPOINT_TOPRIGHT, gameUI, FRAMEPOINT_CENTER, -0.004, -0.014)
call BlzFrameSetTexture(butRam[7], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[8] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[8], width, height)
call BlzFrameSetPoint(butRam[8], FRAMEPOINT_TOPRIGHT, gameUI, FRAMEPOINT_CENTER, -0.014, -0.004)
call BlzFrameSetTexture(butRam[8], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[9] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[9], width, height)
call BlzFrameSetPoint(butRam[9], FRAMEPOINT_RIGHT, gameUI, FRAMEPOINT_CENTER, -0.02, 0.0)
call BlzFrameSetTexture(butRam[9], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[10] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[10], width, height)
call BlzFrameSetPoint(butRam[10], FRAMEPOINT_BOTTOMRIGHT, gameUI, FRAMEPOINT_CENTER, -0.014, 0.004)
call BlzFrameSetTexture(butRam[10], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butRam[11] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butRam[11], width, height)
call BlzFrameSetPoint(butRam[11], FRAMEPOINT_BOTTOMRIGHT, gameUI, FRAMEPOINT_CENTER, -0.004, 0.014)
call BlzFrameSetTexture(butRam[11], "ReplaceableTextures\\CommandButtons\\BTNPhilosophersStone.blp", 0, true)
set butThird[0] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[0], width, height)
call BlzFrameSetPoint(butThird[0], FRAMEPOINT_BOTTOM, gameUI, FRAMEPOINT_CENTER, 0.0, 0.04)
call BlzFrameSetTexture(butThird[0], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[1] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[1], width, height)
call BlzFrameSetPoint(butThird[1], FRAMEPOINT_BOTTOMLEFT, gameUI, FRAMEPOINT_CENTER, 0.006, 0.03)
call BlzFrameSetTexture(butThird[1], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[2] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[2], width, height)
call BlzFrameSetPoint(butThird[2], FRAMEPOINT_BOTTOMLEFT, gameUI, FRAMEPOINT_CENTER, 0.022, 0.022)
call BlzFrameSetTexture(butThird[2], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[3] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[3], width, height)
call BlzFrameSetPoint(butThird[3], FRAMEPOINT_BOTTOMLEFT, gameUI, FRAMEPOINT_CENTER, 0.03, 0.006)
call BlzFrameSetTexture(butThird[3], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[4] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[4], width, height)
call BlzFrameSetPoint(butThird[4], FRAMEPOINT_LEFT, gameUI, FRAMEPOINT_CENTER, 0.04, 0.0)
call BlzFrameSetTexture(butThird[4], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[5] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[5], width, height)
call BlzFrameSetPoint(butThird[5], FRAMEPOINT_TOPLEFT, gameUI, FRAMEPOINT_CENTER, 0.03, -0.006)
call BlzFrameSetTexture(butThird[5], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[6] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[6], width, height)
call BlzFrameSetPoint(butThird[6], FRAMEPOINT_TOPLEFT, gameUI, FRAMEPOINT_CENTER, 0.022, -0.022)
call BlzFrameSetTexture(butThird[6], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[7] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[7], width, height)
call BlzFrameSetPoint(butThird[7], FRAMEPOINT_TOPLEFT, gameUI, FRAMEPOINT_CENTER, 0.006, -0.03)
call BlzFrameSetTexture(butThird[7], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[8] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[8], width, height)
call BlzFrameSetPoint(butThird[8], FRAMEPOINT_TOP, gameUI, FRAMEPOINT_CENTER, 0.0, -0.04)
call BlzFrameSetTexture(butThird[8], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[9] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[9], width, height)
call BlzFrameSetPoint(butThird[9], FRAMEPOINT_TOPRIGHT, gameUI, FRAMEPOINT_CENTER, -0.006, -0.03)
call BlzFrameSetTexture(butThird[9], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[10] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[10], width, height)
call BlzFrameSetPoint(butThird[10], FRAMEPOINT_TOPRIGHT, gameUI, FRAMEPOINT_CENTER, -0.022, -0.022)
call BlzFrameSetTexture(butThird[10], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[11] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[11], width, height)
call BlzFrameSetPoint(butThird[11], FRAMEPOINT_TOPRIGHT, gameUI, FRAMEPOINT_CENTER, -0.03, -0.006)
call BlzFrameSetTexture(butThird[11], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[12] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[12], width, height)
call BlzFrameSetPoint(butThird[12], FRAMEPOINT_RIGHT, gameUI, FRAMEPOINT_CENTER, -0.04, 0.0)
call BlzFrameSetTexture(butThird[12], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[13] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[13], width, height)
call BlzFrameSetPoint(butThird[13], FRAMEPOINT_BOTTOMRIGHT, gameUI, FRAMEPOINT_CENTER, -0.03, 0.006)
call BlzFrameSetTexture(butThird[13], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[14] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[14], width, height)
call BlzFrameSetPoint(butThird[14], FRAMEPOINT_BOTTOMRIGHT, gameUI, FRAMEPOINT_CENTER, -0.022, 0.022)
call BlzFrameSetTexture(butThird[14], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
set butThird[15] = BlzCreateFrameByType(TypeFrame, "TestDialog", gameUI, "StandardFrameTemplate",0)
call BlzFrameSetSize(butThird[15], width, height)
call BlzFrameSetPoint(butThird[15], FRAMEPOINT_BOTTOMRIGHT, gameUI, FRAMEPOINT_CENTER, -0.006, 0.03)
call BlzFrameSetTexture(butThird[15], "ReplaceableTextures\\CommandButtons\\BTNPeriapt.blp", 0, true)
call BlzTriggerRegisterFrameEvent(mouse0, but[0], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(mouse0, function cameraSetter0)
call BlzTriggerRegisterFrameEvent(mouse1, but[1], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(mouse1, function cameraSetter1)
call BlzTriggerRegisterFrameEvent(mouse2, but[2], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(mouse2, function cameraSetter2)
call BlzTriggerRegisterFrameEvent(mouse3, but[3], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(mouse3, function cameraSetter3)
call BlzTriggerRegisterFrameEvent(mouse4, but[4], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(mouse4, function cameraSetter4)
call BlzTriggerRegisterFrameEvent(mouse5, but[5], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(mouse5, function cameraSetter5)
call BlzTriggerRegisterFrameEvent(mouse6, but[6], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(mouse6, function cameraSetter6)
call BlzTriggerRegisterFrameEvent(mouse7, but[7], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(mouse7, function cameraSetter7)
call BlzTriggerRegisterFrameEvent(maus0, butRam[0], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus0, function cameraFast0)
call BlzTriggerRegisterFrameEvent(maus1, butRam[1], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus1, function cameraFast1)
call BlzTriggerRegisterFrameEvent(maus2, butRam[2], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus2, function cameraFast2)
call BlzTriggerRegisterFrameEvent(maus3, butRam[3], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus3, function cameraFast3)
call BlzTriggerRegisterFrameEvent(maus4, butRam[4], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus4, function cameraFast4)
call BlzTriggerRegisterFrameEvent(maus5, butRam[5], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus5, function cameraFast5)
call BlzTriggerRegisterFrameEvent(maus6, butRam[6], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus6, function cameraFast6)
call BlzTriggerRegisterFrameEvent(maus7, butRam[7], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus7, function cameraFast7)
call BlzTriggerRegisterFrameEvent(maus8, butRam[8], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus8, function cameraFast8)
call BlzTriggerRegisterFrameEvent(maus9, butRam[9], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus9, function cameraFast9)
call BlzTriggerRegisterFrameEvent(maus10, butRam[10], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus10, function cameraFast10)
call BlzTriggerRegisterFrameEvent(maus11, butRam[11], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(maus11, function cameraFast11)
call BlzTriggerRegisterFrameEvent(missis0, butThird[0], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis0, function cameraFaster0)
call BlzTriggerRegisterFrameEvent(missis1, butThird[1], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis1, function cameraFaster1)
call BlzTriggerRegisterFrameEvent(missis2, butThird[2], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis2, function cameraFaster2)
call BlzTriggerRegisterFrameEvent(missis3, butThird[3], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis3, function cameraFaster3)
call BlzTriggerRegisterFrameEvent(missis4, butThird[4], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis4, function cameraFaster4)
call BlzTriggerRegisterFrameEvent(missis5, butThird[5], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis5, function cameraFaster5)
call BlzTriggerRegisterFrameEvent(missis6, butThird[6], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis6, function cameraFaster6)
call BlzTriggerRegisterFrameEvent(missis7, butThird[7], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis7, function cameraFaster7)
call BlzTriggerRegisterFrameEvent(missis8, butThird[8], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis8, function cameraFaster8)
call BlzTriggerRegisterFrameEvent(missis9, butThird[9], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis9, function cameraFaster9)
call BlzTriggerRegisterFrameEvent(missis10, butThird[10], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis10, function cameraFaster10)
call BlzTriggerRegisterFrameEvent(missis11, butThird[11], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis11, function cameraFaster11)
call BlzTriggerRegisterFrameEvent(missis12, butThird[12], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis12, function cameraFaster12)
call BlzTriggerRegisterFrameEvent(missis13, butThird[13], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis13, function cameraFaster13)
call BlzTriggerRegisterFrameEvent(missis14, butThird[14], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis14, function cameraFaster14)
call BlzTriggerRegisterFrameEvent(missis15, butThird[15], FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(missis15, function cameraFaster15)
call SetCameraTargetController(gg_unit_Hblm_0000,0,0,false)
call CameraSetSmoothingFactor(1)
set Units = gg_unit_Hblm_0000
set l = Location (0,0)
call SelectUnitForPlayerSingle( gg_unit_Hblm_0000, Player(0) )
call EnableDragSelect(false,false)
call BlzHideOriginFrames(true)
call BlzFrameSetLevel(BlzGetFrameByName("ConsoleUIBackdrop", 0),-3)
call BlzFrameSetVisible(BlzFrameGetParent(BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 5))), false)
call TimerStart(CreateTimer(), 0.01, true, function cameraSetter)
endfunction
endlibrary
Есть нюанс - нажатие мышкой над фреймом ломает управление с клавиатуры, то бишь сбивается фокус. Для решения этой проблемы воспользовался функцией ForceUICancelBJ. Из-за этого стандартные кнопки меню порой не нажимаются + мышка постоянно уходит в центр. Это недостаток такой системы. Если есть предложения, как решить эту проблему иначе, буду рад услышать.
Также код получился не супер оптимизированным и понятным, преследовалась задача реализовать подобное в варкрафте. Спасибо за ваши замечания и уточнения. Ссылка на карту внизу.
Также код получился не супер оптимизированным и понятным, преследовалась задача реализовать подобное в варкрафте. Спасибо за ваши замечания и уточнения. Ссылка на карту внизу.
P.S. на ютубе известен как Brilock, там работаю над wow-подобной картой и шутером от 1 лица. Если интересно, можете чекнуть. Это к тому, что код юзабельный в таких проектах.
Хотя можно подрихтовать:
Включать ForceUICancelBJ, только если левая кнопка зажата более 0,1 сек, ибо на разовых кликах вроде не ломается
Хотя зачем при WASD движение стандартные касты - хороший вопрос, когда можно всё сделать на квик кастах
В целом норм, не тестил код бегло глянул, надо ещё видео приложить и вообще ОГОНЬ
Edited by ScorpioT1000
Edited by captainbob