• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

[Gen III]: Battle Scripting with BSP

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Hello there, as you may have noticed recently, I released a Battle Script Editor called Battle Script Pro. The problem is, apart from myself, no-one really knows how to use it, or even what most of the commands do!

Here, I will walk through the basics of making basic attacks, and how to get basic added effects working.

Before we get started, I should make this clear. Battle Script Pro will support, and parse, any number formatted in Binary, Octal, Decimal, Hexadecimal and Thornal.
Spoiler:


Basic Damaging Attack:
Spoiler:



Status Inflicting Moves:
Spoiler:



Damage AND Status Inflicting Moves:
Spoiler:


Attacks That Don't Miss and Special Status Flags:
Spoiler:
Scalar Multiplication of Attack Damage and Using Keywords:
Spoiler:



Raising/Lowering Stat Buffs:
Spoiler:
Spoiler:


More to follow.
 
Last edited:

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
This is a great tut, I read it over at RHO before it got shut down:(, I even downloaded it for later reading. Eventually, could we use this knowledge to code entire new custom battles? Possibly implement the dual trainers from Emerald in FR? Just some thoughts, it deffinalely is nice to have a tut to go along with your BSP.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Is there a way for the sandstorm/hail to go before the end of the turn like in d p p hg ss b w?
in gen 3 the sandstorm and burn and poison happen after your pokemon faints.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Of course it's possible, it all comes down to implementation and whether or not you could implement it cleanly enough for it to work.

I wouldn't honestly know where to start in terms of rewriting the BS routine for this though. By routine, I don't mean ASM (although there would no doubt be some ASM involved), I simply mean the routine the engine follows when in battle.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Could we search in A-text for "the sandstorm rages" then find a pointer to it, go back a few bytes and we should have the script?
 
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
So I can use battle scripts to make new move effects am I right?
How do I really use it? In your new moves tut, we can do new move effects by creating codes, how about this one?
 

Shadowraze

ur mum
794
Posts
10
Years
This is a very awesome tutorial Jambo.

Although I think you have forgotten to explain some moves, especially the string that appears when the stats are changed from the current code you had given us. I've only been able to raise the stats but, no text appears that says "Pokemon Stat Rose". :/

Also jambo is there a code that is like the random code in XSE? :3
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
I can't help but notice that there are commands above FF, that seem to be for Gen 4 moves.
I take it these only work in the 649 patch? How would one go about getting them to work in
other roms.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
I can't help but notice that there are commands above FF, that seem to be for Gen 4 moves.
I take it these only work in the 649 patch? How would one go about getting them to work in
other roms.

I'm sure you won't be surprised to hear that it requires custom ASM. The way the script runner is built, you physically cannot use commands with an index greater than 0xFF, because a script command's ID can only be a byte in size.

What I did was turn command 0xFF into a command which takes 1 parameter, that parameter being the "extended script ID".

The code reads the ID, and then jumps (in ASM) to the code associated with the ID based on a table built into command 0xFF. It then executes as normal. If the extended ID command has parameters, these parameters follow on directly from the extended script ID, as they would in any normal circumstances.

Basically, command 0xFF in my ROM is a bit like Callstd in overworld scripting.
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
I'm sure you won't be surprised to hear that it requires custom ASM. The way the script runner is built, you physically cannot use commands with an index greater than 0xFF, because a script command's ID can only be a byte in size.

What I did was turn command 0xFF into a command which takes 1 parameter, that parameter being the "extended script ID".

The code reads the ID, and then jumps (in ASM) to the code associated with the ID based on a table built into command 0xFF. It then executes as normal. If the extended ID command has parameters, these parameters follow on directly from the extended script ID, as they would in any normal circumstances.

Basically, command 0xFF in my ROM is a bit like Callstd in overworld scripting.

Hrm that's very interesting I must say. Yeah I figured it wasn't something found normally in the rom.
That's a creative solution, because I was wondering how you'd be able to create extended IDs as FF to me was the biggest an ID could go. I was hoping initially that there'd be some sort of table to extend but that makes sense.

Thanks for your response!
 
944
Posts
11
Years
Wow, I'm so proud of myself I did something like you Jambo. XD
Please, do you thínk that stuff like Prankster and Sucker Punch is possible to do??
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
Wow, I'm so proud of myself I did something like you Jambo. XD
Please, do you thínk that stuff like Prankster and Sucker Punch is possible to do??

Looking at BSP, Jambo's already got Sucker Punch working. It's one of those extra bytes he
was talking about. It's listed as 'jumpiftargetisusingstatusmove'.

My guess would be that if the target is using a status move, it jumps to a new priority check.
I suppose that Prankster is built in a similar way, where it would check if the user was using
a status move. I have no idea about the actual implementation of this or how to replicate it.
You may want to ask Jambo for that.
 
944
Posts
11
Years
Oh!! :o
Yeah, I just found that the game stores what move every pokemon is about to use, so Sucker Punch and Me First are totally possible, Prankster and Stall are still in doubt... -.-
The problem is that Sucker Punch has a static priority, while Prankster and Stall abilities need to alter the priorities...
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Oh!! :o
Yeah, I just found that the game stores what move every pokemon is about to use, so Sucker Punch and Me First are totally possible, Prankster and Stall are still in doubt... -.-
The problem is that Sucker Punch has a static priority, while Prankster and Stall abilities need to alter the priorities...

Stall doesn't alter priority. It makes the Pokémon go last in its priority bracket.

http://bulbapedia.bulbagarden.net/wiki/Stall_(Ability)

Prankster needs to be handled by ASM exclusively. This is because the code which orders attackers is all ASM. The same applies to Stall.
 

TorNyan

Hacker
12
Posts
12
Years
I want to make a custom battle that is very similiar to "old man catches a weedle" tutorial. Tried BSP out. Don't understand much. Tried to compile the basic battle script (copy pasted) in order to test things out. It returned an error. The same with debugging (only if there's no error in my script) and Command Directory (F1). The error transcribes as follows.
Battle Script Pro
Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.

