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

Follow Camera when enter portal any units

Status
Not open for further replies.
Level 5
Joined
Jan 5, 2019
Messages
108
Hey i'm making a map where there's a lot of portals, and i like to make it more user friendly by every time you enter a portal the camera follows who ever enter the portal. thanks in advance :)
 
Level 5
Joined
Jun 13, 2017
Messages
83
first set a camera in the location you want, you can put them in world map the same way you put regions, then in triggers, in actions go to camera options, the first one should be apply camera object, choose the camera you want and maybe change player 1 to owner of unit when they trigger the entering portal.
 
Sadly I'm not aware of there are native events to catch waygate teleporting. If you want a very proper method, one would need to code the waygates mechanics from scratch.

But we can make an attempt to cover most common cases for default waygates, with some naive checks. We can catch when a unit enters the goal_region, and then we can make some checks if the unit has same coordinates it would have had after it used the waygate, or not. If it has wanted coordinates we just expect that the entered unit really used the waygate, else not.

Have a look:

Demo:
  • Enter Copy
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • -------- Define the Rect --------
      • Set WGC_Rect = Region 000 <gen>
      • -------- ----------------- --------
      • -------- Run the WayGateCheck --------
      • Trigger - Run WayGateCheck <gen> (ignoring conditions)
      • -------- ----------------- --------
      • -------- Check the UsedWayGate boolean --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WGC_UsedWayGate Equal to True
        • Then - Actions
          • Camera - Pan camera for (Owner of (Triggering unit)) to (Position of (Triggering unit)) over 0.00 seconds
        • Else - Actions
Check:
JASS:
function WGC_Check takes real val returns boolean
    return val == 0. or val == 16. or val == 32.
endfunction

function Trig_WayGateCheck_Actions takes nothing returns nothing
    set udg_WGC_UsedWayGate = WGC_Check(RAbsBJ(GetRectCenterX(udg_WGC_Rect) - GetUnitX(GetTriggerUnit()))) and /*
                           */ WGC_Check(RAbsBJ(GetRectCenterY(udg_WGC_Rect) - GetUnitY(GetTriggerUnit())))
endfunction

//===========================================================================
function InitTrig_WayGateCheck takes nothing returns nothing
    set gg_trg_WayGateCheck = CreateTrigger(  )
    call TriggerAddAction( gg_trg_WayGateCheck, function Trig_WayGateCheck_Actions )
endfunction
 

Attachments

  • WayGateCheck.w3x
    9.9 KB · Views: 22
Last edited:
Level 6
Joined
Aug 28, 2015
Messages
213
Each waygate has a region around it, what is normally the case because you want to move in both directions.
Then you check if the unit left the region the gate is standing in and check if the unit is in the region the waygate teleports to if so you move the camera. if the unit is not in the other region then it just moved out by walking and don't has to be tracked.
like this
  • WaygateCamera01
    • Events
      • Unit - A unit leaves Waygate 01 <gen>
    • Conditions
      • (Waygate 02 <gen> contains (Triggering unit)) Equal to True
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Camera - Pan camera for (Owner of (Triggering unit)) to TempPoint over 2.00 seconds
      • Custom script: call RemoveLocation(udg_TempPoint)
The issue with my way is that you have to create for each direction one trigger, by a map with may waygates that could be a bit cluttered.
 

Attachments

  • WaygateCamera.w3x
    8.9 KB · Views: 28
Level 5
Joined
Jan 5, 2019
Messages
108
Each waygate has a region around it, what is normally the case because you want to move in both directions.
Then you check if the unit left the region the gate is standing in and check if the unit is in the region the waygate teleports to if so you move the camera. if the unit is not in the other region then it just moved out by walking and don't has to be tracked.
like this
  • WaygateCamera01
    • Events
      • Unit - A unit leaves Waygate 01 <gen>
    • Conditions
      • (Waygate 02 <gen> contains (Triggering unit)) Equal to True
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Camera - Pan camera for (Owner of (Triggering unit)) to TempPoint over 2.00 seconds
      • Custom script: call RemoveLocation(udg_TempPoint)
The issue with my way is that you have to create for each direction one trigger, by a map with may waygates that could be a bit cluttered.

Thanks for the answers, yeah i use alot of waygates so im not sure if i should set my mind into your idea or IcemanBo. Im dont really understand how to set up scripts. But i think i try, i let you guys know if it worked. ^^ Thanks again!
 
Level 5
Joined
Jan 5, 2019
Messages
108
When leave what region? Is it considered the unit can leave the waygate region also normally, without using the teleport?
No it can leave with a portal too, although it would be better if i could make a trigger that made the character return to base after every enemy / player 12 units had died in a specific region. and then the camera would change over to your character again.
 
Status
Not open for further replies.
Top