The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Script to keep player out of an area until a flag is set

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 December 5th, 2016 (4:22 AM).
FSBS's Avatar
FSBS FSBS is offline
Defunct
 
Join Date: May 2015
Gender: Male
Posts: 147
(Accidentally posted to Patching and Emulation because I didn't read the thread title and thought Quick Questions and Answers still existed)
I want to have an NPC to keep the player out of an area until they get their starter. From what I understand about scripting, all I'd have to do is insert a checkflag command into an S event tile next to the NPC, right? Something like the following:

#dynamic 0x8XXXXX

#org @start
checkflag 0xFF
If 0x1 goto @enter
msgbox @talk1 0x2
release
end

#org @enter
= Come on in!

#org @talk1
= You aren't licensed yet!

Of course, that means when the player gets their starter I'd...insert a setflag command for the relevant free flag that the aforementioned script event has to check?
Another thing, where does the player movement commands go in the above script? I think it'd be the #org @talk1, correct?

The following image shows the direction the player would be forced away (red arrow) and the direction the NPC would face.

Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old December 5th, 2016 (12:56 PM).
BluRose BluRose is offline
blu rass
 
Join Date: Apr 2014
Location: michigan tech
Age: 22
Gender: Male
Nature: Timid
Posts: 812
Quote:
Originally Posted by FSBS View Post
Spoiler:
(Accidentally posted to Patching and Emulation because I didn't read the thread title and thought Quick Questions and Answers still existed)
I want to have an NPC to keep the player out of an area until they get their starter. From what I understand about scripting, all I'd have to do is insert a checkflag command into an S event tile next to the NPC, right? Something like the following:

#dynamic 0x8XXXXX

#org @start
checkflag 0xFF
If 0x1 goto @enter
msgbox @talk1 0x2
release
end

#org @enter
= Come on in!

#org @talk1
= You aren't licensed yet!

Of course, that means when the player gets their starter I'd...insert a setflag command for the relevant free flag that the aforementioned script event has to check?
Another thing, where does the player movement commands go in the above script? I think it'd be the #org @talk1, correct?

The following image shows the direction the player would be forced away (red arrow) and the direction the NPC would face.

use var 0x4031; it's the native starter var and just checking if it is a.) equal to zero or b.) equal to anything else/not equal to zero would be the same as checking your flag

player movement commands get their own pointer
so
#org @movement
referenced by applymovement
so
applymovement 0xFF @movement 'make player do movements defined by @movement
__________________
heyo check out my github:

BluRosie
highlights:
battle engine for heartgold
various feature branches in heart gold (fairy type, odd egg, mud slopes)

i'm a big part of the development team of pokemon firegold! all the code that i develop for that hack is also on my github

also on discord: BluRose#0412
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old December 5th, 2016 (1:13 PM).
FSBS's Avatar
FSBS FSBS is offline
Defunct
 
Join Date: May 2015
Gender: Male
Posts: 147
Excellent, I'll try this out later!
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:18 AM.