+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Dragon Warrior II (NES) hacking question
Pages: [1]
Author Topic: Dragon Warrior II (NES) hacking question  (Read 2 times)
cbf01
Guest
« on: May 20, 2008, 05:14:27 pm »

I'm trying to determine how the game handles the occurrence of random enemy encounters.  I'd like to turn them completely off if possible.  Does anyone have any clues on how it might be handled in this game, or how RPGs of this era generally handled it?
Gideon Zhi
Guest
« Reply #1 on: May 20, 2008, 05:26:15 pm »

To the best of my knowledge, there are two ways that random battles were (and probably still are) handled. The first is a step counter - each time you get into a fight or leave a town, a number is generated, and the game counts down each time you take a step. When the number hits zero or becomes negative, a battle is triggered. Others probably generate a random number and check to see if it falls between a specific range of values (i.e. it's less than 0x40).

It's pretty easy to tell if your game does the first. Make an emulator savestate, and count how many steps it takes to get into a battle. Reload the state, repeat. If it's the same number three or four times in a row, try searching for that number in your emulator's cheat search function. If it turns up, freeze its location in memory and see what happens. If that works, eliminating random battles is simply a matter of setting a debugger to snap on write to that memory location, then removing either the store/decrement, or tinkering with the branch.
cbf01
Guest
« Reply #2 on: May 20, 2008, 05:57:12 pm »

Okay, I tested it out and it's definitely giving me a different number of steps each time.  Sometimes it takes five steps, other times it takes more than 20.
deespence2929
Guest
« Reply #3 on: May 20, 2008, 06:12:26 pm »

I dont know how it works, I know how to stop it tho.

http://www.thegshi.org/?s=v2&sys=5&gid=721
KingMike
Guest
« Reply #4 on: May 20, 2008, 07:39:12 pm »

Quote from: Gideon Zhi on May 20, 2008, 05:26:15 pm
To the best of my knowledge, there are two ways that random battles were (and probably still are) handled. The first is a step counter - each time you get into a fight or leave a town, a number is generated, and the game counts down each time you take a step. When the number hits zero or becomes negative, a battle is triggered. Others probably generate a random number and check to see if it falls between a specific range of values (i.e. it's less than 0x40).

It's pretty easy to tell if your game does the first. Make an emulator savestate, and count how many steps it takes to get into a battle. Reload the state, repeat. If it's the same number three or four times in a row, try searching for that number in your emulator's cheat search function. If it turns up, freeze its location in memory and see what happens. If that works, eliminating random battles is simply a matter of setting a debugger to snap on write to that memory location, then removing either the store/decrement, or tinkering with the branch.

Might just be the first one, but I thought some terrain had a higher encounter rate.
Pretty sure I remember hearing FF1 did that (subtracting a larger value for each step in a higher-frequency terrain).
RamenRanger
Guest
« Reply #5 on: May 20, 2008, 08:56:13 pm »

Yes in most of the DQ or DW games terrain had an effect on the encounter rate.
Moulinoski
Guest
« Reply #6 on: May 20, 2008, 09:12:11 pm »

That's true. You had more chances of encountering monsters while traversing mountains and forests than walking through plains.

So, cbf01, unless you went the same exact direction each time, you might want to try doing exactly that. Otherwise, :/
deespence2929
Guest
« Reply #7 on: May 21, 2008, 06:56:01 pm »

He shouldnt need to try and stop it now, cause that link I provided has the code to stop random battles. But sometimes that site goes down, but he'll eventually get it.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC