Sgqvur
FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
- Reaction score
- 62
This is an alternative way for anchoring the camera for a player by applying a given camerasetup. This method is "tappingproof", i.e if you tap the Mouse Wheel, Insert, Delete, Page Up and/or Page Down keys you will notice a minor flickering with the other method: Applying a given camerasetup very fast(0.03125, 0.02 etc.), which is "annoying" : P.
The script:
The provided functions are:
[lJASS]function fixed_cam_start takes camerasetup camera, player p, real camera_targetx, real camera_targety returns nothing[/lJASS]
and
[lJASS]function fixed_cam_stop takes player p returns nothing[/lJASS]
If the above made no sense then just check the map.
The script:
JASS:
library fixedcam initializer init
globals
private timer array camera_locker
private hashtable tripod_data
private constant integer NAIL_ID = 039;hpea039; // or dummy
endglobals
private struct tripod
camerasetup camera
player actor
unit nail
endstruct
function fixed_cam_start_act takes nothing returns nothing
local tripod trp = LoadInteger(tripod_data, 0, GetHandleId(GetExpiredTimer()))
if trp.actor == GetLocalPlayer() then
call CameraSetupApplyForceDuration(trp.camera, true, 1.0)
call SetCameraTargetController(trp.nail, 0.0, 0.0, false)
endif
endfunction
function fixed_cam_start takes camerasetup camera, player p, real camera_targetx, real camera_targety returns nothing
local unit nail
local tripod trp
local integer pid
set nail = CreateUnit(p, NAIL_ID, camera_targetx, camera_targety, 270.0)
call ShowUnit(nail, false)
call SetUnitPathing(nail, false)
call UnitAddAbility(nail, 039;Avul039;)
if p == GetLocalPlayer() then
call CameraSetupApplyForceDuration(camera, false, 0.0)
call SetCameraTargetController(nail, 0.0, 0.0, false)
call SelectUnit(nail, true)
call IssuePointOrder(nail, "move", GetUnitX(nail), GetUnitY(nail) - 16)
call SetUnitY(nail, GetUnitY(nail) + 16)
endif
set trp = tripod.create()
set trp.camera = camera
set trp.actor = p
set trp.nail = nail
set pid = GetPlayerId(p)
call SaveInteger(tripod_data, 0, GetHandleId(camera_locker[pid]), trp)
call TimerStart(camera_locker[pid], 1.0, true, function fixed_cam_start_act)
call SaveInteger(tripod_data, 0, pid, trp)
endfunction
function fixed_cam_stop takes player p returns nothing
local tripod trp = LoadInteger(tripod_data, 0, GetPlayerId(p))
call PauseTimer(camera_locker[GetPlayerId(trp.actor)])
call RemoveUnit(trp.nail)
call trp.destroy()
endfunction
function init takes nothing returns nothing
local integer i
set i = 0
loop
exitwhen i >= bj_MAX_PLAYERS
set camera_locker<i> = CreateTimer()
set i = i + 1
endloop
set tripod_data = InitHashtable()
endfunction
endlibrary
</i>
The provided functions are:
[lJASS]function fixed_cam_start takes camerasetup camera, player p, real camera_targetx, real camera_targety returns nothing[/lJASS]
and
[lJASS]function fixed_cam_stop takes player p returns nothing[/lJASS]
If the above made no sense then just check the map.