• Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.

User Info: Xian_Zhu_Xuande

Xian_Zhu_Xuande
10 years ago#1
This message is for MeteorStrike—not sure how else to reach you! If you still visit this board from time to time please write me using the address below. I saw some of the things you have figured out about Destiny of an Emperor and it occurred to me that you might also be able to help us in discovering a few things we're trying to sort out to make some mods.

http://kongming.net/email/

Hopefully I hear from you at some point!
Kongming’s Archives: kongming.net (Three Kingdoms Web Site)
Scholars of Shen Zhou: the-scholars.com (Three Kingdoms Forum)

User Info: MeteorStrike

MeteorStrike
10 years ago#2
This is probably the worst way to contact me. I don't usually check out the board. Instead, I check my active posts, and see if there are any updates in the topics that I've posted.

I'm not sure what you're looking for... I checked that link and it looks like a standard feedback page... what exactly are you looking for in terms of hack data for this game?

User Info: Xian_Zhu_Xuande

Xian_Zhu_Xuande
10 years ago#3
That 'feedback page' is just an email form for reaching me. I was hoping to converse with you by email or through some other medium that is less cumbersome. I've been hacking Destiny of an Emperor for a while now to create and update two mods and I've also been putting some of that information online for people to use. I noticed that in past months you've come up with some very interesting information about the game's mechanics and it occurred to me that you might be able to help in locating certain game components like what makes an officer immune to An Sha, or what always allows Cao Pi to ambush.
Kongming’s Archives: kongming.net (Three Kingdoms Web Site)
Scholars of Shen Zhou: the-scholars.com (Three Kingdoms Forum)

User Info: MeteorStrike

MeteorStrike
10 years ago#4
Well I got an answer for your Cao Pi's ambush question already:

When a battle is going to take place, the game must determine if you strike first, or if you got caught off guard, or if the battle is just normal in this sense... Obviously, this is determined via a random number. However, for some battles, the game "hard-codes" the fact you are ambushed... bastards!

Here's the code:



// Determines if enemy caught us off guard

// $75 = Battle ID. If the ID is positive, this is a boss battle, otherwise, it's a random battle.
$9CD8:A5 75 LDA $75 = #$3D

// If this battle is one of the following boss battles, make sure the enemy gets to strike first:
$9CDA:C9 48 CMP #$48
$9CDC:F0 1C BEQ $9CFA
$9CDE:C9 39 CMP #$39
$9CE0:F0 18 BEQ $9CFA
$9CE2:C9 3D CMP #$3D
$9CE4:F0 14 BEQ $9CFA
$9CE6:C9 4E CMP #$4E
$9CE8:F0 10 BEQ $9CFA

// If we are here in the execution branch, then this is not a "special" boss battle, so get a random number and compare it against a range to see if you get to strike first, or if the enemy strikes first:
$9CEA:A5 AC LDA $AC = #$64
$9CEC:65 AF ADC $AF = #$6B
$9CEE:29 3F AND #$3F
$9CF0:DD 7B A6 CMP $A67B,X @ $A67E = #$00
$9CF3:90 1B BCC $9D10

// If we jumped from the previous statement into $9D10, we strike first!

$9CF5:DD 7F A6 CMP $A67F,X @ $A682 = #$3A
$9CF8:90 27 BCC $9D21

// If we did NOT jump to $9D21, we got caught off guard! Note that this would take us to the next instruction at $9CFA, which is the same place that we would jump into from the above code for those "special" battles...

$9CFA:20 B0 C9 JSR $C9B0



OK, so which boss battles does the game say you ALWAYS get caught off guard? According to the above code, it's:

#$48 = 072 = (Nan Yang Outside) Yuan Shao
#$39 = 057 = (He Fei) Cao Pi
#$3D = 061 = (Ru Nan) Cao Pi
#$4E = 078 = (Ru Nan) Si Ma Yi

The damage calculator has a list of all the boss battles, since it's part of the damage algorithm:

http://www.geocities.com/mzmexe/DOAE/DamageCalc.html

I'll check out the other question you asked...

User Info: MeteorStrike

