Author Topic: [PSX/PC] General editor - Hades Workshop (0.41f)  (Read 631786 times)

Shinjeez

  • *
  • Posts: 4
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1800 on: 2021-07-04 21:22:26 »
About Ragtime's rights and wrongs, the answers are stored in the AI script, in the form of a bit flag:
Code: [Select]
Function False_CounterEx
    // ...
    if ( 27789 & ( 1 << VAR_GlobUInt8_31 ) ) {
        set VAR_GlobUInt8_32 = 4 // Correct answer
    } else {
        set VAR_GlobUInt8_32 = 6 // Wrong answer
    }
"27789" is a bit flag, that is, its meaning appears when writing that number in base 2:

27789 [base 10]
110110010001101 [base 2]

Thus the 1st, 3rd, 4th, 8th questions... (read the number in base 2 from right to left) must be answered False to be correctly answered. There's a symmetric code in "Function True_CounterEx".

Do you know how to modify a save in order to modify an already given wrong answer into a correct one, so that the Ragtime Mouse says you got 100% correct the next time you meet it?

Tirlititi

  • *
  • Posts: 751
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1801 on: 2021-07-05 18:32:03 »
In any field script, add these lines somewhere that is ran once (start of "Main_Init" function for instance):

Code: [Select]
set VAR_GlobUInt8_0 = Ragtime_QuizzSuccess >> 3
set VAR_GlobUInt8_0++
set Ragtime_QuizzSuccess = ( ( Ragtime_QuizzSuccess & 7 ) | ( VAR_GlobUInt8_0 << 3 ) )

Then parse the script, generate and install the mod, go in-game to the field that was modified, leave it and save (or save inside that field without leaving it), close the game, uninstall the mod and that should be it.

This will increase the number of questions you answered correctly without touching the list of questions you answered (right or wrong). If you enter the field more than once, you'll get more correct answers, potentially getting more correct answers than the total number of questions encountered (I guess it would display a score higher than 100% and still consider it as a 100%).

I am not sure if you can edit the save file using the Memoria Save Editor for that because it's a general variable involved, so better do it with HW.

Shinjeez

  • *
  • Posts: 4
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1802 on: 2021-07-05 20:43:47 »
In any field script, add these lines somewhere that is ran once (start of "Main_Init" function for instance):

Code: [Select]
set VAR_GlobUInt8_0 = Ragtime_QuizzSuccess >> 3
set VAR_GlobUInt8_0++
set Ragtime_QuizzSuccess = ( ( Ragtime_QuizzSuccess & 7 ) | ( VAR_GlobUInt8_0 << 3 ) )

Then parse the script, generate and install the mod, go in-game to the field that was modified, leave it and save (or save inside that field without leaving it), close the game, uninstall the mod and that should be it.

This will increase the number of questions you answered correctly without touching the list of questions you answered (right or wrong). If you enter the field more than once, you'll get more correct answers, potentially getting more correct answers than the total number of questions encountered (I guess it would display a score higher than 100% and still consider it as a 100%).

I am not sure if you can edit the save file using the Memoria Save Editor for that because it's a general variable involved, so better do it with HW.

First of all, thanks for dedicating some time into this.

Sadly, it doesn't seem to work for me; after doing what you wrote, encountering Ragtime Mouse again, and giving the next correct answer, the percentage stays 90% correct.

Here are my steps, in case you notice I did something wrong:

1. Opened "HadesWorkshop.exe" with or without administrator's rights
2. File -> Open -> "FF9_Launcher.exe" in the steamapps>common>FINAL FANTASY IX folder
3. Environments -> Fields -> let all the fields load
4. Selected Alexandria's Theatre -> Edit Script -> copy/pasted your three lines of code at the start of the script, right on top of the first line
5. Parsed, no errors
6. File -> Save Steam Mod -> chose the options "Spreadsheets" and "Unity archives" -> Mod files succesfully created
7. Opened "Memoria.ini" and added "HadesWorkshopMod" to the list of mod folders at the bottom
8. Launched the game, went to the Alexandria's Theatre once, saved, closed the game, deleted the "HadesWorkshopMod" folder and the text from the "Memoria.ini" file
9. Launched the game again, loaded the new save, went into the nearest forest, encountered Ragtime Mouse, gave next correct answer... Still 90%, same as no mod

