#Trying to add AI enums for the script compiler

46 messages ยท Page 1 of 1 (latest)

glacial otter
#

So I wanted to add enums for the AI stuff that the other games have (so you don't have to type out skill IDs, affinity flags and what not). But for reasons that escape my understanding, I have not been able to get it to work. Trying to compile anything with them spits out an error I don't understand, and decompiling with them is like it doesn't even exist.

I edited the enum path into the FlowScriptModules.json file and have checked the enums json itself for what feels like a hundred times and I cannot find any obvious errors that would cause this to not work. I've checked the enums stuff for vanilla P5 (as well as the other games that have these enums) just to make sure I am setting it up the same and they look the same to me. So I'm at a complete loss as to whether I'm just doing something wrong or if this just isn't possible for whatever reason.

#

as well as the error that the compiler keeps spitting at me

[01/22/2024 03:26 AM] "E:\Mods\Game Dumps\Persona 5 Royal PC\BATTLE\SCRIPT\ENEMY\BTL_AI0001.BF" -Decompile -Library P5R -Encoding P5R_EFIGS -Hook -SumBits
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Using P5R_EFIGS encoding
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Output file path is set to E:\Mods\Game Dumps\Persona 5 Royal PC\BATTLE\SCRIPT\ENEMY\BTL_AI0001.BF.flow
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Loading binary FlowScript file...
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Decompiling FlowScript...
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: FlowScript output path set to E:\Mods\Game Dumps\Persona 5 Royal PC\BATTLE\SCRIPT\ENEMY\BTL_AI0001.BF.flow
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: MessageScript output path set to E:\Mods\Game Dumps\Persona 5 Royal PC\BATTLE\SCRIPT\ENEMY\BTL_AI0001.BF.msg
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Start decompiling FlowScript
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Start evaluating FlowScript
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Registering functions
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Registering top level variables
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Evaluating procedures
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Evaluating procedure: 'ai0001_main'
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Done evaluating FlowScript
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Decompiling procedure: ai0001_main
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Done decompiling FlowScript
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Writing decompiled FlowScript to file
[01/22/2024 03:26 AM] 1/22/2024 3:26:50 AM Info: Task completed successfully!
[01/22/2024 03:26 AM]

#

any ideas would be greatly appreciated, this has been driving me absolutely insane

atomic escarp
#

Those files look right to me. Did you actually set the Type of the functions that use these enums?
For example, AI_ACT_SKILL might become

    {
        "Index":  "0x2003",
        "ReturnType":  "void",
        "Name":  "AI_ACT_SKILL",
        "Description":  "",
        "Parameters":  [
                           {
                               "Type":  "BattleSkill",
                               "Name":  "skill",
                               "Description":  ""
                           }
                       ],
        "Comment":  ""
    },

(Note the different "Type" in the "Parameters")

#

If you don't do that the decompilations won't change, compilation should work regardless though

glacial otter
#

I changed the part in "Type", yeah

#

idk if the "Name" or "ReturnType" fields matter or not so I didn't change those

atomic escarp
glacial otter
#

oh I'm dumb, that was from me decompiling something

#

hang on

atomic escarp
#

That's saying the enum already exists...

#

Either that or you've got duplicate values in one, I'm not entirely sure which

glacial otter
#

I have no idea what either of those really mean tbh

atomic escarp
#

Basically you've got the same Name twice in one of the enums. Like you could have two battle skills with the name "Agi" or something (I don't actually know what the duplicate is, just an example)

#

Do you have a flow file you could send me? If so I can try compiling it and probably work it out

glacial otter
#

I wouldn't be surprised if I messed up with one of the skills somewhere with how many duplicates there are

atomic escarp
#

Yeah, it'd be an easy mistake to make lol
It shouldn't take me long to work out what's wrong

atomic escarp
#

It didn't want to play nice with me so I ended up getting chat gpt to help make a python file to do it. Here's the list of duplicates:

  • RESERVE
  • RESERVE1
  • RESERVE2
  • RESERVE3
  • RESERVE7
  • NotUsed
  • Incubus
  • Regent
  • QueensNecklace
  • StoneofScone
  • KohiNoor
  • Orlov
  • EmperorsAmulet
  • HopeDiamond
  • CrystalSkull
  • Baal
  • Desperation
  • Charge
  • Concentrate
  • Tetrakarn
  • Makarakarn
  • FireWall
  • IceWall
  • ElecWall
  • WindWall
  • NukeWall
  • PsyWall
glacial otter
#

huh, seems like there's more in enemy/personas than skills

#

that's what I get for copy pasting I guess lol

#

do they have to be different if they're under different enums?

#

like how Incubus and the treasure demons are in both the enemy and persona enums. I'm going to assume not since the other enum files I'm referencing don't seem to change them?

#

well I went through and fixed those and now it's giving me a different error

glacial otter
#

decompiling seems to be working as expected now at least

atomic escarp
atomic escarp
glacial otter
atomic escarp
#

Thanks

glacial otter
#

pretty sure I got all the duplicates

atomic escarp
#

Sorry that took a while, stuff did not want to work for me ๐Ÿ˜”
The problem is that the value for PsyWall (the last thing in the file) is over the integer limit. Assuming that value is correct, it should be -2147483648 instead. I guess wherever you got it from treated the value as unsigned, whereas script compiler treats it as signed

glacial otter
#

all g

#

I'm pretty sure I got those values from just plugging the flags into a thing that converts hex values to decimal

#

not sure if there's a better way to do those or not

atomic escarp
#

That sounds like a fine way to do it, although I personally always use the windows calculator's programmer mode. Whatever works for you though, they should all do the same thing

glacial otter
atomic escarp
#

I'm pretty sure it should

#

Try and see

glacial otter
#

still giving me that error

#

do I have to do that with other ones too

atomic escarp
#

I think that should've been all ๐Ÿ˜”
I'm in bed now and my PC is off so I won't look again until tomorrow. In the meantime you could probably just delete the psy wall bit from the enum so you can compile stuff.

glacial otter
#

yeah I guess so. just putting it as -2147483648 didn't work, but hey it's compiling now so I'll take it