Can someone teach me how to do an exp multiplier for DQ 4 NES?

Started by EDR, October 12, 2021, 12:16:17 AM

Previous topic - Next topic

EDR

Alright I'll be clear this time, I'm sorry for asking this again but... Can someone teach me about how to do an exp multiplier in NES games?  :angel: :'(



BTW: I found this code "AETEYNPA" this is for 2 exp multiplier

but I want a 4 exp multiplier not a 2  :-[ :-\

FAST6191

It is much the same in most devices but general overview.

You probably want to find the experience counter for end of battle.
You might be able to find it via conventional cheat searching ( https://web.archive.org/web/20080309104350/http://etk.scener.org/?op=tutorial ), especially if you can change the amount of it received by defeating different amounts of enemies. To that end you probably want to do the conventional cheat search for experience in general. You then get to find the thing that adds to it, though for that you have basic tracing. Set a break on write to the total experience. At the end of battle or some point thereafter you will find something writes to it, hopefully the number you just got in battle.

2x,4x... there is a reason 8x and 16x are typically next in that pattern. Every schoolboy knows the multiply and divide by 10 trick of shift the decimal point around. Binary has an equivalent and hence why exp/gold/... codes follow that sort of pattern -- rather than do actual maths you have shifts so shift the binary number up a slot and you have 2x, other way and you have 0.5x (and then 0.25x...)

Anyway so you want to go back to when it it totalling up that experience and when it is done adding everything up you chuck a cheeky couple of shifts in there (might need a jump to a blank area of code and then jump back) before letting it go on its way.


Exception or additional thing to consider.
If the game has a multiplier already embedded in it (bonus area, catch up, completed battle with no damage, consumable, equip, not played in a while...) then you might be able to trip that like you can any other flag.

On that code. I am not going to decode it but you can if you like.
https://web.archive.org/web/20191123185758/https://doc.kodewerx.org/hacking_nes.html
Assuming it is not a 2x flag then it is probably a shift of some form. Do another shift and you have your 4x. The procedure above is a good one to know but "work smarter, not harder" is good too.

General concern in this is overflows and lack of precision.

What is 255 multiplied by 4? Easy enough for you and I but if a computer is limited to 8 bits to hold numbers for a given variable then that poses a greater problem, especially as 255 is actually the limit for 8 bits if starting at 0 and 4x means 65 experience in base game multiplied by 4 potentially has problems. Likewise what is 5 divided by 2? Shifting necessarily loses the bits at the start or end depending which way you go so that 5 is probably going to look more like 2 when all is said and done.
Welcome to the world of bounds checking in programming. You might be able to ignore it easily enough for this (though 64 multiplied by 4 might actually result in 0 experience) but it is a concern.

C_CliFF

Read this thread here: https://www.romhacking.net/forum/index.php?topic=25345.0

The thread explains various approaches to do what you want even though its about double your exp.