Users browsing this thread: 1 Guest(s)
Countdown Timers tutorial

#1
Posts: 3,966
Threads: 279
Thanks Received: 234
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Here's a short written tutorial on how to use countdown timers properly with command A0. You should already know how to create/modify events for understanding what follows.

First of all, that event command has 5 bytes as parameters. The first two are the length of the timer and the last three are the offset of the event to jump to in case the timer expire while on a map. Here's an example:

A0 60 54 5E 42 00:

timer 0 length = 5460 (approximately 6 minutes)
Jump to CA/425E in case timer expire (CA/0000 + 00/425E)

Now the high byte of the offset to jump to can have flags and depending which bits are set it mean different things. Note that there are 4 countdown timer that could be used simultaniously (timer 0 to 3). Here is the meaning of each flag:

Code:
0x10 Countdown will override game clock display in menu. (1)
0x20 Enables exit menu/battle on timer expiration. (1)
0x40 Digits for the countdown display while on the map. (1) (2)
0x80 Countdown pauses while in menu or battle. (1)
0x00 timer 0 (5)
0x04 timer 1 (3)
0x08 timer 2 (3)
0x0C timer 3 (3) (4)

(1) Flags can be added up together. (bits 4 to 7)
(2) You must set bit 1.7 (something to do with layer 3) of the given map to display properly the timer. It can be done in FF6LE.
(3) Only one of these flags can be activated at a time. (bit 2, bit 3 or bit 2 + bit 3)
(4) Well to be exact this one is timer 1 set + timer 2 set. It doesn't add both timers (1 & 2) together; it only sets timer 3...
(5) None of the flags are activated

So for the same example, A0 60 54 5E 42 68 would mean:

timer 2 length = 5460 (approximately 6 minutes).
jump to CA/425E in case timer expire (CA/0000 + 00/5E42).
Digits for the countdown display while on the map.
Enables exit menu/battle on timer expiration.

Now I'll explain briefely how to branch with a countdown timer in a battle that is invoked with command 4D. Let's say you have started your timer by talking to an NPC. (Yes... another example...). The offsets are fictive:

Code:
CA/0000 4B 1A 0A            (Display message 0A1A: "Hurry! Celes is in danger!")
CA/0003 F0 12               (Play song 18: Celes theme)
CA/0005 A0 20 32 66 E5 72   (Set timer 0 to length 3220 (00:03:35))
                            (Jump to CC/E566 in case timer expire. That's the game over event)
                            (Digits for the countdown display while on the map.)
                            (Enables exit menu/battle on timer expiration.)
                            (Countdown will override game clock display in menu.)                    
CA/000B FE                  (return)

And you have a boss battle somewhere else invoked by command 4D which can be triggered by an event tile or a boss NPC. This example is in bank F1 but it could be anywhere where there is events... Here's how to branch properly:

Code:
F1/0000    4D 52 3F             (Invoke battle with enemy set 52, background 3F)
F1/0003    B7 40                (If battle event bit 40 is clear (if the party was not annihiliated))
F1/0005    0D 00 27             (branch to F1/000D (the 2nd check))
F1/0008    B2 66 E5 02          (if party annihiliated, call subroutine CC/5E66 (game over event))
F1/000C    FE                   (return)
F1/000D    B7 45                (If event battle bit 45 is clear (if timer did not expire during battle))
F1/000F    17 00 27             (branch to F1/0017 (end of event))
F1/0012    B2 66 E5 02          (if timer expired during battle, call subroutine CC/5E66 (game over event))
F1/0016    FE                   (return)
F1/0017    A1 00                (reset timer 0)
F1/0019    4B 44 03             (display message 0344: "We saved Celes!")
F1/001C    FE                   (return)

With this example it's a game over if the party is annihiliated and if the timer expire during battle. I tested it. The only thing left that I'm not sure about are random battles but I presume the game makes the same checks for those too. It would have to be verified. This is pretty much everything there is to know about countdown timers. Have a nice timer event!

Here is my first succesful timer attempt. The video only shows the possibles outcomes:

The 4 outcomes of a countdown timer...
  Find
Quote  
[-] The following 4 users say Thank You to madsiur for this post:
  • Angelo26 (01-29-2012), Gi Nattak (01-29-2012), Lockirby2 (12-22-2013), lopolly (11-29-2013)

#2
Posts: 2,768
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
nicely done


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#3
Posts: 831
Threads: 41
Thanks Received: 16
Thanks Given: 12
Joined: Nov 2009
Reputation: 18
Status
None
Thank You Thank You Thank You!!

This has been bothering me for eons now! What I was missing is the check for "If timer expires, go to game over".
Quote  

#4
Posts: 2,548
Threads: 98
Thanks Received: 147
Thanks Given: 156
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Yes, very nice job explaining the timer in detail, today is now officially a great day! =D
Thanks much.


We are born, live, die and then do the same thing over again.
Quote  

#5
Posts: 3,966
Threads: 279
Thanks Received: 234
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Here are a few things I should add:

I believe only timer 0 can be displayed on the screen. The other 3 timers can be use simultaneously though.

As for the branching after a battle, you don't have to branch to an automatic game over for the check #1 and check #2. You could branch to any other part of event that could later lead to a game over or to an event that does not call a game over. I was just showing the structure of the branching with battle event bit #40 and #45.

Finally, it seems random battles that take place when a timer is activated check for bit #40 and #45 as well. I had a game over when the timer expired during a random battle. I don't know how it's possible to make it branch elsewhere after a random battle if the timer expire however.

And thank you guys for the compliments, it's nice seeing that some tutorials help others, even veterans event creators Smile
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite