• 🏆 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!

Flashing camera while using the inventory - 1.18

Status
Not open for further replies.
Level 19
Joined
Sep 4, 2007
Messages
2,826
New Fix!
Here is a fix for the camera system. You can download the trigger here.

To fix it just copy all the changes in this new updated "Inventory Camera" trigger over to the old "Inventory Camera".
  • Inventory Camera
    • Events
      • Time - Inventory_Camera_Test expires
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Inventory_Player_Is_Viewing[(Integer A)] Equal to True
            • Then - Actions
              • Camera - Apply Inventory_Camera[(Integer A)] for (Player((Integer A))) over 0.01 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Heroes[(Integer A)] Not equal to No unit
                • Then - Actions
                  • Set rect = (Position of Heroes[(Integer A)])
                  • Camera - Pan camera for (Player((Integer A))) to rect over 0.01 seconds
                  • Camera - Set (Player((Integer A)))'s camera Distance to target to 1850.00 over 0.01 seconds
                  • Camera - Set (Player((Integer A)))'s camera Angle of attack to 315.00 over 0.01 seconds
                  • Camera - Set (Player((Integer A)))'s camera Rotation to 140.00 over 0.01 seconds
                  • Custom script: set udg_z = GetCameraField(CAMERA_FIELD_ZOFFSET)+300 - (256- GetLocationZ(udg_rect))-GetCameraTargetPositionZ()
                  • Camera - Set (Player((Integer A)))'s camera Height Offset to z over 0.01 seconds
                  • Custom script: call RemoveLocation(udg_rect)
                • Else - Actions
      • Countdown Timer - Start Inventory_Camera_Test as a One-shot timer that will expire in 0.01 seconds
To make it work fully just disable some part of CamLock by replacing the entire code with this one:
JASS:
scope Camlock initializer InitTrig

globals
    trigger CamLock
    integer INDEX = 0
    boolean array DEAD
    unit array HERO
    player array PLAYERS
    integer array IND
    location LOC
endglobals

private function Actions takes nothing returns nothing
//local integer index = 0
//local real x
//local real y
//local real z

//loop
    //exitwhen index == INDEX
    //set x = GetUnitX(HERO[index])
    //set y = GetUnitY(HERO[index])
    //call MoveLocation(LOC,x,y)

    //if GetLocalPlayer() == PLAYERS[index] then
        //if udg_Inventory_Player_Is_Viewing[index] == false then

            //if DEAD[index] == false then
            //set z = GetCameraField(CAMERA_FIELD_ZOFFSET)+300 - (256- GetLocationZ(LOC))-GetCameraTargetPositionZ()
            //call SetCameraField(CAMERA_FIELD_ZOFFSET,z,1.0)
            //call SetCameraPosition(x,y)
            //call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,1850,0.1)
            //call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,315,0.1)
            //call SetCameraField(CAMERA_FIELD_ROTATION,140,0.1)

            //endif
        //endif
    //endif
    //set index = index + 1
//endloop
endfunction

private function InitTrig takes nothing returns nothing
    set CamLock = CreateTrigger()
    set LOC = Location(0,0)
    set DEAD[0] = false
    set DEAD[1] = false
    set DEAD[2] = false
    set DEAD[3] = false
    set DEAD[4] = false
    set DEAD[5] = false
call TriggerRegisterTimerEvent(CamLock,0.017,true)
call TriggerAddAction(CamLock, function Actions)
endfunction


endscope
 
Last edited:
Level 19
Joined
Sep 4, 2007
Messages
2,826
This is an old fix which doesn't really work.


Replace the code in script CamLock with this code. My changes prevents the flashing camera thingy.
JASS:
scope Camlock initializer InitTrig

globals
    trigger CamLock
    integer INDEX = 0
    boolean array DEAD
    unit array HERO
    player array PLAYERS
    integer array IND
    location LOC
endglobals

private function Actions takes nothing returns nothing
local integer index = 0
local real x
local real y
local real z

loop
    exitwhen index == INDEX
    set x = GetUnitX(HERO[index])
    set y = GetUnitY(HERO[index])
    call MoveLocation(LOC,x,y) 
    
    if GetLocalPlayer() == PLAYERS[index] then
        if udg_Inventory_Player_Is_Viewing[index] == false then
        
            if DEAD[index] == false then
            set z = GetCameraField(CAMERA_FIELD_ZOFFSET)+300 - (256- GetLocationZ(LOC))-GetCameraTargetPositionZ()
            call SetCameraField(CAMERA_FIELD_ZOFFSET,z,1.0)
            call SetCameraPosition(x,y)
            call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,1850,0.1)
            call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,315,0.1)
            call SetCameraField(CAMERA_FIELD_ROTATION,140,0.1)
            
            endif
        endif
    endif
    set index = index + 1
endloop
endfunction

private function InitTrig takes nothing returns nothing
    set CamLock = CreateTrigger()
    set LOC = Location(0,0)
    set DEAD[0] = false
    set DEAD[1] = false
    set DEAD[2] = false
    set DEAD[3] = false
    set DEAD[4] = false
    set DEAD[5] = false
call TriggerRegisterTimerEvent(CamLock,0.017,true)
call TriggerAddAction(CamLock, function Actions)
endfunction


endscope
 
Last edited:
Status
Not open for further replies.
Top