- 1,408
- Posts
- 10
- Years
- Seen today
Not a typo, I just forgot to add a check in case the track is a string instead of an audio file.Find a typo(maybe a typo) in [003]Deluxe Battle Rules. Line 177 should be track instead of track&.name.
Not a typo, I just forgot to add a check in case the track is a string instead of an audio file.Find a typo(maybe a typo) in [003]Deluxe Battle Rules. Line 177 should be track instead of track&.name.
I see.Not a typo, I just forgot to add a check in case the track is a string instead of an audio file.
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.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.)
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.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?
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: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.
Well, what does the code look like?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: View attachment 158362
Am I doing something wrong, or is this a bug?
Right, sorry about that. Here's the code:Well, what does the code look like?
MidbattleHandlers.add(:midbattle_scripts, :demo_Kasa_Paradox_Ditto,
proc { |battle, idxBattler, idxTarget, trigger|
scene = battle.scene
battler = battle.battlers[idxBattler]
case trigger
when "RoundStartCommand_1_foe"
battle.pbAnimation(:TRANSFORM, battler, battler)
battler.pbChangeForm(1, "Kasa's Ditto used the PDX-RB Fossil to transform!")
battler.damageThreshold = 4
battler.moves = [:THUNDERCLAP, :DISCHARGE, :DRAGONPULSE, :SNARL]
scene.pbStartSpeech(:ELITEFOUR_Agatha)
scene.pbShowSpeakerWindows("Kasa")
battle.pbDisplayPaused("Excellent job, Ditto!")
battle.pbDisplayPaused("Now, use your newfound power to DESTROY THEM!")
scene.pbForceEndSpeech
when "BattlerReachedHPCap_foe"
battle.pbAnimation(:TRANSFORM, battler, battler)
battler.pbChangeForm(0, "Kasa's Ditto lost its concentration and reverted!")
case $game_variables[26]
when 2
scene.pbStartSpeech(:ELITEFOUR_Agatha)
scene.pbShowSpeakerWindows("Kasa")
battle.pbDisplayPaused("Hrgggh...")
battle.pbDisplayPaused("...No matter, that wasn't the only Fossil I aquired!")
scene.pbForceEndSpeech
battle.pbAnimation(:TRANSFORM, battler, battler)
battler.pbChangeForm(2, "Kasa's Ditto used the PDX-GF Fossil to transform!")
battler.pbRecoverHP(battler.totalhp)
battler.damageThreshold = 4
battler.moves = [:BURNINGBULWARK, :HEATCRASH, :DRAGONCLAW, :STOMPINGTANTRUM]
scene.pbStartSpeech(:ELITEFOUR_Agatha)
scene.pbShowSpeakerWindows("Kasa")
battle.pbDisplayPaused("Prepare to be crushed!")
scene.pbForceEndSpeech
when 1
scene.pbStartSpeech(:ELITEFOUR_Agatha)
scene.pbShowSpeakerWindows("Kasa")
battle.pbDisplayPaused("...Bah, fine!")
battle.pbDisplayPaused("Behold, my final fossil!")
scene.pbForceEndSpeech
battle.pbAnimation(:TRANSFORM, battler, battler)
battler.pbChangeForm(3, "Kasa's Ditto used the PDX-WW Fossil to transform!")
battler.pbRecoverHP(battler.totalhp)
battler.damageThreshold = 4
battler.moves = [:SCALD, :DRAGONPULSE, :FLAMETHROWER, :MUDSHOT]
scene.pbStartSpeech(:ELITEFOUR_Agatha)
scene.pbShowSpeakerWindows("Kasa")
battle.pbDisplayPaused("No more holding back!")
battle.pbDisplayPaused("Ditto, ANNIHILATE THEM!")
scene.pbForceEndSpeech
when 0
scene.pbStartSpeech(:ELITEFOUR_Agatha)
scene.pbShowSpeakerWindows("Kasa")
battle.pbDisplayPaused("...")
battle.pbDisplayPaused("I'm... all out of fossils...")
scene.pbForceEndSpeech
end
$game_variables[26] -= 1 if $game_variables[26] > 0
when "BattleEndWin"
scene.pbStartSpeech(:ELITEFOUR_Agatha)
scene.pbShowSpeakerWindows("Kasa")
battle.pbDisplayPaused("Impossible...")
battle.pbDisplayPaused("Even with the power of the PDX Fossils...")
battle.pbDisplayPaused("...My Ditto was defeated...?")
scene.pbForceEndSpeech()
end
}
)
I'm assuming the only reason you're usingRight, sorry about that. Here's the code:
Spoiler:
Ruby:MidbattleHandlers.add(:midbattle_scripts, :demo_Kasa_Paradox_Ditto, proc { |battle, idxBattler, idxTarget, trigger| scene = battle.scene battler = battle.battlers[idxBattler] case trigger when "RoundStartCommand_1_foe" battle.pbAnimation(:TRANSFORM, battler, battler) battler.pbChangeForm(1, "Kasa's Ditto used the PDX-RB Fossil to transform!") battler.damageThreshold = 4 battler.moves = [:THUNDERCLAP, :DISCHARGE, :DRAGONPULSE, :SNARL] scene.pbStartSpeech(:ELITEFOUR_Agatha) scene.pbShowSpeakerWindows("Kasa") battle.pbDisplayPaused("Excellent job, Ditto!") battle.pbDisplayPaused("Now, use your newfound power to DESTROY THEM!") scene.pbForceEndSpeech when "BattlerReachedHPCap_foe" battle.pbAnimation(:TRANSFORM, battler, battler) battler.pbChangeForm(0, "Kasa's Ditto lost its concentration and reverted!") case $game_variables[26] when 2 scene.pbStartSpeech(:ELITEFOUR_Agatha) scene.pbShowSpeakerWindows("Kasa") battle.pbDisplayPaused("Hrgggh...") battle.pbDisplayPaused("...No matter, that wasn't the only Fossil I aquired!") scene.pbForceEndSpeech battle.pbAnimation(:TRANSFORM, battler, battler) battler.pbChangeForm(2, "Kasa's Ditto used the PDX-GF Fossil to transform!") battler.pbRecoverHP(battler.totalhp) battler.damageThreshold = 4 battler.moves = [:BURNINGBULWARK, :HEATCRASH, :DRAGONCLAW, :STOMPINGTANTRUM] scene.pbStartSpeech(:ELITEFOUR_Agatha) scene.pbShowSpeakerWindows("Kasa") battle.pbDisplayPaused("Prepare to be crushed!") scene.pbForceEndSpeech when 1 scene.pbStartSpeech(:ELITEFOUR_Agatha) scene.pbShowSpeakerWindows("Kasa") battle.pbDisplayPaused("...Bah, fine!") battle.pbDisplayPaused("Behold, my final fossil!") scene.pbForceEndSpeech battle.pbAnimation(:TRANSFORM, battler, battler) battler.pbChangeForm(3, "Kasa's Ditto used the PDX-WW Fossil to transform!") battler.pbRecoverHP(battler.totalhp) battler.damageThreshold = 4 battler.moves = [:SCALD, :DRAGONPULSE, :FLAMETHROWER, :MUDSHOT] scene.pbStartSpeech(:ELITEFOUR_Agatha) scene.pbShowSpeakerWindows("Kasa") battle.pbDisplayPaused("No more holding back!") battle.pbDisplayPaused("Ditto, ANNIHILATE THEM!") scene.pbForceEndSpeech when 0 scene.pbStartSpeech(:ELITEFOUR_Agatha) scene.pbShowSpeakerWindows("Kasa") battle.pbDisplayPaused("...") battle.pbDisplayPaused("I'm... all out of fossils...") scene.pbForceEndSpeech end $game_variables[26] -= 1 if $game_variables[26] > 0 when "BattleEndWin" scene.pbStartSpeech(:ELITEFOUR_Agatha) scene.pbShowSpeakerWindows("Kasa") battle.pbDisplayPaused("Impossible...") battle.pbDisplayPaused("Even with the power of the PDX Fossils...") battle.pbDisplayPaused("...My Ditto was defeated...?") scene.pbForceEndSpeech() end } )
: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.scene.pbStartSpeech(0)
scene.pbShowSpeakerWindows("Kasa", 1)
scene.pbShowSpeaker(:ELITEFOUR_Agatha)
There's gotta be more to this error you aren't showing.
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
}
)
when "BattlerFainted_foe"
old_hp = battler.hp
battler.hp -= 100.round
scene.pbHitAndHPLossAnimation([[battler, old_hp, 0]])
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
To knock out a pokemon.Code:when "BattlerFainted_foe" old_hp = battler.hp battler.hp -= 100.round scene.pbHitAndHPLossAnimation([[battler, old_hp, 0]])
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)
This is why. It's not happening "more frequently", though.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?
"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.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!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 linenext 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.
_foe
would of course trigger on each of the foe's pokemon in a double or triple battle!next if battle.pbTriggerActivated?(trigger)
after the "when" statements; when "BattlerFainted_foe"
next if battle.pbTriggerActivated?("BattlerFainted_foe")
Sure, though you can literally just useYes, 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 thenext 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")
trigger
instead of writing in the specific trigger. The use of case
already specifies the trigger to check for.again, thankyou for the response.Sure, though you can literally just usetrigger
instead of writing in the specific trigger. The use ofcase
already specifies the trigger to check for.