Author Topic: [PSX/PC] General editor - Hades Workshop (0.50b)  (Read 842363 times)

Gordo98

  • *
  • Posts: 5
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1025 on: 2018-03-19 21:04:57 »
This tool looks really cool just from browsing it for awhile but I want to ask; Will editing AI for someone who has no experience in coding whatsoever be a challenge for me and I guess a random question but am I able to make Protect, Shell, Haste and Regen last longer? Imo they don't last long enough in this game to make them useful.

Tirlititi

  • *
  • Posts: 874
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1026 on: 2018-03-20 21:56:46 »
@aidolu12: Yes, it's extremely difficult to do CIL changes by only looking at the CIL code. It's way better to look at the C# code to at least understand how the engine works before guessing how you can tweak it (it requires reading C# but that's always better than CIL).
You can see the C# code in Memoria's Github page, or using a tool like dnSpy or dotPeek.

For your particular question, it's not particulary easy in CIL, but you might change the method "BattleHUD::GoToBattleResult" and add this kind of lines:
Code: [Select]
call 0x6000F5D // FF9StateSystem::get_Battle
ldfld 0x4002267 // BattleState::FF9Battle
ldfld 0x4002230 // FF9StateBattleSystem::btl_list
ldfld 0x4000226 // BTL_DATA::next
ldfld 0x400022A // BTL_DATA::cur
ldfld 0x4000809 // POINTS::hp
call 0x6000F5D // FF9StateSystem::get_Battle
ldfld 0x4002267 // BattleState::FF9Battle
ldfld 0x4002230 // FF9StateBattleSystem::btl_list
ldfld 0x4000226 // BTL_DATA::next
ldfld 0x4000229 // BTL_DATA::max
ldfld 0x4000809 // POINTS::hp
ldc.i4.4
div
add
call 0x6000F5D // FF9StateSystem::get_Battle
ldfld 0x4002267 // BattleState::FF9Battle
ldfld 0x4002230 // FF9StateBattleSystem::btl_list
ldfld 0x4000226 // BTL_DATA::next
ldfld 0x400022A // BTL_DATA::cur
stfld 0x4000809 // POINTS::hp
This only restores 25% of max HP of the 1st character only (and doesn't even check if it goes over the max HP limit)...
Best is to use Memoria for that and add these lines instead, since you can surely use local variables when replacing C# code:
Code: [Select]
for (BTL_DATA next = FF9StateSystem.Battle.FF9Battle.btl_list.next; next != null; next = next.next)
if (next.bi.player != 0 && next.cur.hp>0)
next.cur.hp = min(next.cur.hp + next.max.hp / 4, next.max.hp);
Much simpler indeed ^^'

@Gordo98: What you want to do is not related to AI but to the battle system, so CIL code or C# again :/
And increasing the duration of status effects is not possible with HW, as explained here. The best you can do is to change the tick for poison/venom/regen.

Gordo98

  • *
  • Posts: 5
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1027 on: 2018-03-20 23:51:07 »
@Tirlititi guess I’ll leave that how it is, but by AI I meant enemy patterns and attacks. For example having the following script.

Turn 1: 50% Poison 50% Silence
Turn 2: Attack
Turn 3: 50% Flare, 40% Stop, 10% Doomsday
Turn 4: Attack
Repeat
50% Counter Physical Attack w/ Stop

Something like that or editing existing enemies and replacing attacks or patterns.

Tirlititi

  • *
  • Posts: 874
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1028 on: 2018-03-21 10:01:03 »
Ok yes, this is AI script.

So actually, the default AI scripts are usually quite complex. One thing you should do before editing AI scripts is import the local variable informations ("LocalVariableSettings_v1.hws" that is included with the tool). It makes the scripts a bit more readable.
But writing a simple AI script like what you say can be done quite easily. Here is how the "ATB" function would look like:
Code: [Select]
Function Enemy_ATB
    if (turn_counter == 0) {
        // Turn 1
        if (GetRandom % 2) {
            set SV_Target = RandomInTeam( SV_PlayerTeam )
            Attack( Poison ) // It is not "Poison" that should be in the real thing but the attack ID instead
        } else {
            // You may avoid Silencing someone who's already silenced using this kind of lines
            set SV_Target = RandomInTeam( NotMatching(SV_PlayerTeam[STATUS_CURRENT_A], 265) & NotMatching(SV_PlayerTeam[STATUS_CURRENT_B], 64) )
            if (SV_Target == 0) { // Everyone is either dead or silenced already...
                set SV_Target = RandomInTeam( SV_PlayerTeam )
            }
            Attack( Silence )
        }
    }
    if ((turn_counter == 1) || (turn_counter == 3)) {
        // Turn 2 and 4
        set SV_Target = RandomInTeam( SV_PlayerTeam )
        Attack( Physical Attack )
    }
    if (turn_counter == 2) {
        // Turn 3
        set rnd_num = GetRandom % 100
        if (rnd_num < 50) {
            set SV_Target = RandomInTeam( SV_PlayerTeam )
            Attack( Flare )
        } else {
            if (rnd_num < 90) {
                set SV_Target = RandomInTeam( SV_PlayerTeam )
                Attack( Stop )
            } else {
                set SV_Target = SV_PlayerTeam | SV_EnemyTeam
                Attack( Doomsday )
            }
        }
    }
    set turn_counter = ((turn_counter + 1) % 4)
    return
And declare the local variables "turn_counter" and "rnd_num" in the local variable panel:
Code: [Select]
local uint8 turn_counter
local uint8 rnd_num

For the counter-attack, I suggest that you take a look at Gizamaluke's AI and mimic it.

aidolu12

  • *
  • Posts: 7
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1029 on: 2018-03-24 22:54:55 »
@aidolu12: Yes, it's extremely difficult to do CIL changes by only looking at the CIL code. It's way better to look at the C# code to at least understand how the engine works before guessing how you can tweak it (it requires reading C# but that's always better than CIL).
You can see the C# code in Memoria's Github page, or using a tool like dnSpy or dotPeek.

For your particular question, it's not particulary easy in CIL, but you might change the method "BattleHUD::GoToBattleResult" and add this kind of lines:
Code: [Select]
call 0x6000F5D // FF9StateSystem::get_Battle
ldfld 0x4002267 // BattleState::FF9Battle
ldfld 0x4002230 // FF9StateBattleSystem::btl_list
ldfld 0x4000226 // BTL_DATA::next
ldfld 0x400022A // BTL_DATA::cur
ldfld 0x4000809 // POINTS::hp
call 0x6000F5D // FF9StateSystem::get_Battle
ldfld 0x4002267 // BattleState::FF9Battle
ldfld 0x4002230 // FF9StateBattleSystem::btl_list
ldfld 0x4000226 // BTL_DATA::next
ldfld 0x4000229 // BTL_DATA::max
ldfld 0x4000809 // POINTS::hp
ldc.i4.4
div
add
call 0x6000F5D // FF9StateSystem::get_Battle
ldfld 0x4002267 // BattleState::FF9Battle
ldfld 0x4002230 // FF9StateBattleSystem::btl_list
ldfld 0x4000226 // BTL_DATA::next
ldfld 0x400022A // BTL_DATA::cur
stfld 0x4000809 // POINTS::hp
This only restores 25% of max HP of the 1st character only (and doesn't even check if it goes over the max HP limit)...
Best is to use Memoria for that and add these lines instead, since you can surely use local variables when replacing C# code:
Code: [Select]
for (BTL_DATA next = FF9StateSystem.Battle.FF9Battle.btl_list.next; next != null; next = next.next)
if (next.bi.player != 0 && next.cur.hp>0)
next.cur.hp = min(next.cur.hp + next.max.hp / 4, next.max.hp);
Much simpler indeed ^^'

@Gordo98: What you want to do is not related to AI but to the battle system, so CIL code or C# again :/
And increasing the duration of status effects is not possible with HW, as explained here. The best you can do is to change the tick for poison/venom/regen.

Tirlititi, thanks, I have not try it yet, I have been busy, but as soon, will let you know.

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1030 on: 2018-03-25 11:45:53 »
AI script,
what function makes the enemy perform an attack (ex. Attack(3) ) first every time the battle starts? Attack (3) the enemy will do every start of the fight.

Tirlititi

  • *
  • Posts: 874
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1031 on: 2018-03-25 14:32:09 »
Look at Black Waltz 3's AI script (the battle on the Cargo Ship). He starts the battle by casting trance on Vivi.
Basically, you need to "set SV_FunctionEnemy[ATB] =$ SV_FunctionEnemy[MAX_ATB]" and use a flag for the first attack of the enemy.

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1032 on: 2018-03-26 05:11:58 »
Thanks, it didn't work, but that's okay; I found an alternative.

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1033 on: 2018-03-27 02:42:56 »
Just found a bug with HW version 39b.
Cannot change the value of >Power<, value reverts back to default.

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1034 on: 2018-04-04 11:29:45 »
is there a function in the script that resets the LV back to 1? boolean variable?

Tirlititi

  • *
  • Posts: 874
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1035 on: 2018-04-04 12:00:50 »
It is possible, yes. You just need to empty the party reserve and then setup the characters' data: with the "Update level" option, it usually sets the character's level to the average level of the party reserve, but it sets the level back to 1 for an empty party reserve.
Code: [Select]
    SetPartyReserve( 0 )
    SetCharacterData( character_id, 1, 255, 255, 255 )  // By using 255 in the other arguments, you don't change the value
    SetPartyReserve( 255 ) // May be different if you don't want the 8 regular characters to be available

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1036 on: 2018-04-04 16:31:14 »
Thanks Tirlititi!
guess what,
there's always something missing.
This doesn't apply to all characters, it only applies to one: Eiko
It definitely did not apply to Zidane either.
« Last Edit: 2018-04-04 18:33:02 by Incinerator »

DanTsukasa

  • *
  • Posts: 68
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1037 on: 2018-04-05 02:28:30 »
Awesome progress as always.
Would it be possible to add an exporter thats just OBJ for now, for the walkmeshes, I understand the cameras are a bit of a pain, so if those aren't a priority then I can just guesstimate the rest easily enough.
Having the walkmesh will save a lot of time with recreating some of the environments in HD.

Tirlititi

  • *
  • Posts: 874
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1038 on: 2018-04-07 13:45:40 »
I don't exactly know what you're preparing us, but that sounds very neat :D
Here are the walkmeshes:
https://www.dropbox.com/s/p0yvu6ofcj658u1/FF9Walkmeshes.zip?dl=1

I don't think that I'll add an option to export them in HW as I am pretty sure that there will never be an importer of walkmeshes in OBJ format. Adding an exporter may make people think that walkmeshes are just a bunch of triangles. I'll just let the walkmeshes here.

PS: I double-faced the triangles because apparently the orientation of triangles is not relevant for walkmeshes.

DanTsukasa

  • *
  • Posts: 68
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1039 on: 2018-04-07 14:11:37 »
Lining these up with Cameras is going to take quite a while, but I'll do what I can.

Ah yeah, this project is... going to take a long time, but I want to have some things to show before I see if anyone else is interested, see if I can get myself a good workflow and the like first.

Thankyou for those, I really appreciate it, if you by chance also happen to know how to export the cameras too, as FBX files, that'll speed things up even more.
I have a tool that exports the FF8 walkmeshes and camera all in the correct positions, which was super handy for running tests, though ironicly enough, I find that FF8 doesn't really have any good camera angles, or makes nearly as much use of its pre-render medium as ffix does.

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1040 on: 2018-04-08 00:42:56 »
Tirlititi, I noticed a glaring bug with Vivi using either Cure or Life spells outside of battle. I give him Cure/Cura etc. or Life/Full-Life, and attempt to revive or heal an ally outside of battle, it doesn't heal or revive a character, only depletes his MP, and the Target Window for "Life" shows as if you're curing Bad Statuses.
Differently If I give Steiner/Zidane/Freya Cure/Cura/Life etc., it works perfectly fine. Is this the game's way of showing a black mage just wasn't meant to have white magic?
Also, if a character like Eiko/Dagger (any character who can use Cure) is only in the party, and tries to use Cure outside of battle on themselves, the Target Window refuses to show up. I don't think that was ever present in PSX version.

And about the walkmeshes: specific foot sfxs datas (metal, sand, grain etc.) are stored in the walkmeshes? Replace it and those are lost?
These walkmeshes look like a similar to the meshes I did in The Mist: Resurrection, Memoria levels, tbh.

jmp434

  • *
  • Posts: 285
  • https://www.paypal.me/jmp434
    • View Profile
    • Make a donation
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1041 on: 2018-04-09 06:43:58 »
Hello everyone, being a fan of Final Fantasy 9 especially, I hoped to see its output on PC and the possibility of being able to create it in HD, to redo it in 3D the ideal would be to get the walkmesh, as well as the coordinates camera and each environment to be able to work on it, I am completely null on the mod of FF IX so I wondered if someone had a complete pack to provide me so that I can take care of it? I had already done previously on FF 7 for those who know me :) But FF7 never interest me as much as the 9 and I would like to spend my time on the environment of the 9 which attracts me more and give the opportunity someone to do something :)

