• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Changing Terrain Fog for Local Players

Status
Not open for further replies.
Level 5
Joined
Jan 19, 2018
Messages
126
Hello Hive,
I have made a trigger in my 3v3 map that changes the terrain fog for the player depending on what part of the map the camera is focusing on. The trigger works as intended but the problem is that it sets the terrain fog for all players and I want it to use the local player, is this possible? Here is my trigger to show exactly how I'm doing it, again the trigger is working as intended (technically).
  • Check Camera Location
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Trigger - Run Camera in Blizzard <gen> (checking conditions)
      • Trigger - Run Camera in Throne of Kiljaeden <gen> (checking conditions)
      • Trigger - Run Camera in Abyssal Maw <gen> (checking conditions)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Evaluate Camera in Blizzard <gen> conditions) Equal to False
          • (Evaluate Camera in Throne of Kiljaeden <gen> conditions) Equal to False
          • (Evaluate Camera in Abyssal Maw <gen> conditions) Equal to False
        • Then - Actions
          • Environment - Reset fog to default values
        • Else - Actions
  • Camera in Blizzard
    • Events
    • Conditions
      • (Target X of current camera view) Greater than or equal to (Min X of Blizzard Wind Region <gen>)
      • (Target X of current camera view) Less than or equal to (Max X of Blizzard Wind Region <gen>)
      • (Target Y of current camera view) Greater than or equal to (Min Y of Blizzard Wind Region <gen>)
      • (Target Y of current camera view) Less than or equal to (Max Y of Blizzard Wind Region <gen>)
    • Actions
      • Environment - Set fog to style Linear, z-start 0.00, z-end 8000.00, density 1.00 and color (100.00%, 100.00%, 100.00%)
  • Camera in Throne of Kiljaeden
    • Events
    • Conditions
      • (Target X of current camera view) Greater than or equal to (Min X of The Throne of Kiljaeden <gen>)
      • (Target X of current camera view) Less than or equal to (Max X of The Throne of Kiljaeden <gen>)
      • (Target Y of current camera view) Greater than or equal to (Min Y of The Throne of Kiljaeden <gen>)
      • (Target Y of current camera view) Less than or equal to (Max Y of The Throne of Kiljaeden <gen>)
    • Actions
      • Environment - Set fog to style Linear, z-start 0.00, z-end 8000.00, density 2.00 and color (55.00%, 0.00%, 0.00%)
  • Camera in Abyssal Maw
    • Events
    • Conditions
      • (Target X of current camera view) Greater than or equal to (Min X of The Abyssal Maw <gen>)
      • (Target X of current camera view) Less than or equal to (Max X of The Abyssal Maw <gen>)
      • (Target Y of current camera view) Greater than or equal to (Min Y of The Abyssal Maw <gen>)
      • (Target Y of current camera view) Less than or equal to (Max Y of The Abyssal Maw <gen>)
    • Actions
      • Environment - Set fog to style Linear, z-start 0.00, z-end 8000.00, density 4.00 and color (20.00%, 5.00%, 30.00%)
 
Level 5
Joined
Jan 19, 2018
Messages
126
Run the fog change action in a locally executed block using GetLocalPlayer() == udg_SpecificPlayer as a condition.
But I need to track the current camera view coordinates of the local player don't I? I'm not sure how to do it. I have the local player udg but
I don't know how to apply it to current camera view coordinates of the local player.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
But I need to track the current camera view coordinates of the local player don't I?
One has to to do that globally. Setup the location before the local block and then use it in the local block. 1 location for each player is needed, so using an array which maps player to location would work. Remember to remove the location before overwriting it.
 
