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 Game freezes when this script runs (https://www.pokecommunity.com/showthread.php?t=446248)

exoticbutters50 March 8th, 2021 8:53 AM

Game freezes when this script runs
 
Very new to rom hacking, the error i have is that when this script is walked on the player gets locked in place. I think the game crashes, but the music keeps playing but the visuals all stop. its using pksv-ui if that helps

any help appreciated :)

#org 0x8740BE6 - i have put this in the script offset
'-----------------------------------
checkflag 0x256
if false jump 0x8740BA5
end


#org 0x8740BA5
'-----------------------------------
setflag 0x256
lock
msgbox 0x8740A6A
callstd MSG_LOCK
reappear 0x4
applymovement PLAYER 0x8740B8B
applymovement 0x4 0x8740B8E
msgbox 0x8740A78
callstd MSG_YESNO
msgbox 0x8740AA9
callstd MSG_LOCK
applymovement 0x4 0x8740B94
disappear 0x4
releaseall
end

#org 0x8740A6A
= (speech, igonre this)

#org 0x8740A78
= (speech, igonre this)

#org 0x8740AA9
= (speech, igonre this)

#org 0x8740B8B
M (movement, igonre this)

#org 0x8740B8E
M (movement, igonre this)

#org 0x8740B94
M (movement, igonre this)

Asith March 8th, 2021 9:47 AM

Try setting a variable into the tile's var number in advance map. Set the var value to 0 and then never increment it and the tile should work properly forever

exoticbutters50 March 8th, 2021 11:10 AM

Quote:

Originally Posted by Asith (Post 10306723)
Try setting a variable into the tile's var number in advance map. Set the var value to 0 and then never increment it and the tile should work properly forever

thanks for the help :) it worked when i set the variable number to 0001, but i have a few questions
-do i have to set other script tiles different values per map or at all?
-if i set it back to 0000 will i get the same problem?
-the game now resets at the line
Quote:

reappear 0x4
is there a fix for this?
thanks for the help again, sorry to bother u :)

edit: on doing some further research, i found out that it is only the specific person i am trying to make appear that doesnt. their movement on advance map is set to hidden and they have a person id.

Asith March 8th, 2021 7:11 PM

Quote:

Originally Posted by exoticbutters50 (Post 10306768)
thanks for the help :) it worked when i set the variable number to 0001, but i have a few questions
-do i have to set other script tiles different values per map or at all?
-if i set it back to 0000 will i get the same problem?

To clarify, the game can use a var number and var value to choose whether to activate a script tile the player has walked on or not. This is the same as saying "IF [var number] is currently [var value], activate the script. ELSE, just do nothing". Without this bit, some script tiles will just freeze the screen. This is especially useful when you need to stop a script from activating after a certain point, but since you're doing that with a checkflag inside your script anyway, you can just have the script tile activate infinitely. For that, you need an static variable whose value will never change. iirc I personally use 4001 as my static variable with var number at 0 (every variable is at 0 by default).
I never use that variable inside my scripts, so I know it will always be 0, so all my permanent script tiles will be set to it.
I should've mentioned earlier, but don't use a variable like 0001. It's probably used by the game for other things. Variables 0x4000 to 0x40FF (inclusive) are the safe ones to use.
So yeah, to attempt to sum up, pick a permanent variable, keep its value the same forever, and put it on any permanent script tiles that are freezing the game (regardless of the map)

Quote:

Originally Posted by exoticbutters50 (Post 10306768)
-the game now resets at the line
is there a fix for this?
thanks for the help again, sorry to bother u :)

edit: on doing some further research, i found out that it is only the specific person i am trying to make appear that doesnt. their movement on advance map is set to hidden and they have a person id.

Are you still having trouble with this or did you fix it? I'm not really sure what you mean by the game "resets".

exoticbutters50 March 9th, 2021 7:37 AM

first off, thanks a bunch for the help at the first part, i understand this now
secondly, by reset i mean the rom completely restarts and im sent back to the title screen.
i am still getting issues with this, is it maybe something to do with their movement number? it is currently at 0

Asith March 9th, 2021 10:04 AM

Quote:

Originally Posted by exoticbutters50 (Post 10307515)
first off, thanks a bunch for the help at the first part, i understand this now
secondly, by reset i mean the rom completely restarts and im sent back to the title screen.
i am still getting issues with this, is it maybe something to do with their movement number? it is currently at 0

I'm not familiar with pksv commands - I assume reappear is meant to make a sprite appear like showsprite in xse. If so, we can probably figure why the sprite is misbehaving, but I have no idea why the game would completely reset at that line. Are you sure the script is straight up resetting the game? I don't even know where to begin with a problem like that

exoticbutters50 March 9th, 2021 10:36 AM

ok, so i think i averted the issue
i just occupied the character with something else while the script wasn't running so it looked natural.
thanks for all the help though, i am eternally greatful :)


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.