• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Help for GUI Version!

Status
Not open for further replies.
Level 30
Joined
Jul 31, 2010
Messages
5,246
Hello Helpers! :grin:

I need help for those who knows Jass very much and know a way to make a GUI version for it?. I'm having a hard time pin-pointing this code/s that I am about to show you guys out there, Its about a camera rotations that hit me so good that I want it for my map, but somehow its daunting and I really need help, here are the codes:


1st Category is "Camera"
JASS:
//TESH.scrollpos=75
//TESH.alwaysfold=0
library ThirdPersonCam initializer Init

    globals
        //*****************************************************************************
        // CONSTANTS:
        private constant real DISTANCE_AOA_MIN      = -15
        private constant real DISTANCE_DISTANCE_MIN = 300
        private constant real DISTANCE_AOA_MAX      = -65
        private constant real DISTANCE_DISTANCE_MAX = 500
        private constant real OFFSET_AOA_MIN        = -35
        private constant real OFFSET_OFFSET_MIN     = 0
        private constant real OFFSET_AOA_MAX        = -70
        private constant real OFFSET_OFFSET_MAX     = 150
        
        private constant real Z_OFFSET            = 100
        private constant real TIMEOUT             = 0.1
        private constant real TERRAIN_SAMPLING    = 32
        private constant real PAN_DURATION        = 0.5
        private constant real ANGLE_ABOVE_TERRAIN = 15
        private constant real DEFAULT_AOA         = -20
        private constant real DEFAULT_ROT         = 0
        private constant real FIELD_OF_VIEW       = 120
        private constant real FAR_Z               = 5000
        private constant real CLIFF_DISTANCE      = 500
        //
        //*****************************************************************************
        
        //*****************************************************************************
        // Public variables.
        real array ThirdPersonCamAoA
        real array ThirdPersonCamRot
        //
        //*****************************************************************************
        
        //*****************************************************************************
        // Internal variables. These should not be changed:
        private location Loc = Location(0,0)
        private unit array Unit
        private timer array FirstPan
        
        private real DistanceM = (DISTANCE_DISTANCE_MAX-DISTANCE_DISTANCE_MIN)/((DISTANCE_AOA_MAX-DISTANCE_AOA_MIN)*bj_DEGTORAD)
        private real DistanceT = DISTANCE_DISTANCE_MIN-DISTANCE_AOA_MIN*bj_DEGTORAD*DistanceM
        private real OffsetM = (OFFSET_OFFSET_MAX-OFFSET_OFFSET_MIN)/((OFFSET_AOA_MAX-OFFSET_AOA_MIN)*bj_DEGTORAD)
        private real OffsetT = OFFSET_OFFSET_MIN-OFFSET_AOA_MIN*bj_DEGTORAD*OffsetM
        //
        //*****************************************************************************
    endglobals
    
    //*****************************************************************************
    // Functions for distance and offset. These are linear mathematical functions y = mx+t.
    private function InterpolateDistance takes real angleOfAttack returns real
        if angleOfAttack <= DISTANCE_AOA_MAX*bj_DEGTORAD then
            return DISTANCE_DISTANCE_MAX
        elseif angleOfAttack >= DISTANCE_AOA_MIN*bj_DEGTORAD then
            return DISTANCE_DISTANCE_MIN
        endif
        return DistanceM * angleOfAttack + DistanceT
    endfunction

    private function InterpolateOffset takes real angleOfAttack returns real
        if angleOfAttack <= OFFSET_AOA_MAX*bj_DEGTORAD then
            return OFFSET_OFFSET_MAX
        elseif angleOfAttack >= OFFSET_AOA_MIN*bj_DEGTORAD then
            return OFFSET_OFFSET_MIN
        endif
        return OffsetM * angleOfAttack + OffsetT
    endfunction
    //
    //*****************************************************************************

    //*****************************************************************************
    // Functions for camera settings.
    private function ApplyCam takes integer p, real duration returns nothing
        local real aoa = GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK) - 2*bj_PI
        local real offset = InterpolateOffset(aoa)
        local real newaoa
        local real maxd
        local real tarz
        local real newx
        local real newy
        local real newm
        local real maxm = -1
        local real r = TERRAIN_SAMPLING
        local real dx
        local real dy
        
        call SetCameraField(CAMERA_FIELD_ROTATION, GetUnitFacing(Unit) + ThirdPersonCamRot, duration)
        call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW, FIELD_OF_VIEW, duration)
        call SetCameraField(CAMERA_FIELD_FARZ, FAR_Z, duration)
        call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, InterpolateDistance(aoa), duration)
        
        call PanCameraToTimed(GetUnitX(Unit) + offset * Cos(bj_DEGTORAD*GetUnitFacing(Unit)), GetUnitY(Unit) + offset * Sin(bj_DEGTORAD*GetUnitFacing(Unit)), duration)
        
        set newx = GetCameraTargetPositionX()
        set newy = GetCameraTargetPositionY()
        set maxd = CLIFF_DISTANCE+GetCameraField(CAMERA_FIELD_TARGET_DISTANCE)
        set dx = -Cos(GetCameraField(CAMERA_FIELD_ROTATION))*r
        set dy = -Sin(GetCameraField(CAMERA_FIELD_ROTATION))*r
        
        call MoveLocation(Loc, newx, newy)
        set tarz = GetCameraTargetPositionZ()
        call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + GetLocationZ(Loc) + Z_OFFSET + GetUnitFlyHeight(Unit) - tarz, duration)
                
        loop
            exitwhen r > maxd
            set newx = newx+dx
            set newy = newy+dy
            call MoveLocation(Loc, newx, newy)
            set newm = (GetLocationZ(Loc)-tarz)/r
            if newm > maxm then
                set maxm = newm
            endif
            set r = r+TERRAIN_SAMPLING
        endloop
        set newaoa = - Atan(maxm) * bj_RADTODEG - ANGLE_ABOVE_TERRAIN
        if ThirdPersonCamAoA < newaoa then
            set newaoa = ThirdPersonCamAoA
        endif
        call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, newaoa, duration)
    endfunction
    
    private function Periodic takes nothing returns nothing
        local integer p = GetPlayerId(GetLocalPlayer())
        
        if Unit != null then
            if TimerGetRemaining(FirstPan) <= PAN_DURATION then
                call ApplyCam(p, PAN_DURATION)
            else
                call ApplyCam(p, TimerGetRemaining(FirstPan))
            endif
        endif
    endfunction
    //
    //*****************************************************************************
    
    //*****************************************************************************
    // Public functions.
    function EnableThirdPersonCam takes player whichPlayer, unit whichUnit, real firstPan returns nothing
        local integer p = GetPlayerId(whichPlayer)
        
        set Unit = whichUnit
        call TimerStart(FirstPan, firstPan, false, null)
        if GetLocalPlayer() == Player(p) then
            call StopCamera()
            if whichUnit != null then
                call ApplyCam(p, firstPan)
            endif
        endif
    endfunction
    
    function IsThirdPersonCamActive takes integer p returns boolean
        return Unit != null
    endfunction
    
    function ResetThirdPersonCamAoA takes integer p returns nothing
        set ThirdPersonCamAoA = DEFAULT_AOA
    endfunction
    
    function ResetThirdPersonCamRot takes integer p returns nothing
        set ThirdPersonCamRot = DEFAULT_ROT
    endfunction
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //Init function for timer and arrays.
    private function Init takes nothing returns nothing
        local timer t = CreateTimer()
        local integer i = 0
        
        loop
            exitwhen i == 12
            set ThirdPersonCamAoA[i] = DEFAULT_AOA
            set ThirdPersonCamRot[i] = DEFAULT_ROT
            set Unit[i] = null
            set FirstPan[i] = CreateTimer()
            set i = i+1
        endloop
        
        call TimerStart(t, TIMEOUT, true, function Periodic)
        
        set t = null
    endfunction
    //
    //*****************************************************************************