Level 5
Joined
Jan 19, 2018
Messages
126
I think I got it, it works for me as player 1 so I think it will work for all players.
  • Check Player Camera Coordinates
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 1 (Red)
        • Then - Actions
          • Set PlayerCurrentCamCoordsX[0] = (Target X of current camera view)
          • Set PlayerCurrentCamCoordsY[0] = (Target Y of current camera view)
          • Trigger - Run Camera in Blizzard Player 1 <gen> (checking conditions)
          • Trigger - Run Camera in Throne of Kiljaeden Player 1 <gen> (checking conditions)
          • Trigger - Run Camera in Abyssal Maw Player 1 <gen> (checking conditions)
          • Trigger - Run Camera in Normal Area Player 1 <gen> (checking conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 2 (Blue)
        • Then - Actions
          • Set PlayerCurrentCamCoordsX[1] = (Target X of current camera view)
          • Set PlayerCurrentCamCoordsY[1] = (Target Y of current camera view)
          • Trigger - Run Camera in Blizzard Player 2 <gen> (checking conditions)
          • Trigger - Run Camera in Throne of Kiljaeden Player 2 <gen> (checking conditions)
          • Trigger - Run Camera in Abyssal Maw Player 2 <gen> (checking conditions)
          • Trigger - Run Camera in Normal Area Player 2 <gen> (checking conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 3 (Teal)
        • Then - Actions
          • Set PlayerCurrentCamCoordsX[2] = (Target X of current camera view)
          • Set PlayerCurrentCamCoordsY[2] = (Target Y of current camera view)
          • Trigger - Run Camera in Blizzard Player 3 <gen> (checking conditions)
          • Trigger - Run Camera in Throne of Kiljaeden Player 3 <gen> (checking conditions)
          • Trigger - Run Camera in Abyssal Maw Player 3 <gen> (checking conditions)
          • Trigger - Run Camera in Normal Area Player 3 <gen> (checking conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 4 (Purple)
        • Then - Actions
          • Set PlayerCurrentCamCoordsX[3] = (Target X of current camera view)
          • Set PlayerCurrentCamCoordsY[3] = (Target Y of current camera view)
          • Trigger - Run Camera in Blizzard Player 4 <gen> (checking conditions)
          • Trigger - Run Camera in Throne of Kiljaeden Player 4 <gen> (checking conditions)
          • Trigger - Run Camera in Abyssal Maw Player 4 <gen> (checking conditions)
          • Trigger - Run Camera in Normal Area Player 4 <gen> (checking conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 5 (Yellow)
        • Then - Actions
          • Set PlayerCurrentCamCoordsX[4] = (Target X of current camera view)
          • Set PlayerCurrentCamCoordsY[4] = (Target Y of current camera view)
          • Trigger - Run Camera in Blizzard Player 5 <gen> (checking conditions)
          • Trigger - Run Camera in Throne of Kiljaeden Player 5 <gen> (checking conditions)
          • Trigger - Run Camera in Abyssal Maw Player 5 <gen> (checking conditions)
          • Trigger - Run Camera in Normal Area Player 5 <gen> (checking conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 6 (Orange)
        • Then - Actions
          • Set PlayerCurrentCamCoordsX[5] = (Target X of current camera view)
          • Set PlayerCurrentCamCoordsY[5] = (Target Y of current camera view)
          • Trigger - Run Camera in Blizzard Player 6 <gen> (checking conditions)
          • Trigger - Run Camera in Throne of Kiljaeden Player 6 <gen> (checking conditions)
          • Trigger - Run Camera in Abyssal Maw Player 6 <gen> (checking conditions)
          • Trigger - Run Camera in Normal Area Player 6 <gen> (checking conditions)
        • Else - Actions
  • Camera in Blizzard Player 1
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 1 (Red)
          • PlayerCurrentCamCoordsX[0] Greater than or equal to (Min X of Blizzard Wind Region <gen>)
          • PlayerCurrentCamCoordsX[0] Less than or equal to (Max X of Blizzard Wind Region <gen>)
          • PlayerCurrentCamCoordsY[0] Greater than or equal to (Min Y of Blizzard Wind Region <gen>)
          • PlayerCurrentCamCoordsY[0] Less than or equal to (Max Y of Blizzard Wind Region <gen>)
        • Then - Actions
          • Set CameraInBlizzard[0] = True
          • Environment - Set fog to style Linear, z-start 0.00, z-end 8000.00, density 1.00 and color (100.00%, 100.00%, 100.00%)
        • Else - Actions
          • Set CameraInBlizzard[0] = False
  • Camera in Throne of Kiljaeden Player 1
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 1 (Red)
          • PlayerCurrentCamCoordsX[0] Greater than or equal to (Min X of The Throne of Kiljaeden <gen>)
          • PlayerCurrentCamCoordsX[0] Less than or equal to (Max X of The Throne of Kiljaeden <gen>)
          • PlayerCurrentCamCoordsY[0] Greater than or equal to (Min Y of The Throne of Kiljaeden <gen>)
          • PlayerCurrentCamCoordsY[0] Less than or equal to (Max Y of The Throne of Kiljaeden <gen>)
        • Then - Actions
          • Set CameraInThrone[0] = True
          • Environment - Set fog to style Linear, z-start 0.00, z-end 8000.00, density 2.00 and color (55.00%, 0.00%, 0.00%)
        • Else - Actions
          • Set CameraInThrone[0] = False
  • Camera in Abyssal Maw Player 1
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 1 (Red)
          • PlayerCurrentCamCoordsX[0] Greater than or equal to (Min X of The Abyssal Maw <gen>)
          • PlayerCurrentCamCoordsX[0] Less than or equal to (Max X of The Abyssal Maw <gen>)
          • PlayerCurrentCamCoordsY[0] Greater than or equal to (Min Y of The Abyssal Maw <gen>)
          • PlayerCurrentCamCoordsY[0] Less than or equal to (Max Y of The Abyssal Maw <gen>)
        • Then - Actions
          • Set CameraInAbyssalMaw[0] = True
          • Environment - Set fog to style Linear, z-start 0.00, z-end 8000.00, density 4.00 and color (20.00%, 5.00%, 30.00%)
        • Else - Actions
          • Set CameraInAbyssalMaw[0] = False
  • Camera in Normal Area Player 1
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to Player 1 (Red)
          • CameraInBlizzard[0] Equal to False
          • CameraInThrone[0] Equal to False
          • CameraInAbyssalMaw[0] Equal to False
        • Then - Actions
          • Environment - Reset fog to default values
        • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top