The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script 1st Shiny on a route with a higher shiny chance script

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 April 25th, 2020 (1:18 AM).
Tomahawk1996 Tomahawk1996 is offline
 
Join Date: May 2018
Location: United Kingdom
Gender: Male
Nature: Timid
Posts: 16
Hi,

I'm using Ruby for this script.

So I'm trying to write a script alongside the Shinyzer tool that has a high shiny chance until a shiny appears on a map. (i.e. you're pretty much guaranteed to find a shiny once per route)

I thought I could achieve this with the setflag and check flag and it does work but I can't reuse this for routes 101 & 102 for example (As the script in route 101 then sets the flag so using the same script in route 103 yields no shiny in 103) as the flag has already been set in a previous route).

My question is this: Is there anyway for the script to detect what map it is being run from so I can just have one script for every route?

I thought about getplayerpos but this only seems to be for the map the player is currently in, not the map itself.

If not I'll have to rinse and repeat the script changing the initial offset and the flags for each route. Please have a look over my script to see if more experienced eyes can pick up on things mine cannot.

Thanks,

Script:
'---------------
#org 0x800900
random 0x3
compare LASTRESULT 0x0
if 0x1 goto 0x8800929
compare LASTRESULT 0x1
if 0x1 goto 0x8800929
compare LASTRESULT 0x2
if 0x1 goto 0x880092C
end

'---------------
#org 0x800929
end

'---------------
#org 0x80092C
checkflag 0x1203
if 0x1 goto 0x8800929
callasm 0x8800481
setvar 0x8003 0x1
setflag 0x1203
end
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old April 25th, 2020 (8:19 AM).
Pyxal's Avatar
Pyxal Pyxal is offline
It's pronounced pixel.
 
Join Date: Jul 2019
Location: Pakistan
Age: 17
Posts: 987
Quote:
Originally Posted by Tomahawk1996 View Post
Hi,

I'm using Ruby for this script.

So I'm trying to write a script alongside the Shinyzer tool that has a high shiny chance until a shiny appears on a map. (i.e. you're pretty much guaranteed to find a shiny once per route)

I thought I could achieve this with the setflag and check flag and it does work but I can't reuse this for routes 101 & 102 for example (As the script in route 101 then sets the flag so using the same script in route 103 yields no shiny in 103) as the flag has already been set in a previous route).

My question is this: Is there anyway for the script to detect what map it is being run from so I can just have one script for every route?

I thought about getplayerpos but this only seems to be for the map the player is currently in, not the map itself.

If not I'll have to rinse and repeat the script changing the initial offset and the flags for each route. Please have a look over my script to see if more experienced eyes can pick up on things mine cannot.

Thanks,

Script:
'---------------
#org 0x800900
random 0x3
compare LASTRESULT 0x0
if 0x1 goto 0x8800929
compare LASTRESULT 0x1
if 0x1 goto 0x8800929
compare LASTRESULT 0x2
if 0x1 goto 0x880092C
end

'---------------
#org 0x800929
end

'---------------
#org 0x80092C
checkflag 0x1203
if 0x1 goto 0x8800929
callasm 0x8800481
setvar 0x8003 0x1
setflag 0x1203
end
Just use a "clearflag" command.
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old April 25th, 2020 (12:45 PM).
Tomahawk1996 Tomahawk1996 is offline
 
Join Date: May 2018
Location: United Kingdom
Gender: Male
Nature: Timid
Posts: 16
In regards to the clear flag command, when I added it, it would always clear the flag upon entry to a previously visited route.

Example: Go to route 103, find a shiny zigzagoon and catch it, adds the setflag to stop the 1/3 shiny chance. Leave route 103 to heal newly acquired shiny, re-enter route 103, the clear flag has now reset this routes shiny, reactivating the 1/3 chance.

What I am looking for is a command or offset etc. that can check to see what route/map the player is currently in so I can write the script to check the route before the checkflag.

Hope this helps clarify, though the more I look into this, the more I feel like there isn't going to be any such command and I'll have to write a similar script for each individual map.

Thanks for the response though!
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old April 26th, 2020 (5:29 AM).
Pyxal's Avatar
Pyxal Pyxal is offline
It's pronounced pixel.
 
Join Date: Jul 2019
Location: Pakistan
Age: 17
Posts: 987
Quote:
Originally Posted by Tomahawk1996 View Post
In regards to the clear flag command, when I added it, it would always clear the flag upon entry to a previously visited route.

Example: Go to route 103, find a shiny zigzagoon and catch it, adds the setflag to stop the 1/3 shiny chance. Leave route 103 to heal newly acquired shiny, re-enter route 103, the clear flag has now reset this routes shiny, reactivating the 1/3 chance.

