Author Topic: [FF8] Controlling enemies with their abilities (PC Version)  (Read 2341 times)

Rospark

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Always hit first
    • View Profile
Welcome!


Hello everyone, this is my first post. I discovered this forum recently, and when I saw the MODs section, I realized that there are a lot of talented people here.

That is why I want to ask you if there is any MOD or tool through which you can achieve this:

Fujin & Rajin (using attacks): https://www.youtube.com/watch?v=e-xnMVSkix0

Fujin & Rajin (using limit breaks): https://www.youtube.com/watch?v=fQ68UqC7A90

(Here we can see Rajin & Fujin in our party with their limit breaks and custom attacks, they even have their names on the menu)


Replacing field models: https://www.youtube.com/watch?v=9Jve43HYUSo

(And the creator of this video managed to replace the field models, so you can walk / run with the model of Edea, Cid, and many others)


I hope you can help me with this, since FF8 is one of the jewels of my childhood, and still today I play it.

Thanks!
« Last Edit: 2017-05-27 15:41:05 by Rospark »

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 489
  • Karma: 89
  • Paranoid
    • View Profile
That might be tricky

For field models:


1. Open Deling (editor)
2. Select field you want to modify
3. Click on 'Script' tab
4. Select character you want to modify (e.g. Squall)
5. Click on script label with no name
6. On your right you will see "SETMODEL XYZ"
7. Change XYZ to number ID of model you want (You can see the lists of models in '3D Model' section, first entry on list is ID 0, next entry is 1 and etc...)
8. Click on compile on bottom right
9. Click on 'save' icon

You can also grab other chara.one file and put it in the field archive to use models from other fields (except exceptions, if some entity use model ID higher than model count)
In the video, you can see Rinoa's father at 7:54. 100% author took the Deling chara.one file and put it there

For battle models- there was a PSOne code to change the party to given monster ID. Author in this video claims to work only on file manipulation. I don't believe casual renaming files could work here


EDIT:
WHAT THE
https://www.youtube.com/watch?v=0UAns5WgzRw&list=PL40B4F9F24139705D&index=1

« Last Edit: 2017-05-27 17:27:17 by Maki »

Rospark

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Always hit first
    • View Profile
That might be tricky

For field models:


1. Open Deling (editor)
2. Select field you want to modify
3. Click on 'Script' tab
4. Select character you want to modify (e.g. Squall)
5. Click on script label with no name
6. On your right you will see "SETMODEL XYZ"
7. Change XYZ to number ID of model you want (You can see the lists of models in '3D Model' section, first entry on list is ID 0, next entry is 1 and etc...)
8. Click on compile on bottom right
9. Click on 'save' icon

You can also grab other chara.one file and put it in the field archive to use models from other fields (except exceptions, if some entity use model ID higher than model count)
In the video, you can see Rinoa's father at 7:54. 100% author took the Deling chara.one file and put it there

For battle models- there was a PSOne code to change the party to given monster ID. Author in this video claims to work only on file manipulation. I don't believe casual renaming files could work here


EDIT:
WHAT THE
https://www.youtube.com/watch?v=0UAns5WgzRw&list=PL40B4F9F24139705D&index=1


Wow, I can not believe you answered me. No more than a few hours ago I subscribed to your channel when I was watching this video: https://www.youtube.com/watch?v=hf4m5S-VpXw&t=14s

Thats really insane, you managed to change the animations of the spells in the PC version, which is no small thing.

Regarding to change the battle models, you refer to the codes of King Edgar 0's (https://www.gamefaqs.com/ps/197343-final-fantasy-viii/faqs/4940), however, in the video the user Is not using the PSX version, rather, it is from PC. And I mention it because Fujin & Rajin can not use the "attack" command (in the PSX version), since that crash the game.

So the person behind the video replace not only the battle models, but also the menu commands with monster / enemies skills. Almost 20 years have passed since the original release of the game, and running into these things drives me crazy. That is why I would like to offer any help needed by the people who make up the FF8 team to achieve that kind of progress.




« Last Edit: 2017-05-27 18:28:15 by Rospark »

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 489
  • Karma: 89
  • Paranoid
    • View Profile
