Author Topic: Item effects outside of battle  (Read 2583 times)

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Item effects outside of battle
« on: August 16, 2013, 12:40:34 PM »
Similar to the spells, is it possible to change:
  • What items have what outside-of-battle effects?
  • Can the same effect be shared by multiple items?
  • Can an effect be set so that no item has that effect?
  • What parameters of the effects can be changed (how much does, say, a tent heal, etc)
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #1 on: August 17, 2013, 12:20:19 AM »
Hmm, well I've started to dive into this using the Status Healing Items as a base, now after a bit of diving I found that they are put into a routine which decreases their amount by D5, which is the value of Soft - Item D5.

In this they become somehow tested against the status afflicting the character, but here is where I get lost. It seems fairly simple, but it must deal something with bits and I'm not too familiar with status in bits.

Something I have completely overlooked is that the game sees Curse as an out-of-battle status ailment, due to the Cross being able to be used outside of battle. I guess that was for plans that never got off the ground or just plain oversight.

Here's the code, it seems straightforward but I don't quite grasp it. It is used by all Status Healing Items outside of battle, save Remedy. Remedy seems to be something special.


Code: [Select]
Successful Heal - Soft - Petrify

$01/A776 E9 D5 SBC #$D5 A:A7D5 X:A654 Y:A100 P:eNvMxdIzC
$01/A778 0A ASL A A:A700 X:A654 Y:A100 P:envMxdIZC
$01/A779 85 43 STA $43    [$00:0143] A:A700 X:A654 Y:A100 P:envMxdIZc
$01/A77B A6 43 LDX $43    [$00:0143] A:A700 X:A654 Y:A100 P:envMxdIZc
$01/A77D A0 03 00 LDY #$0003 A:A700 X:0000 Y:A100 P:envMxdIZc
$01/A780 C2 20 REP #$20 A:A700 X:0000 Y:0003 P:envMxdIzc
$01/A782 B1 60 LDA ($60),y[$7E:1043] A:A700 X:0000 Y:0003 P:envmxdIzc
$01/A784 85 45 STA $45    [$00:0145] A:0040 X:0000 Y:0003 P:envmxdIzc
$01/A786 3F C3 FE 1E AND $1EFEC3,x[$1E:FEC3] A:0040 X:0000 Y:0003 P:envmxdIzc
$01/A78A 91 60 STA ($60),y[$7E:1043] A:0000 X:0000 Y:0003 P:envmxdIZc

Code: [Select]
Unsuccessful Heal - Dwarf Bread - Petrify

$01/A776 E9 D5 SBC #$D5 A:A7D7 X:A654 Y:A100 P:eNvMxdIzC
$01/A778 0A ASL A A:A702 X:A654 Y:A100 P:envMxdIzC
$01/A779 85 43 STA $43    [$00:0143] A:A704 X:A654 Y:A100 P:envMxdIzc
$01/A77B A6 43 LDX $43    [$00:0143] A:A704 X:A654 Y:A100 P:envMxdIzc
$01/A77D A0 03 00 LDY #$0003 A:A704 X:0004 Y:A100 P:envMxdIzc
$01/A780 C2 20 REP #$20 A:A704 X:0004 Y:0003 P:envMxdIzc
$01/A782 B1 60 LDA ($60),y[$7E:1043] A:A704 X:0004 Y:0003 P:envmxdIzc
$01/A784 85 45 STA $45    [$00:0145] A:0040 X:0004 Y:0003 P:envmxdIzc
$01/A786 3F C3 FE 1E AND $1EFEC3,x[$1E:FEC7] A:0040 X:0004 Y:0003 P:envmxdIzc
$01/A78A 91 60 STA ($60),y[$7E:1043] A:0040 X:0004 Y:0003 P:envmxdIzc

The answer is in there somewhere, but I can't grasp it.


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #2 on: August 17, 2013, 11:55:02 AM »
Scouring my notes I tried to find some loose ends but to little avail. I will repost some of my notes on the subject here.

In RAM... (Or LoRom?)

Code: [Select]
0x8260 - 03
0x8264 - 87 (Event Number corresponding to Warp)
0x8269 - 04
0x826D - 86 (Event Number corresponding to Exit)
0x8272 - 05
0x8276 - FB (Event Number corresponding to Sight)
0x827B - 06
0x827F - 01 (?? Siren ??)
0x8286 - DB (Event Number corresponding to Magazine)

