The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Script Script to keep player out of an area until a flag is set (https://www.pokecommunity.com/showthread.php?t=384790)

FSBS December 5th, 2016 4:22 AM

Script to keep player out of an area until a flag is set
 
(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.

http://i.imgur.com/buufENb.png

BluRose December 5th, 2016 12:56 PM

Quote:

Originally Posted by FSBS (Post 9508468)
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.

http://i.imgur.com/buufENb.png

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

FSBS December 5th, 2016 1:13 PM

Excellent, I'll try this out later!


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


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.