So... I just tested and casual file renaming works... >_>

I'll keep you update if I made it to control the enemy

UPDATE1:

That's how looks Zell tricking game in thinking it's Squall (memory hack)

UPDATE2:
Didn't work for enemy geometry. Looks like I can't just trick the game into model changing, but need to change whole party ID
« Last Edit: 2017-05-29 11:37:36 by Maki »

NFITC1

  • No life
  • *
  • Posts: 2810
  • Karma: 68
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
If it's anything like FFVII, which it probably is similar, then it would take a HUGE rewrite to add an enemy to the playable party.

Rospark

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Always hit first
    • View Profile
So... I just tested and casual file renaming works... >_>

I'll keep you update if I made it to control the enemy

UPDATE1:

That's how looks Zell tricking game in thinking it's Squall (memory hack)

UPDATE2:
Didn't work for enemy geometry. Looks like I can't just trick the game into model changing, but need to change whole party ID

Wow! That's a big progress. Basically in the PSX version, you had to replace -through codes- a member of your team by a digit (monster), such as here: https://www.youtube.com/watch?v=MNjeqI2gnh0 (He probably replaced Squall with Diablos). I do not know if that information will help you, but I say it just in case you are trying to add a new member to the team - beyond existing ones - that I believe is not possible, but it is simply a stipulation.

Likewise, many thanks for the work you are doing, I truly value it very much, and whatever you need, do not hesitate to ask me. Frankly I do not know much about coding, but if you ask me to do some task (like trying out certain digits to replace models, etc) I learn fast enough and I would devote all afternoon to it.  ;D



Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 489
  • Karma: 89
  • Paranoid
    • View Profile
Okay. So far this:

The forsaken is fully controlable, although I had to fix like 8-9 DIVIDE BY ZERO errors
Fujin instead- no DIVIDE BY ZERO errors, yet her attack doesn't work.

Here's address for "party in battle":
1CFE74C (FF8 English 2000)
The scheme is like this:
4 bytes:
FF020100 - means:
FF- unused
02- Quistis (third party member)
01- Zell (second party member)
00- Squall (First party member)

so you can change it to even:
FF000000, what means that you'd get three Squalls (they work, but are glitchy)

Unfortunately, this list doesn't seem to work with King Edgar IDs
Any ID bigger than 0F just puts Squall with zero HP.
I'll be digging deeper

UPDATE:
I know why. The model ID is stored inside DL, the game finds out the corresponding model ID by doing the [CharaID+CharaID*8] jump and retrieves value at given address. That means it can retrieve some value at weird spots. To avoid that I'm changing register after applying that wicked thing. Finally I'm able to control anything, but:


Still unable to attack, ID is not the same as in any list. I put 9F and got Raijin.

0A is Ward:

Attacks completely fine


UPDATE 3:
20 is cockatrice (fully working)
3F is Chimera (and indeed hangs battle as in wiki)

So yeah, I just ported Enemy control codes to PC version. :)
I'll make tutorial tomorrow (you may need debugger for that)
« Last Edit: 2017-05-29 20:12:50 by Maki »

Rospark

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Always hit first
    • View Profile
Okay. So far this:

The forsaken is fully controlable, although I had to fix like 8-9 DIVIDE BY ZERO errors
Fujin instead- no DIVIDE BY ZERO errors, yet her attack doesn't work.

Here's address for "party in battle":
1CFE74C (FF8 English 2000)
The scheme is like this:
4 bytes:
FF020100 - means:
FF- unused
02- Quistis (third party member)
01- Zell (second party member)
00- Squall (First party member)

so you can change it to even:
FF000000, what means that you'd get three Squalls (they work, but are glitchy)

Unfortunately, this list doesn't seem to work with King Edgar IDs
Any ID bigger than 0F just puts Squall with zero HP.
I'll be digging deeper

UPDATE:
I know why. The model ID is stored inside DL, the game finds out the corresponding model ID by doing the [CharaID+CharaID*8] jump and retrieves value at given address. That means it can retrieve some value at weird spots. To avoid that I'm changing register after applying that wicked thing. Finally I'm able to control anything, but:


