• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Resource icon

Tutorial Trainer comments during Battle 2.0

Zeidra Senester

Rookie
Member
Joined
May 11, 2022
Posts
6
Zeidra Senester submitted a new resource:

Trainer comments during Battle - Have the foe trainer appear and speak during a battle without Elite Battle system.

A couple years ago, I was working on my fangame and I required to add a way for trainer to make comments during a battle, like we see in canon games. I know it's possible with the Elite Battle system, but it doesn't fit my game style at all. So I came with my own solution, and posted it as a tutorial on Reddit.

I'm currently updating my own game to v19.1 (yeah I'm super late) and looking for a solution for that exact same issue, the only result I found… was my own tutorial. So I decided to...

Read more about this resource...
 

BiggusWeeabus

"What's so funny about Biggus Dickus?"
Member
Joined
Sep 1, 2020
Posts
105
I got this error when starting any battle, with or without taunts:
Ruby:
Expand Collapse Copy
[Pokémon Essentials version 19.1]
[Generation 8 Project v1.1.2]

Exception: RuntimeError
Message: Script error in event 27 (coords 38,8), map 32 (Vaniville City):
Exception: NoMethodError
Message: undefined method `[]' for nil:NilClass

***Full script:
pbTrainerBattle(:BUGCATCHER, "Tyler")

Backtrace:
173:Battle_StartAndEnd:273:in `pbStartBattleCore'
173:Battle_StartAndEnd:258:in `pbStartBattle'
231:Overworld_BattleStarting:442:in `block (2 levels) in pbTrainerBattleCore'
232:Overworld_BattleIntroAnim:8:in `pbSceneStandby'
231:Overworld_BattleStarting:441:in `block in pbTrainerBattleCore'
232:Overworld_BattleIntroAnim:102:in `pbBattleAnimation'
231:Overworld_BattleStarting:440:in `pbTrainerBattleCore'
231:Overworld_BattleStarting:507:in `pbTrainerBattle'
[Looping Trainer Intro as BGM] TrainerIntro.rb:52:in `pbTrainerBattle'
(eval):1:in `execute_script'


Backtrace:
033:Interpreter:192:in `rescue in execute_script'
033:Interpreter:138:in `execute_script'
034:Interpreter_Commands:352:in `command_111'
034:Interpreter_Commands:29:in `execute_command'
033:Interpreter:130:in `block in update'
033:Interpreter:87:in `loop'
033:Interpreter:87:in `update'
032:Scene_Map:157:in `block in update'
032:Scene_Map:155:in `loop'
032:Scene_Map:155:in `update'
 

CocoaSama

Rookie
Member
Joined
Oct 28, 2022
Posts
1
hello

your ressource is cool, thank you for sharing it. though, i noticed it is not fully working with v.19.1 + gen8 project and whatnot, notably for the following reasons:
  • the sendout/switch of pokemon in the script is not specific to the opponent thus making the taunt appear when you switch with your own pokemon, instead of sticking to the opponent's party, because your own party is accounted for in idxParty unfortunately
  • the animation for making the trainer disappear crashes the game because it's not properly called in the script
here is the workaround i tinkered in my code to make it work and suit my fangame which uses the v19.1 + gen8 project and whatnot
to fix the issues mentionned at the beginning of my comment, here are the edits i made in the script:
  • def the disappearing animation pbHideOpponent with fadeAnim
  • call the taunt with an additional condition pbAbleNonActiveCount to make the script specific to a situation and trainer
in that case, the taunt doesn't apply to the pokemon anymore, which prevents the taunt from wrongly appearing when you switch your own party, but to a certain situation. you just have to link the items in the taunt array to each condition (theoritically as much as you want instead of just six)

for example, i'm using the taunt=[0,1,2,3] with the following setup:
0=opening dialogue, 1=mid-battle taunt (when count is 2 for opponent), 2=showdown dialogue (when count is 0 for opponent), 3=crisis situation (when count is 0 for player)

note that by doing so, you may encounter an issue with the losertext animation at the end of the battle. but it's ok, you just need to edit the pbDisplayPaused with a new argument @opponent.lost_text so it can be defined by the text in the PBS file

on a side minor note, if you want the trainer to talk with long sentences, it might results in the text being cropped and displayed weirdly during the battle scene. to fix that, it's just a simple use of the extendedtext feature and putting each part within the taunt array in a respective different line, and extend the sleep duration so the player has time to read it

it kind of deviates from your initial purpose of displaying a taunt depending on the pokemon used by the opponent, but i personally find situational taunts more efficient in terms of battle narration which is why i applied those edits in my code instead of fully troubleshooting the original idea. though it can still be further edited to work as intended for you anyway, i'm just sharing how i worked around the issues encountered for my project
in your thread you mentionned this
Indeed, even if there is more than one opposing trainers, it will only show the first one. It could be managed for Battle_Action_Switching, but I couldn't find a solution for Battle_StartAndEnd as idxParty isn't set yet. Actually, the step n°5 is only useful if you ever plan to taunt on first turn.

Next time, I'll add a way to show a taunt when the last opposing Pokémon has only 25% of its HP left, like we can see in B/W during gym leader battles (before this mf uses a Full Heal).
by implementing the aforementioned fixes, you could be able to do so without resorting to idxParty. i guess you could imagine just setting the count for each opponent to 5 in each of the additional conditions
for the second case, i guess you could imagine using the same trick and add another condition for this specific situation using something like a check for battler.hp
if you ever get to test it out, let me know if it works
i'm also currently troubleshooting a deeper fix that will allow to have the opponents sprite interacts individually when taunting during duo battle. i could write an improved tutorial about it when it's done, and include all my comment's instructions in a more detailed way as well if needed. i'll just have to do a bit of speleology in my bits of code first

cheers!
 
Back
Top