endlibrary
JASS:
//TESH.scrollpos=27
//TESH.alwaysfold=0
library FixedCam initializer Init
    
    globals
        //*****************************************************************************
        // CONSTANTS:        
        private constant real TIMEOUT       = 0.1
        private constant real PAN_DURATION  = 0.5
        private constant real FIELD_OF_VIEW = 120
        private constant real FAR_Z         = 5000
        //
        //*****************************************************************************
        
        //*****************************************************************************
        // Public variables:
        real array FixedCamAoA
        real array FixedCamRot
        //
        //*****************************************************************************
        
        //*****************************************************************************
        // Internal variables. These should not be changed:
        private location Loc = Location(0,0)
        private real array X
        private real array Y
        private real array Z
        private unit array Unit
        private timer array FirstPan
        //
        //*****************************************************************************
    endglobals
    
    //*****************************************************************************
    // Functions for camera setting.
    private function ApplyCam takes integer p, real duration returns nothing
        local real unitx = GetUnitX(Unit)
        local real unity = GetUnitY(Unit)
        local real dx = unitx - X
        local real dy = unity - Y
        local real r = SquareRoot(dx*dx + dy*dy)
        
        call PanCameraToTimed(X, Y, duration)
        call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 0, duration)  
        call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW, FIELD_OF_VIEW, duration)
        call SetCameraField(CAMERA_FIELD_FARZ, FAR_Z, duration)
        
        call MoveLocation(Loc, unitx, unity)
        call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, -bj_RADTODEG * Atan2(GetCameraTargetPositionZ()-GetLocationZ(Loc)-GetUnitFlyHeight(Unit), r)+ThirdPersonCamAoA, duration)
        
        call MoveLocation(Loc, GetCameraTargetPositionX(), GetCameraTargetPositionY())
        call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + GetLocationZ(Loc) + Z - GetCameraTargetPositionZ(), duration)
        
        call SetCameraField(CAMERA_FIELD_ROTATION, bj_RADTODEG * Atan2(dy, dx)+ThirdPersonCamRot, duration)        
    endfunction
    
    private function Periodic takes nothing returns nothing
        local integer p = GetPlayerId(GetLocalPlayer())
        
        if Unit != null then
            if TimerGetRemaining(FirstPan) <= PAN_DURATION then
                call ApplyCam(p, PAN_DURATION)
            else
                call ApplyCam(p, TimerGetRemaining(FirstPan))
            endif
        endif
    endfunction
    //
    //*****************************************************************************
    
    //*****************************************************************************
    // Public functions.
    function EnableFixedCam takes player whichPlayer, unit whichUnit, real x, real y, real z, real firstPan returns nothing
        local integer p = GetPlayerId(whichPlayer)
        
        set Unit = whichUnit
        set X = x
        set Y = y
        set Z = z
        call TimerStart(FirstPan, firstPan, false, null)
        if GetLocalPlayer() == Player(p) then
            call StopCamera()
            if whichUnit != null then
                call ApplyCam(p, firstPan)
            endif
        endif
    endfunction
    
    function IsFixedCamActive takes integer p returns boolean
        return Unit != null
    endfunction
    
    function ResetFixedCamAoA takes integer p returns nothing
        set FixedCamAoA = 0
    endfunction
    
    function ResetFixedCamRot takes integer p returns nothing
        set FixedCamRot = 0
    endfunction
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //Init function for timer and arrays.
    private function Init takes nothing returns nothing
        local timer t
        local integer i = 0
        
        loop
            exitwhen i == 12
            set X[i] = 0
            set Y[i] = 0
            set Z[i] = 0
            set FixedCamAoA[i] = 0
            set FixedCamRot[i] = 0
            set Unit[i] = null
            set FirstPan[i] = CreateTimer()
            set i = i+1
        endloop
        
        set t = CreateTimer()
        call TimerStart(t, TIMEOUT, true, function Periodic)
        
        set t = null
    endfunction
    //
    //*****************************************************************************
    