Thanks again

Tirlititi

  • *
  • Posts: 751
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1803 on: 2021-07-06 20:52:12 »
Seems like nothing's wrong with that, but you may have modified an incorrect "Alexandria/Mini-Theater" field (there are several ones depending on the point of the game you're at). You may also have wrongly written "HadesWorkshopMod" in the .ini. Lastly, you must beware that fields are language-dependant so make sure to edit the field's script in "English (US)" and play the game in the same language.

You can test something by writing these lines at the end of the "Main_Init" function, right before the "return" line:
Code: [Select]
set VAR_GlobUInt8_0 = Ragtime_QuizzSuccess >> 3
set VAR_GlobUInt8_0++
set Ragtime_QuizzSuccess = ( ( Ragtime_QuizzSuccess & 7 ) | ( VAR_GlobUInt8_0 << 3 ) )
SetTextVariable( 2, VAR_GlobUInt8_0 )
WindowSync( 6, 0, 68 )
This will display a message box in-game in addition to increasing the variable. You will see how many success you're at after the increase. If you don't see it, that means the script has not been modified for any of the reasons above.

(The message is an unrelated debugging message but it contains a numerical information: "Slot=[N]", and N will be the number of quizz successes.)
« Last Edit: 2021-07-06 20:54:10 by Tirlititi »

Loseless

  • *
  • Posts: 51
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1804 on: 2021-07-08 09:49:23 »
About custom supporting abilities, they can be modified in the Steam version but not with Hades Workshop (to be exact, it is very tedious and limited with Hades Workshop), because they are way too intertwined with the rest of the game's code. The modification of supporting ability effects is a feature of the Memoria Engine modifier, which is also installed automatically if you have the Moguri mod. Open the file "FINAL FANTASY IX\StreamingAssets\Data\Characters\Abilities\AbilityFeatures.txt". Read the documentation, the examples and the way vanilla abilities are coded there to know how to modify things.

Thank you for the points up. I don't have much in the knowledge of code, so I'm probably getting this wrong, but If I understood that doc correctly, I would have to create said file and modify the corresponding status. For instance, where is

>SA 0 Auto-Reflect
StatusInit AutoStatus Reflect

I could put

>SA 0 Auto-Reflect
StatusInit AutoStatus Protect

Instead?

--------------

I'm pretty close to complete my difficulty mod, but I still have a few kinks to iron. For example: If I raise the required AP for Garnet to learn her starting Eidolons, she starts without them. Should I check her status page, I can see she has them listed with the previous required AP values, but as she doesn't has the complete AP she has no access to them any more. I would guess the AP values for her starting Eidolons are given at the point she enters the party, post Evil Forest. Then I assume I would have to find the respective CIL field map code and edit these values. Would you know where the code is located? There are an awful amount of them to just randomly go through.

Another question: where can I change the prizes from fighting the monsters in Treno? And the auction items? Are these things easily changed, or too much hassle to bother?

Thanks for the assistance!

Tirlititi

  • *
  • Posts: 751
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1805 on: 2021-07-08 10:54:30 »
Garnet learns her starting summon abilities in the function "Region7_Range" of the field "Prima Vista/Engine Roo". She learns them again right before the Steiner/Brutos and the Bomb/Steiner fights and finally she learns them again right before entering the world map for the 1st time. All these are script codes (in field scripts), not CIL code. Just search for the lines "LearnAbility" if you want to spot them.

What "LearnAbility" does is that it sets the current AP of Garnet's summon abilities to their AP requirement, so if you start a game in vanilla, reach the "LearnAbility" point, then mod the game to have AP requirement higher and resume the game, the abilities will indeed not be learnt anymore because it will lack the difference in AP. It will be learnt again if you reach another "LearnAbility" point.

