1
1-Cent
Guest
I have a Trigger that I want to "Convert" to the one I use.
Here it is:
How do I make that to the form I use?
Here it is:
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SetCameraDialog
globals
// created on first use, and then reused during the game, never destroyed
private Dialog CameraDialog = 0
endglobals
private function LockCamera takes player p returns nothing
local unit hero = GetSelectedUnit(p)
if hero == null then
call SimError(p, "You must select unit first.")
else
call SetCameraTargetControllerNoZForPlayer( p, hero, 0, 0, false )
call DisplayTextToPlayer(p, 0, 0, GOLD+"Press "+GREEN+"Ctrl-C"+GOLD+" to unlock camera.")
set hero = null
endif
endfunction
private function Callback takes nothing returns nothing
local integer result = CameraDialog.GetResult()
local integer newCameraDistance
if result == HK_1 then
set newCameraDistance = 1600
elseif result == HK_2 then
set newCameraDistance = 2400
elseif result == HK_3 then
set newCameraDistance = 3200
elseif result == HK_4 then
call LockCamera(GetTriggerPlayer())
return
elseif result == HK_ESC then
return
else
call BJDebugMsg("UNKNOWN RESULT #" + I2S(result)) // This should never happen
endif
call SetCameraFieldForPlayer( GetTriggerPlayer(), CAMERA_FIELD_TARGET_DISTANCE, newCameraDistance, 0 )
endfunction
private function Actions takes nothing returns nothing
// create on first use
if CameraDialog == 0 then
set CameraDialog = Dialog.create()
call CameraDialog.SetMessage("Set Camera Distance")
call CameraDialog.AddButton("|c00FFFFFF[1]|r - 1600", HK_1)
call CameraDialog.AddButton("|c00FFFFFF[2]|r - 2400", HK_2)
call CameraDialog.AddButton("|c00FFFFFF[3]|r - 3200", HK_3)
call CameraDialog.AddButton("|c00FFFFFF[4]|r - Lock Camera", HK_4)
call CameraDialog.AddButton("Cancel", HK_ESC)
call CameraDialog.AddAction( function Callback )
endif
call CameraDialog.Show(GetTriggerPlayer())
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger t = CreateTrigger( )
local integer i = 0
loop
exitwhen i>=12 // maximum number of human players is 12
call TriggerRegisterPlayerEvent(t, Player(i), EVENT_PLAYER_END_CINEMATIC)
set i = i + 1
endloop
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endscope
How do I make that to the form I use?