endlibrary

2nd Category is "Camera Pluggins"
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ArrowKeys initializer Init

//*****************************************************************
//*  ARROW KEYS
//*  written by: Anitarf
//*
//*  A simple library for handling arrow keys. It allows you to
//*  check at any time which arrow keys are pressed as well as
//*  respond to keypress events the moment they happen.
//*****************************************************************

    // functions following this function interface can be used as keypress event responses
    // whichkey parameter values: 1-left, 2-right, 3-down, 4-up
    // pressed parameter values: true-key was pressed, false-key was released
    public function interface Event takes player whichPlayer, integer whichKey, boolean pressed returns nothing

    // the library is used through the following variables:
    globals
        // the following constant determines the behaviour of the vertical and horizontal
        // variables. For example, if a player presses the up key and then presses the down
        // key afterwards while still holding the up key, the vertical variable will be set
        // to -1. Then, if the player releases the down key while still keeping the up key
        // pressed, if RESUME_PREVIOUS_KEY is true the vertical variable will be set back
        // to 1, else it will be set to 0.
        private constant boolean RESUME_PREVIOUS_KEY = true
    
        // this tells you the status of the arrow keys in the two directions for each player
        // index 0 holds the values for player 1 (red), index 11 for player 12 (brown)
        // a value of 0 means no keys pressed, 1 means right/up, -1 means left/down
        // do not change the value of these variables
        public integer array vertical
        public integer array horizontal
        // this tells you the status of each arrow key individualy for each player
        // index 0 holds the values for player 1 (red), index 11 for player 12 (brown)
        // this is basicaly the same as vertical/horizontal, you can use whichever you want
        // do not change the value of these variables
        public boolean array up
        public boolean array down
        public boolean array left
        public boolean array right
        // these are the "quick press" variables. They work similarly to the variables above,
        // except that they aren't set to 0/false when a key is released. If you are checking
        // the above variables on a periodic timer, you could miss a keypress if a player
        // quickly presses and releases a key, the variables below allow you to catch such
        // quick keypresses. Note that you must set these variables to 0/false yourself once
        // you check them or they'll remain permanently set to 1/-1/true. Basicaly these
        // variables tell you if a key has been pressed since you last set them to 0/false.
        public integer array verticalQP
        public integer array horizontalQP
        public boolean array upQP
        public boolean array downQP
        public boolean array leftQP
        public boolean array rightQP

        // these are the external functions that get called when an arrow key is pressed/released
        // you can set these variables to your functions that follow the Event function interface
        // you don't need a different function for each event, you can set all these variables to
        // a single function, since the function's parameters tell you what event occured.
        public Event pressUp = 0
        public Event releaseUp = 0
        public Event pressDown = 0
        public Event releaseDown = 0
        public Event pressLeft = 0
        public Event releaseLeft = 0
        public Event pressRight = 0
        public Event releaseRight = 0
    endglobals