In any case, that's not a problem for anyone who would start a new game with the mod.

Prizes for the monsters in Treno and Auction House are to be modified in the related field scripts, like every treasure. For Treno's Griffin reward, for instance, it is found in the function "Main_12":
Code: [Select]
WindowSyncEx( 2, 0, 128, 357 ) // "Old Woman “Wow, I can’t believe it...  Here’s your prize.”"
if ( 0 ) {
// ...
// Code for receiving gil, but unused since the reward is not gil
} else {
if ( ( ( GetItemCount(557) < 99 ) && 0 ) || ( 1 && ( GetCardAmount < 100 ) ) ) {
if ( VARL_GenBool_7347 == 0 ) {
RunSoundCode3( 53248, 108, 0, -128, 125 )
set VARL_GenBool_7347 = 1
SetTextVariable( 0, 557 ) // Tonberry
if ( 0 ) {
AddItem( 557, 1 ) // Code for receiving an item, unused
WindowSync( 7, 0, 56 )
} else {
if ( 1 ) {
AddItem( 557, 1 ) // Tonberry
WindowSync( 7, 0, 57 ) // "  Received [Tonberry] Card!  "
} else {
// Another unused code
}
}
}
} else {
SetTextVariable( 0, 557 ) // Tonberry
if ( 0 ) {
WindowSync( 7, 0, 60 ) // "  Cannot carry another [Tonberry].  "
} else {
WindowSync( 7, 0, 61 ) // "  Cannot hold more Cards.  "
}
}
}
You need to change that "557" into something else everywhere it appears there.

For the Auction House prizes, things are different than usual but I wrote a simplified version of the script that can be found here.

As for Auto-Protect, you nailed it right.
The keywords are scattered a bit in the documentation ("Protect" is quite straightforward, but it is better to search for the exact keyword for the spelling of things like "AutoLife").

FomaX

  • *
  • Posts: 4
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1806 on: 2021-08-26 10:12:11 »
Hello guys! I am new here, and full of enthusiasm, have a lot questions, but i need to start with something...
First of all for me, i want to understand some basicly things - in particular: how i can access to field scripts files from p0data7.bin, however without hades workshop (its great and amazing, honor and respect for it, Tirlititi!), i tried to do this with UnityEX, but that's all I got - encoded text instead of scripts...
Guide me - How to get scripts from extracted (and encoded?) files?

Tirlititi

  • *
  • Posts: 751
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1807 on: 2021-08-27 22:41:57 »
Script files are in a binary format handmade for FF9 (and surely a format that has been developped over the years, improving along with games... I'd bet that at least FFVII to FFX use similar script files). You can't find the readable scripts with lines like "Function Main_Init" or "Wait( 10 )" in the archives because Hades Workshop is doing all the binary <-> script conversion.

IIRC, script files have the extension ".eb.bytes" in p0data7.bin, and p0data7.bin contains pretty much only binary scripts.

I'm not sure why you want to deal with these files without Hades Workshop but that's going to be complicated.

FomaX

  • *
  • Posts: 4
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1808 on: 2021-08-30 14:16:35 »
Thanks, it seems this approach is not worth it.
Can you help me with some other things?

1) I have some troubles with searching binaries for dnspy unity mono, only for building, can you linked me for it? Or share from your archives?

2) Its possible to make free to play or continuation after original game ending?

