RPG Maker 2
Custom Camera System (CCS)
Everything you need to make your own
by Brandon Mintern
updated 10-14-05
doan@doanthenado.com
a.k.a. Doan the Nado
-Contents-
1. Legal Stuff
2. Introduction
3. CCS Questions
4. Getting Started
5. The Scripts
6. About the Scripts
7. Final Notes
8. Acknowledgements
As usual, you can copy the section name, press Ctrl-F, and find the
section you need.
1. Legal Stuff
These Custom Camera Scripts were written entirely by me, and I therefore
take full credit for them. Anyone who claims they wrote these scripts
will be punished in the afterlife. If you see this FAQ somewhere, that's
great! I hope to reach as many people as possible to add a nice feature
to their RPGs. If you think you're doing something illegal, then you're
probably not reading this FAQ. I simply ask that you mention me
somewhere in your game's credits if you do use this Custom Camera System.
All trademarks and copyrights contained in this document are owned by
their respective trademark and copyright holders.
2. Introduction
I've never written an FAQ before, so if you find this hard to follow, be
sure to e-mail me and let me know.
A Custom Camera System (CCS) is a method for allowing the player to
adjust the camera beyond the normal default functions. My CCS includes a
rotation (typical), tilt, and zoom function. I played with the idea of
using a system like this after seeing a video demo by OgreNix. I wasn't
sure how I would accomplish it, and if it would add much to my game.
When I began on a CMS (custom menu system), however, I ran into the
problem of not being able to warp back to the original camera angle. I
was frustrated to find that there is no "Temporary Save Camera" command
as there is for BGM, so after a suggestion by xddga, I went about
creating my own Custom Camera System. I do not claim to be the first to
do it, nor the first to come up with the idea, but I do believe that I am
the first to do it using this method.
In my system, L1 and R1 rotate the camera the same way they normally do.
L2 lowers the angle and R2 raises it (continually pressing R2 will raise
it all the way to an overhead view). L3 (the left analog stick - press
it in) zooms in, and R3 zooms out. Start returns the view to a default
that is set in every map. These can all be changed if you have at least
intermediate scripting experience, or if you get help from someone who
does.
3. CCS Questions
Why use a CCS?
In my opinion, the CCS adds an amazing amount of aesthetic value to the
game. It not only allows the player to view the RPG in whatever manner
he chooses, it also allows the creator (you) to maintain camera angles
across maps. It allows you to warp the party to a CMS screen or a CBS
(custom battle screen) and then warp back to the original map with the
same camera position. It also allows you to script Looping Button Wait
scripts and know whether pressing "up" should make the player go north or
east. It is certainly not a necessity, but it can add a lot of quality
to a game.
Is there anywhere that I can see a CCS in action before I do all of the
scripting?
You can check out the demo page at my website... www.doanthenado.com.
Just look for a video demo that mentions the CCS and you will be able to
see one being used. All of my X-Port demos (other than my first one) have
the CCS, so check it out if you're interested.
How difficult is it to set this up?
If you follow these instructions step-by-step, even beginners can do
this. It helps a lot if you have some scripting experience, and it is
necessary to understand Enter Map scripts, which I will try to go over in
here.
How much memory does it take up?
The entire system takes up just over 3300 memory units. That includes
9 scripts and 1 event. It will also use up 6 of your variables and 1
flag.
Can I change the system?
The system is very customizable. You could make the scripts longer and
the increments smaller. You could add maximum ranges so that the player
can't tilt above or below certain angles. You can change which buttons
do what. I will not go over how to make all of these changes, as they
require at least intermediate scripting ability anyway. If you need help
changing a script, just e-mail me or post at the Domain message board
(doansdomain.proboards27.com).
4. Getting Started
The easiest way to begin is to prepare all of the variables, flags,
scripts, and events that you will need. You will first have to go into
File>Preferences and make sure the game is on hard. Then go into
Game>Game Settings>Custom and rename the variables and flags you are
going to need. To be safe, you may want to avoid using variables <251
or flags <261. For your scripts and events, just create them and leave
them blank, but name them. Here is everything you are going to need:
-Variables-
DefCamDirection
DefCamDistance
DefCamAngle
CameraDirection
CameraDistance
CameraAngle
These variables store the values for each aspect of camera movement. The
default ones are changed every time you enter a map, while the others
update every time the camera is changed.
-Flags-
Custom Camera
This flag allows you to prevent the use of the custom camera. In my game,
the player can't rotate the camera while going down the dungeon steps,
because it really makes my job harder. If you have dynamic camera
rotations (certain spots where you make the camera change), I would
suggest turning this flag OFF in those instances. For now, though, be
sure to have it set to ON.
-Scripts-
Button Wait
Start Pressed
L1 Pressed
R1 Pressed
L2 Pressed
R2 Pressed
L3 Pressed
R3 Pressed
Set Camera
These are the core of the system, of course, since they are the scripts.
The Button Wait script would be used for any custom button mapping, while
the other commands are specific to my CCS.
-Events-
Button Wait
This is an event without a model. Its motion is the Button Wait script.
This event must be placed somewhere in every map where you want the
player to be able to adjust the camera.
One more thing that you must do is to turn off the normal custom rotate.
Place this command in your first enter map script:
Screen Display>Camera>Custom Rotate (Limit E~E)
Never remove this limit. The problem is that holding down the L1 and R1
buttons will only rotate the camera once using the CCS, but it will
continue to rotate using the default camera system. Trust me for now...
you do NOT want this, it will mess everything up (well not everything,
just the CameraDirection variable will not properly match the true
direction).
Now that you've done all this, it's time to move on to the scripts.
5. The Scripts
After naming the variables and flags under the game settings, it's time
to begin the scripting. From here on out, SB means "Script Branch". Here
goes:
-Button Wait (Action)-
SB:Repeat:Flag [Off(fixed)] Off
Input:Buttons:Constant Wait
SB:Sort:Variable[User Button] (this is variable 004)
SB:Apply If:8
Script:Call [Start Pressed]
SB:To End
SB:Apply If:10
Script:Call [L1 Pressed]
SB:To End
SB:Apply If:11
Script:Call [L2 Pressed]
SB:To End
SB:Apply If:12
Script:Call [L3 Pressed]
SB:To End
SB:Apply If:13
Script:Call [R1 Pressed]
SB:To End
SB:Apply If:14
Script:Call [R2 Pressed]
SB:To End
SB:Apply If:15
Script:Call [R3 Pressed]
Script:Branch End
Script:Branch End
-Start Pressed-
SB:Condition:Flag[Custom Camera] On
Data:Variable:CameraDirection=DefCamDirection
Data:Variable:CameraDistance=DefCamDistance
Data:Variable:CameraAngle=DefCamAngle
Script:Call [Set Camera]
Script Control:Force Script End
Script:Condition End
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
-L1 Pressed-
SB:Condition:Flag[Custom Camera] On
Data:Variable:CameraDirection=CameraDirection+1
SB:Condition:Variable[CameraDirection]>=8
Data:Variable:CameraDirection=0
Script:Condition End
Script:Call [Set Camera]
Script Control:Force Script End
Script:Condition End
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
-R1 Pressed-
SB:Condition:Flag[Custom Camera] On
Data:Variable:CameraDirection=CameraDirection-1
SB:Condition:Variable[CameraDirection]<=(-1)
Data:Variable:CameraDirection=7
Script:Condition End
Script:Call [Set Camera]
Script Control:Force Script End
Script:Condition End
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
-L2 Pressed-
SB:Condition:Flag[Custom Camera] On
Data:Variable:CameraAngle=CameraAngle-10
SB:Condition:Variable[CameraAngle]<=(-1)
Data:Variable:CameraAngle=0
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
Script Control:Force Script End
Script:Condition End
Script:Call [Set Camera]
Script Control:Force Script End
Script:Condition End
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
-R2 Pressed-
SB:Condition:Flag[Custom Camera] On
Data:Variable:CameraAngle=CameraAngle+10
SB:Condition:Variable[CameraAngle]>=(91)
Data:Variable:CameraAngle=90
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
Script Control:Force Script End
Script:Condition End
Script:Call [Set Camera]
Script Control:Force Script End
Script:Condition End
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
-L3 Pressed-
SB:Condition:Flag[Custom Camera] On
Data:Variable:CameraDistance=CameraDistance-50
SB:Condition:Variable[CameraDistance]<=(99)
Data:Variable:CameraDistance=100
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
Script Control:Force Script End
Script:Condition End
Script:Call [Set Camera]
Script Control:Force Script End
Script:Condition End
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
-R3 Pressed-
SB:Condition:Flag[Custom Camera] On
Data:Variable:CameraDistance=CameraDistance+50
SB:Condition:Variable[CameraDistance]>=(601)
Data:Variable:CameraDistance=600
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
Script Control:Force Script End
Script:Condition End
Script:Call [Set Camera]
Script Control:Force Script End
Script:Condition End
Sound:SFX[Deny] Vol=100 Pitch=0 Tempo=100
-Set Camera-
Script Control:Apply Together
SB:Sort:Variable[CameraDirection]
SB:Apply If:0
Camera:Rotate(E) 5F
SB:To End
SB:Apply If:1
Camera:Rotate(SE) 5F
SB:To End
SB:Apply If:2
Camera:Rotate(S) 5F
SB:To End
SB:Apply If:3
Camera:Rotate(SW) 5F
SB:To End
SB:Apply If:4
Camera:Rotate(W) 5F
SB:To End
SB:Apply If:5
Camera:Rotate(NW) 5F
SB:To End
SB:Apply If:6
Camera:Rotate(N) 5F
SB:To End
SB:Apply If:7
Camera:Rotate(NE) 5F
Script:Branch End
SB:Sort:Variable[CameraDistance]
SB:Apply If:100
Camera:Distance=100 5F
SB:To End
SB:Apply If:150
Camera:Distance=150 5F
SB:To End
SB:Apply If:200
Camera:Distance=200 5F
SB:To End
SB:Apply If:250
Camera:Distance=250 5F
SB:To End
SB:Apply If:300
Camera:Distance=300 5F
SB:To End
SB:Apply If:350
Camera:Distance=350 5F
SB:To End
SB:Apply If:400
Camera:Distance=400 5F
SB:To End
SB:Apply If:450
Camera:Distance=450 5F
SB:To End
SB:Apply If:500
Camera:Distance=500 5F
SB:To End
SB:Apply If:550
Camera:Distance=550 5F
SB:To End
SB:Apply If:600
Camera:Distance=600 5F
Script:Branch End
SB:Sort:Variable[CameraAngle]
SB:Apply If:0
Camera:Vertical Angle=0 5F
SB:To End
SB:Apply If:10
Camera:Vertical Angle=10 5F
SB:To End
SB:Apply If:20
Camera:Vertical Angle=20 5F
SB:To End
SB:Apply If:30
Camera:Vertical Angle=30 5F
SB:To End
SB:Apply If:40
Camera:Vertical Angle=40 5F
SB:To End
SB:Apply If:50
Camera:Vertical Angle=50 5F
SB:To End
SB:Apply If:60
Camera:Vertical Angle=60 5F
SB:To End
SB:Apply If:70
Camera:Vertical Angle=70 5F
SB:To End
SB:Apply If:80
Camera:Vertical Angle=80 5F
SB:To End
SB:Apply If:90
Camera:Vertical Angle=90 5F
Script:Branch End
Script Control:Apply In Order
That's it! I know, that seems like a lot of scripting, but don't forget
the copy and paste function. Many of the scripts are very similar, and
copying and pasting and changing a couple things can make the scripting a
lot faster.
6. About the Scripts
Here I will try to describe what each script does so that you can better
understand how the system works. This should aid you in customizing it
if you wish to. If you don't plan on customizing or you feel you
understand the scripts well enough, feel free to skip over this section.
-Button Wait-
This script is running constantly. Every time you press a button, it
checks to see which one you pressed. If you pressed Start, L1, L2, L3,
R1, R2, or R3, it calls the appropriate script. If you want to create a
custom function for another button, like Select, you could just put that
script in here too, in the same way that these ones are shown.
-Start Pressed-
This script sets the current camera values equal to the default values,
and then calls the camera rotation script to adjust the camera back to
default.
-L1 Pressed-
This script adds 1 to the CameraDirection variable. As is typical in RPG
Maker 2, I let 0=E, 1=SE, 2=S, and so on. If the variable =7 (NE), after
adding 1, you are left with 8. The branch condition sets any value >7 so
that it =0, allowing the process to start all over.
-R1 Pressed-
This script does the exact same thing as the L1 script, except in
reverse. It subtracts 1 from the CameraDirection Variable, then, if the
resulting value is <0, it sets it equal to 7.
-L2 Pressed-
In my camera-setting script, I increase and decrease the camera angle in
increments of 10. The value of the CameraAngle variable matches the
actual angle of the camera. This script subtracts 10 from the
CameraAngle variable and then resets the camera so that it is lower.
If the number turns out <0, the script sets it equal to 0 and plays the
"deny" SFX.
-R2 Pressed-
This is just like L2 Pressed, but it adds 10 to the variable, then, if it
is >90, it sets it equal to 90 and plays the SFX.
-L3 Pressed-
Since the camera distance is always increased in increments of 50 in my
system, this script decreases the CameraDistance variable by 50, which
will cause the camera to zoom in. If CameraDistance<100,
CameraDistance=100, and the SFX is played.
-R3 Pressed-
I think you get the picture now... R3 is almost the same as L3.
-Set Camera-
This is the script that actually does all of the work. Note how every
script calls this one. What this does is check the value of each of the
3 variables... CameraDirection, CameraDistance, and CameraAngle. It then
rotates, angles, or zooms the camera to the proper postion depending on
the variable values. Simple as that, but since there are a lot of
conditions, it is a long script.
I hope that shed some light on how my system works. It's really quite
simple when you break it all down.
7. Final Notes
If you want different maps to have different default camera settings,
you'll have to set it up in each Enter Map script. I've mentioned Enter
Map scripts before, and now I will explain how to create them. This is
also a good place to turn off the default camera rotation function.
Here's an example of an Enter Map script:
-Script-
-Enter Village1 (Content)-
Camera: Custom Rotate E~E (This will turn off the default rotation
function)
Data:Variable:DefCamDirection=6 (North)
Data:Variable:DefCamDistance=350
Data:Variable:DefCamAngle=40
(Note: The three commands above can be set to whatever you want, as long
as DefCamDirection is 0-7, DefCamDistance is 100-600 and a multiple of
50, and DefCamAngle is 0-90 and a multiple of 10.)
Data:Variable:CameraDistance=DefCamDistance
Data:Variable:CameraAngle=DefCamAngle
Script:Call[SetCamera]
Script:Call[To Map/Facting]
-Event-
-Enter Village1-
System (This is right under the event name)
Apply: Enter Village1
Now go to world organization for Village1 and go to the script tab. Make
Enter Village1 the Enter Map script.
What this script does is set the default camera direction, angle, and
distance. Then, it sets the distance and angle to default (you may think
some rooms look better at different angles and distances than others do).
Finally, it rotates the camera, maintaining the direction that the player
last used, but putting it at a new angle and distance. Now, the player
can change the camera, and upon pressing Start, it will be returned to
the room's default setting.
That's about it. If you want to use dynamic camera rotations, be sure to
turn off the Custom Camera flag. Then, when you want to return to normal
view, turn the flag back on and call the Set Camera script. Easy as that.
Important note: if you rotate the camera at any point to a specific
direction, distance, or angle, but you still want it to be moveable after
the rotation (come down my ladder on my demo to see what I mean), be sure
to change the Camera variable values. For example, if you rotate the
camera to the north over a time of 45F, that's fine, but make sure you
change CameraDirection to 6 after you're done. This will ensure that
later rotating the camera works properly. Otherwise, the camera could be
facing north, but the variable indicates that it's facing east.
8. Acknowledgements
I would like to especially thank OgreNix and xddga. OgreNix had the
first video demo I saw that allowed the player to adjust the camera
angle, and this planted the seed that grew into my system. If OgreNix
was the seed, xddga was the water that made this system grow. I had
nearly forgotten about it, reluctant to spend the time on something that
I didn't think would add enough to be worth it. But after he suggested
that it might solve my CMS problem, I jumped all over it.
I would also like to thank everyone at the Pavilion who has tested my
demos, watched my videos, offered criticisms of my game, or even just
read my thread. Without all of your support, I may have lost interest in
creating my game long ago.
I would like to thank Valkysas for breathing some life back into the
community and getting me excited about making my game after he decided to
make it the new-and-improved Pavilion's first featured game.
Go to http://www.doanthenado.com for more information on my game.
Visit the Pavilion at http://www.pavilionboards.com