Plan for textboxes in battles
It ought to be possible to display textboxes in battles, complete with working conditionals and chaining. The main use is probably for text that pauses battle. E.g. a hero strikes with a sword, says "by my sword you shall die", other heroes reply, and then the attack actually executes.
One way to implement this plan is Plan for implementing battlescripting#Merging battle and map mode.
'Show textbox' could be an alternative to the existing attack caption option. There could be a per-attack option to pause battle until the caption/textbox chain has ended; otherwise make "pause battle on textbox" a global option.
- If a textbox pauses battle, the player's only controls are to press 'use' to close it.
- If it doesn't, then an attack is currently occurring, so the player has no controls anyway.
(Aside: It would be nice if textboxes and captions both indicated whether the player can close them, ie whether "suspend box advance" is active. I'm frequently left wondering.)
So it may make sense for (some of) the existing attack caption options to shared, and extended to accommodate textboxes.
- The "Delay before caption" option makes sense for both.
- If a caption/textbox is only shown for X ticks or for the length of the attack, then it doesn't pause battle.
- On the other hand if a textbox doesn't pause battle, then it doesn't make sense for it to remain open after the attack is over
So have the following alternatives:
- Show caption/textbox and pause (until player advance)
- Show caption/textbox for X ticks
- Show caption/textbox for duration of attack
If a textbox doesn't pause battle but chains to something else, I guess that battle has to pause after the attack until the box chain is finished, otherwise there might be clashes with textboxes on other attacks (we can't allow cancelling a textbox chain, it might do something important) and the point at which conditionals take effect wouldn't be controlled! If "show for X ticks" was used, the attack animation can continue until done, and then the battle pauses. For that reason, it would be complementary to add the following features:
- Add a textbox option (in and out of battle) to advance the textbox after X seconds
- Additionally, if that is used, have an option to disable normal textbox advance
This is something frequently scripted, so makes sense to add as built-in feature.
More tricky stuff[edit]
There could also be an active textbox out-of-battle. (Would the "current textbox" command only report in-battle textboxes when in-battle, and vice versa?) Or should that be disallowed, so there a single global current textbox? We discussed merging the battle system with the map system, and it seems to be against that to have two separate textbox states. If a textbox triggers a battle, we can change it so that the textbox closes before the battle, and the next textbox doesn't trigger until after the battle, so there is only a single global textbox state. But this does not work if it was a script that triggered a battle, while a textbox was open.
If an OOB textbox triggers a battle and has a 'next' chain, should there be an option (in the textbox settings) to show that textbox in-battle instead of after it? What about the reverse, a textbox conditional to end battle? Having separate in and out of battle textbox state doesn't sound all too bad... unless you want a textbox chain triggered in-battle to continue after battle; then they would clash!
If a textbox sets/checks tags, and the triggering attack also sets/checks tags, in which order do they take effect? Probably all attack logic should happen before all textbox logic.
Existing Conditionals[edit]
We can implement this without support for all current textbox conditionals, and add them later. Hopefully no games would actually rely on them not working, so backcompat bits can be omitted.
- Tag and item conditions would work
- The add/remove/swap hero commands are the hardest part, but should definitely be supported, because they would be very useful
- Showing a shop or inn could work, although it's odd. Shops are modal, so would just pause the battle. The hard part is supporting changes to team and equipment.
- Triggering a battle would end the battle and start a new one
- Triggering a door could just do nothing
- Triggering a script runs it immediately even if it's not a battlescript? Not sure whether there would be any distinction between battle and non-battle scripts, except for whether they get paused in battle
New Conditionals[edit]
Maybe it makes sense to have a couple battle-specific conditionals, or maybe they should be done with attack chaining. Everything in-battle is currently done with attacks so it would be powerful to be able to trigger them... but instead of a textbox if-else chain triggered from an attack, why not trigger the right textbox from an if-else attack chain?