Thread: [Tutorial] Setting Scripts on Tiles
View Single Post
  #1    
Old October 13th, 2013 (08:52 PM).
ep!c ep!c is offline
Banned
 
Join Date: Mar 2013
Gender: Male
Posts: 124
Send a message via Skype™ to ep!c
Setting Scripts on Tiles

Hello everyone.
Today I gonna show you, how to set scripts on tiles and how to expand the table up to FF.
I'm sure you all know these behaviour bytes in the block editor of AdvanceMap.
We're gonna edit the behaviour bytes 0x81 to 0xFF.

Expanding the table

Open your hex-editor and go to the offset 0x06D244.
There is a pointer, which points to the scripts from tiles 0x81 to 0x8F.
As we want more than just 15 Scripts, we repoint this table.
Replace the pointer at 0x06D244 with another pointer with free space..

Spoiler:


In my tutorial, I will use the offset 0xA60000 as new table-offset.

Setting up the table

Now we need to write our scripts, all next to each other at the table.
For example, I want to make a script on behaviour-byte 0x81.
Then I have to put this script FIRST in the table.
The SECOND is 0x82, the THIRD 0x83 ... etc.
Funny fact: These scripts must be next to each other without FF byte between them!

Open your XSE-Editor and load your ROM.
Write your script, for example, like this:

Spoiler:


As dynamic offset for textes, applymovements etc we use 0xA80000.
But keep in mind, that we must use #org 0xA60000 and not a dynamic expression
like "#org @start"!

Compile your Script and open your hex-editor once again.
Jump again to position A60000 and see what changed..


Spoiler:


Yeah, this is our Script, beginning with 0x23, the callasm command.
Now look after the script. The free space begins again at 0xA60010.
I want to make another Tile-Script.
This time, I use 0xA60010 as my starting offset...

Spoiler:


Now reopen the ROM-file in your hex-editor and we again see what changed.

Spoiler:


Right after our 0x81-Script, we made our 0x82-Script!
The free space begins at 0xA60019 and as you might guess, this is your next
Script-Offset for the 0x83-behaviour-byte.
I'm sorry that you must always reopen your file in the hexeditor and look which
script-offset you have to use next.. ^.^

Whats left..?

Using AdvanceMap for setting behaviour-bytes

So, open AdvanceMap and click on this purple puzzle picture.
Now you're in the block-editor.
Select the tile, which you want to set the behaviour-byte on.

Spoiler:


I want to set my Tree-tile to a script.
Normally I would use a headbutt-script, but.. whatever ^.^
Look at the marked thing on your right.
These are the behaviour bytes.
For example, I want to set my first script on this tile, means 0x81.

Spoiler:

(sorry that i made the screen wrong.. I inserted 0x81 of course.)


Save your file in AdvanceMap and..

Testing the result in VBA or No$GBA

Open your favourite emulator and load your ROM.
Now go to a Map, where this tile is on, and click the A-button.

Spoiler:


Yay, we got it working

If you want to make requests for other ROMs or just have a problem/question
write it in this tutorial thread, please, and don't write me PMs..

Gl&Hf!
Reply With Quote