The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script NPC Requests to See a Specific Pokemon Script?

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 September 23rd, 2019 (10:41 PM).
thugtality's Avatar
thugtality thugtality is offline
 
Join Date: Sep 2019
Location: Midwest, USA
Posts: 7
Hey guys,

I've been looking everywhere to try and figure out how I can implement a simple script into my Rom Hack that would play out like this, for example:

NPC: "I think Onix is the coolest! If you show me one, I'll give you something special."

*Player has Onix in party*

NPC: "Oh, wow, an Onix, thanks! Here you go, as promised!"

*NPC gives player Metal Coat or other item*

I'm fairly certain that these types of scripts exist even in the base game (Fire Red), and I've tried looking at some of the scripts in Pokemon Gaia, but they're already compiled and it's hard for me to make sense of them. Can anyone explain how to implement this and give me an example to go with it? I would really appreciate it.
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old September 25th, 2019 (5:55 AM).
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
In FR, the command 'special2 0xYYYY 0x147' will return the ID number of a Pokemon in your party to variable 0xYYYY. It takes the value of 0x8004, ranging between values 0x0 and 0x5 to determine which party member's ID number it should return. Knowing this, you can make a script with a simple loop which will gradually increment the value of 0x8004 until it has checked every party member's ID and branch out when the game finds an Onix. Here's a quick one that I whipped up for you with some comments to explain how it works:

Spoiler:
#dynamic 0x800000

#org @start
checkflag 0x200 // Flag check to see if the player has already gotten the reward
if 0x1 goto @AlreadyDone
msgbox @Coolest 0x2
setvar 0x8004 0x0 // Setting variable 0x8004 to 0x0, this will make special2 0x147 check the first Pokemon in the party
goto @Loop

#org @Loop
special2 0x8000 0x147 // The Pokemon in variable 0x8004's party slot's ID is put into variable 0x8000
compare 0x8000 0x5F // Checking if the ID in variable 0x8000 is equal to that of Onix
if 0x1 goto @HaveOnix // If the value is equal, branch off to the part of the script where you get the metal coat
addvar 0x8004 0x1 // Add 1 to variable 0x8004, this will change the party slot to check if we go back to the start of the loop
compare 0x8004 0x6 // If variable 0x8004 is equal to 0x6 at this stage, then we've checked every Pokemon in the party
if 0x5 goto @Loop // The script will go back to @Loop if 0x8004 has any value other than 0x6
msgbox @NoOnix 0x2
release
end

#org @HaveOnix
msgbox @OhWow 0x2
giveitem 0xC7 0x1 0x0
setflag 0x200 // Setting a flag to make sure the player can't get infinite Metal Coats
release
end

#org @AlreadyDone
msgbox @Thanks 0x2
release
end

#org @Coolest
= I think Onix is the coolest!\nIf you show me one, I'll give\lyou something special.

#org @NoOnix
= Sorry, you don't have an Onix...

#org @OhWow
= Oh, wow, an Onix, thanks!\nHere you go, as promised!

#org @Thanks
= Thanks for showing me that Onix!


Hopefully that helps.
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old September 25th, 2019 (9:28 PM).
PorygonParty's Avatar
PorygonParty PorygonParty is offline
 
Join Date: Mar 2017
Posts: 6
Would there happen to be a corresponding special for Emerald?
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old September 26th, 2019 (1:45 AM).
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
Yup, in Emerald special 0x149 works in exactly the same way as 0x147 in FR.
__________________
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old September 26th, 2019 (7:57 AM).
dGxx dGxx is offline
 
Join Date: Oct 2015
Gender: Male
Posts: 46
Now i understand thats how it checks a pkmn in ur party...but how would it check if i caught it, and not in my party?

For FR, please
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old September 30th, 2019 (6:40 PM).
thugtality's Avatar
thugtality thugtality is offline
 
Join Date: Sep 2019
Location: Midwest, USA
Posts: 7
Quote:
Originally Posted by DrFuji View Post
In FR, the command 'special2 0xYYYY 0x147' will return the ID number of a Pokemon in your party to variable 0xYYYY. It takes the value of 0x8004, ranging between values 0x0 and 0x5 to determine which party member's ID number it should return. Knowing this, you can make a script with a simple loop which will gradually increment the value of 0x8004 until it has checked every party member's ID and branch out when the game finds an Onix. Here's a quick one that I whipped up for you with some comments to explain how it works:

Spoiler:
#dynamic 0x800000

#org @start
checkflag 0x200 // Flag check to see if the player has already gotten the reward
if 0x1 goto @AlreadyDone
msgbox @Coolest 0x2
setvar 0x8004 0x0 // Setting variable 0x8004 to 0x0, this will make special2 0x147 check the first Pokemon in the party
goto @Loop

#org @Loop
special2 0x8000 0x147 // The Pokemon in variable 0x8004's party slot's ID is put into variable 0x8000
compare 0x8000 0x5F // Checking if the ID in variable 0x8000 is equal to that of Onix
if 0x1 goto @HaveOnix // If the value is equal, branch off to the part of the script where you get the metal coat
addvar 0x8004 0x1 // Add 1 to variable 0x8004, this will change the party slot to check if we go back to the start of the loop
compare 0x8004 0x6 // If variable 0x8004 is equal to 0x6 at this stage, then we've checked every Pokemon in the party
if 0x5 goto @Loop // The script will go back to @Loop if 0x8004 has any value other than 0x6
msgbox @NoOnix 0x2
release
end

#org @HaveOnix
msgbox @OhWow 0x2
giveitem 0xC7 0x1 0x0
setflag 0x200 // Setting a flag to make sure the player can't get infinite Metal Coats
release
end

#org @AlreadyDone
msgbox @Thanks 0x2
release
end

#org @Coolest
= I think Onix is the coolest!\nIf you show me one, I'll give\lyou something special.

#org @NoOnix
= Sorry, you don't have an Onix...

#org @OhWow
= Oh, wow, an Onix, thanks!\nHere you go, as promised!

#org @Thanks
= Thanks for showing me that Onix!


Hopefully that helps.
Sorry for the late reply, but holy muk, thank you! This was extremely helpful, I appreciate it so much!
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

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:19 AM.