Users browsing this thread: 1 Guest(s)
Timers and Status Durations

#1
Posts: 9
Threads: 2
Thanks Received: 0
Thanks Given: 7
Joined: Nov 2013
Reputation: 0
Status
None
Hello forum.

I recently got into ff6 romhacking (and romhacking in general!) and I've been doing some research the last few days, digging around documentation, searching the forums, and the like. At the moment I don't have a concrete idea of what I want to create, so I've been mostly fiddling around to see what is possible and is not. Here are a few questions I've run into while messing around. I would be grateful if you could humor me and answer some of these possibly odd inquiries.

1. Timers - Is it possible to customize/implement these timers elsewhere?
I found some of the locations where the game uses timers (such as the falling house in Tzen, the Opera House event, etc), but wasn't sure how to exactly implement them or make use of these numbers.

A very simple/hypothetical example of something I'd try out would be like:
When walking into the town of Albrook, the timer starts. If the timer runs out, it's game over -- if the player exits Albrook before the timer ends, the timer resets and can continue safely.

If this is at all possible, would I have to replace data accordingly or would it be possible to call an existing timer with the same conditions for this situation?

2. Status Durations - Is there a way to alter the duration of these effects?
Status effects like Stop and Sleep wear off after a certain amount of time. I was wondering if these values could be changed at all. For example, making the Stop duration wear off much quicker or make Sleep last much longer. If individual spells aren't possible, are they possible to effect as a whole/group?

And a little bonus question:
Is it possible to reset already-opened chests in a playthrough/save file via the editor or hex editing?

I hope I was clear enough and not too wordy.
Much thanks!
  Find
Quote  

#2
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Welcome to the site!

For #1, yes timers can be used pretty much anywhere and in lot's of creative ways for events or battles or whatever. This tutorial here by Madsiur explains how to implement them correctly:
Countdown Timers tutorial: https://www.ff6hacking.com/forums/showth...ight=Timer

For your example it would need to be done within the entrance event for that map, with some checks to tell it when you want it to activate.

#2 is very much doable with some assembly, but that isn't my strong point and I'm too lazy to scour through the disassemblys looking for the code to edit, so I will let someone else answer. XD

And the bonus question I've never seen that feature in a save state editor and am not sure how or where to do it in the hex, to set them back to unopened. If it's been documented I've never seen it.


We are born, live, die and then do the same thing over again.
Quote  
[-] The following 1 user says Thank You to Gi Nattak for this post:
  • lopolly (11-29-2013)

#3
Posts: 9
Threads: 2
Thanks Received: 0
Thanks Given: 7
Joined: Nov 2013
Reputation: 0
Status
None
Awesome. Thanks for the quick and thorough response.
I was searching in the wrong part of the forums for the timer-related stuff it looks like.

I went ahead and gave it a run. For the time being, I didn't edit any numbers myself but referred to existing numbers in the event scripts and created an event via Zone Editor. Ran into some funny results:

http://gyazo.com/14991fddb16dde20d1d9d261d569c7ad
http://gyazo.com/50b89f28958112a3d4cd1c33b07ed9b1
http://gyazo.com/edc3175c56932a6b523edb24872d2487
http://gyazo.com/d5fc6dbd67157a822bc94de7576e7484

So the timer itself I got to work and it would properly Game Over if the timer ran out. As for graphically, as seen in the screenshots, I'd get those funky pixels (which look like oddly colored parts of the chocobo sprite?) outside of battles. In battles, the timer would show up normally.

Also, with the way I had it set up, I could step over the event I created and restart the timer. Would the entrance event you were speaking of solve that issue? If so, how would I go about implementing that?
  Find
Quote  

#4
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
The problem with the timer graphics being messed up lies in the map properties.
Open up FF3LE (or ZE if it has this) and go to your map you have this event on. Click on the Layers tab. You should see a checkbox for 1.7, and it should be unchecked. Check it. That will copy the numbered tiles to VRAM so the timers will display correctly on that map.

For the other, if I'm understanding the problem correctly the event is being triggered again and again, the problem is if you're making an 'event square' that is triggered for this, then you would need to set a condition at the start of the event to check if you already activated it, so that when you walk over it again it does nothing.

It would look something like:
C0 23 80 B3 5E 00 [then your timer, etc.] D0 23 (Set bit 023) FE (Return)
= if byte 023 has been set, then do nothing.

That's just a basic example of a check, you can make it so it check for that bit and then jumps to something else rather than simply returning if you want, or check for multiple bits (C1).

