The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other Can i set a var value back to 0 in fire red?

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 November 13th, 2014 (5:12 AM).
danmander danmander is offline
 
Join Date: Oct 2014
Posts: 14
Basically what i want to do is have a header script which will only activates once a certain event has happened. i thought of using a checkflag, but when i had the string for when the flag is not set it would just keep repeating the script over and over so the player cant do anything anymore. i then thought of setting the var value of the script to be not 0000 so that it wouldnt play normally. that part works, but when i insert "setvar 0x409a 0x0" into a script it doesnt work. can anyone help me? even if there is another way to do this effect (like some way of making the checkflag system work) that would be great. thanks.
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old November 13th, 2014 (5:23 AM).
Christos's Avatar
Christos Christos is offline
 
Join Date: Feb 2006
Gender: Male
Nature: Serious
Posts: 6,355
Quote:
Originally Posted by danmander View Post
Basically what i want to do is have a header script which will only activates once a certain event has happened. i thought of using a checkflag, but when i had the string for when the flag is not set it would just keep repeating the script over and over so the player cant do anything anymore. i then thought of setting the var value of the script to be not 0000 so that it wouldnt play normally. that part works, but when i insert "setvar 0x409a 0x0" into a script it doesnt work. can anyone help me? even if there is another way to do this effect (like some way of making the checkflag system work) that would be great. thanks.
Can you show us the header/level script?

From what I understood, if for example your level script's variable and value are set to 0x409A and 0x1, assuming 409A's initial value is 0, the level script will not be executed until you set its value to 0x1 in a different script. In your level script, you should make sure 409A's value is set to anything other than 1, 2 for example, otherwise the script will keep executing.
__________________

A Pokemon that is discriminated!
Support squirtle and make it everyone's favourite.
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old November 13th, 2014 (5:48 AM).
danmander danmander is offline
 
Join Date: Oct 2014
Posts: 14
Im not sure what you mean. i thought that a script would not play if the var value was anything other than 0?
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old November 13th, 2014 (6:13 AM).
Mickey` Mickey` is offline
 
Join Date: May 2011
Posts: 88
Yeah, you're right. If the variable of your level script is 0x409A, you have to set the value of this var to a value different from 0, before you enter on the map.

If you set the value of the var 0x409A to 0, your level script will be executed.
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old November 13th, 2014 (6:25 AM).
danmander danmander is offline
 
Join Date: Oct 2014
Posts: 14
thats what i thought, and thats what isnt working. i am inserting "setvar 0x409A 0x0" into the script i want to run first but it doesn't seem to work. i know that the script works on its own as i set the var value to start at 0 to test it. is there anything else i should be doing? the script i want to run is:

#dynamic 0x803700

#org @start
setvar 0x409a 0x1
applymovement 0x1 @move1
waitmovement 0x0
msgbox @1 0x2
trainerbattle 0x9 0x059 0x0 @won @lost
msgbox @2 0x2
applymovement 0x1 @move2
waitmovement 0x0
release
end

