Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battle 2k3: Implement in-battle row command #2322

Merged
merged 2 commits into from Sep 10, 2020
Merged

Battle 2k3: Implement in-battle row command #2322

merged 2 commits into from Sep 10, 2020

Conversation

ghost
Copy link

@ghost ghost commented Sep 6, 2020

This PR adds the in-battle row command used in RPG Maker 2003. Merging this PR and #2321 into master fixes #680.

for (auto& actor: Main_Data::game_party->GetActors()) {
if (actor->GetBattleRow() == Game_Actor::RowType::RowType_front) front_row_battlers++;
}
}
Copy link
Contributor

@fmatthew5876 fmatthew5876 Sep 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case doesn't appear to handle back attacks etc..

I checked in RE tools and found that RPG_RT counts the number of actors which row == mirrored and then allows the row command if count >= 2 || current_hero.row != current_hero.mirrored

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the change as requested and tested it. I have amended the commit and force pushed it because I assume you want this in one commit.

@fmatthew5876
Copy link
Contributor

For bonus points, are you bug compatible with this?

#1486 (comment)

😄

@ghost
Copy link
Author

ghost commented Sep 6, 2020

Okay, that thing mentioned in #1486 is a really crazy one. I have tried to reproduce that bug in RPG_RT without avail. Probably I'm missing something obvious. But do we want to emulate that bug? I'm pretty sure the implementation in this PR doesn't. And because this is the pincer battle condition it doesn't matter anyway in which row the battler is.

The in-battle row command has been added now.
@fmatthew5876
Copy link
Contributor

I don't care about the bug it's dumb and better we fix it.

I suspect it's because you reset the actor position after processing row command. RPG_RT just adds or subtracts 24 from x.

@ghost
Copy link
Author

ghost commented Sep 6, 2020

Then we are all set! 😄

const lcf::rpg::BattleCommand* command = static_cast<Game_Actor*>(for_battler)->GetBattleCommands()[index];
for_battler->SetLastBattleAction(command->ID);
} else {
for_battler->SetLastBattleAction(-1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be verified because the last battle action is a battle page start condition (or was it a condition in a conditional branch?). So this value must match.
Even if the row command can't be picked there through the editor I bet there is at least one game that patched the value and checks for it (see Change Vehicle position with -1)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 is indeed the Row command, just tested this via LDB-patching 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's actually -1. The logic I've seen in RPG_RT is usually something like this:

auto* batcmd = GetBattleCommandByIndex(window->currentchoice);
if (batcmd) {
  switch(batcmd->type) {
    // Handle each command
  }
} else {
  // Handle row command
}

What if you try -2 or a large value greater than the number of configured battle commands?

Copy link
Member

@Ghabry Ghabry Sep 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only tested -1 and -2. -2 didn't activate my event page. Note that I talk about the page condition, not about the Command index in the menu.

Copy link
Member

@Ghabry Ghabry Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured it out by now: That's (kinda) a bug. Only kinda because this needs external tools to be utilized:

The GetBattleCommandByIndex function checks if the cmd idx is >= 6 and if yes it returns -1.
Otherwise it resolves the battle command of the actor. For the row this is 0.

Conclusion:
When an actor has 6 battle commands then row has an action ID of -1, otherwise it has an action ID of 0.

@rueter37 can you implement this behaviour? (SetLastBattleAction(-1) for "all/6 cmds", else SetLastBattleAction(0)). And add a comment that this is RPG_RT behaviour.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the LastBattleAction changes.

If an actor uses the row command and has at least 6 battle commands,
then return -1 as last battle action, otherwise 0.
@fdelapena fdelapena added this to the 0.6.3 milestone Sep 10, 2020
@Ghabry Ghabry merged commit 34f9dd3 into EasyRPG:master Sep 10, 2020
@ghost ghost deleted the battlerow-command branch September 10, 2020 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Embric of Wulfhammer's Castle: "Row" battle command is missing
3 participants