Still unable to attack, ID is not the same as in any list. I put 9F and got Raijin.

0A is Ward:

Attacks completely fine


UPDATE 3:
20 is cockatrice (fully working)
3F is Chimera (and indeed hangs battle as in wiki)

So yeah, I just ported Enemy control codes to PC version. :)
I'll make tutorial tomorrow (you may need debugger for that)

Gosh, You really are a god in this. These codes are more than 15 years old. So today you achieved something from another world lol.
It is rare that monsters can not attack (just like in the PSX version). That's why the guy who managed to do it with Fujin & Rajin (with their respective limit breaks) is something amazing. It is a pity that he did not share the method through which he did it, besides he does not upload any more videos (at least about two years ago).

P.D: Since you were totally cool with me, and you help me with this, I will make some designs for your post tomorrow!
« Last Edit: 2017-05-30 00:38:01 by Rospark »

smalldirt

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Hey,  :)

I am the author of the videos you mentioned in the post (which includes Fujin Raijin). I think i still have most of the files , but  i made that vid in 2012 and its the  nonsteam version of ff8, just uploaded the leftovers 2 years ago. Havent tested it on steam yet.
However the models not ready, there are some missing animations as you could see in the video (e.g. dead animation).
About the method in short- basically the enemy files and playable character files are almost the same, enemies have some extra sectiions (AI). It can be modified to match with e.g. squall file structure and just replace it and do the renames . Worst part u need to edit the animations and sequences otherwise it wont work as intended. :'(

Let me know if you have any other questions  ;)
Best Regards

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 489
  • Karma: 89
  • Paranoid
    • View Profile
basically the enemy files and playable character files are almost the same, enemies have some extra sectiions (AI). It can be modified to match with e.g. squall file structure and just replace it and do the renames.

You modified .DAT by yourself? Nice job! I'm amazed by what you did. :)

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 489
  • Karma: 89
  • Paranoid
    • View Profile
Just as requested I'm posting the code for manipulating the party for both 2000 and Steam version:

At 48B7F5 you have:
mov     al, byte ptr ss:SG_PARTY_BATTLE1[ebp]

SG_PARTY_BATTLE1 is DWORD, and EBP holds current pointer to index for getting byte
When EBP is higher than 3 (4) then parsing is done. When AL holds 0xFF, then next character is parsed. Sample party variable:
.data:01CFE74C SG_PARTY_BATTLE dd 0FF050100h
(remember to read variables from end to beginning).

Interesting note: just after party_battle dword there's UnlockedWeapons DWORD and griever name (allocated on 12 bytes including terminator)

so just change (byte):
01CFE74F - to replace 1st party member
01CFE74E - to replace 2nd party member
01CFE74D - to replace 3rd party member