Entrance event's are map specific that happen the moment the map loads, it dictates what is to go on, like those NPCs that are on a track, certain musics that are to be played at certain times, tile replacements, all kinds of stuff. You can make your timer event be "hidden" in the entrance event, as opposed to making an event square -- in other words, when you walk into a town, the very first thing it looks at is the entrance event, without needing to walk over one of those event squares.

Hope I'm making since lol, I'm kinda tired and rambling. I can elaborate more on this tomorrow XD.

I made this thread a while back about entrance events, it might be useful:
https://www.ff6hacking.com/forums/showth...entrance+e


We are born, live, die and then do the same thing over again.
Quote  
[-] The following 1 user says Thank You to Gi Nattak for this post:
  • lopolly (11-29-2013)

#5
Posts: 9
Threads: 2
Thanks Received: 0
Thanks Given: 7
Joined: Nov 2013
Reputation: 0
Status
None
Thanks a bunch. This is helping tremendously. As limited my understanding of all this is at the moment, it's definitely putting things into perspective.

I got the entrance event bits to work which is super cool.
I didn't realize you could define "if" types of checks. I only know of the events dump, but where do you find the references to similar types of commands/checks?

As for the timer graphic, I couldn't find a 1.7 in the layers tab, but there were 1.6 and 6.7 options that were checkable. I tried them out (checking each one individually and also at the same time), but I seemed to be still getting those weird sprites. Here's a screenshot of what my tabs look like in general for reference: http://gyazo.com/c2bb6bd8e0bd19792faa896e5850d4f5

So far this has been very astonishing and educational!
  Find
Quote  

#6
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(11-28-2013, 06:05 PM)lopolly Wrote: Status effects like Stop and Sleep wear off after a certain amount of time. I was wondering if these values could be changed at all.

