• 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: MeteorStrike

MeteorStrike
11 years ago#31
RANDOM ENEMIES' STR + INT + AGI:

// 0x3E45B = $E44B = Start random enemies' STR + INT + Agility ( used for enemies 1 - 3 )
// 0x3E473 = $E463 = Start random enemies' STR + INT + Agility ( used for enemies 4 - ? )
// 0x3E48B = $E47B,X = Random factors list
// STR + INT = Multiplied by a random factor of 1.00 | 1.10 | 1.15 | 1.20
// Agility = Stored as is
// 3 bytes per possible area, since there are 3 values here.

Here, we have an array that stores 3 values per chapter, and those 3 values correspond to the STR, INT, and AGI of the enemy, in that order. Note that the STR + INT + AGI for enemies in any one chapter are always the same. However, for STR and INT, we take a random variance by performing the following calculation:

( final value for STR or INT ) = ( read value for STR or INT ) * variance

Where variance is randomly one of the following possible values:

1 + ( 0 / 256 ) = 1.00
1 + ( 25 / 256 ) =~ 1.10
1 + ( 38 / 256 ) =~ 1.15
1 + ( 51 / 256 ) =~ 1.20

The variance fractions are stored at 0x3E48B, and there are 16 possible variance values (repeats appear)

Note that, much like the Weapons and Armor, you use a different array depending on the enemy unit. Here, Rebel Force gets its own array again, and the other random enemies share the other one.

OK, that's it for HP, Weapons (AP), Armor (AC), STR, INT, and AGI. Now for some caveats:

Caveats:

The algorithm does some branching when reading enemy data, depending on whether or not it reads a 0. Take this piece of code:

Determining which armor ID to allocate for the enemy unit:

// For enemy General IDs 1 -> 2
$E03E:BD AA E4 LDA $E4AA,X @ $E4AA = #$07
$E041:D0 08 BNE $E04B

// For enemy General ID 3
$E043:BD B2 E4 LDA $E4B2,X @ $E4B2 = #$06
$E046:D0 03 BNE $E04B

// For enemy General IDs 4 -> ?
$E048:BD A2 E4 LDA $E4A2,X @ $E4A2 = #$06

The problem with this code is that if the unit is a Pirate Force (ID = 1) but we read 0 for the armor, then we end up using the armor for the Bandit Force instead. If you change the data around, keep in mind that this kind of situation may end up using an armor from a different unit type, even if you allocate no-armor for that unit in that chapter...

Also, when multiplying the final STR and INT, an overflow condition can occur, and it is not considered by the game, so too much STR or INT, or too high a variance can result in very low STR and INT output.

There may be other caveats as well... if you notice anything weird, and / or it doesn't seem to fit 100% with this info, let me know and I'll look into it, but in such a case, I'm sure its just gonna be another little issue I forgot to mention... I got the whole algorithm on paper already so I can take a quick look if anything...

User Info: MeteorStrike

MeteorStrike
11 years ago#32
Just in case there is any confusion, when I say something like:

( used for enemies 1 - 3 )

I am referring to the enemy ID (1 = Pirate Force, 2 = Brigand Force, 3 = Bandit Force, 4 = Rebel Force) and NOT to the position in the enemy list...

User Info: Xian_Zhu_Xuande

Xian_Zhu_Xuande
11 years ago#33
Good work! And what's great is that it is all very easy to edit. :)

MeteorStrike, do you mind if I share what you have researched, credited to you of course, on kongming.net so all the people hacking this game have a quick reference if they want to figure things out? I'd hate to see all of this eventually vanish from GameFAQs.
Kongming’s Archives: kongming.net (Three Kingdoms Web Site)
Scholars of Shen Zhou: the-scholars.com (Three Kingdoms Forum)

User Info: MeteorStrike

MeteorStrike
11 years ago#34
Well, with the archiving system here, it won't just vanish, but nevertheless, feel free to post it elsewhere. I would recommend you confirm all the data first though... if anything, just in case there are any mistakes...

User Info: Xian_Zhu_Xuande

Xian_Zhu_Xuande
11 years ago#35
I'll be confirming just about everything that doesn't require an assembly code-level knowledge of editing. A very large amount of this stuff is going to be used in the ROM remakes I'm working on with my freetime right now. In fact, a few of the coolest things you've shared have already been incorporated. Niahak added the An Sha and Billeting flags to his character editor program.
Kongming’s Archives: kongming.net (Three Kingdoms Web Site)
Scholars of Shen Zhou: the-scholars.com (Three Kingdoms Forum)

User Info: MeteorStrike

MeteorStrike
11 years ago#36
So I read some of the topics in that board, and there appears to be some confusion about the so-called ambush flag. As per one of my previous posts, the following code executes when the game is going to determine if you get automatically ambushed:



// 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:



So basically, this means that the game has "hard-coded the ambush flags" for these battles. In other words, there is no list to edit that will change the ambush battles.

HOWEVER, you can still do some modifications. By changing the code above, you can select up to any 4 boss battles to be ambush battles. If you want more than 4 boss battles to be ambush-able, then it would require a re-write of the code, which would require using more memory from another source (because there is not enough memory in these hard-coded instructions to do it.) This is risky and probably should not be done.

If, on the other hand, you want to change the 4 possible ambush battles to be different ones, OR get rid of them altogether, you can do this very easily:

0x39CEB = First boss battle that will be an ambush. (Should be 0x48 by default)
0x39CEF = Second boss battle that will be an ambush. (Should be 0x39 by default)
0x39CF3 = Third boss battle that will be an ambush. (Should be 0x3D by default)
0x39CF7 = Fourth boss battle that will be an ambush. (Should be 0x4E by default)

By changing the values at the above addresses, you will change the hard-coded opcodes that will test for the ambush-able boss battles... the values to use here are the boss battle IDs. A list of all the boss battle IDs can be found in the Damage Calculator.

If you want to get rid of ambush-able battles, simply use FF for the boss battle ID, since there is no boss battle with ID of FF.

User Info: MeteorStrike

MeteorStrike
11 years ago#37
BTW, this got me curious:


One thing I thought of bringing up to him is the Yuan Shu text in the Text Editor. Maybe he can find a flag for an optional battle against Yuan Shu at Nan Yang to explain those weird, unused lines we found [:)] I mean he found that extra Bow.


What text is he talking about? I already got all the boss battles mapped out. If you want to see what each one looks like, go to 0x3F510 and change the value there for 0x80 to anything else. This will change all random battles to be that battle ID. So for example, if you change 0x3F510 from 0x80 to 0x13, all random battles will become the battle with Yuan Shu (NOTE: As long as he has not been registered as killed! Otherwise he will be missing from the battle and Yuan Yin will be the boss!)

So if you experiment with those, you can test out all the boss battles and their formations. From that, you can see that there is no other battle with Yuan Shu that has not been found already...

BTW, you guys do know you can kill Yuan Shu after the first battle with him... right?

User Info: Xian_Zhu_Xuande

Xian_Zhu_Xuande
11 years ago#38
Thanks for clarifying how Ambushes work!

As for the Yuan Shu 'battle', I think he's referring to a script which reads, "Didn't I just see Yuan Shu right outside the castle." There may have been another similar script which I don't recall. Some have speculated—perhaps due to the unused script I can't remember—that Capcom intended some kind of extra Yuan Shu battle, but it doesn't appear to be in the ROM. There are a few battles in the ROM which you never actually complete, such as Zhou Cang's battle (which probably relates to the would-be battle when you meet him in the cave), a battle with Huang Zhong and Wei Yan, and two Wei battles which include the likes of Cao Hong, Chen Jiao, Guo Jia, Song Xian, Wang Lang, Xu Huang and Yan Xun (I don't remember the specific details), but nothing else.

Actually... when you talk to Zhou Cang, does the game check something?
I wonder if he'll fight you if, for example, your party doesn't meet a certain condition...

We've been curious about another thing in that area. Someone says, "The west gate of Nan Yang Castle is under construction. If you attack now, you can probably break it easily." Does this reflect in the game in some way or another? Does the game calculate the battle differently from different angles? That always seemed strange...
Kongming’s Archives: kongming.net (Three Kingdoms Web Site)
Scholars of Shen Zhou: the-scholars.com (Three Kingdoms Forum)

User Info: MeteorStrike

MeteorStrike
11 years ago#39

We've been curious about another thing in that area. Someone says, "The west gate of Nan Yang Castle is under construction. If you attack now, you can probably break it easily." Does this reflect in the game in some way or another? Does the game calculate the battle differently from different angles? That always seemed strange...


I can answer this one right now. That's actually factored into the Damage Calculation. I had that figured out months ago. :p

http://www.gamefaqs.com/boards/genmessage.php?board=563402&topic=44112071


MeteorStrike
Posted 10/29/2008 2:21:21 AM

Also, there is one single boss battle in which this defense boost is not applied, but ONLY if you attack by moving from the left. I forget the name but the castle you attack where you kill that general, and then his brother wants to avange him? Well, if you attack by stepping on the left tile and moving to the right, the defense boost the enemy gets is ignored. I was all WTF about it until I talked to this lady in a village that said the "west bridge of the castle is under construction" or something like that... I got goose bumps when I read that, cause suddenly that part of the algorithm made sense. XD It's kind of interesting to find out that a lot of these things villagers said about certain places being heavily fortified, and not others, actually had some truth to it...


So basically, if you "attack Nan Yang from the west gate" then the special castle defense boost that the enemies get is neglected. That's really all there is to it. If you attack from any other location, the defense boost is applied. Pretty neat, huh?

Note that my damage calculator page does not take this into account. It factors castle defense boost, but it does not factor "no castle defense boost if attacking from the west in this one single castle." I figured it's pointless to add that one variable to the damage calculator, since it's only used for one battle, and under a certain condition...

User Info: MeteorStrike

MeteorStrike
11 years ago#40
As far as un-used boss battles are concerned, here are the ones I've seen:

Change the value at 0x3F510 (0x80) to the following values and the following battles will be fought as random battles:

2C = Yan Xun
40 = Chen Jiao + Wang Lang
41 = Xu Huang + Guo Jia + Song Xian
49 = Zhou Cang
4A = Huang Zhong + Wei Yan

If you try to fight the last two, it will say there's no one there. So I think the text for those are missing... ? It made me wonder if they can even be fought... but it also makes me wonder whether or not there might be some conditions that need to be matched in order to fight them...
  • Topic Archived

GameFAQs Q&A