Sorry for the bad english, google translation does not speak very well your language.

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1042 on: 2018-04-09 09:38:36 »
Hello everyone, being a fan of Final Fantasy 9 especially, I hoped to see its output on PC and the possibility of being able to create it in HD, to redo it in 3D the ideal would be to get the walkmesh, as well as the coordinates camera and each environment to be able to work on it, I am completely null on the mod of FF IX so I wondered if someone had a complete pack to provide me so that I can take care of it? I had already done previously on FF 7 for those who know me :) But FF7 never interest me as much as the 9 and I would like to spend my time on the environment of the 9 which attracts me more and give the opportunity someone to do something :)

I could see new walkmeshes would provide possibility to import new backgrounds in assets; but whole 3D . In that case, the backgrounds would be kicked, and instead add 3D environments (maps) in the assets. No need for a walkmesh then, in such case. You see?

(Still dunno about the Vivi Cure bug).

DanTsukasa

  • *
  • Posts: 68
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1043 on: 2018-04-09 09:59:10 »
I could see new walkmeshes would provide possibility to import new backgrounds in assets; but whole 3D . In that case, the backgrounds would be kicked, and instead add 3D environments (maps) in the assets. No need for a walkmesh then, in such case. You see?

(Still dunno about the Vivi Cure bug).