In ROM...

Code: [Select]
(Wow, this is Early in ROM!)
0x464 - 87 (Event Number corresponding to Warp)
0x469 - 04
0x46D - 86 (Event Number corresponding to Exit - Emergency Exit)
0x472 - 05
0x476 - FB (Event Number corresponding to Sight - Dwarves' Bread)
0x47B - 06
0x47F - 01 (?? Siren ??)
0x486 - DB (Event Number corresponding to Magazine

I cannot locate the location of the Tent and Cabin events corresponding to this, oddly enough. But to change how much a Tent heals that would be in Event 77 (In hex)

In addition is the old notes on how to change what spells Rydia will learn through the Summon Orbs.

I'll just grab the post and quote it as it has all of the necessary information there.

I think I found it. E7 - B6 = 31, the number of Imp, E8 - B6 = 32, the number of Bomb, E9 - B6 = 33, the number of Roc, EA - B6 = 34, the number of Mage.


What we were looking for this whole time was B6, not 31. Quite a bit of clever space saving on their part.



This is located in RAM at 0x1A892

And in ROM at...  0xAA92 - B6 85 (SBC B6)

This is quite unfortunate though. You can only have the four spells be spells that come in sequence. However this does free up four Summon Skill slots and allows players to learn some unique spells if they put their starting point in the Monster Spells portion...

Remember that it is normally E7,E8,E9,EA - B6, you change B6, do a little bit of Hex Math and you can decide where you want the four to go.


This was quite tricky to find, but in reality was staring me in the face for a while. I just did not realize that it was a -B6 we were searching for. The game makes a lot of references to Address 0x145, which is where starting addresses are placed, I followed that to 0x1A893 as I noticed the 1031 had been added at that time, but by that time it was too late in the sequence to search for it. So I chanced it by using the hex right before it 0x1A891 and there I saw a SEQ B6. I was very confused about what this had to do anything, then I realized that it may not be as simple as finding an elusive digit. This is ASM after all and hardly anything is that straight forward. Then I saw that right before this was the item reference of E7. Finally I came to the conclusion that they may be related, SBC meant to subtract something, put it in the calculator E7 - B6 did indeed equal 31. Everything made sense from there.

Maybe I should give that another look in the near future, my skills and reading of the system have increased dramatically since then.


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #3 on: August 20, 2013, 03:16:07 PM »
Here's some older information that may have been lost in regards to changing Silver Apple/Golden Apple/Soma Drop's effects as well as how to make all (or none) item types count as bunches





:edit: 2 Since I felt I had some good momentum going, I decided to look not just for healing items, but the stat boosting items.

So far I've found Soma Drop's location... and within that given space another pattern emerged to show me the location of the Silver Apple (Golden is conspicuously missing...)

This was done with a simple breakpoint on Rydia's Max MP that when it was written to. I was taken to the end of an instruction block, but becoming more familiar with this game's programming I had a feeling I could simply trace backwards slightly and find it (or at least find another lead) and indeed I did. It was just in the basic instructions without any crazy jumps or loops like they did with healing items.

0x01A754 - Silver Apple's amount of HP Raising - 32 (50)
0x01A761 - Soma Drop's amount of MP raising. - 0A (10)

I'll see what's up with the Golden Apple if I can.


 :edit: 3 Well that didn't take long. Looks like, for whatever reason, Golden Apple is placed roughly 20 bytes above the other two stat items. Same data formation though.
B1 60 18 69 64 00

0x01A73A - Golden Apple's amount of HP Raising 64 (100)

The aforementioned three are located in ROM at...

0xA93A - Golden Apple - 64 (100)
0xA954 - Silver Apple - 32 (50)
0xA961 - Soma Drop - 0A (10)

 :edit: 4 Oh! I'm a fool! The data for healing items had already been found before. Ah well, at least the stat boosting item info is new (I think?)

 :edit: 5 Ah, here's something a bit interesting. I think you can very easily change what stat you want the stat boosting items to raise.

09 00 B1 60 18 69 64 00 - That 09 00 At least is telling the game to write to HP.

0D 00 B1 60 18 69 0A 00 - The 0D 00 is telling the game to write to MP.

If you look at normal character data...

09 of 40 Bytes is the Max HP Byte
0D of 40 Bytes is the Max MP Byte

So if my thoughts are correct you can increase any stat you like with these items. (If I'm not mistaken, maybe even change classes too) this will require some experimentation.

 :edit: Looks like I was right. Rydia eating the Soma Drop changed her name to Yang and gave her Kick.



This does have very interesting applications if one wants to take the game in a new direction.... (Possibly, since it doesn't seem to kill Levels, have a set of 3 jobs you can change into at will.

And even better because the game gives two bytes for these to play around with you can change Class and Character without any ill side effects (well they'll have the stats and equipment of the person they switched from, since you are changing only two bytes) but they'll have their own abilities at least. However the problem that you may have noticed by now is something I didn't take into account. It only increments, it doesn't set a value. Now there may be a way to change that, but as of now I could see these items as only working towards "class upgrades" or some such.

 :edit: 7 Well that issue is solved... truly the Heavens smile on me today. First byte change and boom, exactly what I'm looking for.

0D 00 B1 60 18 69 0A 00 - All you have to do is change 60 to 00. That will get rid of the Increment and the game will read it as an overwrite. Now you can choose whichever 3 classes you like and switch to them freely (It should be noted that all that will accomplish is changing Sprite, commands, and available Equips,(possibly Level Ups as well, I haven't tested that) however you will still be equipped with whatever you had originally, (So say you wanted to change Cecil into a Mage, he would still be equipped with all of the Dark Knight gear if you used this method) Also there is no way (without making a special event place for it) for the game to know who belongs to what class. So if you use... Let's say a Mage book on Yang. That will be Yang, from now on, even if you only planned on having it be given to Cecil.

Really this plan works out Marvelously for a Solo Mod, but when there's a party involved, yeah... things get messy. However you can still increase any basic stat you would like with this, just use... http://rb.thundaga.com/ and JCE's hacking document to change the stat you want to increase or set.

 :edit: As great as Geigers is, sometimes it's just so infuriating "not allowed to go into certain ranges where battle data is contained, grumble, grumble..." so back to Cheat Engine for now, which was not made for SNES games and makes actually doing much other than memory editing a bit tricky...

However I looked up how the game puts various equipment on. The breakable bit, as earlier mentioned, does work for non-arrow items, but the issue is that the game will only ever equip one of an item on. But every inventory slot has an extra byte which would be used for diminishing uses of an item and setting that to 2 or above will show a plain number next to the item. This leads me to believe that it is looking at an index for the Arrows specifically, but if that range can be expanded to all weapons, well there might be an interesting game...


 :edit: 9

I think you'll like this one, PinkPuff (for data purposes, I can't see too many people really making use of it's potential)





No tricks here, just a little simple hacking (just one byte change actually)

I was encountering difficulty discovering where the game was looking to decide whether to add a whole stack or just one to weapon counters, I then eventually found the start of the process at 0x01C12E I was at first searching for BNE (Break if Not Equals) since I thought that would be the defining amount and was indeed looking for item 54, which is Iron Arrows. Lo and behold it seems I was looking for CMP (Compare Accumulator with Memory) and noticed that 54. I changed it to 00 and every weapon (and only weapons) equipped
became equipped in bunches. Which means that my Shadow Sword experiment from way back finally succeeded and you can make SaGa-esque weaponry now!

Down the line I would like to try to make it to where using the weapon as an item would consume it. But that's that! I think with this you have a reason to include the "Break if used" byte included on weapons.

The byte is contained at

0x01C234 in RAM and in ROM at...

0xC434 Just change the 54 to whatever index you like and the items will be equipped in bunches.



Hopefully I can find the mystery to Two-Handed ness as well soon.

Also, in the next update, could the Break-On-Use bit be enabled on weapons? We have everything we need to get it to properly work at this point.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Item effects outside of battle
« Reply #4 on: August 27, 2013, 09:17:38 PM »
Are Call orbs affected by the same type of item range as arrows, two-handed weapons, etc.?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #5 on: August 27, 2013, 10:43:51 PM »
In theory they very well should be, let me take a look at the coding close to my original notes...

Yes, you change how many there are...

01A337 - CMP EB (Carrot, End of Summons?) - RAM

but it does nothing other than crash the game in a multitude of ways, which is strange considering it is just a sequence check and the Key Items have no functions associated with them save the Whistle which has an independent function. This is definitely worthy of further investigation, but I couldn't figure it out unfortunately. It likely means there is another check somewhere to check if the index is valid that I haven't located yet.

 :edit: Posting an older... post of mine from the original Call Items topic. Now perhaps I can find how the game puts said magic into its respective spell set.

 :edit: 2: looks like I forgot that I had basically figured that out as well. Only problem at the time was I wasn't thorough enough to realize that you also need to change the C015's closeby to assure the game recognizes that the spell has been learned in the proper spot to prevent relearning it again from another Call Orb.

In RAM this is at...

0x1A899 - B9 C0 15 - (Checks the value index to see if it is already filled with the spell number)
0x1A8A7 - B9 C0 15 - (As above?)
0x1A8B3 - 99 C0 15 - (Writes the spell number to 15C0, Rydia's Summon Magic)

So to put this into perspective...

7E1560 - Paladin Cecil's White Magic
7E1578 - Kain's Unused White Magic
7E1590 - Rydia's White Magic
7E15A8 - Rydia's Black Magic
7E15C0 - Rydia's Call Magic
7E15D8 - Tellah's White Magic
7E15F0 - Tellah's Black Magic
7E1608 - Rosa's White Magic
7E1620 - Palom's Black Magic
7E1638 - Porom's White Magic
7E1650 - FuSoYa's White Magic
7E1668 - FuSoYa's Black Magic
7E1680 - Edge's Ninjutsu

So there you have it, unfortunately only One Character (or more precisely, one spell set) will be able to learn this sequence of four spells.

In ROM this is located at...

0xAA99 - B9 C0 15 - (Checks the value index to see if it is already filled with the spell number)
0xAAA7 - B9 C0 15 - (As above?)
0xAAB3 - 99 C0 15 - (Writes the spell number to 15C0, Rydia's Summon Magic)

With this information any character can be required to learn the spell and any spell set can learn the given spell and not relearn it.



Thanks to your 1A8B3 hint I did manage to find the first part of what we're looking for, the ID of the sought after Party Member to learn spells.

At 0x1A877 there is a 03, this is Rydia's ID that she Must be in the party to learn the spell. Perhaps the game did intend for others to learn optional spells at one point, since...



Depending on the character ID it shows that name. However as you can imagine, it's all cosmetic. Though you must have Cecil in the party to learn Imp, it is still Rydia who learns Imp.  This goes back to what you first said about changing the owner of the spell and we still have yet to find that in RAM outside of the registers. With any luck we'll find it soon.

EDIT: Oh you were absolutely right, just didn't realize that you had already found the pointer, hehe. Well for reference sake in RAM it is at 1A8B3, the 99 C0 15 pointer.

EDIT 2: Unfortunately you were correct, that single byte is linked to all four Summons, no idea how to easily change that, as for all intents and purposes, we are sifting through ASM and only pulling at data rather than instructions.


EDIT 3: Found it in ROM, curiously enough this entire RAM section is located only 12,000 bytes removed from ROM. In a 1.1? Rom? (Whichever one happens to work with FF4kster) So it's at 0xAA77 for the ID to change who needs to be in the party for the spells to be learned and...

0xAAB3 for where the spells will be added to (still need to find how the spells are added.)

« Last Edit: August 27, 2013, 11:22:29 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #6 on: August 29, 2013, 10:40:52 AM »
Here's something neat. I found how the game decides who can use the Crystal and which item is designated by this ID

RAM: 0x3A127 - C9 C8 (Compare Crystal Item Number)
RAM: 0x3A132 - C9 0B (Only this Unit ID may use the item designated as "Crystal")

ROM...

0x1A327 - C9 C8 (Compare Crystal Item Number)
0x1A332 - C9 0B (Only this Unit ID may use the item designated as "Crystal")

« Last Edit: August 29, 2013, 10:54:48 AM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #7 on: September 02, 2013, 06:14:29 PM »
Here's something I thought was interesting. Instead of using the #DEC (Decrement) command as they normally do with some things in FFIV to minus specific value by 1, the instruction in the Salve Subroutine has a full E9 01, which means SBC 01, so you could make the Salve command say take 2 or 3 of the chosen item instead of 1, in case you wanted to split something that you think might be too good for just one (Phoenix Down's per instance...)

In RAM at...

0x03E30A C901 - CMP 01 - Is there one item?
0x03E312 E901 - SUB 01 - Remove one item.

In ROM at...

0x01E50A C901 - CMP 01 - Is there one item?
0x01E512 E901 - SUB 01 - Remove one item.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Item effects outside of battle
« Reply #8 on: September 02, 2013, 06:31:33 PM »
That's a pretty cool find.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #9 on: October 12, 2013, 06:37:06 PM »
Hmm, well I've started to dive into this using the Status Healing Items as a base, now after a bit of diving I found that they are put into a routine which decreases their amount by D5, which is the value of Soft - Item D5.

In this they become somehow tested against the status afflicting the character, but here is where I get lost. It seems fairly simple, but it must deal something with bits and I'm not too familiar with status in bits.

Something I have completely overlooked is that the game sees Curse as an out-of-battle status ailment, due to the Cross being able to be used outside of battle. I guess that was for plans that never got off the ground or just plain oversight.

Here's the code, it seems straightforward but I don't quite grasp it. It is used by all Status Healing Items outside of battle, save Remedy. Remedy seems to be something special.


Code: [Select]
Successful Heal - Soft - Petrify

$01/A776 E9 D5 SBC #$D5 A:A7D5 X:A654 Y:A100 P:eNvMxdIzC
$01/A778 0A ASL A A:A700 X:A654 Y:A100 P:envMxdIZC
$01/A779 85 43 STA $43    [$00:0143] A:A700 X:A654 Y:A100 P:envMxdIZc
$01/A77B A6 43 LDX $43    [$00:0143] A:A700 X:A654 Y:A100 P:envMxdIZc
$01/A77D A0 03 00 LDY #$0003 A:A700 X:0000 Y:A100 P:envMxdIZc
$01/A780 C2 20 REP #$20 A:A700 X:0000 Y:0003 P:envMxdIzc
$01/A782 B1 60 LDA ($60),y[$7E:1043] A:A700 X:0000 Y:0003 P:envmxdIzc
$01/A784 85 45 STA $45    [$00:0145] A:0040 X:0000 Y:0003 P:envmxdIzc
$01/A786 3F C3 FE 1E AND $1EFEC3,x[$1E:FEC3] A:0040 X:0000 Y:0003 P:envmxdIzc
$01/A78A 91 60 STA ($60),y[$7E:1043] A:0000 X:0000 Y:0003 P:envmxdIZc

Code: [Select]
Unsuccessful Heal - Dwarf Bread - Petrify

$01/A776 E9 D5 SBC #$D5 A:A7D7 X:A654 Y:A100 P:eNvMxdIzC
$01/A778 0A ASL A A:A702 X:A654 Y:A100 P:envMxdIzC
$01/A779 85 43 STA $43    [$00:0143] A:A704 X:A654 Y:A100 P:envMxdIzc
$01/A77B A6 43 LDX $43    [$00:0143] A:A704 X:A654 Y:A100 P:envMxdIzc
$01/A77D A0 03 00 LDY #$0003 A:A704 X:0004 Y:A100 P:envMxdIzc
$01/A780 C2 20 REP #$20 A:A704 X:0004 Y:0003 P:envMxdIzc
$01/A782 B1 60 LDA ($60),y[$7E:1043] A:A704 X:0004 Y:0003 P:envmxdIzc
$01/A784 85 45 STA $45    [$00:0145] A:0040 X:0004 Y:0003 P:envmxdIzc
$01/A786 3F C3 FE 1E AND $1EFEC3,x[$1E:FEC7] A:0040 X:0004 Y:0003 P:envmxdIzc
$01/A78A 91 60 STA ($60),y[$7E:1043] A:0040 X:0004 Y:0003 P:envmxdIzc

The answer is in there somewhere, but I can't grasp it.

Now that I am much wiser about this sort of thing I can fully grasp what's going on with Outside Battle Status Healing Items...

Successful Heal - Soft - Petrify

$01/A776   E9 D5   SBC #$D5   A:A7D5   X:A654   Y:A100   P:eNvMxdIzC - -D5 from A. (Hen Item D5,start of Status Healing Items is read as 00)
$01/A778   0A    ASL A   A:A700   X:A654   Y:A100   P:envMxdIZC  - x2 A? Must only refer to the smaller bytes.
$01/A779   85 43   STA $43    [$00:0143]   A:A700   X:A654   Y:A100   P:envMxdIZc - Store A in 0143.
$01/A77B   A6 43   LDX $43    [$00:0143]   A:A700   X:A654   Y:A100   P:envMxdIZc - Load X from 0143. (Used for indexing later)
$01/A77D   A0 03 00   LDY #$0003   A:A700   X:0000   Y:A100   P:envMxdIZc - Load 0003 into Y.
$01/A780   C2 20   REP #$20   A:A700   X:0000   Y:0003   P:envMxdIzc - Reset Processor Status
$01/A782   B1 60   LDA ($60),y[$7E:1043]   A:A700   X:0000   Y:0003   P:envmxdIzc - Load A from 7E1043.(Indexed 60 must be Start of Item List +Y)
$01/A784   85 45   STA $45    [$00:0145]   A:0040   X:0000   Y:0003   P:envmxdIzc  - Store A in 145.
$01/A786   3F C3 FE 1E   AND $1EFEC3,x[$1E:FEC3]   A:0040   X:0000   Y:0003   P:envmxdIzc - Here is the Very Important Part and it is a part I cannot stress enough. It is a part of LoRom that has a bunch of values that are as follows...
$01/A78A   91 60   STA ($60),y[$7E:1043]   A:0000   X:0000   Y:0003   P:envmxdIZc - Store A in Status Byte 1.

BF (-40 getting rid of Petrify) FF - ?? DF (-20 getting rid of Toad) FF - ?? EF (-10 getting rid of Small.) FF - ?? F7 (-8 getting rid of Pig) FF FB (-4 getting rid of Mute)  FF FD (-2 getting rid of Darkness) FF FE (-1 Getting rid of Poison) - FF FF (getting rid of All Statuses)

This can be seen clearer in my "failed" example...

Unsuccessful Heal - Dwarf Bread - Petrify

$01/A776   E9 D5   SBC #$D5   A:A7D7   X:A654   Y:A100   P:eNvMxdIzC - Dwarf Bread is Item D7 - D5 = Item 2.
$01/A778   0A    ASL A   A:A702   X:A654   Y:A100   P:envMxdIzC - x2 the lower parts of A.
$01/A779   85 43   STA $43    [$00:0143]   A:A704   X:A654   Y:A100   P:envMxdIzc - Store A in 0143 (04 specifically)
$01/A77B   A6 43   LDX $43    [$00:0143]   A:A704   X:A654   Y:A100   P:envMxdIzc - Load X from 0143.
$01/A77D   A0 03 00   LDY #$0003   A:A704   X:0004   Y:A100   P:envMxdIzc - Load 0003 into Y.
$01/A780   C2 20   REP #$20   A:A704   X:0004   Y:0003   P:envMxdIzc - Reset Processo Status.
$01/A782   B1 60   LDA ($60),y[$7E:1043]   A:A704   X:0004   Y:0003   P:envmxdIzc - Load A from Status Byte 1.
$01/A784   85 45   STA $45    [$00:0145]   A:0040   X:0004   Y:0003   P:envmxdIzc - Store A in 145.
$01/A786   3F C3 FE 1E   AND $1EFEC3,x[$1E:FEC7]   A:0040   X:0004   Y:0003   P:envmxdIzc - Add the byte from that value (above) into A.
$01/A78A   91 60   STA ($60),y[$7E:1043]   A:0040   X:0004   Y:0003   P:envmxdIzc - Store A in Status Byte 1.
[/code]

And there we go! I do not know if these values are used elsewhere, my bets are that they likely are not. But I can't be too sure on that. Not that changing them would really help, since you can still only carry those specific statuses out of battle anyhow.


$01/A6DE   C9 DE   CMP #$DE   A:00CE   X:0002   Y:6800   P:eNvMxdIzc - Is the Item Alert?
$01/A6E0   F0 10   BEQ $10    [$A6F2]   A:00CE   X:0002   Y:6800   P:eNvMxdIzc - If so branch to 01A6F2.
$01/A6E2   C9 E2   CMP #$E2   A:00CE   X:0002   Y:6800   P:eNvMxdIzc - Is the Item Tent?
$01/A6E4   B0 0C   BCS $0C    [$A6F2]   A:00CE   X:0002   Y:6800   P:eNvMxdIzc - If greater than tent branch to 01A6F2.
$01/A6E6   20 59 A4   JSR $A459  [$01:A459]   A:00CE   X:0002   Y:6800   P:eNvMxdIzc - Jump to Subroutine (???)
 
(Item decrementing subroutine, quite uninteresting)
$01/A70C   C9 DE   CMP #$DE   A:00CE   X:00B4   Y:0007   P:eNvMxdIzC - Is it Alert?
$01/A70E   F0 12   BEQ $12    [$A722]   A:00CE   X:00B4   Y:0007   P:eNvMxdIzc - If so branch to 01A722.

$01/A710   C9 E2   CMP #$E2   A:00CE   X:00B4   Y:0007   P:eNvMxdIzc - Is the Item Tent?
$01/A712   B0 0E   BCS $0E    [$A722]   A:00CE   X:00B4   Y:0007   P:eNvMxdIzc - If greater than tent branch to 01A722.



Hmm, just some other miscellaneous things. I haven't really been able to use them that well yet. Couldn't find anything of much interest.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #10 on: January 03, 2014, 11:49:45 AM »
Oh yes, I was looking through the information I had located in the past and I found... well a lot. With this information you could turn the "Tools" section into a slightly editable section rather than just change the price of items.

I know how to decide which stat to raise with the Apples and Soma Drop for instance, which some modders might find useful. And while I know the information for how to change the events on Magazine/Exit/Sight items, I think that can be dealt with much easier by just disallowing people to use those spells outside of battle (as you've added to the editor.)

Now the Stat-Boosting Items are very simple affairs.

First off, some Impromptu Code...
Golden Apple Code
Code: [Select]
$01/A731 C2 20 REP #$20 A:A731 X:A654 Y:A100 P:eNvMxdIzc - Reset Processor Status
$01/A733 A0 09 00 LDY #$0009 A:A731 X:A654 Y:A100 P:eNvmxdIzc - Load 0009 into Y (How the game gets to HP, can be altered to any stat)
$01/A736 B1 60 LDA ($60),y[$7E:1009] A:A731 X:A654 Y:0009 P:envmxdIzc - Load Chosen Character's Max HP byte into A.
$01/A738 18 CLC A:00C8 X:A654 Y:0009 P:envmxdIzc - Clear Carry Flag.
$01/A739 69 64 00 ADC #$0064 A:00C8 X:A654 Y:0009 P:envmxdIzc - Add 64 (100) into A.
$01/A73C C9 0F 27 CMP #$270F A:012C X:A654 Y:0009 P:envmxdIzc - Is it 9999?
$01/A73F 90 03 BCC $03    [$A744] A:012C X:A654 Y:0009 P:eNvmxdIzc - If less than 9999 branch to 01A744
---------------------------------------------------------------------------------------------------------------------------
$01/A741 A9 0F 27 LDA #$270F A:2773 X:A654 Y:0009 P:envmxdIzC - Then make it 9999.
--------------------------------------------------------------------------------------------------------------------------------
$01/A744 91 60 STA ($60),y[$7E:1009] A:012C X:A654 Y:0009 P:eNvmxdIzc - Store the new HP in chosen value as chosen by Y above (in this case 0009).
$01/A746 E2 20 SEP #$20 A:012C X:A654 Y:0009 P:eNvmxdIzc - Set Processor to 20
$01/A748 4C 60 87 JMP $8760  [$01:8760] A:00FA X:A654 Y:0009 P:eNvMxdIzc - Jump Elsewhere.

Silver Apple

Code: [Select]
$01/A74B C2 20 REP #$20 A:A74B X:A654 Y:A100 P:eNvMxdIzc - Reset Processor Status.
$01/A74D A0 09 00 LDY #$0009 A:A74B X:A654 Y:A100 P:eNvmxdIzc - Load 0009 into Y (to reach Max HP)
$01/A750 B1 60 LDA ($60),y[$7E:1009] A:A74B X:A654 Y:0009 P:envmxdIzc - Load Chosen Character's Max HP into A.
$01/A752 18 CLC A:00C8 X:A654 Y:0009 P:envmxdIzc - Clear Carry Flag.
$01/A753 69 32 00 ADC #$0032 A:00C8 X:A654 Y:0009 P:envmxdIzc - Add 32 (50) to Max HP.
$01/A756 80 E4 BRA $E4    [$A73C] A:00FA X:A654 Y:0009 P:envmxdIzc - Loop back to 01A73C (this is above, but is important to cover regardless)
$01/A73C C9 0F 27 CMP #$270F A:00FA X:A654 Y:0009 P:envmxdIzc - Is it 9999?
$01/A73F 90 03 BCC $03    [$A744] A:00FA X:A654 Y:0009 P:eNvmxdIzc - If 9999 or less branch to 01A744.
-----------------------------------------------------------------
$01/A741 A9 0F 27 LDA #$270F A:2773 X:A654 Y:0009 P:envmxdIzC - Then make it 9999.
-----------------------------------------------------------------
$01/A744 91 60 STA ($60),y[$7E:1009] A:00FA X:A654 Y:0009 P:eNvmxdIzc - Store A into Chosen Character's HP.
$01/A746 E2 20 SEP #$20 A:00FA X:A654 Y:0009 P:eNvmxdIzc - Set Processor to 20.
$01/A748 4C 60 87 JMP $8760  [$01:8760] A:00FA X:A654 Y:0009 P:eNvMxdIzc - Jump Elsewhere.

Soma Drop

Code: [Select]
$01/A75A A0 0D 00 LDY #$000D A:A758 X:A654 Y:A100 P:eNvmxdIzc - Load 000D into Y (to reach Max MP value)
$01/A75D B1 60 LDA ($60),y[$7E:104D] A:A758 X:A654 Y:000D P:envmxdIzc - Load Chosen Character's Max MP into A.
$01/A75F 18 CLC A:0032 X:A654 Y:000D P:envmxdIzc - Clear Carry Flag.
$01/A760 69 0A 00 ADC #$000A A:0032 X:A654 Y:000D P:envmxdIzc - Add 0A (10) onto A.
$01/A763 C9 E7 03 CMP #$03E7 A:003C X:A654 Y:000D P:envmxdIzc - Is it 999?
$01/A766 90 03 BCC $03    [$A76B] A:003C X:A654 Y:000D P:eNvmxdIzc - If 999 or lower branch to 01A76B.
$01/A76B 91 60 STA ($60),y[$7E:104D] A:003C X:A654 Y:000D P:eNvmxdIzc - Store A in Chosen Character's Max MP.
$01/A76D E2 20 SEP #$20 A:003C X:A654 Y:000D P:eNvmxdIzc - Set Processor to 20.
$01/A76F 4C 60 87 JMP $8760  [$01:8760] A:003C X:A654 Y:000D P:eNvMxdIzc - Jump Elsewhere.

As can be seen above these are very simple instructions and their use can be easily altered.

Unheadered Rom

Golden Apple
Raise Max HP by 100 if more than 9999then make it 9999


Max HP - (Read Byte/Write Byte) - ROM 0xA734
100 (2 Byte Value) - ROM 0xA73A

Silver Apple
Raise Max HP by 50 if more than 9999 thenMake it 9999

Max HP - (Read Byte/Write Byte) - ROM 0xA74E
50 (2 Byte Value) - ROM 0xA754

(Shared by both Golden and Silver Apple)
9999 (2 Byte Value) - ROM 0xA73D
Make it 9999 (2 Byte Value) - ROM 0xA742

Soma Drop
Raise Max MP by 10 if more than 999 then Make it 999

Max MP (Read Byte/Write Byte) - ROM 0xA75A
10 (2 Byte Value) - ROM 0xA761
999 (2 Byte Value) - ROM 0xA764
Make it 999 - ROM 0xA769

And there you go! That's all you would need to say... raise any of the primary stats. and with the enforced limits you can easily make them cap at 99. You could even raise your critical Hit Rate with these. (Should probably make a copy of this post to add to the editor topic as parts ready to be implemented)

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Item effects outside of battle
« Reply #11 on: January 03, 2014, 02:28:12 PM »
This is pretty cool - nice work  :happy:

I could see tapping into this someday if I were feeling frisky. Off the top of my head I could imagine some event to include Edward coming back late game and then something happening to him with a message "Amazing Things Occur and Edward Catches Up!!" - but then just writing a small script that calls this code X times to boost him up while ensuring that the game will handle it properly. Granted I'd have to think about the leveling problem as just discussed; but just in general I'm happy you found it  - The less I have to worry about writing the safety checks the better  :wink:
"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Item effects outside of battle
« Reply #12 on: January 03, 2014, 02:47:04 PM »
Hmm, any more suggestions on what I should look up? Left to my own devices I ordinarily just procrastinate on matters or try to make a new ability or something, but when I have a focused goal I can go a decent way to accomplish it.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Item effects outside of battle
« Reply #13 on: January 03, 2014, 05:13:55 PM »
This is totally wicked. It might be a while before I get to this though, my to-do list for FF4kster is already piling up, but it will happen.
Let's dance!