• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
April 16, 2024, 03:50:59 pm

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


Razele's ASM Hacks

Started by Razele, January 01, 2009, 02:08:08 pm

Kokojo

January 04, 2009, 01:22:48 pm #20 Last Edit: December 31, 1969, 07:00:00 pm by Kokojo
Wait so i could give everyone innate defend up and magic defence up? I want it!

I lovezors you razele.
I keep leaving, I keep coming back. Boomerang boy.

Razele

January 04, 2009, 01:51:36 pm #21 Last Edit: January 09, 2009, 05:05:40 am by Razele
- Fixed AI to properly use Defend with "Defend innate all" hack
- Restrict Move Find Item innate all for humans only
- Added Equip Sword - Equip Sword + Knight's Sword + Spear
- Added Equip Spear - Equip Rod + Staff + Instrument + Dictionary
- Added Defend Up innate all
- Added Magic Defend Up innate all

About Equip Change on AI, I don't know if AI really use Equip Change.
I give Agrias "Equip Change", removed all of her equipments, set her AI from "Fight for life" to "Run like a rabbit" but
she never uses "Equip Change" in battle.


Equip Knife -> Katana + Ninjato + Poles + Bags
Equip Axe -> Axes + Flails + Cloths
Not possible because of space limitation. Reasons :

1. Items are divided into 4 group


I'll provide some example :

- It's possible to merge two adjacent group together, ex : Equip Gun -> Equip "Instrument + Book" (group 2) + "Shield + Hat" (group 3)
- It's not possible to merge two distant group, ex : Equip Sword -> Equip "Axe + Rod" (group 1) + "Bag + Armor" (group 3)
- It's possible to change one group to another group, ex : Equip Axe (group 1) -> Equip Shield + Helmet (group 3)
Because there's not enough space to write the asm instruction.

2. "Equip XXX" functions are located in SCUS_942.21
Since I don't have enough space to write asm code in SCUS_942.21, I have to use WORLD.BIN / BATTLE.BIN
BATTLE.BIN is only loaded in battle, so I have to pick WORLD.BIN.
I can write a jump instruction to WORLD.BIN and write a function to change "Equip Axe" to "Equip Axe + Flail + Cloth".
It will works fine in world map, but when you enter battle, the game will load BATTLE.BIN, not WORLD.BIN
Bad things will happen if you use "Equip Change", since the game know you have "Equip Axe", it will jump
to the address in WORLD.BIN, but WORLD.BIN isn't exist anymore in the memory.

These requests will be pending until Zodiac find the safe area to write asm code in SCUS_942.21


QuoteIf I had to make a request, it'd be an expansion of the request I made in the other thread. Basically, to have some of these changes more fully explained and expanded upon. Like the "Equip Sword" skill... if it weren't too much work, it'd be nice to simply have the different values usable to make it whatever we want (or at least an explanation of how to achieve this, for instance if each weapon value were listed, and then an explanation on how to mix-and-match them).
There's a few reason why I don't explain it in detail what I found :

1. Even without my explanations people with a bit asm language can find "Require Sword" check easily in the game under 5 minutes.
2. The documentation can be long, and I don't like to write a long pages.
3. You need asm knowledge to modify how things work in the game. Even after you read my explanation, it's still hard to implement the changes without a bit of asm knowledge.

To understand "Equip Sword" function you must know bitwise operation, which is a bit hard to explain.
I'll explain how I modify "Require Sword" to "Require Knight's Sword",
since "Require Sword" hack only require a bit explanation.


First, every item in the game is classified into a few types :

Item Type
0x00 Nothing
0x01 Knife
0x02 Ninja Blade
0x03 Sword
0x04 Knight Sword
0x05 Katana
0x06 Axe
0x07 Rod
0x08 Staff
0x09 Flail
0x0A Gun
...
There's more, you can see it in fftpatcher.

This is how the game check if an item is really a "sword" if "Require Sword" is checked in fftpatcher.
For example, we will use Defender. Defender is a 0x04 Knight Sword in item type.
The game subtract Defender's item type, 0x04 Knight Sword with 3 and check if the result < 2
0x04 - 3 = 1, so it is a "sword"

Let's check 0x01 Knife.
0x01 - 3 = -2.
-2 < 2 in signed mode, but the game check it in unsigned mode, so -2 become 65,534
65534 > 2, so it is not a "sword"

With a simple logic, you can modify "Require Sword" to "Require Knight Sword"
Just change the subtract modifier from 3 to 4 and check if the result < 1.
1. Let's check 0x03 Sword
0x03 - 4 = -1
-1 < 1 in signed mode, but the game check it in unsigned mode, so -1 become 65,535
65535 > 1, so it is not a "sword"

