• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Script] [Emerald] Offset used for SURF

That script for Surf doesn't include all of the checks that you'd need in order to use the move in the overworld via an item (like the rest of your scripts I'm assuming). Whenever you interact with a surfable tile, the game checks three things: If the tile is surfable, if flag 0x86B is set (5th gym badge) and if you have a Pokemon with surf on your team. If all three conditions are met, it will then move onto the script you've linked and ask if you want to surf. If any of the three checks returns false, then the routine will terminate early and you won't even be given a chance to surf. The first two checks are easy to bypass (I'll mention how to change the flag below), but the third check is the sticky point. This third check requires you to have a Pokemon with Surf in your party before it will continue on to your edited script, removing the whole point of using an item to Surf rather than a Pokemon. I'm not very good with ASM, so if anybody better is able to help out, I believe the check is somewhere around 0x9C7F2 - nulling it out should solve this issue.

If you're able to get past that hurdle, you can then move onto the script whose offset you've found. Once you've edited it to your heart's content, compile it in XSE and write down the offset you're given. Open your ROM in a hex editor and go to 0x9C820. Turn your offset from XSE into a pointer (There's a tutorial at the bottom of this page - GBA Pokemon game use little endian) and overwrite the pointer to the script that you've identified that's already there. Now whenever you get past the three pre-checks, it will run your altered script.

Its pretty easy to edit the second check to work with any flag you want. Just go to 0x9C81C and change the two bytes there to the flag you want to use. In a clean ROM its says 6B 08, which correlates to flag 0x86B (the fifth gym flag) so just change it to whatever you want and set that flag in the script whenever you receive the surf item.
 
Last edited:
Back
Top