I don't think its really possible to just switch everything out with 3d meshes, what I'll do, and I'm guessing what jmp434 intends to do is simply remodel and replace the backgrounds like what people did with the FF7 backgrounds (admittedly, to a much higher quality).

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1044 on: 2018-04-09 22:44:11 »
I don't think its really possible to just switch everything out with 3d meshes,

Oh it's possible; being a Unity game after all.

DanTsukasa

  • *
  • Posts: 68
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1045 on: 2018-04-10 00:08:36 »
Oh it's possible; being a Unity game after all.

Ah, I mean more as in, 'I don't think its a realistic goal', its possible, but the amount of extra things that'd need writing and editing is a bit much, plus actual 3D environments, if its still a static camera, would end up looking worse due to aliasing I'd imagine.

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1046 on: 2018-04-10 04:05:57 »
Ah, I mean more as in, 'I don't think its a realistic goal', its possible, but the amount of extra things that'd need writing and editing is a bit much, plus actual 3D environments, if its still a static camera, would end up looking worse due to aliasing I'd imagine.

oh, but a real goal it is; determine is key. Minus the static camera; I always saw me eventually making ffix:tza with 3d & environments gambits (not a fan of backgrounds + fixed cameras; seems like an old method) with this engine still. T pointed where UI handled, it was extra work, but was determined to get gambits working here; at least I got somewhere! The button. I don't see it as completely impossible, more doable with determination. If Tirlititi confirms it's 100% impossible to do 3d environments; well, there's always back to walkmeshes for new backgrounds.

