• 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.

[ARCHIVE] Simple Questions (SEARCH BEFORE ASKING A QUESTION)

Status
Not open for further replies.
22
Posts
11
Years
  • Seen Jan 18, 2015
Hey guys! Hope someone can help me with a little (scripting) question I have: how do I make the sound return to normal at the end of a script? For example, my background music is Mt. Moon standard (0x120 if I'm not mistaken), and for the duration of an event I changed it to 0x11C). However, since I noticed it didn't just revert back to the default (I found somewhere that pause 0xA should accomplish something along these lines, but that didn't help either), I simply told it to play music 0x120. However, in a later event in the same map, which heals your pokemon, the game plays the pokemon healing music (0x100) at the same time as the Mt. Moon music, which sounds horrible.

So my question, really: is there a scripting command that pauses the music currently playing?
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Hey guys! Hope someone can help me with a little (scripting) question I have: how do I make the sound return to normal at the end of a script? For example, my background music is Mt. Moon standard (0x120 if I'm not mistaken), and for the duration of an event I changed it to 0x11C). However, since I noticed it didn't just revert back to the default (I found somewhere that pause 0xA should accomplish something along these lines, but that didn't help either), I simply told it to play music 0x120. However, in a later event in the same map, which heals your pokemon, the game plays the pokemon healing music (0x100) at the same time as the Mt. Moon music, which sounds horrible.

So my question, really: is there a scripting command that pauses the music currently playing?

Here is a list of every single command by thethethethe. This list is kind of old, but I have yet to find a problem. Maybe some of the higher level commands are a little outdated but it still is extremely useful:

Spoiler:


Here is a link to the original post: http://thethethethesromhacking.weebly.com/commands.html

I have also taken the liberty of highlighting all sound and music commands I saw in Red. Hope this helps!
 

Blah

Free supporter
1,924
Posts
11
Years
ill try that later tonight but now i have come across another problem,i did a trainer battle script and it all is orking perfectly up to the point of the trainer, the battle starts,text good,but it isnt the trainer i saved, i did the 1st one
001
which is an aqua person with ekans
and i changed it to a full team and it puts that,but when i reopen the rom it shows what i did

Post the script? Other than the fact that it's not working, I can't tell anything else from you inquiry. Make sure your trainer ID is not the wrong remember and that the second parameter is trainer ID and that it IS in hex.
 
215
Posts
11
Years
  • Seen Jul 14, 2020
Hey is there a program that tells you which flags/variables are being used and which ones aren't? I haven't scripted in a while and I forgot which variables and flags I used and I don't want to re-use them :P

Also is there a list of variables and flags used in POKEMON FIRE RED? Because I used JPANs Fire Red Hack Engine and I am assuming that made some flags/variables avilable and I would love to not waste them :P

One last question, can your flags/variables only be numbers? Can I have a flag or variable with the value 0x800A, 0x800B, 0x800C, 0x800D, 0x800E, 0x800F

Thanks alot for helping! :)
 
947
Posts
11
Years
I am wondering if there is a simple way to prevent the usability of Pokéballs in a specific wild battle?!
How about disabling the "release" option in the PC's boxes?

Hey is there a program that tells you which flags/variables are being used and which ones aren't? I haven't scripted in a while and I forgot which variables and flags I used and I don't want to re-use them :P
I don't think so. :/ You should have made some kind of a note/list of your own variables, flags, IDs, ... x)
Also is there a list of variables and flags used in POKEMON FIRE RED? Because I used JPANs Fire Red Hack Engine and I am assuming that made some flags/variables avilable and I would love to not waste them :P
Yes, you can find the list in pretty much any tutorial. If you already have XSE tool, you can find the list in the guide (press F2)
One last question, can your flags/variables only be numbers? Can I have a flag or variable with the value 0x800A, 0x800B, 0x800C, 0x800D, 0x800E, 0x800F
If I am not mistaken, flags can be either 1 or 0. Variables can stock from 0x0000 up to 0xFFFF I guess, hence why we use 2 variable to stock biggers values such as pointers. Also, try to use flags and variables as less as possible, there is no 100% confirmed list of already used/not-used variables so you can never know if such or such flag/variable would unexpectedly change its value. xD
 
Last edited:

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
I am wondering if there is a simple way to prevent the usability of Pokéballs in a specific wild battle?!
How about disabling the "release" option in the PC's boxes?


I don't think so. :/ You should have made some kind of a note/list of your own variables, flags, IDs, ... x)

Yes, you can find the list in pretty much any tutorial. If you already have XSE tool, you can find the list in the guide (press F2)

If I am not mistaken, flags can be either 1 or 0. Variables can stock from 0x0000 up to 0xFFFF I guess, hence why we use 2 variable to stock biggers values such as pointers. Also, try to use flags and variables as less as possible, there is no 100% confirmed list of already used/not-used variables so you can never know if such or such flag/variable would unexpectedly change its value. xD



I will help you out a bit. Flags are stored in bits. By now you should know that a byte is 8 bits or a binary number of 8 characters. Binary numbers can only have the characters of 0 or 1. So, a single byte can hold 8 flags. In fact, flags are stored just before var 4000, so the amount of usable flags are in the var space for about var 3000+.

To check which flags you have used, I would suggest going through all of the scripts you made and making a list, especially when flags are turned on and then back off again, as checkflag command might not let you know if it was indeed used.

In JPAN's engine, any and all storyline flags and vars are good to use since every storyline script has been cleared.

Here is a nice list of used flags and vars in FR: http://www.pokecommunity.com/showthread.php?p=6829256#post6829256

The post has a follow-up here: http://www.pokecommunity.com/showpost.php?p=6902344&postcount=183

[bookmark this^^^!!!!! I use it far too often.]





Now for your question. I believe JPAN has a routine for un-catchable pokemon. Search around and try and find it. For the second one, it is probobly a special multi-choice box that you would just need to edit the script for.
 
215
Posts
11
Years
  • Seen Jul 14, 2020
Hey Karatekid Thanks a lot! I think you're my favorite person on this website because you are so helpful! :)
Mind if I ask more questions about it however? I just want to be very clear because I don't want to mess up my ROM by reusing variables :P

So for the Post by DavidJCobb, is he saying I can use any variables except the ones between 4000 and 7FFF? (So I would be able to use variables 0001,0002,0003,0004 and so on?)
And is he saying I can use any flags after 8C2? (so I can use flag 1000,1001,1002 and so on?)

please let me know :)
Thanks a lot for your help once again! :)
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Hey Karatekid Thanks a lot! I think you're my favorite person on this website because you are so helpful! :)
Mind if I ask more questions about it however? I just want to be very clear because I don't want to mess up my ROM by reusing variables :P

So for the Post by DavidJCobb, is he saying I can use any variables except the ones between 4000 and 7FFF? (So I would be able to use variables 0001,0002,0003,0004 and so on?)
And is he saying I can use any flags after 8C2? (so I can use flag 1000,1001,1002 and so on?)

please let me know :)
Thanks a lot for your help once again! :)

