The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script level script: check if HM (cut) has been used in OW?

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 January 10th, 2017 (11:12 AM). Edited January 10th, 2017 by tkim.
tkim's Avatar
tkim tkim is offline
 
Join Date: May 2011
Posts: 232
Is there a way to check if an HM such as Cut has been used on a map?
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old January 11th, 2017 (3:34 PM).
MagicalEye MagicalEye is offline
 
Join Date: Jan 2017
Gender: Male
Posts: 4
If the HM Cut was used on a Pokemon or HM Cut was used on a tree?

If you're talking about the tree then set a flag when the tree is Cut:
TreeEvent:
-isCut? setFlag true or false

Or do:
MapEvent:
-isSurfing? setFlag true or false

There are probably more ways to accomplish what you're asking.
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old January 11th, 2017 (4:52 PM).
tkim's Avatar
tkim tkim is offline
 
Join Date: May 2011
Posts: 232
Quote:
Originally Posted by MagicalEye View Post
If the HM Cut was used on a Pokemon or HM Cut was used on a tree?

If you're talking about the tree then set a flag when the tree is Cut:
TreeEvent:
-isCut? setFlag true or false

Or do:
MapEvent:
-isSurfing? setFlag true or false

There are probably more ways to accomplish what you're asking.
I meant using Cut on grass. I would like a script to check if the player used Cut on grass in a particular map.
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old January 11th, 2017 (5:43 PM).
MagicalEye MagicalEye is offline
 
Join Date: Jan 2017
Gender: Male
Posts: 4
I'm new to scripting. Here is some script I found on a tree.

#org 0x2906BB
lockall
checkflag 0x867 Checking for a flag
if 0x0 goto 0x8290721 Flag is false? Don't do much
checkattack 0xF Checking for Cut?
compare LASTRESULT 0x6
if 0x1 goto 0x8290721 Compared result is true? Don't do much
setanimation 0x0 LASTRESULT
bufferpartypokemon 0x0 LASTRESULT
bufferattack 0x1 0xF
msgbox 0x829072E MSG_YESNO '"This tree looks like it can be\nCU..."
compare LASTRESULT 0x0
if 0x1 goto 0x829072B
msgbox 0x8290771 MSG_KEEPOPEN '"[buffer1] used [buffer2]!" PokemonName used PokemonMove!
closeonkeypress
doanimation 0x2
waitstate
goto 0x8290710


I believe you have something similar on your grass. Put a flag in your event on the grass or in the Header > Map Scripts. Then check if your grass flag has been Cut(true).
checkFlag 0x8FF You define where the flag is located
if 0x0 goTo 0x8FFFFFF If false, go do another thing
Do your stuff here


Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old January 12th, 2017 (5:04 AM).
Trev's Avatar
Trev Trev is offline
i gave you everything...
 
Join Date: May 2012
Age: 26
Gender: Male
Nature: Sassy
Posts: 1,505
Quote:
Originally Posted by MagicalEye View Post
checkFlag 0x8FF
Do not put an 8 before your flag number. The only reason there's an 8 in the flag number for the Cut script is because it uses flag 867.

If you're trying to make it so that you can keep grass removed after using Cut, you'll need to use setmaptile in conjunction with setting flags, and you'd also have have a way to check which grass tiles are gone (which is impossible unless you reroute the Grass cutting system to store several XY coordinates in various accessible locations, which would require a lot of ASM.)
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old January 13th, 2017 (8:59 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
If you want to just see if the HM cut has been used on grass, or the map in general, I had a post in the ASM resources thread addressing field moves. You'd want to hook into cut's launch routine and set your flag.

However, if you wanted to make cut grass changes persist through warping, you'd need a more complicated data structure to accomplish this. Specifically, you'd need to log map number and bank, alongside x/y and radius (I believe hyper cutter cuts a larger block of grass). While this is within reason for FireRed using the Community Hack's save block expansion, I don't think you'd reliably have Save and EWRAM space on other ROMs to do this.
__________________
...
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old January 13th, 2017 (12:14 PM). Edited January 13th, 2017 by tkim.
tkim's Avatar
tkim tkim is offline
 
Join Date: May 2011
Posts: 232
Quote:
Originally Posted by FBI View Post
If you want to just see if the HM cut has been used on grass, or the map in general, I had a post in the ASM resources thread addressing field moves. You'd want to hook into cut's launch routine and set your flag.
This is what I was looking for. Please help me further with this! Would this require ASM? And how would an example script look like at the end? My goal here is to imitate the event that occurs when one cuts the grass on Faraway Island, in which then the message "The feeling of being watched faded..." pops up and Mew disappears. Does "hook into cut's launch routine and set your flag" mean callasm 0x8_________ followed by setflag 0x___ ?

edit: or would it look more like this:
Spoiler:
comparefarbytetobyte 0x_ 0x_
if 0x1 call @1
end

'---------------
#org @1
setflag 0x_
return
Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old January 13th, 2017 (4:07 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 tkim View Post
This is what I was looking for. Please help me further with this! Would this require ASM? And how would an example script look like at the end? My goal here is to imitate the event that occurs when one cuts the grass on Faraway Island, in which then the message "The feeling of being watched faded..." pops up and Mew disappears. Does "hook into cut's launch routine and set your flag" mean callasm 0x8_________ followed by setflag 0x___ ?

edit: or would it look more like this:
Spoiler:
comparefarbytetobyte 0x_ 0x_
if 0x1 call @1
end

'---------------
#org @1
setflag 0x_
return
There already exists a similar functioning routine in FireRed for Ruin valley. It looks like this:


You do need some ASM, as you'd want to hook exactly where this is and add in your own little bit of ASM to set your special checking byte.

You could do this a little more easily if your hack doesn't have ruin valley's door thing in it. Specifically, you must write at 080978A2 "01". Fair warning though, it might not cut the grass if you do this (I haven't investigated) but if it doesn't then fall back and hook instead. Anyways if you do write 01 there and it works fine, the byte at 02039874 with be 0x1 in the event cut is used on the Map.
__________________
...
Reply With Quote
  #9   Link to this post, but load the entire thread.  
Old January 13th, 2017 (5:54 PM). Edited January 13th, 2017 by tkim.
tkim's Avatar
tkim tkim is offline
 
Join Date: May 2011
Posts: 232
Quote:
Originally Posted by FBI View Post
There already exists a similar functioning routine in FireRed for Ruin valley. It looks like this:


You do need some ASM, as you'd want to hook exactly where this is and add in your own little bit of ASM to set your special checking byte.

You could do this a little more easily if your hack doesn't have ruin valley's door thing in it. Specifically, you must write at 080978A2 "01". Fair warning though, it might not cut the grass if you do this (I haven't investigated) but if it doesn't then fall back and hook instead. Anyways if you do write 01 there and it works fine, the byte at 02039874 with be 0x1 in the event cut is used on the Map.
I will really have to study this because I want to add onto the vanilla game and not remove any events. I basically want to have Faraway Island in FireRed (without some features such as tall grass and special 0x1F7 from Emerald.) Thanks for the info!
Reply With Quote
  #10   Link to this post, but load the entire thread.  
Old January 15th, 2017 (7:58 PM).
camthesaxman camthesaxman is offline
reverse engineer of teh pokeymanz
 
Join Date: Jan 2017
Gender: Male
Nature: Lonely
Posts: 23
Why would you need asm for this? There is the checkflag and setflag script commands which set and check various flags.
__________________

Pokemon Ruby/Sapphire disassembly project
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:17 AM.