• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Alpha] [FR] Berry System V2

82
Posts
6
Years
Berry System in FireRed! Now with RTC

giphy.gif

Technical Information:
Spoiler:


System Algorithm:
The current system has 5 phases, each phase is 12 hours; feel free to change this to whatever you want. You can Increase or decrease this time by going to the "getTreeData" routine, finding my comment in all caps and changing the constant. There is also another "Change" label. So if more than 3 days has passed, it will automatically set the stage to 5(picking berries). If you change the phases to 24 hrs, this needs to be changed. Make sure to add 1 for safety reasons. I discovered if I had it set to 2 and you planted in the evening of the 10th and you came back the morning of the 12th, it would go into stage 5 when it should be 4. But right now its set to the same as DPPT so I see no reason to change it.
Link to DPPT berry system: http://bulbapedia.bulbagarden.net/wiki/Berry#Formula



Tutorial:

First of all, before you implement my system you need to insert:
JPAN's save block hack: http://www.pokecommunity.com/showpost.php?p=6993092&postcount=206
You will then need to install some RTC. Note: If you use DNS, go to the second to last page of the thread and get endrifts patch. PATCH THE DNS PROGRAM NOT YOUR ROM. This patch fixes dns compatibility with mgba. If you don't do this, dns will only work on vba and not no$gba or Mgba. If you use sq's rtc, it will only work on VBA. These are bugs with rtc and emulators, not my system.

Insert the following routines into freespace.

bagHack:
Spoiler:


getTreeData:
Spoiler:


setTreeData:
Spoiler:


getYeild:
Spoiler:


setTime:
Spoiler:


Now, once you've compiled those routines into free space you will need to insert their pointers (not in reverse hex) into this script. Remember to add 1 to the pointer.
I've made sure to add comments everywhere there is a callasm command to one of my routines. You'll also notice that the names I call these routines are identical to the names I gave the spoilers. You need to match the call to the pointer to the name of the routine!

XSE script:
Spoiler:



Usage:
After you've compiled the script, write down the offset of it as well. You will need to remember it.
Here is how you'll be using the script:

Code:
#dyn 0x740000
#org @start
setvar 0x8000 0x[max berry yield]
setvar 0x8001 0x[min berry yield]
setvar LASTRESULT 0x[Tree ID] 'Start at 00
jump 0x8[Offset where you compiled the above script]

Every tree should have a unique Tree ID. So if you want two trees, one can be 0x0, and the other can be 0x1. You can theoretically go up to FFFF or 65,535 trees with the current system but we don't have enough ram for that. I think FF is a fine amount. Set the tree ID to lastresult and then jump the script that handles the complicated stuff.

Getting Sprites to Load:
Everyone can thank DrFuji for this.
Spoiler:


Insert this level script into every level you have berry trees on:
Spoiler:


Now once you do that....a tutorial will be put here later!


Notes:
- Watering item is a masterball, change it to your watering item
- Where you see "SAVEBLOCK" in each routine, change that to a spot in ram that your tree data table will be located. Every tree is 6 bytes of ram.
- YOU MUST MOVE BERRIES INTO THE ITEM POUCH
Why?
Spoiler:


Future Updates:
- Move berries bag into berry pouch when/if we find a way to do so

Credits:
Spoiler:
 
Last edited:

Prof. Leon Dias

Let your memes be dreams
118
Posts
11
Years
Definitely adding this to my rom base when the kinks are ironed out.

My suggestion to not fill up the amount of OWs with just berry trees are to use HGSS Apricorn tree sprites instead, having 4 or 5 with different colors should be sufficient, and when berries are picked we just use the sprite minus the colored fruit inside.
 
82
Posts
6
Years
Definitely adding this to my rom base when the kinks are ironed out.

My suggestion to not fill up the amount of OWs with just berry trees are to use HGSS Apricorn tree sprites instead, having 4 or 5 with different colors should be sufficient, and when berries are picked we just use the sprite minus the colored fruit inside.

Im confused. Can you explain a bit better? I never played hgss. I looked at the trees, just looks like they have colored tops?


Update: RTC version is done. Initial testing and bug fixes are done. DrFuji wrote me a level script for loading sprites on loading the map. Going to start working that in later today. Hopefully I can release the rtc system sometime this week. RTC will only work if its Sq's on vba or DNS on mgba. Vba has a bug so only sq's works on it. Sq's routine has a bug so it doesn't work on mgba. Ill also be releasing an updated version playtime clock version that will reduce ram usage from 6 to 4 bytes. Youre welcome DrFuji...
 
Back
Top