Don't forget to thank @kurapika, he gave you some help too!




Now, no that was not what he was saying. Flags above 900 overlap the ram used for vars 4000 and up. This means that you can use them (1 var takes the same amount of space as 16 flags) but you have to be EXTREMELY careful. You need to make sure the var you are replacing is safe, then, using the equation I posted in R&D, find the flags that fit in that var space. The most commonly used standard flags, especially on JPAN's engine (sice all the scripts are cleared) are the ones that have specific story implications that have been removed. The most common of this set being 200-2FF, but before you ever decide to use a flag, check that list to make sure it is safe. Just as a main thing, flags 500-700 are trainer flags, don't touch them. Saftey is Key!!!!

Now for safe vars- that was what the second post mainly dealt with. Nothing under 4000, the vars under 4000 overlap ram for flags. Not good.

  • Variables 0x4100 to 0x417F (inclusive) overlap the RAM used for a special data type called "hidden variables" -- a set of 64 dwords used by certain script commands whose purpose is unknown.
  • Variables 0x5084 to 0x55CC overlap RAM used for seemingly-arbitrary data. I haven't noticed any ill effects from overwriting this data, but it changes frequently, so the variables themselves are unreliable.
  • Variables 0x56F4 - 0x5EF3 appear to also overlap RAM used for the PC. This doesn't match with JPAN's findings (the 0x5EF4 figure is from him) so either one of us is wrong, or this variable range overlaps non-essential parts of the PC data.
