Advertiser Content

Other Script events create soft lock

Started by MINDL3SS November 22nd, 2015 2:29 PM
  • 1742 views
  • 19 replies

Vendily

Female
Seen 12 Hours Ago
Posted 1 Day Ago
894 posts
3.9 Years
I've been trying to create a rom hack for Pokemon Fire red. For some reason when I step on a tile that has a script event my game soft locks. Any help appreciated.
Did you remember to assign a variable to your script tile? And increment your assigned var in the script itself (if you only wanted the script to run once)?
If you don't know what I mean, look at the Applymovement section of this tutorial.

Sefuree

Canada Goose

Age 18
Male
Canada
Seen 1 Day Ago
Posted September 10th, 2018
3,249 posts
5.2 Years
assign a variable? as in, set a flag? yes ive done that.
No, like this...


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...



to this....



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

:)
Male
Seen 2 Days Ago
Posted November 5th, 2018
87 posts
3.8 Years
Should every script event have those exact values?
Those numbers are used to let the script run only in certain circumstances.
You can use variables from 4011 to 40FF. The script will run only when the variable's value is the one you wrote in "Var value".
Assuming that the current value of 4011 is 0, if you put "setvar 0x4011 0x1" in your script it will run just once since at its end 4011's value won't be 0 anymore.
Seen September 24th, 2016
Posted August 3rd, 2016
16 posts
3.7 Years
Those numbers are used to let the script run only in certain circumstances.
You can use variables from 4011 to 40FF. The script will run only when the variable's value is the one you wrote in "Var value".
Assuming that the current value of 4011 is 0, if you put "setvar 0x4011 0x1" in your script it will run just once since at its end 4011's value won't be 0 anymore.
should i always use the "setvar 0x???? 0x1" command? considering most scripts only run once.
Seen September 24th, 2016
Posted August 3rd, 2016
16 posts
3.7 Years
Well it is recommended. What matters is that the script runs only if the variable you put has the value you put (on Advance Map I mean).
The values i set in advanced map, will they ever change? if they will never change then what do i need the setvar command for? and if i have flags set in the in the script wont that stop the script from running twice?

heres on of the scripts i wrote.

#dynamic 0x72395E

#org @start
lock
checkflag 0x1004
if 0x1 goto @done
countpokemon
compare 0x800D 0x1
if 0x1 goto @continue
applymovement 0x290B @move
msgbox @1 0x6
applymovement 0xFF @movehero
waitmovement 0x290B
applymovement 0x290b @move1
release
end

#org @continue
lock
applymovement 0x290b @move
bufferfirstpokemon 0x00
msgbox @2 0x06
applymovement 0x290b @move1
setflag 0x1004
release
end

#org @done
release
end

#org @2
= OOH! That's a pretty scary looking\n\v\h02\

#org @move1
#raw 0x3
#raw 0xFE

#org @move
#raw 0x1
#raw 0xFE

#org @1
= I'm sorry but, it's to dangerous\nto go alone. Go talk to Professor\lOak to choose your pokemon.

#org @movehero
#raw 0x51
#raw 0xFE

C me

Creator of Pokemon League Of Legends

Age 22
Male
Seen February 2nd, 2019
Posted September 9th, 2018
683 posts
5.5 Years

heres on of the scripts i wrote.
The 40XX value doesn't change but the other number changes because you set it in a script. Yes flags do work like that but if you have script events (green ones) then they need a var number and value to work. You also need them for level scripts. Flags are more used for person events as they are only on or off.

Don't use flag 0x1004(doesn't even exist), there's a list of flags on ths forum should come up on google.

A person number of 290b is super high, you'd usually use something less than 10(hex). The max is FF anyway.
Seen September 24th, 2016
Posted August 3rd, 2016
16 posts
3.7 Years
The 40XX value doesn't change but the other number changes because you set it in a script. Yes flags do work like that but if you have script events (green ones) then they need a var number and value to work. You also need them for level scripts. Flags are more used for person events as they are only on or off.

Don't use flag 0x1004(doesn't even exist), there's a list of flags on ths forum should come up on google.

A person number of 290b is super high, you'd usually use something less than 10(hex). The max is FF anyway.
I though the flag number and person number didnt matter. I was reading some article and it said that is was best to start with 0x1000 as your first flag and continue from there. So if the hex value for 1 is "1", I would use 0x0001 as my person number? As the hex value for 10 is "A I would use 0x000A? Thanks a lot.
Male
Seen 2 Days Ago
Posted November 5th, 2018
87 posts
3.8 Years
Ok then:

#dynamic 0x72395E
#org @start
lockall
It is better using "lockall" and "releaseall" when using an S script.

checkflag 0x1004
if 0x1 goto @done
Safe flags range from 200 to 2FF. Anyway here this part is not necessary: the script runs only when the variable on Advance Map has the value you set.

countpokemon
compare 0x800D 0x1
if 0x1 goto @continue
applymovement 0xY @move
The number after applymovement is the number of the person in Advance Map. Remember to convert it in hexadecimal.

msgbox @1 0x6
applymovement 0xFF @movehero
waitmovement 0x0
applymovement 0xY @move1
waitmovement 0x0
release
end
Same here, use waitmovement 0x0 after a single/a set of simultaneous applymovement.

#org @continue
lockall
applymovement 0xY @move
waitmovement 0x0
bufferfirstpokemon 0x00
msgbox @2 0x06
applymovement 0xY @move1
waitmovement 0x0
setvar 0x40XX 0xZ
releaseall
end
Use variables from 4011 to 40FF. If you set variable 4011 to 0x1, for example, and put on Advance Map's script "Variable number: 4011, Variable value: 0", at the end of the script var 4011's value will be 1 and not 0.

#org @done
releaseall
end
#org @2
= OOH! That's a pretty scary looking\n\v\h02\

#org @move1
#raw 0x3
#raw 0xFE

#org @move
#raw 0x1
#raw 0xFE

#org @1
= I'm sorry but, it's to dangerous\nto go alone. Go talk to Professor\lOak to choose your pokemon.

#org @movehero
#raw 0x51
#raw 0xFE
This should be ok now, if it doesn't work just tell me!

Vendily

Female
Seen 12 Hours Ago
Posted 1 Day Ago
894 posts
3.9 Years
I do apologize but im still not quite understanding the "0x1" part of the setvar command i understand "setvar 0x????" just not the second part. I do understand everything else thank you.
The 0x1 part of setvar is the number you set the variable to.
So, setvar 0x4007 0x1 means make variable 0x4007 equal 0x1
The 0x part means the number is in hexadecimal, or base-16.

DrFuji

Heiki Hecchara‌‌

Age 26
Male
Aussie
Seen 1 Hour Ago
Posted 1 Day Ago
1,592 posts
9.9 Years
The pictures in that spoiler aren't coming up, and I am also looking for the solution to this problem. If you see this (I know its been a few years) could you please tell me what happened in those images?
Here you go:

Spoiler:
Didn't work, did it? Froze on the spot. You're going to need to change this...



to this....



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


Unfortunately diegoisawesome doesn't really go into why those number have to be like that or what they mean, but fortunately karatekid552's tutorial has an excellent part on script tiles that explains what's going on.
Seen 2 Days Ago
Posted 4 Weeks Ago
7 posts
1.3 Years
Here you go:

Spoiler:
Didn't work, did it? Froze on the spot. You're going to need to change this...



to this....



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


Unfortunately diegoisawesome doesn't really go into why those number have to be like that or what they mean, but fortunately karatekid552's tutorial has an excellent part on script tiles that explains what's going on.
Thanks, but I did figure it out, I didn't realize that vars had to be there, I thought it was like flags and person events, where it doesn't run if it's true, not that it did run if it's true. Also, the tutorials I found said changing the first unknown to 3 used to be done for consistency with game freak, but then was discovered 3 and 0 are the same (don't know about 300 though)
Advertiser Content