SQL logic error or missing database
no such table: commands.

Details:
Spoiler:

If one is to click "Continue", the application continues as normal, but if one hovers over the bar with compile button and all that, it shows the hourglass pointer. If one is to click "Quit". It quits as regular and asks to save.

Good night.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
You need to update the database before you open a script. It's in the settings in the program I think.
 

TorNyan

Hacker
12
Posts
12
Years
You need to update the database before you open a script. It's in the settings in the program I think.

Thank you very much, it solved my problem (though it was from the Help menu).


Now that I've gotten that out the way, I have a few open questions.

How do I implement a battle script in my hack?
Does it work with both trainer battles and wild battles (and legendary battles)?
Where and how do I find the already implemented battles in the game?

Thanks in advance.
 
Last edited:
2
Posts
15
Years
  • Seen Jan 23, 2014
Would it be possible to check the levels at the beginning of any wild battle, and if your level is a certain amount higher, it automatically wins the battle?

For instance, I'm running around with a level 62 Charizard. I run into a wild Caterpie at level 4. I want to be able to automatically win the battle and gain the experience, without actually battling the Pokémon. Is this at all possible?
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Would it be possible to check the levels at the beginning of any wild battle, and if your level is a certain amount higher, it automatically wins the battle?

For instance, I'm running around with a level 62 Charizard. I run into a wild Caterpie at level 4. I want to be able to automatically win the battle and gain the experience, without actually battling the Pokémon. Is this at all possible?

Not using this, no. What you want to do would require ASM to implement, and would be exceedingly complex.
 

daniilS

busy trying to do stuff not done yet
409
Posts
10
Years
  • Age 24
  • Seen Jan 29, 2024
Is it possible to call a battle script from an asm routine?
 
Back
Top