Tirlititi

  • *
  • Posts: 751
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1809 on: 2021-08-30 22:24:23 »
1) Is it what you're looking for? I'm not sure I understand: https://github.com/dnSpy/dnSpy/releases/
2) Yes. You can simply change the destination field of one of the ending fields to the entrance of Memoria for instance (or you can change the destination in Necron's AI as well).
In Necron's "Main_Init" function:
Code: [Select]
RunBattleCode( 37, 2901 )Or at the end of the function "Vivi_Loop" of the field "Ending/AT":
Code: [Select]
Field( 2901 )You may also put the variable "General_ScenarioCounter" back to some early value, like "11100" (the line "set General_ScenarioCounter = 11100" should bring you back to the situation of the start of the disc 4, so you'll fight the bosses again).

FomaX

  • *
  • Posts: 4
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1810 on: 2021-09-02 11:03:29 »
Thank you very much for answering, it's great.

1) What about field script vars, which global - is it global through all field scripts? Or only global through functions in current (one) field?
2) What about field script functions? They are somehow related to the AssemblyCSharp.dll ? Where the definitions of this functions?
3) And still no one has been able to expand slots from 9 to 12 to make all 12 characters unique?

4) The condition highlighted below will never be true? My reasoning: Function Main_Init triggered first and once, General_LoadedGame wasn't declared earlier with the value. Or not?
Code: [Select]
Function Main_Init
    set VAR_GlobBool_159 = 0
    set VAR_GlobUInt8_17 = 255
    set VAR_GenBool_191 = 0
    if ( General_LoadedGame == 1 ) {
        set General_FieldEntrance = 10000
    }

Code: [Select]
    set General_LoadedGame = 0

P.S. About DnSpy, i was talking about patched mono.dll, for real time debug. It's just unavailable at github for now. But it's ok, i found it on my other comp, downloaded some time ago.
« Last Edit: 2021-09-07 20:32:36 by FomaX »

ChikoLad

  • *
  • Posts: 17
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1811 on: 2021-09-09 01:09:59 »
Been a while since I posted here.

Deciding to have a little look at modding FFIX again and as part of that I want to attempt to re-create a passive aura that Freya has in another game, Dissidia Final Fantasy: Opera Omnia, and implement it as a support ability she can equip in FFIX.

The main two effects of this ability are:

-Grants HP Regen to the party
-If any party member's current HP is equal to or greater than 50% of their Max HP, and party member takes damage equal to or greater than current HP, party member survives with 1 HP

Here is what I have so far:
Code: [Select]
  >SA 63 Soothing Petals
  StatusInit AutoStatus Regen
  Ability AsTarget WhenBattleScriptEnd
  [code=Condition] HPDamage >= TargetHP && TargetHP >= TargetMaxHP / 50 && (EffectTargetFlags & 3) == 1
                && CasterIsPlayer != TargetIsPlayer
[code=TargetHP] 1 [/ code]

(Extra space in the last "/code" is just for formatting here on the forums, dunno how to do that properly lol)

Basically just looking to verify the code.

I'm a newbie at this so I know it's probably wrong. I don't know how to tell the game to set the target's HP to 1 so I just took a guess.

Additionally, the part I don't have a clue on is how to tell the game to apply this effect to the entire party when the support ability is only equipped to Freya.

Any insight would be appreciated.

Tirlititi

  • *
  • Posts: 751
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1812 on: 2021-09-09 09:16:50 »
@FomaX:
1) There are 3 types of variable, "local" variables are local to an entry (they are shared between eg. "Blank_Init" and "Blank_Loop" but not between "Blank_Init" and "Marcus_Init"), "global" variables are local to a script (so all the functions of the same field or world map or battle share them), and "general" variables are shared by everything and are also saved in save files.
2) Somehow yes. The overall system is quite complicated but it's mainly coded in EventEngine.cs.
3) The problem is that doing so will change the format of save files, thus provoking compatibility issues. If I try to do that, I'll search for a way to have save compatibility backward and forward (= you can use non-Memoria saves after installing Memoria + you can use Memoria saves after deinstalling Memoria).
4) Since "General_LoadedGame" is a general variable, it can be set to 1 in another script or be 1 in the player's save. For this variable in particular, I think it is set everytime the player has a chance to save, like "set General_LoadedGame = 1 ... Menu( Save ) ... set General_LoadedGame = 0".

