FFHacktics
News
About

Downloads
Tools
Patches
Custom Sprites

Community
Forum
Contests
PJIRC
Mibbit
irc.ffhacktics.com #FFH

Resources
Wiki
Maps
Effects
Pastebin
Tutorials
Sprites
Item Palettes
Event Instructions


Affiliates
FFVI Hacking
Graphics Gale
Church of the FSM

Valid XHTML 1.0 Transitional
CSS Valide !
Handling the camera (written by: Zodiac )

This tutorial is about using the Camera instruction [19] in events.

All the camera values are absolute; not relative. It will only take into acound current values to determine the shortest way to reach destination.
Absolute: Based on point zero (0,0,0)
Relative: Based on last coordinates

All numbers are suggestions and by no means you must use only those. Anything can range from -32768 to 32767.
For the sake of simplicity, all words don't have their bytes swapped to avoid confusion when hex editing.

Go take a look at the maps sections to help yourself when you want to determine coordinates or the like. By the way those maps were all taken at 30; except the first one at 90.

1- Move on X axis


A tile is 28x28
The camera can move 4x more precisely than the tiles, so moving a tile away would require 28*4=112.
If you simply add tiles, it will already be centered, 112 will have 1st tile centered. 168 whoever will be the border between 1st and 2nd tiles.
00112(x7000) = 20 pixels = 1 tile (center)
00392(x0001) = 98 pixels = 3,5 tiles (border 3-4)
00896(x8003) = 224 pixels = 8 tiles (center)

2- Move on Z axis


Similarly to the X & Y, 1h is 12 pixels high, or 48 units high when using the camera.
Centering is the determined by given height +2h (48*2=96), which is technically not correct as most units are 3h high (48*3=144) so if you want "perfect" centering, you have to subtract 1/2h (40/2=24).
00048(x3000) = 1h (centers 3h)
00192(xC000) = 4h (centers 6h)
00384(x8001) = 8h (centers 10h)

3- Move on Y axis


see Move on X axis

4- Angle *From the map's base


00000(x0000) = 00,00
00302(x2E01) = 26,54 (often used in instructions)
00341(x5501) = 30,33
01024(x0004) = 90,00 (bird view)


5- Rotation around the map *clockwise


The camera will take the shortest way to the new coordinates based on the previous ones.
You should always stay in a range on -180 to 180 to avoid unecessary rotations. I marked -135, -45, 0, 45 and 135 with an asterix (*) to help.
-03584(x00F2) = -315,00 [Map_1]
-02560(x00F6) = -225,00 [Map_2]
-01536(x00FA) = -135,00 [Map_3]*
-00512(x00FE) = -045,00 [Map_4]*
00000(x0000) = 000,00 [Map_0]* ((0,0) at bottom left corner)
+00512(x0002) = +045,00 [Map_1]*
+01536(x0006) = +135,00 [Map_2]*
+02560(x000A) = +225,00 [Map_3]
+03584(x000E) = +315,00 [Map_4]

6- Camera Rotation *clockwise


And no, at 180 your characters won't fall from the map like ants. That's why it's the camera that is rotating, and not the map.

-02048(x00FA) = -180,00
-01024(x00FB) = -090,00
-00512(x00FE) = -045,00
00000(x0000) = 000,00
+00512(x0002) = +045,00
+01024(x0004) = +090,00
+02048(x0008) = +180,00

7- Zoom level


This one is rarely ever used since resizing makes the maps, and mostly units, ugly.
02048(x0008) = 050%
04096(x0010) = 100%
08192(x0020) = 200%

8- Time Required


00050(x3200) = 0,50 seconds
00100(x6400) = 1,00 second
00300(x2C01) = 3,00 seconds


So let's take the event where Besrodio is caugh.

[19] Camera (+00392, +00115, +00504, +00302, +00512, +00000, +04096, +00070);
[...]
[10] DisplayMessage ("
{font:08}Rudvich Mercenary
{font:00}I know you're in there!
Open the door!!
");
[E5] WaitForInstruction (r0100);
[51] CloseDialog (r02FFFF0000);
[E5] WaitForInstruction (r0100);
[19] Camera (+00056, -00172, +00680, +00190, +00336, +00000, +08192, +00016);
[E5] WaitForInstruction (r0400);
[F1] Wait (00006);
[21] PlaySound (x0018);
[41] Earthquake (r02020001);

I will directly add the +2 height in my calculations.
So basically the camera starts at (3.5, 1.026, 12.5), 26.54 angle, 45/-315 [Map_4], 0 rotation, 100% zoom and camera has already moved so time is not important.
and it ends up at (0.5, -1.536, 16.167), 16.7 angle, 29.53/-330.47, 0 rotation, 200% zoom all that during 1.6 seconds

Let's now see what the camera will actually do
0.5 - 3.5 = Move -3x
- 1.536 - 1.026 = Move -2.562y
16.167 - 12.5 = Move 3.667z
16.7 - 26.54 = lower angle by 9.84
29.53 - 45 = rotate around by 15.47 anti-clockwise
0 - 0 = no change
200% - 100% = +100% zoom increase
All that will be done during 1.6 seconds. Everything will start at the same time and end at the same time.

That is all.
Final Fantasy Hacktics 2.0 ~ The Final Fantasy Tactics Hacking community
2007-2014 Xifanie Boisvert
All materials are property of their respective owners.