• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script: Deluxe Battle Kit [v21.1]

1,406
Posts
10
Years
    • Seen yesterday
    Minor Update (v1.1.3)
    • Fixed a crash that could occur when setting custom music for a battle through a battle rule.
    • Fixed an issue with low HP music ending when Pokemon with critical HP is on the field, but a healthy partner Pokemon is sent out, or a partner Pokemon is healed out of the critical HP zone.
    • Added the "endBGM" Command Key to be used in a midbattle hash. This can be used to fade out and end the current BGM without immediately playing a new one.
     
    1
    Posts
    54
    Days
    • Seen Apr 24, 2024
    Hello! I apologize in advance if I'm bothering you, I just need a little help with the midbattlescript. I've tried to follow the explanations as closely as possible, but I don't understand much, probably because English isn't my first language and I haven't been coding in a game for long. I mainly want to understand where I should write the scripts for battles.. (I hope I don't sound like an idiot by asking this question.)
     
    1,406
    Posts
    10
    Years
    • Seen yesterday
    Hello! I apologize in advance if I'm bothering you, I just need a little help with the midbattlescript. I've tried to follow the explanations as closely as possible, but I don't understand much, probably because English isn't my first language and I haven't been coding in a game for long. I mainly want to understand where I should write the scripts for battles.. (I hope I don't sound like an idiot by asking this question.)
    Theyre written within their own battle rule. You can look at one of the example battles provided in the guide to see what this looks like.
     
    14
    Posts
    7
    Years
    • Seen May 1, 2024
    Hello! I've been playing around with this script, and have been absolutely loving it so far. I was curious if there was a way to have multiple mid-battle variables during one battle (ex. Using one to track the number of player's misses with moves, and another to track the number of items used by the player); would I be able to add a temporary variable to a hardcoded script, or would I have to manually edit the Midbattle Overwrites script to add more mid-battle variables?
     
    1,406
    Posts
    10
    Years
    • Seen yesterday
    Hello! I've been playing around with this script, and have been absolutely loving it so far. I was curious if there was a way to have multiple mid-battle variables during one battle (ex. Using one to track the number of player's misses with moves, and another to track the number of items used by the player); would I be able to add a temporary variable to a hardcoded script, or would I have to manually edit the Midbattle Overwrites script to add more mid-battle variables?
    Only one variable is coded into the script. However, you can always just use the regular $game_variables in a hardcoded script if you wanna do something more elaborate.
     
    14
    Posts
    7
    Years
    • Seen May 1, 2024
    Only one variable is coded into the script. However, you can always just use the regular $game_variables in a hardcoded script if you wanna do something more elaborate.
    Thank you for the update! I've encountered another problem, unfortunately; when I try to use the hardcoded script version of "setSpeaker" to set the speaker to a Trainer Type, it crashes with this error: 1713577871319.png

    Am I doing something wrong, or is this a bug?
     
    14
    Posts
    7
    Years
    • Seen May 1, 2024
    Well, what does the code look like?
    Right, sorry about that. Here's the code:

    Spoiler:
     
    1,406
    Posts
    10
    Years
    • Seen yesterday
    Right, sorry about that. Here's the code:

    Spoiler:
    I'm assuming the only reason you're using :ELITEFOUR_Agatha instead of a battler index is because you want to use a different sprite from the the trainer sprite? If that's not the case, you should just use an index, it's much simpler.

    Anyway, this just seems like there's a bug when using ID's instead of an index. I'll probably have already fixed it before you read this, but there's an easy work-around you could use that I'll describe anyway:
    Ruby:
    scene.pbStartSpeech(0)
    scene.pbShowSpeakerWindows("Kasa", 1)
    scene.pbShowSpeaker(:ELITEFOUR_Agatha)
    This would accomplish the exact same thing, just done in more parts. You start the speech from the player's perspective (index 0), which means no sprite slides on screen. But before any dialogue starts, you just change the player's name window and then force a sprite to slide on screen with pbShowSpeaker. This mimics what you're trying to do with just pbStartSpeech alone if it wasn't bugged.


    EDIT: Bug is now fixed.
     
    Last edited:
    3
    Posts
    5
    Years
    • Seen May 1, 2024
    Hey, bit of a weird one.
    After writing a simple interaction in hardcode it runs successfully, however it runs multiple times in a row.
    Not on consecutive turns, but immediately after itself on the same turn.
    Code:
    MidbattleHandlers.add(:midbattle_scripts, :deletethatumbreon_test,
      proc { |battle, idxBattler, idxTarget, trigger|
        scene = battle.scene
        battler = battle.battlers[2]
        case trigger
        when "RoundStartCommand_1_foe"
          scene.pbStartSpeech(1)
          battle.pbDisplayPaused(_INTL("So stealing is fair game then?"))
        end
      }
    )

    We have a similar interaction happening when we used
    Code:
      when "BattlerFainted_foe"
          old_hp = battler.hp
          battler.hp -= 100.round
          scene.pbHitAndHPLossAnimation([[battler, old_hp, 0]])
    To knock out a pokemon.
    The "(pokemon) has fainted" message will appear 3-4 times in a row before the game can proceed, then continue to pop up after every action from then on.

    I know the documentation said that the hardcoded scripts continue to run each turn as if the "_repeat" extension was added to the trigger, but this happening much more frequently than once per turn do you have any suggestions as to what be causing this?

    We are running:
    Pokemon essentials v21.1
    with:
    v21.1 Hotfixes (ver. 1.0.9)
    Generation 9 Pack (ver. 3.2.3)
    Deluxe Battle Kit (ver. 1.1.3)
     
    3
    Posts
    5
    Years
    • Seen May 1, 2024
    Here's a gif of the repeating text I mentioned, just for more context.
     

    Attachments

    • 49e3531c899719880f540f045b0b8d23.gif
      49e3531c899719880f540f045b0b8d23.gif
      2.1 MB · Views: 5
    1,406
    Posts
    10
    Years
    • Seen yesterday
    Hey, bit of a weird one.
    After writing a simple interaction in hardcode it runs successfully, however it runs multiple times in a row.
    Not on consecutive turns, but immediately after itself on the same turn.
    Code:
    MidbattleHandlers.add(:midbattle_scripts, :deletethatumbreon_test,
      proc { |battle, idxBattler, idxTarget, trigger|
        scene = battle.scene
        battler = battle.battlers[2]
        case trigger
        when "RoundStartCommand_1_foe"
          scene.pbStartSpeech(1)
          battle.pbDisplayPaused(_INTL("So stealing is fair game then?"))
        end
      }
    )

    We have a similar interaction happening when we used
    Code:
      when "BattlerFainted_foe"
          old_hp = battler.hp
          battler.hp -= 100.round
          scene.pbHitAndHPLossAnimation([[battler, old_hp, 0]])
    To knock out a pokemon.
    The "(pokemon) has fainted" message will appear 3-4 times in a row before the game can proceed, then continue to pop up after every action from then on.

    I know the documentation said that the hardcoded scripts continue to run each turn as if the "_repeat" extension was added to the trigger, but this happening much more frequently than once per turn do you have any suggestions as to what be causing this?

    We are running:
    Pokemon essentials v21.1
    with:
    v21.1 Hotfixes (ver. 1.0.9)
    Generation 9 Pack (ver. 3.2.3)
    Deluxe Battle Kit (ver. 1.1.3)

    You kinda answered your own question without realizing it.
    I know the documentation said that the hardcoded scripts continue to run each turn as if the "_repeat" extension was added to the trigger, but this happening much more frequently than once per turn do you have any suggestions as to what be causing this?
    This is why. It's not happening "more frequently", though. "RoundStartCommand_1_foe" doesn't trigger once on the first turn. It triggers once on the first turn for each opposing Pokemon. So since both opposing Pokemon are eligible to trigger the "_foe" extension, it repeats for both Pokemon. However, since both Pokemon are owned by the same trainer, what ends up happening is that the same trainer speaks the same lines twice. Regardless of whether or not this is the outcome you wanted, this is logically consistent with how it should work. For comparison's sake, a trigger such as "RoundStartCommand_1_foe1" wouldn't repeat twice in the same turn, because only the foe's first Pokemon on their side of the field would be eligible for the "_foe1" extension. So that would be an alternative you could use specifically for a double/triple battle scenario if you only want something happening once during the first turn. The generic "_foe" extension triggers for all opposing Pokemon...which isn't usually an issue when used in single battles, since there's only one foe that can trigger it.

    Generally speaking though, if you're hardcoding a script, you should always be using the line next if battle.pbTriggerActivated?(trigger) after each "when" line that you don't want repeating in your battles. This is probably the most concrete way of preventing repeats in all situations.
     
    Last edited:
    3
    Posts
    5
    Years
    • Seen May 1, 2024
    You kinda answered your own question without realizing it.

    This is why. It's not happening "more frequently", though. "RoundStartCommand_1_foe" doesn't trigger once on the first turn. It triggers once on the first turn for each opposing Pokemon. So since both opposing Pokemon are eligible to trigger the "_foe" extension, it repeats for both Pokemon. However, since both Pokemon are owned by the same trainer, what ends up happening is that the same trainer speaks the same lines twice. Regardless of whether or not this is the outcome you wanted, this is logically consistent with how it should work. For comparison's sake, a trigger such as "RoundStartCommand_1_foe1" wouldn't repeat twice in the same turn, because only the foe's first Pokemon on their side of the field would be eligible for the "_foe1" extension. So that would be an alternative you could use specifically for a double/triple battle scenario if you only want something happening once during the first turn. The generic "_foe" extension triggers for all opposing Pokemon...which isn't usually an issue when used in single battles, since there's only one foe that can trigger it.

    Generally speaking though, if you're hardcoding a script, you should always be using the line next if battle.pbTriggerActivated?(trigger) after each "when" line that you don't want repeating in your battles. This is probably the most concrete way of preventing repeats in all situations.
    Yes, yes!
    I can see now that _foe would of course trigger on each of the foe's pokemon in a double or triple battle!
    Thank you soo much for that, it's suddenly much clearer.

    For your advice about the next if battle.pbTriggerActivated?(trigger) after the "when" statements;
    is this a viable implementation of your advice:

    Code:
        when "BattlerFainted_foe"
          next if battle.pbTriggerActivated?("BattlerFainted_foe")
    ?
     
    1,406
    Posts
    10
    Years
    • Seen yesterday
    Yes, yes!
    I can see now that _foe would of course trigger on each of the foe's pokemon in a double or triple battle!
    Thank you soo much for that, it's suddenly much clearer.

    For your advice about the next if battle.pbTriggerActivated?(trigger) after the "when" statements;
    is this a viable implementation of your advice:

    Code:
        when "BattlerFainted_foe"
          next if battle.pbTriggerActivated?("BattlerFainted_foe")
    ?
    Sure, though you can literally just use trigger instead of writing in the specific trigger. The use of case already specifies the trigger to check for.
     
    Back
    Top