• 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] Can someone make a battle script tutorial

853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
I've looked through this entire site and I haven't seen a single tutorial on how to battle script.

The closest thing I've found are these; jambo51's bsp tool guide.
And this post also by Jambo51.

I've talked with others and they've also said they never found a battle script tutorial, so I'm asking if anyone sees this and has the knowledge, please rectify this and make a tutorial for the community.

Thank-you.


edit for clarity;

Things I'm looking for are a list of battle script commands, what they do, the proper syntax/order for battle script.
as well as how and where to write it/compile it, since you can't do it in xse.

I already have what I believe to be a full list of battle script commands thanks to hex maniac advance, and I think you can edit and write/compile battlescript with hex maniac advance.


found a list of battle script defines to add to this.

Alright and here's a list of commands and macros.

2nd edit;
ok so far, no takers, so for now I'll just use this thread to compile all the info I can find on battle script in the event it can be used one day.
 
Last edited:
135
Posts
3
Years
  • Age 33
  • Seen Mar 26, 2024
Battle script meaning "trainerbattle 0x1 0x280 0x0 @Encounter @Defeat"? Or actual assembly code on how battles work?
 
853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
Battle script meaning "trainerbattle 0x1 0x280 0x0 @Encounter @Defeat"? Or actual assembly code on how battles work?

that first part is just regular event scripting involving a trainer battle command. this is battle sceipt.



#org @start
attackcanceler
accuracycheck 0x1D695E 0x0
attackstring
ppreduce
calculatedamage
attackanimation
waitanimation
cmd5c 0x0
waitstate
datahpupdate 0x0
graphicalhpupdate 0x0
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
goto 0x1D6947
 
Last edited:
853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
A little update, with the resources I've gathered I can read a little battlescript.

Attached is an example battle script to compare.

So using that, an ability table, for my rom, plus the chart of bs commands courtesy of HMA. I was able to draw some conclusions from looking at the bs for the move "attract.

First what I've found, if you can find the table for battle script then you know the size of the script is the difference between one pointer and the next.

every bs script will have a section that checks accuracy, and reduces pp. they also have a attackanimation commmand preceding a waitanimation command.

If it does damage it will also have health bar update and datahpupdate, because while the hp bar represents your hp, it itself isn't your mon's hp, so both must be updated for damage to be calculated and shown correctly.

And from what I can tell, most if not all moves (for fire red) end with a pointer to 1D694E, which handles move end.

Ok so the example script for attract is this.

A6488A:
attackcanceler
accuracycheck <A67FD5> 0000 // don't quite get what this is doing since both of these have attack string and ppreduce, maybe this is a call and the second one
attackstring // doesn't activate but just lists what's at where you're jumping to/calling from.
ppreduce
jumpifability 00 0C <A63E45> // so this says to skip a section, if the opponent has ability 0C aka ability 12. Which you can tell from my screenshot is "oblivious"


A67FD5:
attackstring
ppreduce
A67FD7:
pause 0020
orbyte 2023DCC 20
resultmessage
waitmessage 0040
goto <1D694E>



1D694E:
setbyte 2023FD8 00
1D6954:
moveend 00 00
1D6957:
end

So I can't make a tutorial but that's a little something I was able to figure out on my own.
 

Attachments

  • Screenshot (685)_LI - Copy.jpg
    Screenshot (685)_LI - Copy.jpg
    306.6 KB · Views: 10
853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
ok so learned some more stuff, so thought I'd update this.

Here's the deal.

Each rom is built with a set of pre-defined battle script commands.

and each battle script accomplishes its tasks by making use of said commands.


Each command has its own built in conditions and functions,
and in most cases if you wanted to make a new effect or change how an existing effect work.

It would actually involve changing the commands used within the battle script.

either changing what the command is doing/referring to,

adding another command,

or removing the command all together.


A simple example is,

say you wanted to make a move that had the "effect" of having infinite pp i.e never running out.

To accomplish that you would need to make sure the effect's battle script doesn't have the ppreduce command.

That way even you'd set the PP to 1, it would just never decrease.



I've also learned that every "jump" command, is referring to another battle script.

So tells it if said condition is met, then jump to so and so battle script.

Ok that's what I've got, so hopefully someone can make use of that to do something cool.

Everything I've learned on this has been from switching over to decomp and spending a good amount of time just staring at the code.
 
1
Posts
1
Years
  • Age 25
  • Seen Feb 6, 2023
ADRESS:
X
goto <2D8A00>

in the HMA with this code it does Hit + effect, this was what I discovered texting I hope it helps and there is more update on this topic ( "ADRESS" is the address where the code is engraved)

WHERE X :

setbyte 0x02024335 1 Sleep

setbyte 0x02024335 2 poison

setbyte 0x02024335 3 burn

setbyte 0x02024335 4 frozen

setbyte 0x02024335 5 paralyse

setbyte 0x02024335 6 bad poison

setbyte 0x02024335 7 confuse

setbyte 0x02024335 8 flinch

setbyte 0x02024335 9 par/bur/frez

setbyte 0x02024335 10 uproar effect