2. Let's check 0x04 Knight's Sword
0x04 - 4 = 0
0 < 1, so it is a "sword"


Well it's easy if I explain that in human language.
Unfortunately, to modify that in the game you must understand asm language.
This is how "Require Sword" works in asm :

0005c660:  lbu r2,0x2ebd(r1)     [load item type]
0005c664:  nop
0005c668:  addiu r2,r2,0xfffd    [decrease r2 by 3]
0005c66c:  sltiu r2,r2,0x0002    [check if r2 < 2, set r2 to 1]
0005c670:  beq r2,r0,0x0005c68c  [if r2 equal to zero, it's not a sword, jump to 0x5c68c]

After I modified "Require Sword" to "Require Knight's Sword"

0005c660:  lbu r2,0x2ebd(r1)     [load item type]
0005c664:  nop
0005c668:  addiu r2,r2,0xfffc    [decrease r2 by 4]
0005c66c:  sltiu r2,r2,0x0001    [check if r2 < 1, set r2 to 1]
0005c670:  beq r2,r0,0x0005c68c  [if r2 equal to zero, it's not a sword, jump to 0x5c68c]

QuoteAnd that "Mighty Sword" hack... Is that simply a modification to the 2E formula (just curious)?  

There's 2 Equipment check, to check whether you wear 0xFF Nothing, if yes, give 00% hit chance.
Monster wears 0x00 Nothing, since 0x00 Nothing is different than 0xFF nothing, Mighty Sword should work on monster,
but the game check if the target's gender is Male / Female / Monster. If it's monster, give 00% hit chance.

Quote from: "Kokojo"Wait so i could give everyone innate defend up and magic defence up? I want it!

I lovezors you razele.
Added Defend Up innate all and Magic Defend Up innate all

Vanya

January 04, 2009, 02:23:56 pm #22 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
Thanks for the explanation and ASM hacks, dude! You rock! ^_^
  • Modding version: Other/Unknown
¯\(°_0)/¯

The Damned

January 04, 2009, 03:17:58 pm #23 Last Edit: December 31, 1969, 07:00:00 pm by The Damned
Quote from: "Razele"- Fixed AI to properly use Defend with "Defend innate all" hack

....

I believe these lyrics explain my current feeling on the situation:


GALINDA:
What is this feeling,
So sudden and new?

ELPHABA:
I felt the moment
I laid eyes on you;

GALINDA:
My pulse is rushing;

ELPHABA:
My head is reeling;

GALINDA:
My face is flushing;

BOTH:
What is this feeling?
Fervid as a flame,
Does it have a name?
Yes! Loathing
Unadulterated loathing



Seriously, though, thank you so very much.

I'm curious how the computer uses Defend, though considering they can use it at every possible opportunity. That's something I've been a bit afraid of despite wanting the AI to be able to use Defend.


QuoteAbout Equip Change on AI, I don't know if AI really use Equip Change. I give Agrias "Equip Change", removed all of her equipments, set her AI from "Fight for life" to "Run like a rabbit" but
she never uses "Equip Change" in battle.

As with Defend, the computer has never been able to use Equip Change. Hence why I was winking at Zozma since it shouldn't be a problem that all monsters have Equip Change.

Also, thank you for the impromptu item lesson. I had been wondering why some item combinations were impossible.
"Sorrow cannot be abolished. It is meaningless to try." - FFX's Yunalesca

"Good and evil are relative, but being a dick cannot be allowed." - Oglaf's Thaumaturge in "The Abyss"

"Well, see, the real magic isn't believing in yourself. The real magic is manipulating people by telling them to believe in themselves. The more you believe, the less you check facts."  - Oglaf's Vanka in "Conviction"

Vanya

January 04, 2009, 07:19:42 pm #24 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
Quote from: "Razele"Equip Knife -> Katana + Ninjato + Poles + Bags
Equip Axe -> Axes + Flails + Cloths
Not possible because of space limitation.

Are these Possible then?

Equip Axe -> Axes + Flails
Equip Crossbow -> Crossbows + Bows + Guns
Equip Knife -> Katana + Ninjato
Equip Gun -> Poles + Bags + Cloths

I guess I should explain what I'm doing since I'm going to bother you with another request.
My hack is going to include a special job called 'Freelancer'. The freelancer is my repository job so that other jobs don't have to have skill slots used up with common stuff. They are built off of the Chemist so they come with all the Item skills for free and can be used to learn all 6 weapon equip skills. That's why I'm trying to get all weapon types except knives into 6 skills.

Once again, Thank You for all your help! ^_^

PS- I was wondering if it would be difficult to make an 'Innate All' hack where all units get a specific skill set added to their action menu below 'Equip Change'? Basically I was thinking of trying to give all units a new 'Items' command so I could use the Chemist job for something else entirely. I'm just curious at this point since I was satisfied with my Freelancer job as a good alternative. Thanks again again! ^_^
  • Modding version: Other/Unknown
¯\(°_0)/¯

Zozma

January 04, 2009, 09:01:44 pm #25 Last Edit: December 31, 1969, 07:00:00 pm by Zozma
is this one complicated?

make it so the  "monster" gender doesnt disable equipping items.

currently you can make a monster equipped with an item in entd editor.. and they will have the item in the menu and when u select "reequip" but the item doesnt show in battle nor does its affects work....
  • Modding version: Other/Unknown
Wiegraf: Draw your sword Ramza!
Ramza: But im a monk!!

Vanya

January 04, 2009, 10:09:30 pm #26 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
I'd like to know that too because it probably also has a link to the Mime job not being able to equip item. ^_^
  • Modding version: Other/Unknown
¯\(°_0)/¯

Armony

January 05, 2009, 12:11:54 am #27 Last Edit: December 31, 1969, 07:00:00 pm by Armony
QuoteAre these Possible then?

Equip Axe -> Axes + Flails
Equip Crossbow -> Crossbows + Bows + Guns
Equip Knife -> Katana + Ninjato
Equip Gun -> Poles + Bags + Cloths

If I understand this correctly, I know two of these

Equip Crossbow -> Crossbows + Bows + Guns
SCUS_942.21
0x4CB08   0x10 change to 0x38

Equip Knife -> Katana + Ninjato
SCUS_942.21
0x4CAEC   0x04 change to 0x24

Feel free to correct me if I'm wrong, but I think I got how these work, at least for staying in the same column.

Also, if you have the time for another equip request Razele, could you do Equip Shield -> Rod + Staff please?

I'm going to put Shield in with Equip Armor in what I'm working on, so I plan on using Equip Shield for caster weapons, since none of them have equip skills.

Razele

January 07, 2009, 12:17:51 pm #28 Last Edit: December 31, 1969, 07:00:00 pm by Razele
- Added Equip Axe - Equip Axe + Flail
- Added Equip Crossbow - Equip Crossbow + Bow + Gun
- Added Equip Knife - Equip Katana + Ninja Blade
- Added Equip Gun - Equip Pole (Spear) + Bag + Cloth
- Added Equip Shield - Equip Rod + Staff
- Added Item innate all
- Added Formula 4E Dmg_(MA*Y) Hit(100)% becomes 4E Dmg_(MA*Y) Hit(MA+X)%

QuoteI'm curious how the computer uses Defend, though considering they can use it at every possible opportunity. That's something I've been a bit afraid of despite wanting the AI to be able to use Defend.
Defend is the best possible action when they're not doing any useful actions.
Unless we give AI some restriction, they will use it most of the time.

Quoteis this one complicated?

make it so the "monster" gender doesn't disable equipping items.

currently you can make a monster equipped with an item in entd editor.. and they will have the item in the menu and when u select "reequip" but the item doesn't show in battle nor does its affects work....

It's complicated, and the game doesn't use gender to determine whether an unit can set equipment or not. It uses Job ID.
Before the game check whether a unit can wear equipment or not the game read lots of useless
variable, like HP Multiplier, Innate, and do lots of useless stuff. That useless function hide the real function that
determine whether an unit can set equipment or not. Also, there's two possibilities how the game check whether an unit
can set equipment or not.

1. If Job ID is in range 0x3C..0x49 and 0x5D..0x9F, disable EQ change.
2. There's a variable stored in each Job that determine whether that Job can change EQ / Abilities.

The best example for this case is 0x3D Knight. Although they can wear several EQ (Sword, Knight Sword, Armor, etc),
the game doesn't allow you to set their Abilities / Equipments.

Zozma

January 07, 2009, 12:24:26 pm #29 Last Edit: December 31, 1969, 07:00:00 pm by Zozma
so if i specifically want to make job 46 able to equip + mountable?
  • Modding version: Other/Unknown
Wiegraf: Draw your sword Ramza!
Ramza: But im a monk!!

Vanya

January 07, 2009, 12:26:53 pm #30 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
Thanks again for the edits Razele! You rock, dude! ^_^

Quote from: "Razele"- Added Equip Gun - Equip Pole (Spear) + Bag + Cloth

Is this "Pole + Polearm + Bag + Cloth" or "Polearm + Bag + Cloth" or "Pole + Bag + Cloth"?
The way you wrote it is a tad confusing.

Edit:
Wait! Formula 4E didn't work the way it said in the patcher?
  • Modding version: Other/Unknown
¯\(°_0)/¯

Gamesoul Master

January 07, 2009, 12:58:15 pm #31 Last Edit: December 31, 1969, 07:00:00 pm by Gamesoul Master
Thanks a bunch Razele. I understand that some explanations would be quite difficult... I was pretty much just wondering what you've now answered. That's a really odd method they use for checking for a sword (a little drawn out for what should be a single line of code).

@Vanya: He must have meant "Pole + Bag + Cloth", since that's the only combination where all three are in the same group, and he stated earlier that the Equip abilities can currently only use types from one group at a time (until he figures out where he could safely write extensions to this).

Vanya

January 07, 2009, 01:21:45 pm #32 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
No they can be pairs of adjacent groups too. I was looking at the changes and I think it's "Polearm + Bag + Cloth".
I'm trying to see if I can change Polearm to Pole, but I don't think I understand the relation between the hex and the ASM well enough.
  • Modding version: Other/Unknown
¯\(°_0)/¯

LastingDawn

January 07, 2009, 03:55:46 pm #33 Last Edit: December 31, 1969, 07:00:00 pm by LastingDawn
My hero! Thank you Razele! That makes the Invoker a complete class! Well done, sir! Well done! With that, every basic class is finished, by basic I mean... Knight, Archer, Invoker, Cantor, for this demo... Also, quite interesting work for the other Equip X, you're really making them extremely versatile!
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

Vanya

January 07, 2009, 06:42:27 pm #34 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
I discovered a small problem when Innate Item All, Innate Defend All, and Innate Equip Change All are used at the same time.

If all three are active and the unit has 2 skill sets the menu's graphics glitch on the bottom half of the last command on the list.

Also, I noticed that if the unit is a chemist they have Item listed twice.
  • Modding version: Other/Unknown
¯\(°_0)/¯

Zozma

January 07, 2009, 06:52:17 pm #35 Last Edit: December 31, 1969, 07:00:00 pm by Zozma
hmm i didnt do the "item all" thing but did equip change all and defend all and those two have no problems
  • Modding version: Other/Unknown
Wiegraf: Draw your sword Ramza!
Ramza: But im a monk!!

Vanya

January 07, 2009, 07:20:09 pm #36 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
It's not a problem with them directly. If you have too much stuff on the menu it glitches the graphics 'cause it wasn't programmed to handle that many lines of text.

Also, I have an idea for the double Item problem.
I tested some stuff out. And because of the way that the game handles the Mime job it is a perfect place to put the Item skill set. The game won't display the mime's skill set even if it has auto-learned skills in it.

The only problem is that the mime won't record skills learned on the menu; only those it started with. Also, if it has skills available to learn the player can enter the lean skill screen. If the mime could be forced to learn all the skills in it's set automatically and block the learn option completely it would be perfect. It would house the item skills & still function perfectly as a mime. Plus if the mime's normal options, except the ability to learn skills, were unlocked it could house the Item set and be more useful as an Onion Knight or Freelancer.
  • Modding version: Other/Unknown
¯\(°_0)/¯

Armony

January 08, 2009, 02:58:11 pm #37 Last Edit: December 31, 1969, 07:00:00 pm by Armony
Thank you very much Razele.

Razele

January 09, 2009, 04:59:36 am #38 Last Edit: December 31, 1969, 07:00:00 pm by Razele
- Fixed Equip Gun - Equip Pole (Stick) + Bag + Cloth
- Fixed Item innate all to show once with Chemist
- Added Every monster is mountable + screenshot

Quoteso if i specifically want to make job 46 able to equip + mountable?
In other words, I haven't found out how to make monster equip items.
Instead of 0x46 job id 0x38 can equip Items

Riding a monster give you several status immunities.
It's almost the same as Zodiac status immunities, except for Crystal, Dead, Faith, Innocent, Charm.



If you ride a monster, the monster also cured from the following status :


Credits to Notti for the original information.

Asmo X

January 09, 2009, 12:42:16 pm #39 Last Edit: December 31, 1969, 07:00:00 pm by Asmo X
I once tested riding other monsters just by swapping the chocobo sprite but it doesnt look very good. The Chocobo seems to be a 2 part sprite where if you rode it and looked at it from behind, the rider, if i remember correctly, would then be behind the tail feathers but in front of the head. If you use other sprites, you'll notice that the rider is just always behind the mount which looks kind of dumb, especially when you look at it from behind. I wonder if the other sprites could be made in the same format as the chocobo.

Anyway, good hacks.