The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script SOLVED [FireRed] Questions: Comparing & National Dex

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old May 2nd, 2018 (12:36 PM). Edited May 2nd, 2018 by dot hash.
dot hash's Avatar
dot hash dot hash is offline
 
Join Date: Mar 2015
Location: UK
Gender: Male
Nature: Quirky
Posts: 75
I am trying to make a script:
Check if the player has seen at least 10 PKMN in the national dex.
Then if they have, give them an Old Rod.
It seems to work.

Script:
Spoiler:

'---------------
#org 0x106473C
lock
faceplayer
checkflag 0x1011
if 0x1 goto 0x9064253
msgbox 0x9064269 MSG_FACE '"Ah... yes! Don't say a word! I can..."
setvar 0x8005 0x1
special 0xD4
compare 0x8005 0xA
if 0x0 goto 0x906425E
msgbox 0x90642BF MSG_FACE '"Crawling through caves...\pRunning..."
giveitem 0x106 0x1 MSG_OBTAIN
setflag 0x1011
msgbox 0x9064400 MSG_FACE '"That's my Old Rod, from when I\nfi..."
release
end

'---------------
#org 0x1064253
msgbox 0x90644F9 MSG_FACE '"Ah, yes. I hope that Old Rod will\..."
release
end

'---------------
#org 0x106425E
msgbox 0x9064559 MSG_FACE '"Hmm... Or maybe not...\nListen, co..."
release
end


'---------
' Strings
'---------
#org 0x1064269
= Ah... yes! Don't say a word! I can\ntell you are the kind of kid who\lgets around!...

#org 0x10642BF
= Crawling through caves...\pRunning through fields...\pClimbing great mountains...\pCrossing huge oceans!\pSneaking into secret hideouts!\pSeeking out hidden temples and\nancient ruins!\pBusting into the houses of\ninnocent civilians and running\laround their rooms searching for\litems! Haha! I love a good\ladventure! Listen up!

#org 0x1064400
= That's my Old Rod, from when I\nfirst went out to study and catch\lPokémon. Now I know some people\lsay Old Rods can't catch anything\lgood! But listen, kid! I've caught\lplenty of baby Water type Pokémon\lwith that rod, and raised them to\lbe powerful!

#org 0x10644F9
= Ah, yes. I hope that Old Rod will\nhelp you out! Remember, there are\lother types of Rods, too!

#org 0x1064559
= Hmm... Or maybe not...\nListen, come see me after you have\lseen at least 10 kinds of Pokémon,\lI'll give you something to help\lyour adventuring! You don't have\lto catch them, just collect 10 in\lyour Pokédex as seen!


Two things I am not 100% sure about:

-Is this the right way to check if it is 10 or greater?
Or will this only allow it if it is exactly 10?
So there is another way to compare to 10 or greater than 10?

-Secondly, I had a bug in one test where even if I had seen 10, it did not work.
Am I correctly checking the 8005 variable?
I think special D4 writes national dex seen PKMN data there?
Is it affected by something else?

Thanks. :)
__________________
If I'm talking a lot, tell me to stop squandering my free time, and to go and work on my hack!
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old May 2nd, 2018 (2:34 PM).
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
Quote:
Originally Posted by dot hash View Post
-Is this the right way to check if it is 10 or greater?
Or will this only allow it if it is exactly 10?
So there is another way to compare to 10 or greater than 10?
The 'if' command has a number of mathematical operations it can use when comparing a variables value. diegoisawesome's XSE tutorial lists them so I'll quote them here:

Code:
Lower Than (0x0)
Equals (0x1)
Greater Than (0x2)
Lower than or Equal to (0x3)
Greater than or Equal to (0x4)
Not exactly equal to (0x5)
So while you used 'if 0x0' correctly in your script, there are other ways to achieve the same result if you have the syntax right.

Quote:
Originally Posted by dot hash View Post
Secondly, I had a bug in one test where even if I had seen 10, it did not work.
Am I correctly checking the 8005 variable?
I think special D4 writes national dex seen PKMN data there?
Is it affected by something else?
Yep, you're checking 0x8005 correctly. Special 0xD4 doesn't automatically check the National Dex though. If 0x8004 is equal to 0x0 it will check the Regional Dex, if it is any other value it will check the National Dex.

I'm pretty sure that line nine of your script (setvar 0x8005 0x1) is meant to be altering 0x8004 to check the National Dex instead. Perhaps that's why it didn't work one time? You saw too many post-151 Pokemon so you didn't see 10 in the regional Dex.

As an aside, as you're hacking FR, you're using some pretty dangerous flags. Flags above 0x900 start interferring with variables and that can cause a lot of problems. I'd strongly suggest reading this thread to learn which flags you should be using.
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old May 2nd, 2018 (3:20 PM). Edited May 2nd, 2018 by dot hash.
dot hash's Avatar
dot hash dot hash is offline
 
Join Date: Mar 2015
Location: UK
Gender: Male
Nature: Quirky
Posts: 75
Quote:
Originally Posted by DrFuji View Post
Thankyou, this is very helpful.
I had read about the flags, but forgot, there is a lot for me to take in the last couple of weeks of learning. :)
All questions answered really great!
__________________
If I'm talking a lot, tell me to stop squandering my free time, and to go and work on my hack!
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:14 AM.