DanTsukasa

  • *
  • Posts: 68
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1047 on: 2018-04-10 04:42:18 »
oh, but a real goal it is; determine is key. Minus the static camera; I always saw me eventually making ffix:tza with 3d & environments gambits (not a fan of backgrounds + fixed cameras; seems like an old method) with this engine still. T pointed where UI handled, it was extra work, but was determined to get gambits working here; at least I got somewhere! The button. I don't see it as completely impossible, more doable with determination. If Tirlititi confirms it's 100% impossible to do 3d environments; well, there's always back to walkmeshes for new backgrounds.

Hmm, I'm quite happy to just remake backgrounds and pre-render them honestly. Then I can paint over to get smaller details, this is a bit easier than doing standard 3D, and its a nice change of pace from the usual day job.

I'm curious to see what Tirlititi thinks about the possibility of fully 3D Environments, as that'd require a huge amount of work, replacing the environments is one thing, but then if you have a 3D Camera the game would have to become quite different in order to work, so instead of having single scenes like now, it'd have a whole accessible map, which means NPC's walking between scenes, things looking good from every angle. Even modelling wise it'd add so much extra time.

Theres a point where you'd be doing so much work, and so many edits, and wrestling against the engine so much, that it'd be easier to simply rebuild most of the engine to support all the changes instead of trying to endlessly bend it to your will.