Anyway- that's wrong. I was enough reckless to not note where is the actual model ID stored and that what happened. Anyway, the new method I discovered doesn't require 1ms memory injection but simple memory change and requires you to have fixed party (if not, I'll tell you how to calculate it)

Let's get started:
ParseBattleParty+93   push    eax ; eax stores Party member ID as variables from above
ParseBattleParty+94   call    ParseBattleCharacter

ParseBattleCharacter in PC2000 is located at: 495520
Step by step:
mov     ebx, [esp+CharacterID] ;EBX now stores party ID. Here 00 because Squall is first in party
ParseBattleCharacter+A    lea     eax, [ebx+ebx*8] ; dark magic strawberries
ParseBattleCharacter+17   lea     edi, [ebx+eax*2] ; another dark magic strawberries
ParseBattleCharacter+20   mov     dl, SG_CHARACTER_MODEL_ID[edi] ; DL stores real model ID from King's Edgar codes

SG_CHARACTER_MODEL_ID is at 01CFE0F0

Now math time!
If Squall (ID=00) is in party, then:
x=(0+0*8 )
y=x*2 + 0
z = ((x+y) << 3) + SG_CHARACTER_MODEL_ID_ptr

If Selphie (ID==05) is in party, then:
x=(5+5*8 )
y=x*2 + 5
z = ((x+y) << 3) + SG_CHARACTER_MODEL_ID_ptr

Example calculation in python for selphie:
Code: [Select]
hex(((5+5*8 )*2+5)<<3)will give 0x2f8
Then: 01CFE0F0 + 0x2F8 = 01CFE3E8 = Byte to change - you can do it in CE freely

Changing 01CFE3E8 to 0x20 will give you Cockatrice instead of Selphie in party

Non-hacker guide: (2000 PC)
Now, I'm pretty sure you don't want to do all the calculations and also you don't have all engine IDs for party, so I pre-calculated values for you:
Squall replace- 0x1CFE0F0
Zell replace- 0x1CFE188
Irvine replace- 0x1CFE220
Quistis replace- 0x1CFE2B8
(CharID=4)- 0x1CFE350
Selphie replace- 0x1CFE3E8

Non-hacker guide: (Steam)
I know many of you play Steam version, so here are the codes for Steam:
ParseBattleParty is 0048B7E0 sub_48B7E0
ParseBattleCharacter is 00495530
so SG_CHARACTER_MODEL_ID_ptr is byte_1CFE0F0 (01CFE0F0)
Therefore 2000 PC version and Steam version BOTH SHARE THE SAME ADDRESSES.
« Last Edit: 2018-01-19 16:46:34 by Maki »

fornis

  • Fast newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
as a follow up on the steam (and presumably 2000 version) this indeed works, but doesn't work.

https://www.youtube.com/watch?v=AL_HpcdVoZE

More than likely I fucked up, though? I don't really know, considering your screenshots would prove this should work no problem.

Where does it pull the data for junction/stats anyways for any of the bytes above 0x11 (anything after ward seems to crash it).

Is the dream dead? I hope not.

« Last Edit: 2018-01-21 16:15:13 by fornis »

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 489
  • Karma: 89
  • Paranoid
    • View Profile
DIV BY ZERO - CPU error
Looks like I didn't test it perfectly before handing it out. There's sub_496300, a function that parses party abilities. It want's to read some rubbish data and in fact tries to divide some variable by zero. Let me investigate that...

UPDATE:
Ok, got it- it's HP error. It takes it's ability from playable party structure:
01CF75F5 (named K_CHARACTER_HP_B) [Steam should use the same variables]
Calculation: 01CF75F5 + (characterID*0x24)
Let's see... Cockatrice is 0x20 (32 in decimal). So:
I'm setting 01CFE0F0 to 0x20
I'm setting (0x20 * 0x24) + 01CF75F5 to 255 (0xFF)

UPDATE 2:
Loord... another DIVIDE BY ZERO...

UPDATE 3:
Too much strawberries is going on here. I need to find another way. At the moment do this:
Put a breakpoint at 495550 (mov dl, 01CFE0F0)
Step forward, change EDX register (only two last digits) to the monster you want to control in battle. That's for now unfortunately, I need to think how to deal with this now so you can modify it without disassembler and you could access menu normally.

Grab video tut here:
https://www.youtube.com/watch?v=irNiwcGltkw&feature=youtu.be

I think I know how to do it...

UPDATE 4:
You can use assembler script I wrote. It replaces Squall: (change MOV dl, 0x20 to any enemy you want; Keep in mind this only works for battle so far...)
Code: [Select]
alloc(newmem,2048)
label(returnhere)

newmem:
CMP EAX, 0
JNE noSquall
mov dl,0x20
JMP exit
noSquall:
mov dl,[edi+FF8_EN.exe+18FE0F0]
jmp returnhere

"FF8_EN.exe"+95550:
jmp newmem
nop
returnhere:
« Last Edit: 2018-01-21 20:31:55 by Maki »

fornis

  • Fast newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
https://www.youtube.com/watch?v=ls74BJquLQM

Toggle breakpoint works, though using the assembly at least for this seems to crash it, without an error prompt no less...

Interestingly though, using togglebreak point after a battle it seems to give EXP like it would in PS1 version to the controlled monster.

Junctions carry over, which I think is normal and how it happens on PS1/PSP and thusfar so that's good, though I recall a few monsters not doing this. Not sure why.