(i have the first string there because i dont want the script to repeat regardless of if i win or lose the battle)
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old November 13th, 2014 (6:34 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by danmander View Post
thats what i thought, and thats what isnt working. i am inserting "setvar 0x409A 0x0" into the script i want to run first but it doesn't seem to work. i know that the script works on its own as i set the var value to start at 0 to test it. is there anything else i should be doing? the script i want to run is:

#dynamic 0x803700

#org @start
setvar 0x409a 0x1
applymovement 0x1 @move1
waitmovement 0x0
msgbox @1 0x2
trainerbattle 0x9 0x059 0x0 @won @lost
msgbox @2 0x2
applymovement 0x1 @move2
waitmovement 0x0
release
end

(i have the first string there because i dont want the script to repeat regardless of if i win or lose the battle)
Try checking the variable yourself
Code:
#dynamic 0x803700

#org @start
compare 0x409A 0x1
if 0x1 jump @done
setvar 0x409a 0x1
applymovement 0x1 @move1
waitmovement 0x0
msgbox @1 0x2
trainerbattle 0x9 0x059 0x0 @won @lost
msgbox @2 0x2
applymovement 0x1 @move2
waitmovement 0x0
jump @done

#org @done
release
end
__________________
...
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old November 13th, 2014 (6:38 AM).
Christos's Avatar
Christos Christos is offline
 
Join Date: Feb 2006
Gender: Male
Nature: Serious
Posts: 6,355
Quote:
Originally Posted by danmander View Post
Im not sure what you mean. i thought that a script would not play if the var value was anything other than 0?
In AdvanceMap, you can set which value the variable should have in order to be executed. It's usually 0, but you could also set it to 1, for example, and then the script would only play if the variable's value was 1.
__________________

A Pokemon that is discriminated!
Support squirtle and make it everyone's favourite.
Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old November 13th, 2014 (7:11 AM). Edited November 13th, 2014 by Christos.
danmander danmander is offline
 
Join Date: Oct 2014
Posts: 14
@fbi
I was using a checkflag to do it like that, but the problem i was having was that if it went to the @done part it was just constantly looping so the player couldnt move. i know this because i tested it by putting a msgbox as part of the @done script and it was just opening the msgbox as soon as i closed it.

@christos
i think i understand now, is that what is being set when i input a var value in advance map?

so i tried setting the varvariable for 409A to 0x1 and using the string "setvar 0x409A 0x1" in the previous script, but what happens is the screen just goes black as soon as i enter the map with the header script.

i just tested the script on a script tile instead of a header and it worked so the script seems ok. when i use header script type [02] it will lock the player and have a message box with constant gibberish when the script is set to not run, amd when i use header script type [04] it just freezes on a black screen when the script is set to run. im really at a loss.
Reply With Quote
  #9   Link to this post, but load the entire thread.  
Old November 13th, 2014 (8:44 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by danmander View Post
i just tested the script on a script tile instead of a header and it worked so the script seems ok. when i use header script type [02] it will lock the player and have a message box with constant gibberish when the script is set to not run, amd when i use header script type [04] it just freezes on a black screen when the script is set to run. im really at a loss.
Oh, you need to remove the raw 0xFFs at the start of your script.
A few things before:

1) Make sure in amap flag = 409a, and value = 0000
2) ctrl + H to go into advance header
3) Copy the map script offset and decompile it in a script editor
4) you should see a #raw word 0xFFFF hanging about change this to #raw word 0x0
__________________
...
Reply With Quote
  #10   Link to this post, but load the entire thread.  
Old November 13th, 2014 (10:50 AM).
Nikolai Fox's Avatar
Nikolai Fox Nikolai Fox is offline
 
Join Date: Mar 2010
Gender: Male
Posts: 202
Be happy to have a look at the problem if you PM me your mod.

I'll make sure you have your var's communicating properly and check the raw 0xFFFFs as stated above.
Reply With Quote
  #11   Link to this post, but load the entire thread.  
Old November 13th, 2014 (2:08 PM).
danmander danmander is offline
 
Join Date: Oct 2014
Posts: 14
Quote:
Originally Posted by FBI agent View Post
Oh, you need to remove the raw 0xFFs at the start of your script.
A few things before:

1) Make sure in amap flag = 409a, and value = 0000
2) ctrl + H to go into advance header
3) Copy the map script offset and decompile it in a script editor
4) you should see a #raw word 0xFFFF hanging about change this to #raw word 0x0
I followed your advice but when i decompile the script it just has:

#org 0x71A294
end

also i dont want the value to be 0000 because i dont want the script to run until another script has happened. Am i trying to do that in the wrong way?

to add to that, it does run perfectly when the value is 0000 but then it also runs the first time i enter the map which i dont want.
Reply With Quote
  #12   Link to this post, but load the entire thread.  
Old November 13th, 2014 (2:48 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by danmander View Post
I followed your advice but when i decompile the script it just has:

#org 0x71A294
end

also i dont want the value to be 0000 because i dont want the script to run until another script has happened. Am i trying to do that in the wrong way?

to add to that, it does run perfectly when the value is 0000 but then it also runs the first time i enter the map which i dont want.
Make it 0000. Set it to 0x1 in the script.
__________________
...
Reply With Quote
  #13   Link to this post, but load the entire thread.  
Old November 13th, 2014 (9:50 PM).
danmander danmander is offline
 
Join Date: Oct 2014
Posts: 14
Quote:
Originally Posted by FBI agent View Post
Make it 0000. Set it to 0x1 in the script.
Thanks, I have it working now. I have the script 409A var set to 0000 (which means the script would run the first time i enter the map). Then i have a script which runs before i get to that particular map which includes the line "setvar 0x409A 0x1" to make it so that the 409A script wont run. Then i use the line "setvar 0x409A 0x0" in the script i want to run before this, which means that the script will now run. I assume that was how you were suggesting to do it?
Reply With Quote
  #14   Link to this post, but load the entire thread.  
Old November 14th, 2014 (2:44 AM).
Nikolai Fox's Avatar
Nikolai Fox Nikolai Fox is offline
 
Join Date: Mar 2010
Gender: Male
Posts: 202
Bit unnecessary but it's essentially the same what you've done.

You could have just had script 409A var set to 0001. 409A would by default be 0000, so it wouldn't run the script until you later changed setvar 4091 to 0x1.
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

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:08 AM.