setbyte 0x02024335 11 more money

setbyte 0x02024335 12 ?????

setbyte 0x02024335 13 sand tomb effect

setbyte 0x02024335 14 recoil

setbyte 0x02024335 15 up atack 1 oponente

setbyte 0x02024335 16 up defense 1 oponente

setbyte 0x02024335 17 up speed 1 oponente

setbyte 0x02024335 18 up sp.atk 1 oponente

setbyte 0x02024335 19 up sp.def 1 oponente

setbyte 0x02024335 20 up accuracy 1 oponente

setbyte 0x02024335 21 up evassive 1 oponente

setbyte 0x02024335 22 down atack 1 oponente

setbyte 0x02024335 23 down defense 1 oponente

setbyte 0x02024335 24 down speed 1 oponente

setbyte 0x02024335 25 down sp.atk 1 oponente

setbyte 0x02024335 26 down sp.def 1 oponente

setbyte 0x02024335 27 down accuracy 1 oponente

setbyte 0x02024335 28 down evassive 1 oponente

setbyte 0x02024335 29 oponente recharge

setbyte 0x02024335 30 rage effect??

setbyte 0x02024335 31 ?????

setbyte 0x02024335 34 up all stats 1 self

setbyte 0x02024335 37 down atack and defense 1 self

setbyte 0x02024335 38 recoil

setbyte 0x02024335 39 up atack 2 oponente

setbyte 0x02024335 40 up defense 2 oponente

setbyte 0x02024335 41 up speed 2 oponente

setbyte 0x02024335 42 up sp.atk 2 oponente

setbyte 0x02024335 43 up sp.def 2 oponente

setbyte 0x02024335 44 up accuracy 2 oponente

setbyte 0x02024335 45 up evassive 2 oponente

setbyte 0x02024335 46 down atack 2 oponente

setbyte 0x02024335 47 down defense 2 oponente

setbyte 0x02024335 48 down speed 2 oponente

setbyte 0x02024335 49 down sp.atk 2 oponente

setbyte 0x02024335 50 down sp.def 2 oponente

setbyte 0x02024335 51 down accuracy 2 oponente

setbyte 0x02024335 52 down evassive 2 oponente

setbyte 0x02024335 53 outrage effect???

setbyte 0x02024335 59 down sp.atk 2 self

setbyte 0x02024335 65 self sleep

setbyte 0x02024335 66 self poison

setbyte 0x02024335 67 self burn

setbyte 0x02024335 68 self frozen

setbyte 0x02024335 69 self paralyse

setbyte 0x02024335 70 self bad poison

setbyte 0x02024335 71 self confusion

setbyte 0x02024335 73 paralyse

setbyte 0x02024335 74 uproar effect

setbyte 0x02024335 75 more money

setbyte 0x02024335 76 repeat atack

setbyte 0x02024335 77 self effect sand tomb

setbyte 0x02024335 78 recoil

setbyte 0x02024335 79 up atack 1 self

setbyte 0x02024335 80 up defense 1 self

setbyte 0x02024335 81 up speed 1 self

setbyte 0x02024335 82 up sp.atk 1 self

setbyte 0x02024335 83 up sp.def 1 self

setbyte 0x02024335 84 up accuracy 1 self

setbyte 0x02024335 85 up evassive 1 self

setbyte 0x02024335 86 down atack 1 self

setbyte 0x02024335 87 down defense 1 self

setbyte 0x02024335 88 down speed 1 self

setbyte 0x02024335 89 down sp.atk 1 self

setbyte 0x02024335 90 down sp.def 1 self

setbyte 0x02024335 91 down accuracy 1 self

setbyte 0x02024335 92 down evassive 1 self

setbyte 0x02024335 93 self recharge

setbyte 0x02024335 98 up all stats 1 self

setbyte 0x02024335 101 down atack/defense 1 self

setbyte 0x02024335 102 recoil

setbyte 0x02024335 103 up atack 2 self

setbyte 0x02024335 104 up defense 2 self

setbyte 0x02024335 105 up speed 2 self

setbyte 0x02024335 106 up sp.atk 2 self

setbyte 0x02024335 107 up sp.def 2 self

setbyte 0x02024335 108 up accuracy 2 self

setbyte 0x02024335 109 up evassive 2 self

setbyte 0x02024335 110 down atack 2 self

setbyte 0x02024335 111 down defense 2 self

setbyte 0x02024335 112 down speed 2 self

setbyte 0x02024335 113 down sp.atk 2 self

setbyte 0x02024335 114 down sp.def 2 self

setbyte 0x02024335 115 down accuracy 2 self

setbyte 0x02024335 116 down evassive 2 self

setbyte 0x02024335 117 outrage effect

setbyte 0x02024335 123 down sp.atk 3 self

setbyte 0x02024335 129 sleep

setbyte 0x02024335 130 poison

setbyte 0x02024335 131 burn

setbyte 0x02024335 132 frozen

setbyte 0x02024335 133 paralyse

setbyte 0x02024335 134 bad poison

setbyte 0x02024335 135 confusion

....... continue repeat list
 
Back
Top