// ================================================================
    
    private function KeyPressLeft takes nothing returns nothing
        local integer i = GetPlayerId(GetTriggerPlayer())
        set left[i]=true
        set horizontal[i]=-1
        set leftQP[i]=true
        set horizontalQP[i]=-1
        if pressLeft != 0 then
            call pressLeft.evaluate(GetTriggerPlayer(), 1, true)
        endif
    endfunction
    private function KeyPressRight takes nothing returns nothing
        local integer i = GetPlayerId(GetTriggerPlayer())
        set right[i]=true
        set horizontal[i]=1
        set rightQP[i]=true
        set horizontalQP[i]=1
        if pressRight != 0 then
            call pressRight.evaluate(GetTriggerPlayer(), 2, true)
        endif
    endfunction
    private function KeyPressDown takes nothing returns nothing
        local integer i = GetPlayerId(GetTriggerPlayer())
        set down[i]=true
        set vertical[i]=-1
        set downQP[i]=true
        set verticalQP[i]=-1
        if pressDown != 0 then
            call pressDown.evaluate(GetTriggerPlayer(), 3, true)
        endif
    endfunction
    private function KeyPressUp takes nothing returns nothing
        local integer i = GetPlayerId(GetTriggerPlayer())
        set up[i]=true
        set vertical[i]=1
        set upQP[i]=true
        set verticalQP[i]=1
        if pressUp != 0 then
            call pressUp.evaluate(GetTriggerPlayer(), 4, true)
        endif
    endfunction

    private function KeyReleaseLeft takes nothing returns nothing
        local integer i = GetPlayerId(GetTriggerPlayer())
        set left[i]=false
        if RESUME_PREVIOUS_KEY and right[i] then
            set horizontal[i]=1
        else
            set horizontal[i]=0
        endif
        if releaseLeft != 0 then
            call releaseLeft.evaluate(GetTriggerPlayer(), 1, false)
        endif
    endfunction
    private function KeyReleaseRight takes nothing returns nothing
        local integer i = GetPlayerId(GetTriggerPlayer())
        set right[i]=false
        if RESUME_PREVIOUS_KEY and left[i] then
            set horizontal[i]=-1
        else
            set horizontal[i]=0
        endif
        if releaseRight != 0 then
            call releaseRight.evaluate(GetTriggerPlayer(), 2, false)
        endif
    endfunction
    private function KeyReleaseDown takes nothing returns nothing
        local integer i = GetPlayerId(GetTriggerPlayer())
        set down[i]=false
        if RESUME_PREVIOUS_KEY and up[i] then
            set vertical[i]=1
        else
            set vertical[i]=0
        endif
        if releaseDown != 0 then
            call releaseDown.evaluate(GetTriggerPlayer(), 3, false)
        endif
    endfunction
    private function KeyReleaseUp takes nothing returns nothing
        local integer i = GetPlayerId(GetTriggerPlayer())
        set up[i]=false
        if RESUME_PREVIOUS_KEY and down[i] then
            set vertical[i]=-1
        else
            set vertical[i]=0
        endif
        if releaseUp != 0 then
            call releaseUp.evaluate(GetTriggerPlayer(), 4, false)
        endif
    endfunction

    private function TriggerRegisterKeypressEvent takes trigger t, playerevent ev returns nothing
        local integer i = 0
        loop
            exitwhen i == 12
            call TriggerRegisterPlayerEvent( t, Player(i), ev )
            set i = i + 1
        endloop
    endfunction
    private function Init takes nothing returns nothing
        local trigger t

        //press left
        set t = CreateTrigger()
        call TriggerRegisterKeypressEvent( t, EVENT_PLAYER_ARROW_LEFT_DOWN )
        call TriggerAddAction( t, function KeyPressLeft )
        //release left
        set t = CreateTrigger()
        call TriggerRegisterKeypressEvent( t, EVENT_PLAYER_ARROW_LEFT_UP )
        call TriggerAddAction( t, function KeyReleaseLeft )

        //press right
        set t = CreateTrigger()
        call TriggerRegisterKeypressEvent( t, EVENT_PLAYER_ARROW_RIGHT_DOWN )
        call TriggerAddAction( t, function KeyPressRight )
        //release right
        set t = CreateTrigger()
        call TriggerRegisterKeypressEvent( t, EVENT_PLAYER_ARROW_RIGHT_UP )
        call TriggerAddAction( t, function KeyReleaseRight )

        //press down
        set t = CreateTrigger()
        call TriggerRegisterKeypressEvent( t, EVENT_PLAYER_ARROW_DOWN_DOWN )
        call TriggerAddAction( t, function KeyPressDown )
        //release down
        set t = CreateTrigger()
        call TriggerRegisterKeypressEvent( t, EVENT_PLAYER_ARROW_DOWN_UP )
        call TriggerAddAction( t, function KeyReleaseDown )

        //press up
        set t = CreateTrigger()
        call TriggerRegisterKeypressEvent( t, EVENT_PLAYER_ARROW_UP_DOWN )
        call TriggerAddAction( t, function KeyPressUp )
        //release up
        set t = CreateTrigger()
        call TriggerRegisterKeypressEvent( t, EVENT_PLAYER_ARROW_UP_UP )
        call TriggerAddAction( t, function KeyReleaseUp )

        set t = null
    endfunction

