cooley
///Keepin' it simple
- 1,148
- Posts
- 18
- Years
- United States
- Seen Dec 5, 2014
How to create a Level Script
Yes, another tutorial, due to the large amount of level script questions
Note: Before reading, please learn some scripting first.
You all may think that making a level script is really hard, and categorize it in the same field as ASM hacking. Well, it isn't hard, at all.
This is what a level script looks like:
The most important part is the "setvar 0x4033 0x1". Without this in this 'type' of level script, then you will get a repeating level script.
Well, that's the tutorial... "I'll add more Later" xD
Nah, only joking :P
Okay, the first thing you would do is head on over to the Header Tab, in A-map. I'm pretty sure, everyone knows where that is.
If you look down a little, you will see this:
Click on add, and then click on "script type". You should see a drop-down menu like this:
All of these are different types of Level scripts. The one you most likely want is the one that is highlighted.
"01 'setmaptile' script" is not the official name, but it's used in the Pokemart in Viridian City. It's purpose is in it's name; which is to setmaptile(s) before the map loads. It's not as fast as:
"04 Validates valus, loads handler to 0x03000F28" which is used to make something happen the instant you walk into the entrance/exit of the map. It's used in the PLAYER's Room to make him face up towards the Nintendo. The best time to use this is in houses or places you warp to, not like routes and towns where you walk into.
"03 On entering map/not on menu close" This is a multipurpose one. You can checkflags, compare vars, and other things and use them to make other things happen. There are a lot of these, so there is also a lot to learn from by decompiling Nintendo's scripts.
Last but not least, "02 Validates values, loads handler to 0x03000EB0". The one that most people use to make a level script. This one, you can literally use almost all the commands, like msgbox, applymovement, fadescreen, etc. But the catch is that I haven't found a way to use it like "checkflag 0x828/if 0x1 goto @done" because once you set the var, it's set... But don't worry, I'll find a way.
Okay, once you've clicked on "02 Validates values....." You will see the script offset and script offset 2 boxes are "$000000". Also the Flag and Value boxes should be 0000 too.
Compile your Level script [make sure it has a setvar 0x(variable) 0x(value) in the script though]
According to score_under:
Click Save map scripts and the Script offset box contents should change.
Save from the File menu(Ctrl+S) and play your ROM.
Wow, the level script really worked!!!
But...
Advance Map overwrites the 0000 that you put into the Value box, with FFFF. And since it's subtracted by 1, and FFFF is the highest number you can insert, the level script glitches up.
To fix this, you go to the header tab, and press Ctrl+H to get professional header view. You should see an area called "Map Options". And within it you should see "Map script offset"
Copy the map script offset, and open your ROM in XSE.
Once done, paste the offset in the "decompile box" and click on "level script"
(This is the old XSE, but they both function similarly.)
After you've pasted the offset, and toggle the level script decompile feature (last button to the right) click decompile or "Shift+Ctrl+D"
ATTENTION: OLD XSE! IF YOURS LOOKS LIKE THIS, THEN YOU NEED A SERIOUS UPDATE!
This is the important part. The 0xFFFF needs to be 0x0 so change it to 0x0 and compile. You should see the compiler log:
Now your Level script should work, no problems at all...
That was easy, right Staples?
Make a level script inactive until a certain event happens
Okay, so you've had fun with Level scripts, and you're both good friends. But... You walk into a map, and need a level script to activate, but not the first or second time you enter the map, but the 5th time!
Video Demonstration:
For this to work, you will need the cooperation of two maps. For my example I used the Player's room [PALLET TOWN (4.0)] and PALLET TOWN (3.0) map.
In the Player's room the level script is Level script type 03 "On entering map/not on menu close":
I set the var to 0x1 so that the level script in Pallet town is deactivated. Hope you understood that.
This should clear things up. Here is the level script in Pallet Town:
Pretty simple huh? Basically, the level script won't activate, because the variable has been set already.
Since you enter Your Room before exited your house into Pallet town, the level script in Pallet town wont work. [/DUMBEDDOWN]
You should be outside of your house. I assigned the Daisy(Gary's sister) in Pallet town this script, as seen in the video:
Don't mind the "\c\h08ó" . That's just how I make my msgs. It doesn't affect the outcome at all, just added for special effects :P
And once you talk to DAISY, walk out her house, and it should start raining, just like in the Video :)
I guess that's that...
Anything else you need to know, ask here, I'll see if I can answer!
Thanks for reading!
Yes, another tutorial, due to the large amount of level script questions
Note: Before reading, please learn some scripting first.
You all may think that making a level script is really hard, and categorize it in the same field as ASM hacking. Well, it isn't hard, at all.
This is what a level script looks like:
Code:
[FONT=Segoe UI][SIZE=2]#dynamic 0x800000[/SIZE]
[/FONT][FONT=Segoe UI][SIZE=2]#org @start[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]msgbox @string 0x6[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]setvar 0x4033 0x1[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]release[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]end[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#org @string 0x6[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]= You see?\nThe level script worked![/SIZE]
[/FONT]
The most important part is the "setvar 0x4033 0x1". Without this in this 'type' of level script, then you will get a repeating level script.
Well, that's the tutorial... "I'll add more Later" xD
Nah, only joking :P
Okay, the first thing you would do is head on over to the Header Tab, in A-map. I'm pretty sure, everyone knows where that is.
If you look down a little, you will see this:
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i35.tinypic.com/2dbmo2p.jpg)
Click on add, and then click on "script type". You should see a drop-down menu like this:
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i34.tinypic.com/efm39v.jpg)
All of these are different types of Level scripts. The one you most likely want is the one that is highlighted.
"01 'setmaptile' script" is not the official name, but it's used in the Pokemart in Viridian City. It's purpose is in it's name; which is to setmaptile(s) before the map loads. It's not as fast as:
"04 Validates valus, loads handler to 0x03000F28" which is used to make something happen the instant you walk into the entrance/exit of the map. It's used in the PLAYER's Room to make him face up towards the Nintendo. The best time to use this is in houses or places you warp to, not like routes and towns where you walk into.
"03 On entering map/not on menu close" This is a multipurpose one. You can checkflags, compare vars, and other things and use them to make other things happen. There are a lot of these, so there is also a lot to learn from by decompiling Nintendo's scripts.
Last but not least, "02 Validates values, loads handler to 0x03000EB0". The one that most people use to make a level script. This one, you can literally use almost all the commands, like msgbox, applymovement, fadescreen, etc. But the catch is that I haven't found a way to use it like "checkflag 0x828/if 0x1 goto @done" because once you set the var, it's set... But don't worry, I'll find a way.
Okay, once you've clicked on "02 Validates values....." You will see the script offset and script offset 2 boxes are "$000000". Also the Flag and Value boxes should be 0000 too.
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i34.tinypic.com/14o9501.jpg)
Compile your Level script [make sure it has a setvar 0x(variable) 0x(value) in the script though]
According to score_under:
score_under said:It does not have to be subtracted by 1. The reason we use 0x0 in the Value box is because the var starts at 0. The Value box dictates which value the var has to be to start the script. After the script, you set it to 1 (or indeed any other value if you choose to), and this means it no longer equals zero, so no longer activates.
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i35.tinypic.com/vq1a8l.jpg)
Click Save map scripts and the Script offset box contents should change.
Save from the File menu(Ctrl+S) and play your ROM.
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i37.tinypic.com/wvbonb.jpg)
Wow, the level script really worked!!!
But...
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i36.tinypic.com/2vrss37.jpg)
Advance Map overwrites the 0000 that you put into the Value box, with FFFF. And since it's subtracted by 1, and FFFF is the highest number you can insert, the level script glitches up.
To fix this, you go to the header tab, and press Ctrl+H to get professional header view. You should see an area called "Map Options". And within it you should see "Map script offset"
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i37.tinypic.com/rshsaq.jpg)
Copy the map script offset, and open your ROM in XSE.
Once done, paste the offset in the "decompile box" and click on "level script"
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i37.tinypic.com/205cqc6.jpg)
(This is the old XSE, but they both function similarly.)
After you've pasted the offset, and toggle the level script decompile feature (last button to the right) click decompile or "Shift+Ctrl+D"
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i33.tinypic.com/a5gsk9.jpg)
ATTENTION: OLD XSE! IF YOURS LOOKS LIKE THIS, THEN YOU NEED A SERIOUS UPDATE!
Code:
[FONT=Segoe UI][SIZE=2]#org 0x71A242[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word 0x0[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word 0x0[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw pointer 0x880007D[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word [B]0xFFFF[/B][/SIZE]
[/FONT]
Code:
[FONT=Segoe UI][SIZE=2]#org 0x71A242[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word 0x0[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word 0x0[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw pointer 0x880007D[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word [B]0x0[/B][/SIZE]
[/FONT]
This is the important part. The 0xFFFF needs to be 0x0 so change it to 0x0 and compile. You should see the compiler log:
![[PokeCommunity.com] Creating Level Scripts [PokeCommunity.com] Creating Level Scripts](https://i38.tinypic.com/2jepm3n.jpg)
Now your Level script should work, no problems at all...
That was easy, right Staples?
Make a level script inactive until a certain event happens
Okay, so you've had fun with Level scripts, and you're both good friends. But... You walk into a map, and need a level script to activate, but not the first or second time you enter the map, but the 5th time!
Video Demonstration:
For this to work, you will need the cooperation of two maps. For my example I used the Player's room [PALLET TOWN (4.0)] and PALLET TOWN (3.0) map.
In the Player's room the level script is Level script type 03 "On entering map/not on menu close":
Code:
#org 0x800000
setvar 0x4010 0x1
release
end
I set the var to 0x1 so that the level script in Pallet town is deactivated. Hope you understood that.
This should clear things up. Here is the level script in Pallet Town:
Code:
'---------------
#org 0x800007
setweather 0x4
doweather
applymovement MOVE_PLAYER 0x8800052
waitmovement 0xFF
sound 0x15
pause 0x32
msgbox 0x880002B MSG_NORMAL '"Oh, boy[.]\pJust my luck, it's rai..."
setvar 0x4010 0x1
release
end
'---------
' Strings
'---------
#org 0x80002B
= Oh, boy[.]\pJust my luck, it's raining!
'-----------
' Movements
'-----------
#org 0x800052
#raw 0x62 'Exclamation Mark (!)
#raw 0xFE 'End of Movements
Pretty simple huh? Basically, the level script won't activate, because the variable has been set already.
Since you enter Your Room before exited your house into Pallet town, the level script in Pallet town wont work. [/DUMBEDDOWN]
You should be outside of your house. I assigned the Daisy(Gary's sister) in Pallet town this script, as seen in the video:
Code:
'---------------
#org 0x800054
msgbox 0x8800064 MSG_NORMAL '"Setting Variable 0x4010 back to 0x..."
setvar 0x4010 0x0
release
end
'---------
' Strings
'---------
#org 0x800064
= Setting Variable 0x4010 back to 0x0\n\c\h08ó. \c\h08ó. \c\h08ó.Done!
Don't mind the "\c\h08ó" . That's just how I make my msgs. It doesn't affect the outcome at all, just added for special effects :P
And once you talk to DAISY, walk out her house, and it should start raining, just like in the Video :)
I guess that's that...
Anything else you need to know, ask here, I'll see if I can answer!
Thanks for reading!
Last edited by a moderator: