The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script berries behavior in Berry forest in a npc 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 December 20th, 2016 (8:01 PM). Edited December 21st, 2016 by tkim.
tkim's Avatar
tkim tkim is offline
 
Join Date: May 2011
Posts: 232
In FireRed, there are berries that sometimes spawn after every 512 steps in Berry Forest. Is it possible to see this same behavior in a script? I would like Lostelle to maybe (not always) give the player a random berry after every 512 steps. I know how to generate a random berry, but I don't know how to check or call for the amount of steps a player has taken.

Edit: So I tried playing around with a couple of "pedometer" vars that I found, but it seems like the only var that works is 0x4020, which is specifically used for repel. Is there another var I can use besides 0x4020 that won't roll over to 0x0 when it hits its set value? Here's a script I've tested with 0x4020.
Spoiler:
'---------------
#org 0x800500
lock
faceplayer
compare 0x4020 0x0
if 0x1 goto 0x8800100
msgbox 0x81A2B53 MSG_KEEPOPEN '"Listen, listen!\pPlease show me yo..."
release
end

'---------------
#org 0x800100
setvar 0x4020 0x7f
msgbox 0x8800200 MSG_KEEPOPEN '"Hi!"
release
end


'---------
' Strings
'---------
#org 0x1A2B53
= Listen, listen!\pPlease show me you being cool\nagain!

#org 0x800200
= Hi!


EDIT: I figured out how to use 0x4023 which doesn't roll over back to 0x0 when it reaches its maximum value, which is 0x5DC. I had previously thought that all the pedometer vars counted downwards from the value I set. Turns out only 0x4020 (repel) counts downwards to 0x0 from the value I set, while 0x4023 counts upwards to the maximum value of 0x5DC from the value I set. The others (0x4021-0x4022) do roll over according to Spherical Ice with even shorter maximum values. Here's an example script that I finally got working.
Spoiler:
'---------------
#org 0x800500
lock
faceplayer
compare 0x4023 0x5DC
if 0x1 goto 0x8800100
msgbox 0x81A2B53 MSG_KEEPOPEN '"Listen, listen!\pPlease show me yo..."
release
end

'---------------
#org 0x800100
setvar 0x4023 0x3DC
msgbox 0x8800200 MSG_KEEPOPEN '"Hi!"
release
end


'---------
' Strings
'---------
#org 0x1A2B53
= Listen, listen!\pPlease show me you being cool\nagain!

#org 0x800200
= Hi!

0x4023 0x5DC is 1500 steps while 0x4023 0x3DC is 988 steps. Subtract the two and you'll end up with 512 steps.
I will now make Lostelle give me a random berry- or not, every 512 steps I take!
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
Thread Tools

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