endlibrary
JASS:
//TESH.scrollpos=12
//TESH.alwaysfold=0
library TPCKeyboardPlugin initializer Init requires ArrowKeys, ThirdPersonCam
    
    globals
        //*****************************************************************************
        // CONSTANTS:
        private constant boolean INVERTED  = false
        private constant real TIMEOUT      = 0.1
        private constant real MIN_AOA      = -65
        private constant real MAX_AOA      = 0
        private constant real MAX_ROT      = 105
        private constant real AOA_INTERVAL = 3
        private constant real ROT_INTERVAL = 7.5
        //
        //*****************************************************************************
    endglobals
    
    private function CappedReal takes real r, real lowBound, real highBound returns real
        if r < lowBound then
            return lowBound
        elseif r > highBound then
            return highBound
        endif
        return r
    endfunction
    
    private function Periodic takes nothing returns nothing
        local integer i = 0
        
        loop
            exitwhen i == 12
            if IsThirdPersonCamActive(i) then
                if INVERTED then
                    set ThirdPersonCamRot[i] = CappedReal(ThirdPersonCamRot[i] + (ArrowKeys_horizontal[i] + ArrowKeys_horizontalQP[i]) * ROT_INTERVAL, -MAX_ROT, MAX_ROT)
                else
                    set ThirdPersonCamRot[i] = CappedReal(ThirdPersonCamRot[i] - (ArrowKeys_horizontal[i] + ArrowKeys_horizontalQP[i]) * ROT_INTERVAL, -MAX_ROT, MAX_ROT)
                endif
                set ArrowKeys_horizontalQP[i] = 0
                
                set ThirdPersonCamAoA[i] = CappedReal(ThirdPersonCamAoA[i] - (ArrowKeys_vertical[i] + ArrowKeys_verticalQP[i]) * AOA_INTERVAL, MIN_AOA, MAX_AOA)
                set ArrowKeys_verticalQP[i] = 0
            endif
            set i = i+1
        endloop
    endfunction
    
    private function Init takes nothing returns nothing
        local timer t = CreateTimer()
        
        call TimerStart(t, TIMEOUT, true, function Periodic)
    endfunction