My suspicion -- an unconfirmed one -- is that the only safe variables are those from 0x4000 to 0x40FF (inclusive), excluding variables in that range that are set or read by the core game engine (as opposed to those used by scripts that can be safely removed).

Now, looking above is a quote from said post, we know deffinatly that you can use vars 4000-40FF. Make sure they aren't used by the game, though. Also, i have used vars in the 5000's very nicely with no problems, so I believe that 5000-5083 are also quite safe.

Judging from the above post also, there is no mention of vars above 417F. These may be safe. [Could a good ASM hacker, one with more experience than me confirm this? I'll have to bring this up on IRC later....] So for now, leave them alone. Vars 4180-5000 have good chance of being safe, but I'm not certain, so refrain from using them.


I hope this cleared some things up a bit, good luck!:D
 
241
Posts
11
Years
Sooo is there a way to change what level trade pokemon obey you at with each badge? I'd assume it'd be a simple hex edit somewhere, but I don't know how to go searching...
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Sooo is there a way to change what level trade pokemon obey you at with each badge? I'd assume it'd be a simple hex edit somewhere, but I don't know how to go searching...

Most likely, it is a part of the routine that is carried out when you tell your pokemon to attack. It probobly runs though and sees your highest badge, then branches off, checks if the pokemon's and your IDs match, then, if not, compares the levels and sees if the pokemon is higher, if so, it goes on to calculate the chance of the pokemon not obeying. If any one of the checks passes, the routine return to the starting point and runs as normal. I have not a clue as to where said routine is located though:/. I just stared learning ASM and still have trouble finding things like that. I wish I could help more.
 

ep!c

Banned
124
Posts
11
Years
  • Seen Jan 4, 2015
Well, you obtain the bagde as soon as you set the flag.
If you got VBA-SDL-H set a breakpoint on this flag.
The VBA-SDL-H will stop as soon as you reached this position.

Now look into the log and you see the assembler code.
Type "n", press Enter and you jump to the next line of the code.

Now just interpret the code as good as you can, maybe you find a mov r0, #0x46 or such a thing..

(0x46 is 70 in decimal)
 
215
Posts
11
Years
  • Seen Jul 14, 2020
Ooooh I didn't even see kurapika's post! Thank you kurapika and Thank you Karatekid552!!!
You guys completely answered all my questions and for that I thank you. But now I have another question on a different topic.

I am working on my Pokemon ROM and in one part, I have a lot of sprites (9 Pokeballs, 6 Trainers and the player. So in total 15 person events + the player on the screen at once) while I am at that part of the game, some of the sprites will appear and reappear, any reason why this happens?

I am assuming there is a person event limit you can have on the screen (like 12 or something) but I just want to make sure that is the case :P

also anyone have the list of the different text colors I can use?
I know 0x0 is blue, 0x1 is red and 0x2 is black, but I need green :P
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
I am assuming there is a person event limit you can have on the screen (like 12 or something) but I just want to make sure that is the case :P

I've encountered the same problem during my hacking time with Life of Guardians, and yes, I believe there is a limit of how many NPCs are to be displayed on the screen. :\
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
Most likely, it is a part of the routine that is carried out when you tell your pokemon to attack. It probobly runs though and sees your highest badge, then branches off, checks if the pokemon's and your IDs match, then, if not, compares the levels and sees if the pokemon is higher, if so, it goes on to calculate the chance of the pokemon not obeying. If any one of the checks passes, the routine return to the starting point and runs as normal. I have not a clue as to where said routine is located though:/. I just stared learning ASM and still have trouble finding things like that. I wish I could help more.
These kind of routines are often found with debugging. If you've got "nothing" to begin with, you might want to first look for the asm routine used for giving you a badge. For this, you also use debugger by tracking down the routine used by that "givebadge X" command.

If I was to do that myself, I would start looking what is executed when you talk to a person event which does nothing more than give you a certain badge and execute "return to gameplay" then.

Once you've found the asm routine used to give you a badge, you'll also find where in ram 1 is written and next, you start debugging the obeying routine using this ram address as a breakpoint. The program will stop executing code when this ram address is looked for during the code which, like you said, happens next to the code of comparing the ID of the pokemon attacking to the ID of the player.

You modify the routine there and... job finished.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Most likely, it is a part of the routine that is carried out when you tell your pokemon to attack. It probobly runs though and sees your highest badge, then branches off, checks if the pokemon's and your IDs match, then, if not, compares the levels and sees if the pokemon is higher, if so, it goes on to calculate the chance of the pokemon not obeying. If any one of the checks passes, the routine return to the starting point and runs as normal. I have not a clue as to where said routine is located though:/. I just stared learning ASM and still have trouble finding things like that. I wish I could help more.

Having looked at the code which takes care of this, I can tell you you're nearly 100% right. The code is pretty simple, it checks the flags which are tied to the badges, and branches if they're set. It then compares the Pokémon's level against a hard coded value, which would be easy to change with a simple hex edit. It then performs a random if the Pokémon's OTID doesn't match yours. If I remember right, it's a weighted random. That is, the higher over the level cap, the more likely it is to disobey. However, what would be better would be rewriting if to support more flags and level caps. Reading from tables is always a good way to support such extendability.
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years


I've encountered the same problem during my hacking time with Life of Guardians, and yes, I believe there is a limit of how many NPCs are to be displayed on the screen. :\

This I know is a definable. The game can only have so many OAMs displayed at once.

Having looked at the code which takes care of this, I can tell you you're nearly 100% right. The code is pretty simple, it checks the flags which are tied to the badges, and branches if they're set. It then compares the Pokémon's level against a hard coded value, which would be easy to change with a simple hex edit. It then performs a random if the Pokémon's OTID doesn't match yours. If I remember right, it's a weighted random. That is, the higher over the level cap, the more likely it is to disobey. However, what would be better would be rewriting if to support more flags and level caps. Reading from tables is always a good way to support such extendability.

Awesome, my guessing skills are getting better. I was actually banking on the hope that you or Darth would come along and see this and give me some help.:p Now to find it....

These kind of routines are often found with debugging. If you've got "nothing" to begin with, you might want to first look for the asm routine used for giving you a badge. For this, you also use debugger by tracking down the routine used by that "givebadge X" command.

If I was to do that myself, I would start looking what is executed when you talk to a person event which does nothing more than give you a certain badge and execute "return to gameplay" then.

Once you've found the asm routine used to give you a badge, you'll also find where in ram 1 is written and next, you start debugging the obeying routine using this ram address as a breakpoint. The program will stop executing code when this ram address is looked for during the code which, like you said, happens next to the code of comparing the ID of the pokemon attacking to the ID of the player.

You modify the routine there and... job finished.

I know how to debug and modify routines. It's more of a where do I start? kind of thing.:p So, thanks for giving me that clue, I'll see if I can find it!
 
Last edited:
103
Posts
15
Years
How would I go about gender based rivals as I plan to put two gender based rival Green/Red & Kris/Ethan and I have no idea how to do that so if you could point the way that would be great
 
215
Posts
11
Years
  • Seen Jul 14, 2020
I have a stupid question that i'm pretty sure I know the answer to already, but is there away to add more memory to your ROM? I have a very bad feeling that I will run out of varibales and offsets eventually if I make my game. I just don't want to be in half way through my game then realise that I can't make anymroe because I have ran out of variables and memory.
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
How would I go about gender based rivals as I plan to put two gender based rival Green/Red & Kris/Ethan and I have no idea how to do that so if you could point the way that would be great

A command called "checkgender" will help you. Just set it up so that based upon which gender, it runs different scripts, activates different battles, and, in turn, creates gender based rivals. Full documentation for it can be found in diegoisawesome's XSE tutorial.

I have a stupid question that i'm pretty sure I know the answer to already, but is there away to add more memory to your ROM? I have a very bad feeling that I will run out of varibales and offsets eventually if I make my game. I just don't want to be in half way through my game then realise that I can't make anymroe because I have ran out of variables and memory.

No way that I know of to add more variables and memory in the RAM, but you can increase the rom size from 16mb to 32mb using a function in XSE version 1.1.1, it is in one of the top menus.
 
Last edited:
Status
Not open for further replies.
Back
Top