# Tutorial[v18] Scripted and Simulated Battles 2.2

#### Hollow_Ego

##### Cooltrainer
Member
Hollow_Ego submitted a new resource:

[v18] Scripted and Simulated Battles - Define battles until the very last turn or simulate a trainer battle

Scripted and Simulated Battles
Taking the randomness out of battles.

Description

Have you ever been this situation? In your story you have this all powerfull Pokémon Trainer and you want to show how badass they are, but all you can do is, fade the screen to black for a moment and then have your characters just comment on how tough it was? No need to pretend...

#### Hollow_Ego

##### Cooltrainer
Member
Hollow_Ego updated [v18] Scripted and Simulated Battles with a new update entry:

Fixed Multihit and Protect moves bug

There was an oversight in the first release, that would break protect and multihit moves in normal battles. This is fixed now.

Either redownload the folder and replace everything with dirty.txt if you are using the dirty approach or replace the contents of Scripted_Battle_Moves Script Section with the content of the file.

Or just copy the new version here and replace the whole methods.

Update:
class PokeBattle_Move_0C0 < PokeBattle_Move
def...

Read the rest of this update entry...

#### KrakerwatYT

##### Pokémon Master
Member
Is it possible to have a trainer's name be a variable, you know like your using your rival so you have to use like \v[12] just to show his name, but I've tried putting the name as both \v[12] and \\v[12] but neither show the name of the rival

#### Hollow_Ego

##### Cooltrainer
Member
I'm not certain what you mean by "but neither show the name of the rival", but I assume that no message at all was showing.
If that's the case, check out the update. I somehow lost (or removed it on purpose) the code for :moveMessage. I decided to merge it with :tryUseMove, as I don't see a need to differentiate it further. In newer version you can use either of those keywords.

I also tested showing the variables in a move message and itr works just fine. I used \\v[12].

#### Hollow_Ego

##### Cooltrainer
Member
Hollow_Ego updated [v18] Scripted and Simulated Battles with a new update entry:

Merged Keywords

Summary
• Merged :moveMessage with :tryUseMoveMessage
• They can both be used to show a message, whenever a Pokemon tries to use a move, regardless of success
• I lost (or removed on purpose) the code that was used for :moveMessage and after investigating, decided that there is no need to differentiate between those two
• Updated docs

Changed files/sections
• Scripted_Battle_Battler_2
• Scripted_Battle_Docs

Changed methods
- def...

Read the rest of this update entry...

#### ghostofherooftime

##### Rookie
Member
Dumb Question - Can you utilize this to script to dictate what only one side of the battle is doing? I've had this idea for an Elite Four member who starts off with a FEAR Starly as a cheap shot but I wasn't sure how to make that happen successfully.

#### Hollow_Ego

##### Cooltrainer
Member
Well, it is possible to give control back to the player, however using moves or do anything else will break the game. It would requiere quite some more coding to fix this. And in that process you would lose control of all targeting attributes (like "paralyze Squirtle" or "do 10hp damage on squirtel"), as you wouldn't know what Pokemon the player will use (unless you limit that too). Which is also the reason I didn't work on that, as you usually wwant everything to be scripted or everything to be simulated/actuallly calculated.

What exactly do you have in mind though?

#### ghostofherooftime

##### Rookie
Member
Gotcha.... Well I had a rather devious Elite 4 group in mind. The first one would have birds and would start off with a FEAR Starly. You know, the old rattata strategy of having a level 1 with a focus sash, have it use endeavor first turn then quick attack second turn to KO the first pokemon. I want to have that E4 person do those actions first. Always use Endeavor first then quick attack immediately after. Rest of the battle can be anything. Another Idea was an E4 member who always uses Explosion when their pokemon is at low health, but i can work around that by limiting their move to Explosion only. That was my idea

#### Hollow_Ego

##### Cooltrainer
Member
I think in this case it would be better to modify the AI script to prefer those moves or even completely override the move choice on those turns/conditions

#### KrakerwatYT

##### Pokémon Master
Member
I'm not certain what you mean by "but neither show the name of the rival", but I assume that no message at all was showing.
If that's the case, check out the update. I somehow lost (or removed it on purpose) the code for :moveMessage. I decided to merge it with :tryUseMove, as I don't see a need to differentiate it further. In newer version you can use either of those keywords.

I also tested showing the variables in a move message and itr works just fine. I used \\v[12].
Actually it isn't in the move message, it's set as the name because I have the rival being used for the catching tutorial. And when he catches a Pokémon, it appears as "\v[14] caught Lillipup" instead of showing his name

#### Hollow_Ego

##### Cooltrainer
Member
Actually it isn't in the move message, it's set as the name because I have the rival being used for the catching tutorial. And when he catches a Pokémon, it appears as "\v[14] caught Lillipup" instead of showing his name
I'm not really sure where that shpws up. Did you put in this message at one point or is it the regular message, that shows up when you catch a Pokemon?

#### KrakerwatYT

##### Pokémon Master
Member
I'm not really sure where that shpws up. Did you put in this message at one point or is it the regular message, that shows up when you catch a Pokemon?
It's the regular message

#### Hollow_Ego

##### Cooltrainer
Member
Then it's not influenced by this script. You might need to add the replacing script to this particular message.
If the name works correctly in the rest of the battle, then this particular message might be handled differently.

#### Hollow_Ego

##### Cooltrainer
Member
Hollow_Ego updated [v18] Scripted and Simulated Battles with a new update entry:

Support for VS Animations

With this version I added full VS Animation support. Just make sure to have all files set up (see here).
With this version there is one more file added: Shared_PField_Visuals.txt

Update Guide (Clean installation only)
If you have already installed the script and want to update you can do either of the following things. In both cases you need to add a new script section named...

Read the rest of this update entry...

#### Hollow_Ego

##### Cooltrainer
Member
Hollow_Ego updated [v18] Scripted and Simulated Battles with a new update entry:

Major Update to support Z-Moves, Ultra Burst, Dynamx and GMax

With this update you can now use Z-Moves, Ultra Burst, Dynamax and GMax in scripted battles. To make this work you will need the ZUD Plugin by Lucidious89 and StCooler.

Say thanks to the two people who suggested this support :)

There won't be support for Raid Battles, as that requires too much rework, for the time that I got.

Read the rest of this update entry...

#### Hollow_Ego

##### Cooltrainer
Member
Hollow_Ego updated [v18] Scripted and Simulated Battles with a new update entry:

Bug Fix - Error on Line 14 in 2_Scripted_Trainer when compiling

This new version contains a permanent solution to this bug, which was caused by my script trying to access trainer data before that was compiled. With that bug fix your scripted battles will only recompile when they have changed and compiling them will always happen after compiling everything else.

How to update (Clean Installation Only)
1. Replace your whole 14_Scripted_Battle_Compile script section with the following content
...

Read the rest of this update entry...

#### Hollow_Ego

##### Cooltrainer
Member
Hollow_Ego updated [v18] Scripted and Simulated Battles with a new update entry:

Bug fixes

• Fixed Bug, where end speeches wouldn't work on the player side in a simulated battle
• Fixed Bug, where recompiling the trainers pbs wouldn't updated the scripted battles

How to update (Clean installation only)
1. Replace your whole 14_Scripted_Battle_Compile script section with the following content
Ruby:
#===============================================================================
# Compile scripted battles...

Read the rest of this update entry...