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)
-   -   Other Why does this script make my game freeze? (https://www.pokecommunity.com/showthread.php?t=360693)

yoloanarchist7777 January 1st, 2016 9:35 PM

Why does this script make my game freeze?
 
I'm a somewhat inexperienced scripter, and I'm working on a Fire Red hack (original, I know) and before you leave the first town, I want to have event tiles that will stop you from leaving the town if you haven't received a starter from the professor. When you get said starter, flag 1000 is triggered. The script that I have in my game looks good to me, but when you walk on the tile, your ROM will freeze. No message box will appear (but it should). I would be immensely grateful if someone could tell my why it's freezing, and even better, provide script that could get it to work. Thanks!

tile script (triggers when walked on):
Spoiler:
#dyn 0x740000
#org @main
lockall
checkflag 0x1001
if == jump @void
compare 0x1000 0x1
if == jump @pass
applymovement 0x3 @exclaim
pauseevent 0x0
message @goback
callstd MSG_NORMAL
applymovement PLAYER @return
pauseevent 0x0
releaseall
end

#org @pass
message @good
callstd MSG_NORMAL
setflag 0x1001
releaseall
end

#org @void
releaseall
end

#org @exclaim
M say_! end

#org @return
M walk_down end

#org @goback
= Tall grass is dangerous!\nYou probably shouldn't go any\pfurther without any pok\emon.

#org @good
= Please, \v\h01. Defeat \v\h06\nand save KANTO.


(The guard who receives the exclaim movement has a standard talking script that works as it should, with no flags at all)

All var values, var #s, unknowns, and person ID's are set to 0 (idk if this is relevant, but again, I'm inexperienced). Thanks!

Danny0317 January 1st, 2016 10:01 PM

Okay, for one, script tiles should NOT check if something should happen with flags, you should do that with the var.

Example, you have a script that happens when 0x4772 (an example) is 0, at the end of the script, set the var to 1, or addvar it.

I don't think 0x1000 is a good var to use btw..

Vendily January 1st, 2016 10:48 PM

Quote:

Originally Posted by yoloanarchist7777 (Post 9059567)
I'm a somewhat inexperienced scripter, and I'm working on a Fire Red hack (original, I know) and before you leave the first town, I want to have event tiles that will stop you from leaving the town if you haven't received a starter from the professor. When you get said starter, flag 1000 is triggered. The script that I have in my game looks good to me, but when you walk on the tile, your ROM will freeze. No message box will appear (but it should). I would be immensely grateful if someone could tell my why it's freezing, and even better, provide script that could get it to work. Thanks!

tile script (triggers when walked on):
Spoiler:
#dyn 0x740000
#org @main
lockall
checkflag 0x1001
if == jump @void
compare 0x1000 0x1
if == jump @pass
applymovement 0x3 @exclaim
pauseevent 0x0
message @goback
callstd MSG_NORMAL
applymovement PLAYER @return
pauseevent 0x0
releaseall
end

#org @pass
message @good
callstd MSG_NORMAL
setflag 0x1001
releaseall
end

#org @void
releaseall
end

#org @exclaim
M say_! end

#org @return
M walk_down end

#org @goback
= Tall grass is dangerous!\nYou probably shouldn't go any\pfurther without any pok\emon.

#org @good
= Please, \v\h01. Defeat \v\h06\nand save KANTO.


(The guard who receives the exclaim movement has a standard talking script that works as it should, with no flags at all)

All var values, var #s, unknowns, and person ID's are set to 0 (idk if this is relevant, but again, I'm inexperienced). Thanks!

If it freezes when you step on the tile, you need to set the variable attached to the event.
Quote:

Originally Posted by diegoisawesome (Post 4227306)
Okay. Compile the script, assign it to a script tile (green with an S) and not a person.
Now test it in the ROM. Then look at this spoiler.
Spoiler:
Didn't work, did it? Froze on the spot. You're going to need to change this...

http://files.domoreaweso.me/before%20change.jpg

to this....

http://files.domoreaweso.me/after%20change.jpg

Try it now. Worked perfectly, didn't it?

Then just increase the variable at the end of the event, like Danny said.
Also, Karatekid552 posted a list of safe flags and variables (ie ones that won't break the game when you use them.)
Flag 0x1000 goes into variable space and that can screw up your hack.

Le pug January 1st, 2016 11:29 PM

Quote:

Originally Posted by Danny0317 (Post 9059589)
Okay, for one, script tiles should NOT check if something should happen with flags, you should do that with the var.

Example, you have a script that happens when 0x4772 (an example) is 0, at the end of the script, set the var to 1, or addvar it.

I don't think 0x1000 is a good var to use btw..

For this specific script, I agree that he should use a var instead of a flag. But realistically, I use flags for OWs too and on more stupid events than this. It's not a bad idea to use flags for scripts, but there are way more vars than flags to use and var numbers further expand that.


All times are GMT -8. The time now is 2:26 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.