endlibrary
JASS:
//TESH.scrollpos=6
//TESH.alwaysfold=0
library FCKeyboardPlugin initializer Init requires ArrowKeys, FixedCam

    globals
        //*****************************************************************************
        // CONSTANTS:
        private constant real TIMEOUT      = 0.1   
        private constant real MAX_AOA      = 20
        private constant real MAX_ROT      = 20
        private constant real AOA_INTERVAL = 3
        private constant real ROT_INTERVAL = 3
        //
        //*****************************************************************************
    endglobals
    
    private function CappedReal takes real r, real lowBound, real highBound returns real
        if r < lowBound then
            return lowBound
        elseif r > highBound then
            return highBound
        endif
        return r
    endfunction
    
    private function Periodic takes nothing returns nothing
        local integer i = 0
        
        loop
            exitwhen i == 12
            if IsFixedCamActive(i) then
                set FixedCamRot[i] = CappedReal(FixedCamRot[i] - (ArrowKeys_horizontal[i] + ArrowKeys_horizontalQP[i]) * ROT_INTERVAL, -MAX_ROT, MAX_ROT)
                set ArrowKeys_horizontalQP[i] = 0
                
                set FixedCamAoA[i] = CappedReal(FixedCamAoA[i] + (ArrowKeys_vertical[i] + ArrowKeys_verticalQP[i]) * AOA_INTERVAL, -MAX_AOA, MAX_AOA)
                set ArrowKeys_verticalQP[i] = 0
            endif
            set i = i+1
        endloop
    endfunction
    
    private function Init takes nothing returns nothing
        local timer t = CreateTimer()
        
        call TimerStart(t, TIMEOUT, true, function Periodic)
    endfunction
    
endlibrary

and the last Category "Init"
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Init initializer Init

    private function Actions takes nothing returns nothing
        local integer i = 0
        local unit u
        
        call FogEnable(false)
        call FogMaskEnable(false)
        call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
        
        loop
            exitwhen i == 12
            if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
                set u = CreateUnit(Player(i), 'hfoo', -1500, -2500, 45)
                call EnableThirdPersonCam(Player(i), u, 0)
            endif
            set i = i+1
        endloop
        set u = null
    endfunction

    private function Init takes nothing returns nothing
        set gg_trg_Init = CreateTrigger()
        call TriggerAddAction(gg_trg_Init, function Actions)
    endfunction

