View Page Source

Revision (current)
Last Updated by admin@tasvideos.org on 1/1/2022 6:13 PM
Back to Page

!!The RNG
Like any RPG, Final Fantasy Legend 2 also uses an RNG. However, this RNG is difficult to manipulate, as it only updates whenever a random number is needed. Even a reset won't change this.

Every time the game calls for a random number, an address gets incremented and used in generating a random number.

! RNG Addresses
The RNG begins at address {{C0A0}} and ends at {{C0DF}}. Although many bytes are apparently taken up by the RNG, only a few of them are actually used, and every single RNG call acts as if they only have one byte.

The RNG is rolled for each item listed in the related box, for every instance it is needed. Small text is a note of when another roll takes place, but the purpose is unknown.

||RAM addr||Notes||
|{{C0A0}}|((Rolled once every few frames, dependent on C0A1?))|
|{{C0A1}}|((Rolled once every frame, when in the field))|
|{{C0A5}}|Damage dealt%%%Turn order, rolled for every combatant%%%What ability a Mutant will learn|
|{{C0A6}}|Whether an attack hits%%%Meat or item drop from enemies%%%Growth of Humans and Mutants (Rolled 2 or 3 times; Ability, HP, and maybe a stat)%%%HP growth, if HP is selected to grow%%%Whether you run away successfully%%%((Rolled at beginning of turn, is the enemy "thinking"?))%%%((Rolled at beginning of battle menu))|
|{{C0A7}}|((Rolled at start of battle))|
|{{C0A8}}|((Rolled at start of battle))|
|{{C0A9}}|Whether your next step is an encounter|
|{{C0AA}}|What group you will encounter|
|{{C0AB}}|Size of the group you encounter|
|{{C0C0}}|NPC1's next direction to step into|
|{{C0C1}}|NPC2's next direction to step into|
|{{C0C2}}|NPC3's next direction to step into|
|{{C0C3}}|NPC4's next direction to step into|
|{{C0C4}}|NPC5's next direction to step into|


!!RNG Manipulation
Since it only ever increments when you trigger actions that need the RNG, the only way to affect the RNG is to actually use it. Even a reset won't budge any RNGs!

However, don't be afraid to modify the game's memory if you're searching for a desired effect. Loading state and trying different actions may change the RNGs, but directly changing the RNG yourself will speed up your search -- Doing different actions in hopes of finding the target RNG will take a ''long'' time, so search for the numbers you need by cheating, then do a legitimate run knowing what numbers to aim for.

! Encounter RNG
{{C0A9}} - Increments with each step%%%
{{C0AA}} - Determines what groups of monsters you face%%%
{{C0AB}} - Determines ''how many'' of said groups of monsters you face

If you must prevent a random encounter, you need to walk far enough so that your next step will generate an encounter. Save, walk the step, reset, then load the game. The RNG will have updated your steps and you can continue from there.

You also have the choice to update {{C0AA}} and {{C0AB}}: Resetting on the first frame possible will only update the steps at {{C0A9}}, while resetting one frame later will update the encounter type and size RNGs. You only lose one frame in order to advance {{C0AA}} & {{C0AB}}, in case you need to encounter a different foe later on.

A table of observed values to watch out for {{C0A9}}. Rate of 4 means if in an encounter zone, you will fight a battle at this value, where 3, 2, and 1 are fought only in places with higher encounter rates.
||Dec.%%%Hex.|0%%%00|38%%%26|77%%%4D|104%%%68|114%%%72|154%%%9A|161%%%A1|169%%%A9|195%%%C3|197%%%C5|212%%%D4|251%%%FB|255%%%FF|
||Rate|4|4|1|4|4|3|2|4|4|4|4|4|4|
----
! C0A5, the secondary battling RNG
For battling, this is mainly the damage RNG.

This RNG only increments when you actually ''fight'' your battles. Successfully running away every battle or avoiding them as described above will never increment this address.

*When you begin a new round, this RNG increments once per active combatant. Most likely determining turn order.
**You may reset during this time to stop the processing, though no guarantees that you'll get the exact number you need.
**{{C0A5}} is rolled after the game rolls {{C0A6}} several times when "thinking" for enemies.
*Increments once per damage number. This is a slower way to increment this RNG, as most actions increments this once at a time.
**The action must be one that can deal damage, but it doesn't necessarily need to, as hitting a target and dealing no damage due to defense still increments the RNG. ''Missing'' the target does __not__ increment {{C0A5}}.
**If the action can hit all enemies, and not just simply a group, it is rolled once per group. An enemy action that hits your entire party will roll this RNG once per member that is hit.
**Some actions hit the same target multiple times. This rolls the RNG on a per hit basis. When 6-Arms hits 4 times, this RNG has been rolled 4 times to calculate the damage of each hit.
*More importantly, this RNG determines ''what'' ability your mutant gets. Make sure that it rolls to a specific number when you want your mutant to learn the right ability.

