Hey all, I have begun the process of digging into the EXE & scripts to hopefully be able to add some sort of turn changing functionality like in modern atlus games.
At the very bare minimum, I think it would be most easy and possible to implement Metahpors' pass functionality by:
- Enabling a temporary flag within the same turn IF the current party member hits a weakness. (and reset or delete on turn end)
- When a keybind button is pressed, ONLY if the temp weakness hit flag is toggled, we add the current party member at the end of the turn list and move the turn on to the next party member in order
Any pointers to specific functions, advice, feedback, or if anyone wants to outright takeover, please be my guest. Thanks.
I think this would be the easiest implementation and then from there you can add UI, some visual event like in other games, and specific party member picking(like P5R and P3R, because I think this is the hardest part of the mod yet not essential is why it should come later). But I also think passing would be much more balanced for P4G without any additional changes.
Currently, I believe I have learned a few things decompiling the main EXE.
Within the BattleUseSkill annotated function:
The weakness is identified and handled in the following block of code:
if (((0 < local_240) && ((info->field321_0x173 & 3) == 1)) && (info->Unit->IsEnemy == 0)) {
uVar25 = 0x18;
goto LAB_1400579a9;
}
because the variable local_240 is incremented earlier in the code whenever a target is found to have a weakness to the skill being used. Specifically, where each target (pBVar23) is processed:
if ((*(uint *)(&pBVar23->field_0x174 + (ulonglong)isEnemy * 0x20) & 0x100000) != 0) {
local_240 = local_240 + 1;
local_2a4 = local_2a4 | *(ushort *)&pBVar23->field_0x176;
}
The condition checks if the target has a weakness flag set (0x100000), and if so, increments local_240.
The if statement checks if any target had a weakness (local_240 > 0), when the conditions are true, uVar25 is set to 0x18 (??) and calls LAB_1400579a9 to handle the weakness hit. I think this function displays or processes the weakness hit effect.
It's preparing an action (pTVar20) with specific properties related to the weakness hit. Heres the function:
LAB_1400579a9:
local_328 = local_328 & 0xffffffff00000000;
pTVar20 = (TurnInfo *)FUN_1400c02d0(info,uVar25);
*(undefined *)pTVar20 = 5;
*(undefined8 **)&pTVar20->field_0x8 = puVar18;
*(float *)&pTVar20->field_0x88 = (float)(int)local_2f4;
pTVar20->field146_0xa0 = uVar29;
anyways thats a little off course but after setting up the action, it executes it:
FUN_1400b1090(pTVar20, 1);
which appears to be responsible for adding a TurnInfo object to a global action queue or list of which I don't understand.
....
Basically, I just need to figure out exactly where the weakness is exactly exploited, then I can create a variable/flag/event that exists only for the current turn(or re use another), then I would need to find out where and how turn order is handled(likely the hardest part) and just pass it on to the next team member basically by brute forcing ending the current turn, and then just adding another turn or team member back into the turn list(maybe some logic of only going to the next party member in the turn list is also needed for every non-advantage turn). Basically you could get away with just a random keybind that does it for now, i wouldnt be suprised if the actual logic involves less than 30 lines of assembly code.