endscope
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FixedCamInit initializer Init

    private function Action takes nothing returns nothing
        local player p = GetOwningPlayer(GetEnteringUnit())
        
        call EnableThirdPersonCam(p, null, 0)
        call EnableFixedCam(p, GetEnteringUnit(), GetRectCenterX(gg_rct_FixedCam), GetRectCenterY(gg_rct_FixedCam), 200, 1)
    endfunction

    private function Init takes nothing returns nothing
        local region reg = CreateRegion()
        
        set gg_trg_FixedCamInit = CreateTrigger()
        call RegionAddRect(reg, gg_rct_FixedCam)
        call TriggerRegisterEnterRegion(gg_trg_FixedCamInit, reg, null)
        call TriggerAddAction(gg_trg_FixedCamInit, function Action)
        set reg = null
    endfunction
    
endscope
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FixedCamEnd initializer Init

    private function Action takes nothing returns nothing
        local player p = GetOwningPlayer(GetLeavingUnit())
        
        call EnableFixedCam(p, null, 0, 0, 0, 0)
        call EnableThirdPersonCam(p, GetLeavingUnit(), 1)
    endfunction

    private function Init takes nothing returns nothing
        local region reg = CreateRegion()
        
        set gg_trg_FixedCamEnd = CreateTrigger()
        call RegionAddRect(reg, gg_rct_FixedCam)
        call TriggerRegisterLeaveRegion(gg_trg_FixedCamEnd, reg, null)
        call TriggerAddAction(gg_trg_FixedCamEnd, function Action)
        set reg = null
    endfunction
    
endscope

If my explanations are so long here is the referrence of the camera style : http://www.wc3c.net/showthread.php?t=104786

this code was from Opposum (the Maker) and I don't know if he's forever offline cause I've already send him a message for a help.

if anyone knows how to change this back to GUI please, I'll accept your help, thank you so much for reading! :thumbs_up:
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Why don't you just learn to use systems that are written in JASS? If you "know" why they are written in JASS, why are you asking if there are GUI versions when you already know the answer?

I hate to say it, but GUI is inferior, if you disagree you're wrong, and it just can't do systems period. In the long term if you want to do certain things you'll have to accept that you'll need to work with some JASS. In this case I skimmed the code and while someone might be able to hack something together in GUI, aside from being worse it would take much longer to work out how to use it than just using the JASS you are already given (as well as waste someone's time writing it).

People who know enough to write stuff like this generally don't go near writing GUI with a 10 foot pole, and for good reason.
 
Level 30
Joined
Jul 31, 2010
Messages
5,246
Why don't you just learn to use systems that are written in JASS? If you "know" why they are written in JASS, why are you asking if there are GUI versions when you already know the answer?

I hate to say it, but GUI is inferior, if you disagree you're wrong, and it just can't do systems period. In the long term if you want to do certain things you'll have to accept that you'll need to work with some JASS. In this case I skimmed the code and while someone might be able to hack something together in GUI, aside from being worse it would take much longer to work out how to use it than just using the JASS you are already given (as well as waste someone's time writing it).

People who know enough to write stuff like this generally don't go near writing GUI with a 10 foot pole, and for good reason.

well your right, I guess I had no choice but to use Jass anyway, thank you for helping me, and for the pin-points you've shown, I just like GUI so much rather than Jass so I thought there is a altered version for this, anyways I'll just work hard time with jass, and for the second time, thank you for the help :smile:
 
Level 30
Joined
Jul 31, 2010
Messages
5,246
yeah its like a total pain, I tried many attempts but still blank, well just gonna do a little trial and error, thanks by the way, although i'm looking really hard for that keyboard system for that camera rotation. have you checked the demo map of it? the rotations are just incredible :grin:
 
Status
Not open for further replies.
Top