If you're not getting an ability you want from a boss, try loading to an earlier battle, one you plan to avoid by reset, and actually initiate a round of attacks. Remember, reset when {{C0A5}} is where you need it, or at least closer to what you need.

Since running away successfully doesn't ever touch this RNG, you only need to worry about it changing when you actually fight or fail to run.

Notable values recorded for specific circumstances:
||Explode (Ashura)%%%((Instant-win vs. random enc.))||Dec.%%%Hex.|10%%%0A|14%%%0E|16%%%10|135%%%87|172%%%AC|241%%%F1|243%%%F3|253%%%FD|
||Teleport (Dunatis)%%%((To a selected town instantly%%%Useful for glitching))||Dec.%%%Hex.|37%%%25|70%%%46|73%%%49|82%%%52|91%%%5B|136%%%88|159%%%9F|180%%%B4|
----
! C0A6, the primary battling RNG
For battling, this is primarily the chance-to-hit RNG.

This RNG is rolled many, many times. Just entering a battle causes it to roll twice, if you're not dodging it by reset.

*When you begin a new round, this RNG increments several times. The enemy is "thinking" about what to do.
**This needs further investigation, as it is rolled at least twice per enemy, but could be rolled more than that at times.
**This thinking takes place before the game increments {{C0A6}} as part of the round beginning processing.
*Increments every time an action relying on chance to hit is executed
**Always hit (damage spells, perhaps?) or always fail (enemy resistance) do __not__ increment this value.
*Increments once when running away.
*It determines what sort of growth you get for your Humans and Mutants. More importantly, whether you even ''get'' an ability for a mutant.

It's possible to change {{C0A6}} without affecting {{C0A5}}. Two examples:
*Entering a battle and running away increments {{C0A6}} 3 times without affecting {{C0A5}}.
*Decide your actions or fail to run away, then reset while the game is still thinking what to use for your enemies (reading these addresses will help). As it hasn't moved on to process turn order yet, {{C0A5}} isn't affected.
----
!!Glitches
What good is a game if it doesn't have glitches to abuse? Here are those fun ones we know about.

! Trash Can Bug
The act of attempting to use the Trash Can will make the game think you're using the 17th item in your inventory. Problem is, the game only set aside 16 spots in the main inventory for items. This "17th item" just happens to use memory for other, relatively important things...

||RAM addr||"17th item" details||Actual RAM value||
|{{C2D9}}|Identifies what the item is|MAGI counter|
|{{C2DA}}|Number of uses of item|Upper nybble: Who's equipped with Power MAGI?%%%Lower nybble: Power MAGI count|

In effect, if the MAGI counter matches the ID of an item or ability that can be used outside of battle, you can use the Trash Can. [http://www.youtube.com/watch?v=AKhW-UMSf5Y|The main purpose of which is to create an arbitrary number of stat-boosting items].

A few noteworthy values:
||{{C2D9}}%%%MAGI (hex)||Item||
|29 (1D)|Cure Potion|
|30 (1E)|X-Cure Potion|
|31 (1F)|Curse Potion|
|32 (20)|Eye Drop|
|36 (24)|Cure Book|
|47 (2F)|Heal Staff|
|65 (41)|Elixier|
|66 (42)|Soft Potion|
|67 (43)|Power Potion|
|68 (44)|Speed Potion|
|69 (45)|Magic Potion|
|70 (46)|Body Potion|
|71 (47)|Tent|
And like other items with limited uses, using the Trash Can will affect what it sees as the use count. In this case, the "17th item" affects your Power MAGI. Each use reduces its count by 1. If someone is equipping it, add 16 uses for every spot down in the party order the someone is in. In effect, you can get infinite uses by reequipping the Power MAGI when it unequips itself with 1~15 uses left.

When an item runs out of uses, the game writes {{0xFF}} in the bytes that the item once occupied. Running out of uses in your Trash Can sets your MAGI counter to 255 (though you only see 99) and you now have 15 Power MAGI equipped on... No one in particular. It'll unequip itself by entering and exiting the MAGI menu.

The 255 MAGI count is interesting: This allows you to enter any MAGI-based doors at will. This has obvious sequence-breaking use. The drawback being that picking up a single MAGI from anywhere sets your count to 0. Another interesting aspect is that it allows an item dropped from an enemy to write itself into your MAGI count, to make it faster to corrupt a new, useful item such as stat-boosters.

Only items dropped from enemies may place themselves in this "17th item" slot -- Shops and treasure boxes simply say your inventory is full. And yes, in order to put something in the "17th item" slot, the first 16 slots must already have stuff filling them.

! Teleport out of the Dragon Race
Do exactly as named above, while riding a dragon. You will teleport outside of the Dragon Race with the dragon still with you. Aside from graphical glitches with the dragon's sprite, you will be able to travel through walls with impunity.

This requires the Teleport spell first, however. Two bosses before the Dragon Race can bestow this ability to a Mutant: Dunatis, and Venus.

The glitch can be seen in action [http://www.youtube.com/watch?v=OV5GTqo8t1g|here].