MeteorStrike

#111MeteorStrikePosted 4/27/2009 1:17:34 AM
1) Change the color of the 'Liu Bei' sprite in the opening scene?

Sorry, but my answer is still the same... Changing the value at 0x3C613 from 15 to 01 will make Liu Bei blue instead of red... Try this Game Genie code on a clean copy of the game and see what I mean:

PAEGLTIP

Unless you warped the game beyond recognition, this should make Liu Bei's 16 x 16 pixel Sprite show up with a Blueish armor instead of a Red one.

This changes Color 3 for Palette 0 from the SP Palettes that is loaded throughout the game. You might have changed the Palette number that Liu Bei uses, in which case the above code will not do anything. The range of 0x3C610 -> 0x3C61F defines the SP palettes. There may possibly be more than one group of Palettes loaded for the Sprites, but even if this is true, the above Palettes are used for the intro and even after starting the game.

If you want to know how to change the Palette used for Liu Bei instead of the color definitions for SP Palette 0, then that's a different question altogether, but I'd rather not sink into that until I know what it is that you're looking for... the Game Genie code of PAEGLTIP will make Liu Bei's armor appear blue...
#112MeteorStrikePosted 4/27/2009 1:21:57 AM
Ah wait, I think that IS what you're looking for... you want Liu Bei's sprite to use Palette 1 ( which has the colors of black, white, orange, and purple..ish ) instead of using Palette 0 ( which has the colors of black, white, pink, and red ) correct?

If so, where did you go to change it "for everything else"? That info would give me a heads-start on finding it...
#113MeteorStrikePosted 4/27/2009 1:38:55 AM
2) Make items like the Gemsword droppable?

This one is actually easy:

$8915:BD 00 61 LDA $6100,X @ $6100 = #$41
$8918:29 7F AND #$7F
$891A:C9 28 CMP #$28
$891C:B0 08 BCS $8926

All items with ( Item ID < 0x28 ) cannot be discarded. There is no "list" of items that you can manually turn on or off, however, you can easily make all items discardable by making the comparison with 0 instead of 0x28.

0x3892B == 28
Change it to 00

If you want to make only certain items discardable, you will need to "move" items around... meaning that the Gemsword cannot have item ID < 0x28 anymore. This kind of moving around is really tough, because then you'd have to examine all uses of the item in the ROM and change them accordingly. Needless to say, this is more work than its worth... I would just recommend making items like the Gemsword not appear... If the Gemsword is completely worthless in your mod, then you might want to consider changing the contents of the chest with the Gold Key to some other treasure, thereby preventing the Gold Key from being acquired in the first place..

In the actual game, you can get the Gemsword and never give it to Lu Bu, thereby getting into the same situation where you have an item you no longer need and cannot discard...

Oh, also, when trying to sell an item:

$8EFE:BD 00 61 LDA $6100,X @ $6100 = #$19
$8F01:29 7F AND #$7F
$8F03:85 4D STA $4D = #$19
$8F05:C9 28 CMP #$28
$8F07:B0 0B BCS $8F14

0x38F16 == 28
Change it to 00

Might be interesting to find some rare, plot item that can sell for a lot of money... lol...
#114MeteorStrikePosted 4/27/2009 2:16:12 AM
3) Officer Recruitability?

This one is a big pain in the butt... There are multiple places where this is done... For example, when you beat the last solo brother of the yellow scarves at the beginning of the game, 2 of the 3 Generals that are in that area are set so that they cannot be encountered in random battles, but the other one is set to be able to join you. This code is explicit and the function call that does it is meant to be done only once, probably via a function pointer call... This is a little like your "scripts" that you mention...

Finding all such "scripts" in code would require putting a breakpoint on write for all the Generals and playing the whole game, then taking note of the script code, and then the memory locations you would want to change to alter the code for each script...

I don't think I'm gonna want to do this one... however, I will leave you with this much, in case you want to do it: $6300 -> $63FF = The status of all Generals in the game. So for example, after you defeat Zhang Jao, the following code executes:

// Set General ID 0x38 with status 0x90
// This makes him recruitable
$B089:A9 90 LDA #$90
$B08B:9D 00 63 STA $6300,X @ $6338 = #$98

And the following executes when all 3 of the brothers were defeated:

// Set General ID 0x10 and General ID 0xBA with status 0x80
// This makes them unavailable for random battles
$B02D:A9 80 LDA #$80
$B02F:8D 10 63 STA $6310 = #$98
$B032:8D BA 63 STA $63BA = #$98

So if you put breakpoints on the entire memory range from $6300 -> $63FF, you can find all such scripts and change them as needed. $6300 = Status code of General ID 00, $6301 = Status code of General ID 01, and so on...

Status code flags are as follows:
0x80 = Alive
0x40 = ( I think this one was set when the General has joined the player's party. Too lazy to check it now... )
0x10 = Available for random battles
0x08 = Cannot be recruited after random battles

There is one place in code that does seem to run a lot of times with parameters, meaning that the one single function handles a lot of the enemies, instead of all these "individual" hard coded scripts. The function is kind of lengthy though, and I don't exactly want to get into it too much... theres a lot of little scripts here and there that pretty much fragment the whole process anyways, so the best way to get them all is to put a breakpoint on this memory range and then find them in code when they execute...

By the way, since most of these scripts are very easy (at least the part about setting the Generals status codes) this could be a good, simple project for you to do, and start learning some of that NES assembly code. :)
#115kawaiifanPosted 5/10/2009 2:58:28 AM
Thanks again MeteorStrike and Xian Zhu Xuande for all of the great information! *huggles* <(^.^<)

