Continuous battle music over a 'wave' of battles

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,478
Reaction score
11,948
First Language
English
Primarily Uses
RMVXA
What I would like to happen is this.
First battle : music track x
During the 'victory sequence (A's Party was victorious etc.) the same music should play instead of reverting to the map music.
Second battle: music track continues from where it is instead of starting again.
Rinse, repeat until the end of the final battle of the wave.

Is this possible?
Thank you.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,194
Reaction score
723
First Language
English
Primarily Uses
RMVXA
I'm thinking of coding a condition with a switch and a variable.
Start Battle, turn switch on (on troop page), when battle is done, increment variable (or perhaps use an array) to go to the next battle right away. Music would not stop because we intercept the code that makes it stop and just clean up the battle and start the next.
Unless you want to exit and go to the next. Then the music would need to be captured.

Just a thought, would have to spend some time to test it.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,194
Reaction score
723
First Language
English
Primarily Uses
RMVXA
@Kes Should be good. Tested in default system.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Battle Sequence              ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║                                     ╠════════════════════╣
# ║ Play Running Battles                ║    10 Jun 2021     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Battles will be done one after another until complete    ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   Set variable to the starting troop number              ║
# ║   Depending on how you want to proceed,                  ║
# ║   You can either set the next troop number in the        ║
# ║   variable or you can let this script do sequential.     ║
# ║                                                          ║
# ║   When the switch is used, this script will prevent      ║
# ║   the battle music from stoping and carry on to          ║
# ║   the next battle.                                       ║
# ║                                                          ║
# ║   Turn the switch off when you want to stop.             ║
# ║   Configure settings below.                              ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use:                       ║
# ║ Free for all uses in RPG Maker      ║
# ╚═════════════════════════════════════╝

module R2_BSV
  SWITCH = 1 # switch number
  # switch that enables this script functions
  VARIABLE = 1 # variable number
  #variable used to determine which troop to use
  SEQUENTIAL = 2 # switch number
  # true means that the next battle will be 1 higher
  # Battle is troop 5, next troop will be 6
  # if not used, it will take the game variable
  # variable must be set to the starting troop
  # then you can change it in the troop page or let it do sequential
  SHOW_VICTORY = 3 # switch number
  # Display the Victory text and exp or not. True = yes
end

module BattleManager
  class << self
    alias r2_battle_sequence_victory  process_victory
  end
  def self.process_victory
    if $game_switches[R2_BSV::SWITCH] == true
      if $game_switches[R2_BSV::SHOW_VICTORY] == true
        $game_message.add(sprintf(Vocab::Victory, $game_party.name))
        display_exp
      end
      gain_gold
      gain_drop_items
      gain_exp
      if $game_switches[R2_BSV::SEQUENTIAL] == true
        $game_variables[R2_BSV::VARIABLE] += 1
      end
      $game_troop.setup($game_variables[R2_BSV::VARIABLE])
      continue_battle(true)
      battle_start
      return false
    else
      r2_battle_sequence_victory
    end
  end
  def self.continue_battle(value = false)
    @continue = value
  end
  def self.continue_battle_setup
    @continue
  end
end

class Scene_Battle < Scene_Base
  alias r2_bsv_update_battle  update
  def update
    r2_bsv_update_battle  
    if BattleManager.continue_battle_setup == true
      BattleManager.continue_battle(false)
      @spriteset.create_enemies
      @spriteset.update_enemies
    end
  end
end
 
Last edited:
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,478
Reaction score
11,948
First Language
English
Primarily Uses
RMVXA
@Roninator2 Thank you for this.
Please excuse my stupidity, but I cannot get this to work.
I configured the script like this:
Code:
module R2_BSV
  SWITCH = 241 # switch number
  # switch that enables this script functions
  VARIABLE = 102 # variable number
  #variable used to determine which troop to use
  SEQUENTIAL = 242 # switch number
  # true means that the next battle will be 1 higher
  # Battle is troop 5, next troop will be 6
  # if not used, it will take the game variable
  # variable must be set to the starting troop
  # then you can change it in the troop page or let it do sequential
  SHOW_VICTORY = 243 # switch number
  # Display the Victory text and exp or not. True = yes
end
In my test event I wanted to run troops 4 - 7 inclusive. I was a little puzzled about how I would tell the script how many troops the variable had to allow, but I thought I would work that out once it gave me some.

I set my event like this:
1623416834022.png

I assumed that if the variable automatically picked up at troop 4, I didn't need to give a Battle Processing command. I got the test text message, but nothing else happened.

I tried inserting the 4 troops manually, and they ran, but the battle music stopped for the Victory text and started over at the beginning for the next battle.

Can you please explain to me what I am doing wrong?
Thank you.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,194
Reaction score
723
First Language
English
Primarily Uses
RMVXA
@Kes

The variable is designed to be the troop number, not how many to do. Which I think is what you've done. So if you start with troop 73 and have switch 242 on then the next battle will be troop 74.
Other than that the script is not designed to start a battle. You still have to do that.

If variable 105 is set to 4, you manually start battle troop id #4, the next battle will be troop #5.
It's designed so that you could at each troop page specify a different troop number.
With sequential off, you could something like 16, 32, 8, 45

