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

Region/Camera Help Required

Status
Not open for further replies.
Level 5
Joined
Apr 11, 2011
Messages
107
first off, here are my triggers.
  • Zone1
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
      • (1o <gen> contains Hero) Equal to True
    • Actions
      • Camera - Apply Camera 001 <gen> for Player 1 (Red) over 0.00 seconds
      • Camera - Set the camera bounds for Player 1 (Red) to 1i <gen>
      • Camera - Lock camera target for Player 1 (Red) to Hero, offset by (0.00, 0.00) using Default rotation
(Skip ahead to the part marked with a "+" for the actual request.)


"1o" is the outside region, in this case, its a 512x512 square.

"1i" is the inside region, it is nestled within "1o" and acts as a center point for the camera. it is a 256x25 square.

the regions are not always these dimensions. these just happen to be hallway "rooms". the boss fight room is 5x as large.

what im trying to do is create a camera system similar to this: >Click Me<

for those of you too lazy to watch. it essentially locks the camera in a square room, and when you move to another square room, the camera shifts over.

+what i want is a way to do all of this with out having to make 2 regions and a trigger for each "room". or if i must, a way to do it with out all of the triggers, i am willing to do the regions.

thanks for any help you can provide :)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You could use "Unit enters region"

Register all regions for one trigger. Save the handle of the camera bounds regien for the region you enter and also save the camera handle.

The initialization trigger might become long this way, but then you only need one trigger that handles all the regions and cameras.

Events
Unit enters region
Coditions
Actions
Apply "load camera handle"
Set camera bounds to "load region handle"


New:
  • Untitled Trigger 031
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: local region r
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
      • Set trig = Untitled Trigger 032 <gen>
      • -------- ---------------------------------------- --------
      • Set regions[1] = 1 <gen>
      • Set regions[2] = 2 <gen>
      • -------- ---------------------------------------- --------
      • Set cameras[1] = Camera 001 <gen>
      • Set cameras[2] = Camera 002 <gen>
      • -------- ---------------------------------------- --------
      • Custom script: set r = CreateRegion()
      • Custom script: call RegionAddRect(r, gg_rct_Region001)
      • Custom script: call TriggerRegisterEnterRegion(udg_trig, r, null)
      • Custom script: set udg_i1 = GetHandleId(r)
      • Hashtable - Save 1 as 0 of i1 in hash
      • -------- ---------------------------------------- --------
      • Custom script: set r = CreateRegion()
      • Custom script: call RegionAddRect(r, gg_rct_Region001)
      • Custom script: call TriggerRegisterEnterRegion(udg_trig, r, null)
      • Custom script: set udg_i1 = GetHandleId(r)
      • Hashtable - Save 2 as 0 of i1 in hash
      • -------- ---------------------------------------- --------
      • Custom script: set r = null
  • Untitled Trigger 032
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_i1 = LoadInteger(udg_hash, GetHandleId(GetTriggeringRegion()), 0)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i1 Not equal to 0
        • Then - Actions
          • Camera - Set the camera bounds for (Owner of (Triggering unit)) to regions[i1]
          • Camera - Lock camera target for (Owner of (Triggering unit)) to (Triggering unit), offset by (0.00, 0.00) using Default rotation
        • Else - Actions
I used the following GUI variables:
i1 - integer
hash - hashtable
trig - trigger
regions - region array
cameras - camera array

When you set up cameras and regions into the arrays, don't use index 0.

In this block
  • Custom script: set r = CreateRegion()
  • Custom script: call RegionAddRect(r, gg_rct_Region001)
  • Custom script: call TriggerRegisterEnterRegion(udg_trig, r, null)
  • Custom script: set udg_i1 = GetHandleId(r)
  • Hashtable - Save 1 as 0 of i1 in hash
Change the Region001 into your region name. Region names will always have gg_rct_ prefix if they are not trigger generated. Change the 1 in the hashtable line to the index of the region/camera you want to use for the enterable region.
 
Last edited:
Level 5
Joined
Apr 11, 2011
Messages
107
will this trigger work with what ive got here? (attached map) ive got 4 regions/rooms/areas using my triggers. will yours do the same?
 

Attachments

  • adi.w3x
    30.4 KB · Views: 36
Level 5
Joined
Apr 11, 2011
Messages
107
I was just going to use 1 timer, then around 100 if/then/else actions.

With your trigger what do I need to do/change? Besides the trigger names and triggers to run. Do I need to name my regions special? Do I need to set any additional variables?
 
Status
Not open for further replies.
Top