I honestly think a lot of the charm of the game is due to the framing of the scenes, having a fully 3D scene would require things that're off camera usually to have new animations, effectively you'd have to redo all the 3D Art again from scratch, but if its possible, it'd be a very interesting thing to witness.

Tirlititi

  • *
  • Posts: 874
    • View Profile
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1048 on: 2018-04-10 11:26:48 »
So, I'm working on something else right now and I can't test about these bugs you mentioned, Incinerator, but I'll eventually take a look at them.
About 3D environment, it would be possible to change the engine to make it possible ; I don't even think that would be such a huge amount of work (the environment is already mostly 3D, engine-wise). It would be way more difficult to recreate the scenes themselves in 3D, and I don't think they would look as great as prerendered backgrounds (not to mention that a lot of things are working visually because of static backgrounds: look at Alexandria's bell tower, its size from outside and its camera for inside).

The foot sfx datas are indeed stored in the walkmesh (well, more precisely, the walkmesh says which kind of ground each triangle is ; then the script says which footstep sound is played on each kind of ground). It is not possible to replace the walkmesh data now because there's no tool to edit the walkmesh itself.

@jmp434: You have the 3D OBJ files describing the walkmesh geometry two posts above yours. The cameras of the fields are a bit weirdly stored and, last time I tried, I couldn't have them properly readed.

Incinerator

  • Guest
Re: [FF9] General editor - Hades Workshop (0.39b)
« Reply #1049 on: 2018-04-10 21:37:00 »
a huge amount of work,

That's the thing; I love it when it's possible, so it doesn't feel huge; especially when I think of the beautiful final outcome it would have! The determination never dies.

So, I'm working on something else right now and I can't test about these bugs you mentioned, Incinerator, but I'll eventually take a look at them.

Understood.

About 3D environment, it would be possible to change the engine to make it possible ; I don't even think that would be such a huge amount of work (the environment is already mostly 3D, engine-wise).

Yaass! Positive possibility!

It would be way more difficult to recreate the scenes themselves in 3D, and I don't think they would look as great as prerendered backgrounds (not to mention that a lot of things are working visually because of static backgrounds: look at Alexandria's bell tower, its size from outside and its camera for inside).

Yeah, and recreate texture sets to match the environments from the prerendered backgrounds. Proper UV's.
I was forced to recreate in the environments in 3D anyways for ffix: tza the fmvs, considering it has different characters; look at the CGI, those as close to visual 3D of the environments in FF9 as one would get, without always seeing static positions. So, best start is to observe those, get a ball rolling and build off that.