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

Enabling Third Person when Unit Enter's a Region

Status
Not open for further replies.
Level 1
Joined
Nov 23, 2015
Messages
2
Thanks to third person tutorial I have been able to get it in my level and it works great, but I want third person view to take place only between/in specific areas of my level. When i try to do it, i am facing a problem. The angle of the view doesn't move. It's just stuck at one position.

Any help would be really appreciated. Thanks.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
We can't really help you with the specific problem that you are facing right now.
We have to see what you have already got to find out where the problem lies.
If we cant, we would just copy the tutorial... technically.

(You can post triggers in [ TRIGGER ][ /TRIGGER ] tags. (without spaces))
 
Ok, this will be rough. I'm doing it from memory, but it should go like this.
  • Events -
    • Unit - A unit enters a region
  • Conditions -
    • Region - Region is equal to <your region>
  • Actions-
    • Set Camera_On[player number of (owner of (entering unit))]* = true
Then do another one for when the unit leaves.
  • Events -
    • Periodic - Every 0.03 seconds
  • Conditions -
  • Actions -
    • Pick Players - Pick every player in (all players) and do actions
      • Loop -
        • If the following conditions are true do -
          • Conditions -
            • Boolean - Camera_On[Player number of (picked player)]
          • Actions -
            • Set TempLoc[Player number of (picked player)] = (Position of CameraUnit[Player number of (picked player)])
            • Camera - Set camera height to 1400 for(picked player)
            • Camera - Pan camera to (TempLoc[Player number of (picked player)])
            • Camera - Set camera Rotation to yada yada yada....
*Boolean variable.
I don't know how you are picking the camera unit, but set that in another trigger. Also set the facing angle and anything else you want in a variable with a player number index if this is multiplayer.
Don't lock camera to unit. That disables clicking on the mini-map for move orders. Also, it doesn't look as good.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
TempLoc[player number] should be TempLoc[0]
And you have to remove the location leak.

In the first trigger, you have to check if the entering unit is the camera unit.

Set camera and stuff are only to be used locally.

And store data that you use multiple times in a variable (Player number of (Picked player) in an integer variable.)
 
Level 1
Joined
Nov 23, 2015
Messages
2
Solved It

Thanks guys for all your help, i managed to get it solved. I just had to was make a group of all 3rd person view code and set in inactive. And when a unit enters a region, i had to set it active.
 
There is also the "set camera target controller" action which allows you to let the camera inherit the units orientation (facing). You only have to use this once, and then do "reset game camera for [player]" when you want to return to normal view. I think it's better for third person cameras than the "pan camera" solution.
 
Status
Not open for further replies.
Top