The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other Script tile problem

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 October 8th, 2014 (11:15 PM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
Hello guys. I am having some serious problem with script tiles. What i wanted to do is create a script tile in which if you step on, you MIGHT find an item. But i dont understand what var and value i should fill in A-map. If it is zero, the game freezes. If it is something else than the script always happens. I tried compiling the script to an NPC, and it worked fine, so the script is not causing problems. A total n00b here :P
__________________
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old October 8th, 2014 (11:26 PM).
destinedjagold's Avatar
destinedjagold destinedjagold is offline
You can contact me in PC's discord server...
 
Join Date: May 2007
Age: 32
Gender: Male
Nature: Careful
Posts: 8,579
Well, if you want it to be a one-time only event, then you'll either have to use vars or flags for that. For now, I suggest you use flags. There are scripting tutorials in the tutorials section for that.

Anyway, on A-Map, set the [Unknown] and [Var Number] to 0003 and 4000 respectively.
Spoiler:

And then add a check and set flag commands into your script.
__________________

Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old October 9th, 2014 (2:10 AM).
JosefigGaming's Avatar
JosefigGaming JosefigGaming is offline
 
Join Date: May 2013
Location: Portugal
Age: 23
Gender: Male
Posts: 287
Quote:
Originally Posted by destinedjagold View Post
Well, if you want it to be a one-time only event, then you'll either have to use vars or flags for that. For now, I suggest you use flags. There are scripting tutorials in the tutorials section for that.

Anyway, on A-Map, set the [Unknown] and [Var Number] to 0003 and 4000 respectively.
Spoiler:

And then add a check and set flag commands into your script.
Flags might be a tiny bit easier to understand, but you'd be better off using a var.
Here's the thing
Var is short for Variable. A variable's purpose is to hold a value to later be checked.
For example, you have a script in which you have to choose either Charizard or Blastoise.
If you choose Charizard you give the var a value of 1.
If you choose Blastoise then you give the var a value of 2.
In a later script, you check the var too see wheter the var is at 0x1 or at 0x2
Now, in this specific case, what you do is that you set a var and a value to a script tile. If the box in amap for value has 1, and the var number 4050, the script will only run if the var 4050 has a value of 1
With that said, if you dont change the value of the var before the player steps on the script tile, the script wont happen
Now let's say that in some script you assigned 0x1 to 0x4050
Now, when you step in the tile the script will run
Now, if at the end of the script you put setvar 0x4050 0x2, the value of the var will now be 2, and the script wont happen once you step on the script tile
Hope I helped and didn't sound confusing.
(closing notes, all vars are 0 before any changed has been applied to them, and safe variables range between 4011 and 40FF)
EDIT: forgot to say, you also don't need to put 0003 in the unknown box in amap, it does the same as not putting anything
__________________
Working on:


#fasterSneasel :D (nohomo)

Coolest IRC with the coolest people in the coolest rooms:
http://chat.linkandzelda.com:9090/?channels=romhacking,gogo,discovery,fluorite
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old October 9th, 2014 (2:27 AM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
I am not that much n00b -_- i know what they do and i know how to work with them. But the problem is i dont understand how to make them work on a script tile. I used random 0xa so and compared lastresult with 0x2 and if it matches than u get an item. It works at NPC but not on tiles
__________________
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old October 9th, 2014 (9:14 AM).
JosefigGaming's Avatar
JosefigGaming JosefigGaming is offline
 
Join Date: May 2013
Location: Portugal
Age: 23
Gender: Male
Posts: 287
Quote:
Originally Posted by Knight of Duty View Post
I am not that much n00b -_- i know what they do and i know how to work with them. But the problem is i dont understand how to make them work on a script tile. I used random 0xa so and compared lastresult with 0x2 and if it matches than u get an item. It works at NPC but not on tiles
Alright then, I guess I'll just try to get back the 7 hours of my life it took me to write that reply ;.;
You wanna send your script? I'm sure we can make it work
__________________
Working on:


#fasterSneasel :D (nohomo)

Coolest IRC with the coolest people in the coolest rooms:
http://chat.linkandzelda.com:9090/?channels=romhacking,gogo,discovery,fluorite
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old October 10th, 2014 (1:34 AM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
Quote:
Originally Posted by JosefigGaming View Post
Alright then, I guess I'll just try to get back the 7 hours of my life it took me to write that reply ;.;
You wanna send your script? I'm sure we can make it work
OK here it is
Spoiler:

#dynamic 0x7200000
#org @start
random 0xa
compare lastresult 0x2
if 0x1goto @giveit
end

#org @giveit
giveitem 0xd 0x1 MSG_FIND
end
__________________
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old October 10th, 2014 (1:41 AM).
destinedjagold's Avatar
destinedjagold destinedjagold is offline
You can contact me in PC's discord server...
 
Join Date: May 2007
Age: 32
Gender: Male
Nature: Careful
Posts: 8,579
Quote:
Originally Posted by Knight of Duty View Post
OK here it is
Spoiler:

#dynamic 0x7200000
#org @start
random 0xa
compare lastresult 0x2
if 0x1goto @giveit
end

#org @giveit
giveitem 0xd 0x1 MSG_FIND
end
...as I mentioned, use these values on your script tile.
Spoiler:

...or if you're using FireRed, try using [4050] instead of [4000] on the Var number.

And I suggest you add flags on that script so it won't repeat itself.
Like so...

Code:
#dynamic 0x7200000

#org @start
checkflag 0x200
if 0x1 goto @done
random 0xA
compare lastresult 0x2
if 0x1goto @giveit
end

#org @giveit
giveitem 0xd 0x1 MSG_FIND
setflag 0x200
end

#org @done
end
But I suggest you check scripting tutorials and see which flags are free to use for your ROM~
__________________

Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old October 10th, 2014 (12:44 PM).
AkameTheBulbasaur's Avatar
AkameTheBulbasaur AkameTheBulbasaur is offline
Akame Marukawa of Iyotono
 
Join Date: May 2013
Location: A place :D
Age: 25
Gender: Male
Nature: Docile
Posts: 408
One thing that should be added to what Destinedjagold said is that when you have a green script tile, you HAVE to use a var. I've tried, it doesn't do anything otherwise. To do that, you just need to put

"setvar 0xYYYY 0xZ"

The Ys being what variable you choose, and the Z being any number that ISN'T what you put in the "Unknown" box in advance map. I don't know exactly how it works, but I know that if "Z" is the same as what you put in the "Unknown" box, it won't work.

If you use this method to prevent your script from running again, then flags are unnecessary unless you're using them for something else in the script, such as a sprite disappearing. When you step on the tile again, and have done the process of setting the variable correctly, nothing will happen.
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
Reply With Quote
  #9   Link to this post, but load the entire thread.  
Old October 10th, 2014 (9:56 PM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
I dont wanna add flags as i want a repeating script
__________________
Reply With Quote
  #10   Link to this post, but load the entire thread.  
Old October 11th, 2014 (2:21 AM).
JosefigGaming's Avatar
JosefigGaming JosefigGaming is offline
 
Join Date: May 2013
Location: Portugal
Age: 23
Gender: Male
Posts: 287
Quote:
Originally Posted by Knight of Duty View Post
I dont wanna add flags as i want a repeating script
I think we've gotten to the conclusion that the problem is not the script but the a-map boxes...
We already told you everything you have to do, have you done any of it?
__________________
Working on:


#fasterSneasel :D (nohomo)

Coolest IRC with the coolest people in the coolest rooms:
http://chat.linkandzelda.com:9090/?channels=romhacking,gogo,discovery,fluorite
Reply With Quote
  #11   Link to this post, but load the entire thread.  
Old October 11th, 2014 (4:26 AM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
Quote:
Originally Posted by JosefigGaming View Post
I think we've gotten to the conclusion that the problem is not the script but the a-map boxes...
We already told you everything you have to do, have you done any of it?
Yes, nothing happens when i step on it, i know it is random, but it should happen 1 out of 10 times, but it doesn’t
__________________
Reply With Quote
  #12   Link to this post, but load the entire thread.  
Old October 11th, 2014 (6:53 AM).
AkameTheBulbasaur's Avatar
AkameTheBulbasaur AkameTheBulbasaur is offline
Akame Marukawa of Iyotono
 
Join Date: May 2013
Location: A place :D
Age: 25
Gender: Male
Nature: Docile
Posts: 408
So, I tried your script on my ROM, and after a couple edits I was able to get it to work.

For the record, I was using PKSV, but XSE should be similar (but with different commands possibly. Giveitem wasn't recognized in PKSV so I replaced it with additem)

Here's what I did (the important parts highlighted in red):

#dynamic 0x720000
#org @start
random 0xa
compare lastresult 0x2
if 0x1 jump @giveit
jump @end

end

#org @giveit
additem POTION 0x1
message @find
callstd MSG_SIGN
fanfare 0x102
waitfanfare

setvar 0x4000 0x0
end

#org @end
release
setvar 0x4000 0x0
end


#org @find
= \v\h01 found a POTION!

I basically added another script for it to go to when you don't find the item. When I didn't have this it just froze, so I recommend putting it in for safety. You need to put the "setvar" in both the "give it" script and the "end" script.

Also I couldn't get the "MSG_FIND" thing to work right. It just gave me weird text. So I made a separate message for it. I have no idea if the MSG_FIND works for you, so you can disregard it too.

Also, to have the script run over and over, you just set the "Unknown" value to the same thing that you set the variable too.

I also put in a fanfare, to make it sound more professional. You can use this or not.
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
Reply With Quote
  #13   Link to this post, but load the entire thread.  
Old October 11th, 2014 (6:54 AM).
JosefigGaming's Avatar
JosefigGaming JosefigGaming is offline
 
Join Date: May 2013
Location: Portugal
Age: 23
Gender: Male
Posts: 287
Quote:
Originally Posted by Knight of Duty View Post
Yes, nothing happens when i step on it, i know it is random, but it should happen 1 out of 10 times, but it doesn’t
Ok, here's what. Put this in your script tile:
Code:
#dynamic 0x720000

#org @start
lock
giveitem 0xd 0x1 MSG_FIND
release
end
If you recieve your item, then the problem is your script.
If it doesn't work, you just failed at following our instructions :P
__________________
Working on:


#fasterSneasel :D (nohomo)

Coolest IRC with the coolest people in the coolest rooms:
http://chat.linkandzelda.com:9090/?channels=romhacking,gogo,discovery,fluorite
Reply With Quote
  #14   Link to this post, but load the entire thread.  
Old October 11th, 2014 (11:59 AM).
HidoranBlaze's Avatar
HidoranBlaze HidoranBlaze is offline
 
Join Date: Apr 2013
Age: 26
Gender: Male
Posts: 252
Quote:
Originally Posted by AkameTheBulbasaur View Post
One thing that should be added to what Destinedjagold said is that when you have a green script tile, you HAVE to use a var. I've tried, it doesn't do anything otherwise. To do that, you just need to put

"setvar 0xYYYY 0xZ"

The Ys being what variable you choose, and the Z being any number that ISN'T what you put in the "Unknown" box in advance map. I don't know exactly how it works, but I know that if "Z" is the same as what you put in the "Unknown" box, it won't work.

If you use this method to prevent your script from running again, then flags are unnecessary unless you're using them for something else in the script, such as a sprite disappearing. When you step on the tile again, and have done the process of setting the variable correctly, nothing will happen.
"I know that if "Z" is the same as what you put in the "Unknown" box, it won't work."
IIRC the Unknown box doesn't have anything to do with "Z". In a script tile, you're basically saying "If the value in this variable is equal to Z, run the script". Z is by default 0. Since most of the unknowns in FR are 3 , I'm assuming you did "setvar 0xYYYY 0x3" or something like that sometime during your hacking career, which wouldn't have made the script run unless you had set the value of var 0xYYYY to 3 before you stepped on the green tile.
Reply With Quote
  #15   Link to this post, but load the entire thread.  
Old October 11th, 2014 (1:01 PM).
AkameTheBulbasaur's Avatar
AkameTheBulbasaur AkameTheBulbasaur is offline
Akame Marukawa of Iyotono
 
Join Date: May 2013
Location: A place :D
Age: 25
Gender: Male
Nature: Docile
Posts: 408
The whole entire "setvar" concept is pretty new to me, actually. I just know that when I did the script I posted before, I had "Z" be the same as what I set the var to, which caused the script to run every time I stepped on the tile. Setting the variable to something not in the unknown box is like setting a flag, but slightly more complicated.
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
Reply With Quote
  #16   Link to this post, but load the entire thread.  
Old October 11th, 2014 (1:38 PM).
HidoranBlaze's Avatar
HidoranBlaze HidoranBlaze is offline
 
Join Date: Apr 2013
Age: 26
Gender: Male
Posts: 252
Quote:
Originally Posted by AkameTheBulbasaur View Post
The whole entire "setvar" concept is pretty new to me, actually. I just know that when I did the script I posted before, I had "Z" be the same as what I set the var to, which caused the script to run every time I stepped on the tile. Setting the variable to something not in the unknown box is like setting a flag, but slightly more complicated.
I'm going to correct you there: Setting the var to something not in the var value box is like setting a flag. The unknown box doesn't have anything to do with setting vars. In your script, you made 0xZ equal to 0x0 right? Which was equal to the number in the var value box right? That's why the script runs every single time. If Z is equal to the var value, the script will run. If it's not, the script won't run. That's why people make their 'Z' value something other than 0 when they want their script to run only once. The var value is 0 by default, so setting 'Z' to something other than 0 after you're done with your script will make it so that the script won't run again.
EDIT: This is probably derailing the purpose of the thread right here, so I'm going to stop here.
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:07 AM.