What I am looking for is a command or offset etc. that can check to see what route/map the player is currently in so I can write the script to check the route before the checkflag.

Hope this helps clarify, though the more I look into this, the more I feel like there isn't going to be any such command and I'll have to write a similar script for each individual map.

Thanks for the response though!
What I meant was, using two flags, the script can see which flag has been set and which has not, and then just clear the flag (via "checkflag" command or whatever you want).
__________________
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old April 26th, 2020 (12:31 PM).
Tomahawk1996 Tomahawk1996 is offline
 
Join Date: May 2018
Location: United Kingdom
Gender: Male
Nature: Timid
Posts: 16
PokeChu, would you be able to give an example or elaborate what that would do in terms of the script?

I apologise in advance, I'm a scrub at scripting at the moment but I'm getting there piece by piece.

Would the second flag's usage just to be to check if the first flag has been triggered/set?

Or do you mean have multiple flags one for each route in the game and have the script check each route's respective flag?

Thank you for both your patience and help :)
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old April 27th, 2020 (1:36 AM).
Pyxal's Avatar
Pyxal Pyxal is offline
It's pronounced pixel.
 
Join Date: Jul 2019
Location: Pakistan
Age: 17
Posts: 987
Quote:
Originally Posted by Tomahawk1996 View Post
PokeChu, would you be able to give an example or elaborate what that would do in terms of the script?

I apologise in advance, I'm a scrub at scripting at the moment but I'm getting there piece by piece.

Would the second flag's usage just to be to check if the first flag has been triggered/set?

Or do you mean have multiple flags one for each route in the game and have the script check each route's respective flag?

Thank you for both your patience and help :)
What I am talking about is, I don't know, advanced, or something?
But you can have different flags for each route.
__________________
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old April 27th, 2020 (9:03 AM).
Tomahawk1996 Tomahawk1996 is offline
 
Join Date: May 2018
Location: United Kingdom
Gender: Male
Nature: Timid
Posts: 16
I think I got what you meant, I trialed a script that calls on an edited one of the one I posted (See Below)

Good news is... it works! The script checks to see if a shiny has been encountered on the route and if it hasn't it calls the Base script.

I'll post it here in case anyone wants to improve on it but glad I could get this working :)

Route Script:
'---------------
#org 0x800000
checkflag 0x8C4
if 0x1 goto 0x8800019
call 0x8800373
checkflag 0x8C3
if 0x1 goto 0x8800022
end

'---------------
#org 0x800019
end

___________________________________________
Revised Base Script (Which is called on by above)

'---------------
#org 0x800373
clearflag 0x8C3
random 0x3
compare LASTRESULT 0x0
if 0x1 goto 0x8800929
compare LASTRESULT 0x1
if 0x1 goto 0x8800929
compare LASTRESULT 0x2
if 0x1 goto 0x880092C
end

'---------------
#org 0x800022
setflag 0x8C4
end

'---------------
#org 0x800929
end

'---------------
#org 0x80092C
callasm 0x8800481
setvar 0x8003 0x1
setflag 0x8C3
return
Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old April 27th, 2020 (9:32 AM).
Pyxal's Avatar
Pyxal Pyxal is offline
It's pronounced pixel.
 
Join Date: Jul 2019
Location: Pakistan
Age: 17
Posts: 987
Quote:
Originally Posted by Tomahawk1996 View Post
I think I got what you meant, I trialed a script that calls on an edited one of the one I posted (See Below)

Good news is... it works! The script checks to see if a shiny has been encountered on the route and if it hasn't it calls the Base script.

I'll post it here in case anyone wants to improve on it but glad I could get this working :)

Route Script:
'---------------
#org 0x800000
checkflag 0x8C4
if 0x1 goto 0x8800019
call 0x8800373
checkflag 0x8C3
if 0x1 goto 0x8800022
end

'---------------
#org 0x800019
end

___________________________________________
Revised Base Script (Which is called on by above)

'---------------
#org 0x800373
clearflag 0x8C3
random 0x3
compare LASTRESULT 0x0
if 0x1 goto 0x8800929
compare LASTRESULT 0x1
if 0x1 goto 0x8800929
compare LASTRESULT 0x2
if 0x1 goto 0x880092C
end

'---------------
#org 0x800022
setflag 0x8C4
end

'---------------
#org 0x800929
end

'---------------
#org 0x80092C
callasm 0x8800481
setvar 0x8003 0x1
setflag 0x8C3
return
Haha, you got it! Good job.
__________________
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:18 AM.