The switch to activate the script is used to intercept the victory sequence. So you have to start a battle with the switch on (or turn the switch on in the troop page) for the script to do anything.

When you are finished doing battles sequences, you have to turn switch 241 off. Otherwise it will continue the next battle. If sequential is off then it will repeat the last enemy troop indefinitely. If the sequential switch is on it will continue until it reaches the bottom of your troop list and probably crash is you have any that are empty.

So this script, as is, is mostly manually controlled. If it works for you I can see about putting in some automation. But I still would not make it start a battle automatically. To do so would put code in to enable that and you would still have to use a command to tell the script to start.
To have it set to start a battle as soon as switch 242 is on, means all the other switches and variable has to be set first. Regardless, I think its a waste of code when the editor can do it for you.

Plus this script gives the freedom to have random battles do sequential. You just have to have the switches and variable set on the troop page.

What battle script are you using? There may be some requirements for it as well.
 
Last edited:
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,478
Reaction score
11,948
First Language
English
Primarily Uses
RMVXA
@Roninator2
I feel such a fool because I am now more confused than ever.
The variable is designed to be the troop number, not how many to do. Which I think is what you've done.
It is coincidence that I am starting at troop 4 and having 4 battles. I chose early troops for testing so that I could finish each battle very fast.

It's designed so that you could at each troop page specify a different troop number.
Here's where the confusion starts to deepen. What do you mean by 'each troop page'? I have the troops on the troop tab in the ordinary way. This sounds like I need to set up the troop page for each of the battles in a different way, insofar as I am not aware of how to get multiple troops into a single troop slot.
As an experiment I copied the 4 test troops to slots 65 and following, and changed the variable #102 to 65. I turned on control switches 241 and 242 in the event, followed by Battle Processing troop 65. Still just one battle.
I then at turn zero in troop 65 set the variable #102 to 66 to see if that would move it on. It didn't.

I am utterly lost. I know this is asking a lot, but could you post a screen shot of what the event should look like, and a screen shot of what should be on the troop page of the 4 troops in the wave? I am assuming that to end the sequence, I turn OFF switch 241 at turn zero in the last troop. I am also assuming that I've done the configuration bit in the script correctly.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,194
Reaction score
723
First Language
English
Primarily Uses
RMVXA
I have the troops on the troop tab in the ordinary way

Good, nothing special. I just meant each troop. Because you can have several pages on each troop tab for the conditions.
1623504982244.png
Why it is not working for you, I don't know.
Here is the sample project.
 

Attachments

  • Forums Testing 5.zip
    1.3 MB · Views: 1
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,478
Reaction score
11,948
First Language
English
Primarily Uses
RMVXA
It's still the same. I even went so far as to copy/paste your event commands into my event in case there was something I'd missed, but that made no difference.

I suspect that my CTB battle script is preventing this running properly, in which case I feel guilty that I have wasted your time. I can think of no other explanation.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,194
Reaction score
723
First Language
English
Primarily Uses
RMVXA
CTB battle script
That's what I was wondering. And I did ask. What battle scripts do you have?
If they are not custom, then I can look at the issue there. Also if you have any scripts below mine that overwrites the victory method, then my script will do nothing.
 
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,478
Reaction score
11,948
First Language
English
Primarily Uses
RMVXA
I'm using Yami's Predictive CTB script, plus their Order Battlers. These require Yanfly's Battle Engine and Yami's Battle Symphony scripts.
Your comment about another victory script rang bells, I have a small custom script which shows individual EXP after each battle. Moving that above your script solved the problem we've been discussing, but I got an error message
1623512579955.png
As Battle Symphony is such a huge, complex script, there might not be an obvious solution.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,194
Reaction score
723
First Language
English
Primarily Uses
RMVXA
Order Battlers.
I put all those in one at a time and no issues until I added order battles. try taking that our to see if it works
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,478
Reaction score
11,948
First Language
English
Primarily Uses
RMVXA
I got the same error message. However, when I copy/pasted the scripts (minus Order Battlers) into your demo project, it worked. It must, therefore be something else in my scripts.

I have a lot of them. Would it help if I posted my scripts file from the Data folder so that you can see what's there?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,194
Reaction score
723
First Language
English
Primarily Uses
RMVXA
Would it help if I posted my scripts file from the Data folder so that you can see what's there?
send me a PM of the file if you wish to do so.
 

Latest Threads

Latest Posts

Latest Profile Posts

Did you know that 90% of people in the world use the number in their sentence as they see fit?
It's been a long time since I was here but I have a lot of updates... btw I am teaching again about game programming and game design in some schools here in Brazil hahahaha It's good to see kids and teens learning this kind of thing!
welp, I literally can't continue working on ALEX now that my MZ trial is up (unless I somehow place in the jam which I don't remotely deserve to for my unfinished crap) so I am back on my bullshit
some test stuff. Empty for now. My other project (this project) needs more attention. The lagging really kicks up when I try to capture gameplay. ✨

Forum statistics

Threads
113,887
Messages
1,078,212
Members
147,980
Latest member
gpc_826
Top