@ChikoLad: That's a tough one. Your code looks fine except that setting the target's HP to 1 will not prevent the damage to apply and thus still kill the character. You can either add a code "[ code = HPDamage ] 0 [ /code ]" or replace the setting of HP by a change of the damage "[ code = HPDamage ] TargetHP - 1 [ /code ]".
This system wouldn't prevent a "Death" spell or a tick from poison / venom (as they are not damaging through an ability cast). You could add a way to prevent "Death" but the poison / venom tick seems impossible to prevent this way... (although the Regen effect would make it hard to die from poison).

More importantly, I don't see any way to extend any of the two effects to all allies. You can't currently check if an ally has a SA equipped. I'll try to add that kind of features at some point.

ChikoLad

  • *
  • Posts: 17
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1813 on: 2021-09-11 00:43:14 »
@FomaX:
1) There are 3 types of variable, "local" variables are local to an entry (they are shared between eg. "Blank_Init" and "Blank_Loop" but not between "Blank_Init" and "Marcus_Init"), "global" variables are local to a script (so all the functions of the same field or world map or battle share them), and "general" variables are shared by everything and are also saved in save files.
2) Somehow yes. The overall system is quite complicated but it's mainly coded in EventEngine.cs.
3) The problem is that doing so will change the format of save files, thus provoking compatibility issues. If I try to do that, I'll search for a way to have save compatibility backward and forward (= you can use non-Memoria saves after installing Memoria + you can use Memoria saves after deinstalling Memoria).
4) Since "General_LoadedGame" is a general variable, it can be set to 1 in another script or be 1 in the player's save. For this variable in particular, I think it is set everytime the player has a chance to save, like "set General_LoadedGame = 1 ... Menu( Save ) ... set General_LoadedGame = 0".

@ChikoLad: That's a tough one. Your code looks fine except that setting the target's HP to 1 will not prevent the damage to apply and thus still kill the character. You can either add a code "[ code = HPDamage ] 0 [ /code ]" or replace the setting of HP by a change of the damage "[ code = HPDamage ] TargetHP - 1 [ /code ]".
This system wouldn't prevent a "Death" spell or a tick from poison / venom (as they are not damaging through an ability cast). You could add a way to prevent "Death" but the poison / venom tick seems impossible to prevent this way... (although the Regen effect would make it hard to die from poison).

More importantly, I don't see any way to extend any of the two effects to all allies. You can't currently check if an ally has a SA equipped. I'll try to add that kind of features at some point.

Thank you for the response!

So I changed the code to what you suggested, but I haven't been able to test it as I realise I've hit a road block - I don't actually know how to put the ability into the game. I saw mention of examining the CIL code in Hades Workshop, but I admittedly can't make much sense of anything there. I know I need to look at the "CheckStatusAbility" code but I'm not sure what to do with it. I can changed the name, description, and cost of the "Void" ability to what I want but I don't know how to change it's code. I also noticed in the Help tab of Hades Workshop, it states that "You can't change the effects of the supporting abilities for now". Is this still the case?

-------------

Other than that, I've gone back and dabbled into changing the field/world map character model and animations. I was reading the documentation for your Play As Kuja mod and it really helped me get back into this, so thanks for that!

Using the Dictionary Patch method, I was able to very easily replaces Zidane's model in the field and world map with Freya's, and replaced a few of the animations the two have in common (like changing Zidane's running animation to Freya's and so on). This is a lot faster and more convenient than the method I was using before (editing each field script individually), but it has the drawback of just completely replacing Zidane's model with Freya's, such that in scenes where Zidane and Freya are normally both present, there will instead be two Freyas.

I was wondering if it was possible to somehow mix the two methods. The ideal scenario in my opinion, would be to use the "global hijack" method so that I just replace Zidane's model/animations with Freya's, which works for just generic exploration scenes where only Zidane is present in the original game (such as exploring in the post-game - Freya only shows up on the Invincible and in the ending cutscenes at that point so those are the only scenes that need attention in the post-game) - scenes like Cleyra and Desert Palace where Freya is already playable would work fine this way too. However, for scenes where both Zidane and Freya are present, I would like to make an "exception" somehow in those field scripts (so that it ignores the Dictionary Patch), and then manually change the model and animations as necessary (making Freya the "player" character and making Zidane the NPC).

