The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Flags and checkflags

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 30th, 2017 (1:26 AM).
saadcharizard8's Avatar
saadcharizard8 saadcharizard8 is offline
 
Join Date: May 2017
Location: India
Gender: Male
Nature: Calm
Posts: 3
Hi. I am making a Rom hack and I don't really understand what are flags and checkflags. Please give an example also
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old May 30th, 2017 (2:04 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
Quote:
Originally Posted by saadcharizard8 View Post
Hi. I am making a Rom hack and I don't really understand what are flags and checkflags. Please give an example also
Flags are one of the ways the game uses to mark your progression. If an event is only meant to happen once, a flag is set in that script so that on subsequent interactions the script will do something different. Here's an example for a script in XSE:

Code:
#dynamic 0x800000

#org @start
checkflag 0x200
if 0x1 goto @skip
msgbox @hello 0x2
setflag 0x200
release
end

#org @skip
msgbox @goodbye 0x2
clearflag 0x200
release
end

#org @hello
= Hello.

#org @goodbye
= Goodbye.
If you were to compile the above script and apply it to an NPC they will cycle between saying hello and goodbye each time you talk to them. I'm telling the game to check if a flag has been set - if it has been set, it will go to @goodbye, while if it hasn't it will continue the rest of the first script block as usual. Furthermore, I've either set or cleared the flag in both instances to have the script continuously flip between hello and goodbye. If I only wanted the NPC to say hello once and then say goodbye forever I would delete the cleaflag command.

There are a few other things that flags can do, namely:
  • Make NPCs appear and disappear
  • Allow you to fly to locations you've visited on the world map
  • Activate the National Dex
  • Get special items such as the Running Shoes and Pokedex

I'd suggest reading this thread if you would like some more detailed information on flags (especially if you're hacking Fire Red) or just generally read scripting tutorials as some have good introductions to how flags work. Hopefully this has been helpful~
__________________
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:17 AM.