Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to try creating a custom Starcraft 2 map with a third-person camera following a unit. A few custom maps with this feature exist already, so I know it's possible.

How do I do this? Do I need a custom mods file, or can everything be done in the map file?

share|improve this question

migrated from gaming.stackexchange.com Jan 14 '11 at 17:43

This question came from our site for passionate videogamers on all platforms.

2  
sc2mapster.com/maps/tpsfps_battle_rts I think this might help. Its a link to a site for one of the more popular maps that have this feature. I think they have a how to on the site. –  McAzzaMan May 17 '11 at 4:09
    
Contacting an author of a custom map that does this would probably be the most straightforward way of finding out how.. –  Jari Komppa Apr 16 at 5:39
    
This question appears to be off-topic because it is about modding a specific game, and after three years it's not likely to get answered. –  Jari Komppa Apr 16 at 5:41
    
@Jari I think this should stay open as long as game modding is on-topic here and SC2 has an active community. The SC2: Heart of the Swarm expansion is only a year old. –  Anko Apr 16 at 21:53
    
@Anko Agreed; SC2 and its mods are far from outdated. Also, the question is narrowly scoped and clearly possible to accomplish. –  Seth Battin Apr 17 at 14:07

1 Answer 1

The information provided below is from http://www.staredit.net/starcraft2/Third_Person_Camera where you can find out more stuff like WASD triggers and multiple camera options, but the basics for the 3rd person setup is here:

Setting up the Camera Object

Underneath the "Create Camera" Button, you will see a white box with the value "Camera 001" in it, right click it and hit "Modify Properties". Set the values to the following (Name - Sub - Value - (Description)):

  • Angle - Field Of View - 27.996 - (How wide the view is. This will be a 28 degrees view from the left of the screen to the right) Angle - Roll - 0.0 - (How far to roll the camera from the left to right. Think barrel rolls.)
  • Depth of Field - Amount - 0.0 - (Unknown, feel free to update the wiki article if you know any information about this value)
  • Depth of Field - Depth - 8.0 - (How far the camera sees)
  • Depth of Field - End - 8.0 - (The end position of the view from the point of the camera)
  • Depth of Field - Start - 0.0 - (The start position of the view from the point of the camera)
  • Distance - 4 - (How far the literal camera is from the actual location of the camera. Setting this to 0 results in a FPS (First Person Shooter), around 4 with be a TPS (Third Person Shooter))
  • Distance - Far Clip - 300.0 - (The distance from which nothing will be rendered. If anything is farther than this from the camera, it WILL NOT RENDER)
  • Distance - Near Clip - .1 - (The distance when nothing will be rendered. If anything is closer than this from the camera, it WILL NOT RENDER)
  • Distance - Shadow Clip - 75.0 - (Assuming the distance after which shadows will not be rendered)
  • Target - Pitch - 12 - (Pitch of the camera. Pitch is the looking up/down movement)
  • Target - X - (Doesn't matter, this will change every frame of the game)
  • Target - Y - (Doesn't matter, this will change every frame of the game)
  • Target - Yaw - 180 - (Yaw of the camera. Think left to right movement that isn't barrel rolls)
  • Target - Z Offset - 1 - (How far the camera is off the ground)

The main value we need here is the Distance - 4. Setting this to 4 will create a third person camera (Although with units other than a marine, you may need to edit this). 0 will create a first person camera. The same goes for the Target - Z Offset - 1. A taller unit will need a higher value to raise the camera up some.

Global Variables

A few global variables are needed, the names and types of which are indicated below (Name - Type - Value - (Description)):

  • FaceOffset[8] - Real - 0.0 - (Where each player's respective units is facing)
  • Speed - Real - 0.03 - (The speed at which a unit moves)
  • Units[8] - Unit - [EMPTY] - (Stores each player's respective units)
  • PlayerA[8] - Real - 0 - (Stores is the players A key is down)
  • PlayerS[8] - Real - 0 - (Stores is the players S key is down)
  • PlayerD[8] - Real - 0 - (Stores is the players D key is down)
  • PlayerW[8] - Real - 0 - (Stores is the players W key is down)

Set Up Camera Trigger

Set Up Camera
   Events
       Timer - Every 0.0 seconds of Game Time
   Local Variables
       Yaw = 0.0 <Real>
       CameraFocus = No Point <Point>
       Counter = 0 <Integer>
   Conditions
   Actions
       General - For each integer Counter from 1 to 8 with increment 1, do (Actions)
           Actions
               General - If (Conditions) then do (Actions) else do (Actions)
                   If
                       (Controller of player Counter) == User
                       (Status of player Counter) == Playing
                   Then
                       Camera - Apply Camera 001 for player Counter over 0.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Don't Include Target
                       Camera - Lock camera mouse relative mode On for player Counter
                       Camera - Turn camera mouse rotation On for player Counter
                       Camera - Turn camera height smoothing Off for player Counter
                       Camera - Turn camera height displacement On for player Counter
                   Else

Camera Update Trigger:

Camera Update
   Events
       Timer - Every 0.0 seconds of Game Time
   Local Variables
       Yaw = 0.0 <Real>
       CameraFocus = No Point <Point>
       Counter = 0 <Integer>
   Conditions
   Actions
       General - For each integer Counter from 1 to 8 with increment 1, do (Actions)
           Actions
               General - If (Conditions) then do (Actions) else do (Actions)
                   If
                       (Controller of player Counter) == User
                       (Status of player Counter) == Playing
                   Then
                       Variable - Set Yaw = (Current camera yaw of player Counter)
                       Variable - Set CameraFocus = ((Position of Units[Counter]) offset by 0.0 towards (Yaw + 90.0) degrees)
                       Unit - Make Units[Counter] face (Yaw + FaceOffset[Counter]) over 0.0 seconds
                       Camera - Set the camera bounds for (Player group(Counter)) to (Region((X of CameraFocus), (Y of CameraFocus), ((X of CameraFocus) + 0.01), ((Y of CameraFocus) + 0.01))) (Do Not adjust the minimap)
                   Else
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.