MeteorStrike
10 years ago#5
Btw do you know which enemies are immune to An Sha? I'd like to have confirmation of the stuff Im testing...

User Info: MeteorStrike

MeteorStrike
10 years ago#6
Never mind, I got the other one...

When the player uses a tactic, the following code executes at some point in time:



// $AC -> $AF = Random Numbers

// Testing if we randomly succeeded in using [tactic?]
$B9C6:A5 AD LDA $AD
$B9C8:65 AE ADC $AE
$B9CA:29 0F AND #$0F
$B9CC:C5 F3 CMP $F3
$B9CE:90 0D BCC $B9DD

// If we branched, we succeeded, check more conditions.
// Otherwise, we do not branch and we failed.

$B9D0:A9 06 LDA #$06



The value of $F3 is currently unknown. I would have to trace a bunch of code to figure out what it means, and I'm not in the mood, but basically, if you get a random number between 0 and 15, and the random number you got is LESS than the one at $F3, your attack worked, otherwise it failed. So $F3 just appears to be another random number, but again, I didn't want to trace a bunch of code for this. The An Sha immunity has nothing to do with this part of the code anyways, so let's move on...

Now, if we got to $B9DD, our attack worked, and we do the following:



// Test to see if tactic used was An Sha
// $4D = Tactic used
// #$1A = 26 = An Sha

$B9DD:A4 4D LDY $4D
$B9DF:C0 1A CPY #$1A
$B9E1:D0 1A BNE $B9FD



If the tactic was not An Sha, then we quickly went to $B9FD, where we succeeded. Otherwise, we need to do some additional tests for An Sha to make sure it worked:



// Test to see if Attacker has enough INT
// $61A8,X = Allies / Enemies INT
// $4A = Attacker

$B9E3:A5 AC LDA $AC
$B9E5:65 AF ADC $AF
$B9E7:A4 4A LDY $4A
$B9E9:D9 A8 61 CMP $61A8,Y
$B9EC:B0 E2 BCS $B9D0

// If the attacker does not have enough INT, attack failed!



Basically, we pick a random number and test it against the attacker's INT. If the attacker's INT is smaller than the random number, then An Sha failed! So here, a higher INT gives you a higher chance to succeed in casting An Sha.

Once this test is done, then comes the immunity test:



// Test to see if Defender is immune to An Sha
// $4B = Defender
// $60A8,Y = Allies / Enemies General IDs

$B9EE:A4 4B LDY $4B
$B9F0:B9 A8 60 LDA $60A8,Y
$B9F3:A0 07 LDY #$07
$B9F5:D9 4C BC CMP $BC4C,Y
$B9F8:F0 D6 BEQ $B9D0
$B9FA:88 DEY
$B9FB:10 F8 BPL $B9F5



Here, the game checks an array with 8 entries:
$BC4C,Y = 57 71 88 00 00 00 00 00

If the defending general is any one of those, then the attack automatically fails. This is the immunity test. Although the game tests 8 possible generals, only 3 of them are actually immune to An Sha, since the other 5 entries are all 0's:

// 57 = Sun Quan
// 71 = Cao Pi
// 88 = Si Ma Yi

So those are the only 3 generals immune to An Sha, and this is the location in the code where this test happens...

Well, it looks like that's all you've asked for here... I hope you're familiar wish NES ASM though, cause otherwise it's gonna be a little hard for you to get this... based on your site, though, it looks like you know the lingo already, so I'm sure you'll know how to use this info for your hack. :)

User Info: MeteorStrike

MeteorStrike
10 years ago#7
Well, to follow the same tradition of most other stuff I've hacked, here are some Game Genie codes made out of this data:

// Avoid hard-coded caught off guard:
9CD8 ? A5 : A9 = OXSOEGSX

Note that getting caught off guard can still happen randomly. This code merely prevents the game from hard-coding a "caught off guard" scenario every time for those 4 battles.

// Bypass immunity test for An Sha:
B9F9 ? D6 : 00 = AENUOPVI