Sorry for the late reply. What you are asking is really easy to do. For Stop the value is 12 (LDA #$12), Reflect is 1A, Sleep is 12 and Freeze is 22. You can change those values:

Code:
(Stop - set)

C2/467D: 08           PHP
C2/467E: E2 20        SEP #$20     (Set 8-bit A)
C2/4680: A9 12        LDA #$12
C2/4682: 99 F1 3A     STA $3AF1,Y  (Time until Stop wears off)
C2/4685: 28           PLP
C2/4686: 60           RTS


(Reflect - set)

C2/4687: 08           PHP
C2/4688: E2 20        SEP #$20     (Set 8-bit A)
C2/468A: A9 1A        LDA #$1A
C2/468C: 99 0C 3F     STA $3F0C,Y  (Time until Reflect wears off, though permanency can prevent its removal)
C2/468F: 28           PLP
C2/4690: 60           RTS


(Freeze - set)

C2/4691: 08           PHP
C2/4692: E2 20        SEP #$20     (Set 8-bit A)
C2/4694: A9 22        LDA #$22
C2/4696: 99 0D 3F     STA $3F0D,Y  (Time until Freeze wears off)
C2/4699: 28           PLP
C2/469A: 60           RTS


(Sleep - set)

C2/4634: 08           PHP
C2/4635: E2 20        SEP #$20     (Set 8-bit A)
C2/4637: A9 12        LDA #$12
C2/4639: 99 F9 3C     STA $3CF9,Y  (Time until Sleep wears off)
C2/463C: 28           PLP
C2/463D: 80 E7        BRA $4626
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • lopolly (11-29-2013)

#7
Posts: 9
Threads: 2
Thanks Received: 0
Thanks Given: 7
Joined: Nov 2013
Reputation: 0
Status
None
No worries as there's no rush and thanks so much! This is more or less exactly what I was looking/hoping for.

I also found this entry in Gi Nattak's events thread:
Quote:Changing the inherent +20 to speed in battle - This will also affect the speed of the "wait timer" [which determines how long a

character is in their ready stance], the Condemned counter, invisible
timers for auto-expiring statuses
, and the frequency of damage/healing
from statuses like Regen and Poison.

Not to be redundant but just for the sake of confirmation, would this include the above statuses like Stop/Sleep/Freeze?
  Find
Quote  

#8
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(11-29-2013, 09:14 PM)lopolly Wrote: Not to be redundant but just for the sake of confirmation, would this include the above statuses like Stop/Sleep/Freeze?

From the comments of the disassembly yes, but I can't tell where exactly it happens. I trust however the guy who wrote these comments. The best way to know is to test it.

You have to see the function as a whole where many parameters can be modified to change the Battle Time Counter function, the code in the event thread being one.

Code:
Battle Time Counter function
(Recalculate the amount by which to increase the ATB gauge.  
This will also affect the speed of the "wait timer" [which determines how long a
character is in their ready stance], the Condemned counter, invisible timers
for auto-expiring statuses, and the frequency of damage/healing from statuses
like Regen and Poison.)

C2/09D2: 08           PHP
C2/09D3: A0 20        LDY #$20      (ATB multiplier = 32 if slowed)
C2/09D5: BD F8 3E     LDA $3EF8,X
C2/09D8: 89 04        BIT #$04
C2/09DA: D0 08        BNE $09E4     (Branch if Slow)
C2/09DC: A0 40        LDY #$40      (ATB multiplier = 64 normally)
C2/09DE: 89 08        BIT #$08
C2/09E0: F0 02        BEQ $09E4     (Branch if not Haste)
C2/09E2: A0 54        LDY #$54      (ATB multiplier = 84 if hasted)
C2/09E4: 98           TYA
C2/09E5: 9D DD 3A     STA $3ADD,X   (save the ATB multiplier)
C2/09E8: 98           TYA           (this instruction seems frivolous)
C2/09E9: 48           PHA
C2/09EA: 18           CLC
C2/09EB: 4A           LSR
C2/09EC: 63 01        ADC $01,S
C2/09EE: 83 01        STA $01,S     (ATB multiplier *= 1.5)
C2/09F0: BD 19 3B     LDA $3B19,X   (Speed)
C2/09F3: 69 14        ADC #$14        
C2/09F5: EB           XBA           (Speed + 20 in top byte of Accumulator)
C2/09F6: E0 08        CPX #$08    
C2/09F8: 90 06        BCC $0A00     (branch if not an enemy)
C2/09FA: AD 90 3A     LDA $3A90     (= 255 - (Battle Speed setting * 24) )
                                    (remember that what you see on the Config menu is
                                     Battle Speed + 1)
C2/09FD: 20 81 47     JSR $4781     (A = (speed + 20) * $3A90 )
C2/0A00: 68           PLA           (bottom byte of A is now Slow/Normal/Haste Constant)
C2/0A01: 20 81 47     JSR $4781     (Let C be the Slow/Normal/Haste constant, equal to
                                     48, 96, or 126, respectively.
                                     for characters:
                                      A = (Speed + 20) * C
                                     for enemies:
                                      A = ( ((Speed + 20) * $3A90) DIV 256) * C  )
C2/0A04: C2 20        REP #$20
C2/0A06: 4A           LSR
C2/0A07: 4A           LSR
C2/0A08: 4A           LSR
C2/0A09: 4A           LSR           (A = A / 16)
C2/0A0A: 9D C8 3A     STA $3AC8,X   (Save as amount by which to increase ATB timer.)
C2/0A0D: 28           PLP
C2/0A0E: 60           RTS
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • lopolly (11-30-2013)

#9
Posts: 9
Threads: 2
Thanks Received: 0
Thanks Given: 7
Joined: Nov 2013
Reputation: 0
Status
None
This is starting to make more sense as I go along. Really appreciate all the replies. On the subject of status effects, while messing with usME to test the status timers, I noticed something else. Maybe it's common knowledge but it didn't occur to me until I ran into it.

I was assigning the negative statuses to equipment via the Item editor (in the adv tab) to try to quickly inflict my characters with effects. It seems like the second row of statuses (Condemned, Image, Mute, Berserk, Muddle, Sleep, etc) cannot be applied to weapons, but will work when checked on anything else (Shields, Armor, Helmets, Relics). I didn't try them all out, but the first row of statuses seem to work on weapons. For example, I checked off Stop on a weapon and the character equipping it started with Stop in a battle.

Is there any particular reason for this differentiation and is it possible at all to make these work for weapons? Also, is it possible to make a character start with one of those statuses innately without the use of equipable items? For example, making a character start with Condemned status every battle. I searched around a bit and it sounds like things like Dog Block and Magi-Tek can be applied through events but I couldn't find anything for certain statuses such as Condemned.
  Find
Quote  

#10
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
I receive a email yesterday from the guy who made the disassembly comments and he said his comment can be misleading. The status timers are based on $3ADD and not $3AC8 so the speed wont affect them.

He said: "'This will also affect' was meant in regards to things Function C2/09D2 governs, and not meant to imply these things all work the same."

Concerning you equipment status question, I've never really edited weapons and never looked up the process in the disassembly so I can't really answer.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite