Unit enters region -> Camera locks to bounds of the region.

DoomedDude

New Member
Reaction score
1
So..
I'm working on a RPG map. There are lots of pretty small rooms. There are teleports where you go to and you get to another room.
My problem is, how could I lock the camera into the room a unit goes to, without making a trigger for every region. I could do it to every region
Trigger:
  • Events
    • Unit - A unit enters RegionA <gen>
    • Conditions
    • Actions
      • Set TempCam = RegionA <gen>
      • Camera - Set the camera bounds for (Triggering player) to TempCam
      • Custom script: call RemoveRect(udg_TempCam)


I'm looking for a action that would do action
Set TempCam = (Region (triggering unit) enters (triggering region)) or something, but that doesn't exist, is there a way to make it hard way?
 

millz-

New Member
Reaction score
25
Are the small rooms all of same size? if they are, you can use a region variable.

(assuming your "small room" is 1000 by 1000)
set minx of variable to GetX(Center of (the_region_you_teleported_to)) - 500
set miny of variable to GetY(Center of (the_region_you_teleported_to)) - 500
set maxx of variable to GetX(Center of (the_region_you_teleported_to)) + 500
set maxy of variable to GetY(Center of (the_region_you_teleported_to)) + 500

Then, set your camera bounds to this region variable. Of course, this is just a rough example of how the idea works, you will have to do more changes to this.

If they are not of the same size, you can probably use a region array variable instead. Set all regions of the small rooms to the array, then set camera bounds accordingly.
 

DoomedDude

New Member
Reaction score
1
Haha, that's gonna be a lot of work, just which I am trying to avoid, as there are more than 100 rooms.
Yes, they are different size. Could the arraying be done same way as the creep revival I found here? Liiink
 

BlueMirage

Trust, but doubt.
Reaction score
39
Questions:
Are all rooms shaped like a square?
Are there visibility modifiers in the rooms (Blockers)?
 

DoomedDude

New Member
Reaction score
1
Rooms are not squares, but rectangles (Four corners anyway..), but I think that's enough?
And no, there are no visibility blockers.
 

azareus

And you know it.
Reaction score
63
Try making visibility blockers around the rooms, and then just lock the camera to the room. (no idea if it will work though lol)
 

BlueMirage

Trust, but doubt.
Reaction score
39
In that case, I think I can solve this without using Azareus solution.
Though I have one problem. We'll need to find the point that matches X conditions that is the closest to another point. Does anyone have an idea how?

Meh, I'll try to explain my idea even though it's probably impossible to use.

Skip regions. Let's use Dummies.

First, create a dummy for each room you have in your map. Place them so that it will see every inch of the room, but not outside it.
When the game starts, set RoomUnit to the respective unit of the room you start in.

Set the current camera bounds to the visible area that unit can see.

When a unit leaves (Current Camera Bounds), pick every one of these dummies in the game with the exception of RoomUnit, and check which one is visible to the owner of the triggering unit. Set that new dummy to RoomUnit, and set its visibility to its camera bounds.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top