Note that this only bypasses the immunity test. You still have to overcome the random number calculation, which tests if it will work, AND you still have to overcome the random number comparison with the attacker's INT. Also, the value of $F3 remains unknown, so it MAY (and probably) is dependent on the INT of the general being attacked, meaning that casting An Sha on those 3 generals will still rarely work. (The value of $F3 for Cao Pi was calculated to 0x02 when I was experimenting, so overcoming the first random number is still a rare occurrence!) Regardless, An Sha should work (once in a blue moon) on those 3 generals with this code, since they are no longer IMMUNE to it...

User Info: Xian_Zhu_Xuande

Xian_Zhu_Xuande
10 years ago#8
Pretty bad-ass, MeteorStrike! I'm very impressed, and this has already been quite helpful!

It was very easy to find the An Sha array in the ROM once you sorted out how it works. It is located at HEX 3BC5D. How kind of Capcom to leave room for up to eight possible An Sha-immune officers!

As for the ambushes, perhaps you can share some knowledge with me. How does something like $B9E3:A5 AC LDA $AC translate into actual locations in the ROM? For example, you listed the location of the An Sha flags as $BC4C,Y -- but I'm not sure how that actually becomes 3BC5D. If I'm able to understand this it should become much easier to edit the mechanics behind how certain things in the game work.

Again, thank you for this helpful information.

Here are a few more things I'm curious about, if you've got the time:

1) How is tactic damage calculated? Say I wanted to increase the strength of Shui Long, or increase or decrease the healing power of a healing tactic? I always imagined that there might be a base variable which is considered with a multiplier.

2) Where are the set healing values for the Elixir items stored? The 400 troop recovery of Resurrect?

3) How are the strength, intelligence, and soldier counts of Rebel Forces determined?

If I can combine some of this information with actual locations in the ROM some cool stuff can be accomplished.
Kongming’s Archives: kongming.net (Three Kingdoms Web Site)
Scholars of Shen Zhou: the-scholars.com (Three Kingdoms Forum)

User Info: Xian_Zhu_Xuande

Xian_Zhu_Xuande
10 years ago#9
MeteorStrike, another request, if you don't mind:

You're obviously aware of the glitch that sometimes causes treasures to vanish—you went through a whole heck of a lot of trouble trying to figure it out in another thread here. Sometimes this glitch causes items like the Iron Ore or the Saltpeter to vanish, and that's prevented people from finishing an otherwise functional game.

Seeing as how you're good with Game Genie codes, would it be possible to create codes that either re-populate those chests, or which allows the player to actually buy Iron Ore or Saltpeter in one of the shops? If such codes existed, people would have an option to continue playing games that have suffered that corruption without starting, and it would be most excellent.
Kongming’s Archives: kongming.net (Three Kingdoms Web Site)
Scholars of Shen Zhou: the-scholars.com (Three Kingdoms Forum)

User Info: MeteorStrike

MeteorStrike
10 years ago#10
Well, you took a while to respond... lol

As I mentioned, I still need to finish figuring out why that bug happens, and then in doing so I may be able to come up with a way to avoid it, and / or use it to one's advantage. I'm really not in the mood to do that now, though, but in the meantime, Game Genie codes that allow these items to be purchased in stores should be trivial...

I looked through your site and there's already codes that allow this to be done:


Elixir C sold at Xuzhou
LUUPLAPL
Elixir C replaces Steed.
Thanks, Tony Hedstrom!


If you put this into FCE Ultra, you get:
90B3 ? 31 : 33
So it replaces the value at $90B3 from 0x31 to 0x33, which effectively changes the sold item from Elixir A to Elixir C. (The site has Steed but that is not correct)

All you wanna do is create codes so that, instead of using 0x31 as the value, you use whatever the value for the items you want... For example:

0x1D = Iron Ore
0x1F = Saltpeter

So you want the codes:

// Buy Iron Ore in Items Shop at Xu Zhou Castle:
90B3 ? 31 : 1D = IOUPLAPU

// Buy Saltpeter in Items Shop at Xu Zhou Castle:
90B3 ? 31 : 1F = YOUPLAPU

I think Tony should get credit for those, though... I only modified them anyways...
  • Topic Archived