I haven't actually had the time to play through your Kuja mod yet so I'm not sure how you handled scenes where Zidane and Kuja were both present in the original game.

Also, for custom animations, I'm wondering how you approached making them. Did you use a 3D program like Blender or Unity? I have experience in Blender and I know how to open FFIX Steam models and animations to preview them in Unity, which also means I could probably make custom animations there and visualise them as I make them. But I'm curious on how things need to be formatted in order for FFIX to read them correctly.
« Last Edit: 2021-09-11 00:46:06 by ChikoLad »

Tirlititi

  • *
  • Posts: 751
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1814 on: 2021-09-13 10:21:09 »
"I don't actually know how to put the ability into the game"
=> Oh, I get it now. You don't need to transpose the content of "AbilityFeatures.txt" anywhere. The game (Memoria Engine mod) will read that text file and use these codes automatically. The only things are: if you edited the main "AbilityFeatures.txt", some of the abilities may be overwritten by Alternate Fantasy's own "AbilityFeatures.txt" (but only those that AF uses and it doesn't use SA 63, and only if you have AF of course), and also the behaviour in case of an incorrect code may vary from (IIRC, it can "ignore the ability", "crash the game" or "prevent abilities to deal damage").

Hades Workshop can't handle the "AbilityFeatures.txt". You edit the features with a notepad and/or edit the ability stone costs and descriptions with HW.

In "Play as Kuja", Kuja shows up twice in scenes where he appears normally, just like you said with Freya. I didn't do any field script modification as it was more of a possibility exhibition rather than a complete mod. It is not possible to restrict "DictionaryPatch.txt" to parts of the game and I don't think it should. For a proper 3D model replacement, I think that you should only deal with field scripts like you did with Freya (it was the tough way but also the proper way). DictionaryPatch can be used for battle models or hacky purpose. I mean, if you care enough about "having 2 freyas on the screen", then you should care about "I walked with Freya to Alexandria's boat deck early disc 3, but then Freya was already there and it's Zidane that arrives instead", so half a measure such as a DictionaryPatch restriction would not be satisfying IMO. If you want things to be handled in a credible way, you need field scripts.

About animations, that's a sensible point...
I made a custom animation format (based on JSON); you can only work with these animations using a notepad (so without preview or convenient 3D editing tools) or by exporting the existing ones with Hades Workshop.
I would have gladly use an existing and compatible 3D animation format but alas I couldn't find any that would be similar to Unity animations and open-source. If you know of any animation format that would be nice, please tell me. I'm not a pro with Blender but I couldn't find anything like that (if I recall correctly, even the FBX that can be imported in Blender lose their animations when doing so).

FomaX

  • *
  • Posts: 4
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1815 on: 2021-09-23 21:26:23 »
Hellow Again!) :)

I have some progress to make unique all 12 characters with there own slots.
Now i can access to ALL 12 characters in the start of the game, (i have custom partymenu script) and shuffle all of them to make very interesting party combinations )


Without field scripts editing, all characters with there own slots have their corresponding unique abilities, default equips, stats and etc.


But i have a problem - first battle (and other in the same reason) cant start with party members (after battle swril - black screen), which have slot ids 9,10 and 11 (Cinna/Marcus/Blank). I also want to note that party formed correctly before battle start (i can access party menu any time by press f8 key). I test first battle with other party members (by editing field script), which slot ids less 9 (8,7,6 ... etc) - all work fine.

Edit 1:
Now i have new progress: Battle can start! With Cinna/Marcus/Blank. But... Now game crush before end of battle...

Edit 2:

O yeah, i solved the problem with it! Now i can start battle with full 12 slots, with cinna/marcus/blank and game don't crush after first battle ending. But there is still a lot of work!)

To fix some bugs with battle shadows, and there will be others, i think.

Thank's all for your moral support!  ;D
« Last Edit: 2021-09-27 21:13:30 by FomaX »