---
kawaiifan misses her gfaqs9 ;.;
#116kawaiifanPosted 5/23/2009 2:50:29 AM
*smiles happily* ^.^

---
kawaiifan misses her gfaqs9 ;.;
#117FatRatKnightPosted 5/25/2009 9:09:48 AM
*Attempts to steal kawaiifan's smile*
*Slips and falls in the attempt*
*Stands up and dusts self off*
*Acts as though it never happened*


I've looked over the level up formulas...

Through observation, it seems that the "level up" generals don't have a constant factor for gaining soldiers. I did not record the following numbers, but rather derived them after getting an idea of what the heck is going on.

Zhao Yun / Jiang Wei is a perfect example...
_1 . __100
_2 . __112 . ( 256 + 31 ) / 256 . Starting growth value
_3 . __125
_4 . __140
_5 . __156
_6 . __174
_7 . __195
_8 . __218
_9 . __244
10 . __273
11 . __309 . ( 256 + 34 ) / 256 . Eep! It changed!
12 . __350
13 . __396
14 . __448
15 . __507
16 . __574
17 . __650
18 . __736
19 . __833
20 . __943
21 . _1082 . ( 256 + 38 ) / 256 . Now the growth rate is awesome!
22 . _1242
23 . _1426
24 . _1637
25 . _1879
26 . _2157
27 . _2477
28 . _2844
29 . _3266
30 . _3750
31 . _4306 . ( 256 + 38 ) / 256 . Still high growth
32 . _4945
33 . _5679
34 . _6521
35 . _7488
36 . _8599
37 . _9875
38 . 11340
39 . 13023
40 . 14956
41 . 16474 . ( 256 + 26 ) / 256 . The last 10 levels are this slow for everyone...
42 . 18147
43 . 19990
44 . 22020
45 . 24256
46 . 26719
47 . 29432
48 . 32421
49 . 35713
50 . 39340
51 . 45179 . ( 256 + 38 ) / 256 . Assumed it uses the next byte, which is Zhang Fei/Bao's Lv1~10 growth


As I've shown here, the growth rate isn't set in stone from beginning to end, as what seemed to be implied earlier. Rather, it changes every 10 levels.

The growth numbers I observed are as follows:

36,36,31,31,26 . Huang Zhong
34,34,34,34,26 . Ma Chao / Zhu Ge Liang
36,36,36,31,26 . Guan Yu / Guan Xing
31,34,38,38,26 . Zhao Yun / Jiang Wei
38,38,36,31,26 . Zhang Fei / Zhang Bao

Some things I would like to know involves whether Lv51 uses the same growth for 41~50, or if it uses the next byte. If it does use the next byte, then what's the value for Zhang Fei/Bao's Lv51 growth? I haven't gone out there to check.

I've checked ludmeister's post for some idea on the HP stuff. Getting an idea of the HP values going from Lv1 to Lv2 did help. It also told me what order their growths were in. I don't know Zhang Fei/Bao's growth at Lv51, so if it does use the next byte, then I would guess it's 42623, 42785 or 42946 at Lv51. The growth would be almost worthless at that level, so Zhang Fei and Zhang Bao would end with the second highest value at Lv51.

Again, I don't know if Lv51 uses a different byte from Lv41~50.
---
Be specific when titling topics.
This topic's title is: Unrated. I don't feel like rating it. ... Exactly how should I rate it, anyway?
#118MeteorStrikePosted 5/25/2009 12:57:55 PM
It appears you are trying to derive the formula to calculate the amount of Max HP ( soldiers ) that any given General will have at any specific level. This has been already covered here:

http://www.gamefaqs.com/boards/detail.php?board=563402&topic=47999342&message=533759329
#119FatRatKnightPosted 5/25/2009 4:40:09 PM
I saw that already. The impression I got was that there was a single number for each general's growth, not multiple numbers.

Although, I could very well have misread something. I read it again, and I haven't seen anything new. I'm not a ROM hacker in the least, but you explain it well enough that I understand (or try to) what you're saying.

I need some clarity of the situation before I say more.
---
Be specific when titling topics.
This topic's title is: Unrated. A quick response. Not one I'd like, but it all helps.
#120MeteorStrikePosted 5/25/2009 5:28:36 PM
Well, like I mentioned in that older post, I didn't trace through the code at the time. It may be possible that there are more than one DX value used for each General depending on the Party Level. In this sense, you may be on to something with regards to different DX values for different Party Levels. When I first read your post, though, it gave me the impression that you were not aware of my older post.

If you want to research the DX issue more thoroughly, though, I would suggest using a Hex Editor and trying to change the data I mentioned in that older post, to see what DX values are used at each level. Tracing the algorithm would be a more complete approach but I personally don't have the time or willingness to do that...