The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script How to tell if player is riding a bicycle? [SOLVED]

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 May 11th, 2018 (9:46 AM). Edited May 12th, 2018 by Sakakii.
Sakakii's Avatar
Sakakii Sakakii is offline
 
Join Date: Nov 2017
Posts: 242
Hello, does anyone know how to tell if the players is on their bike or not?

This would make one of my scripts smoother.
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old May 11th, 2018 (7:27 PM).
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
If you're hacking FR, you can tell whether the player is on a bike by using the speed value assigned to the player, detailed here by knizz. Here's a simple script will take the speed value and place it into variable 0x8000, allowing you to check it without having to make a custom ASM routine:

Code:
#dynamic 0x800000

#org @start
setvar 0x8000 0x0
copybyte 0x020370B8 0x02037078
compare 0x8000 0x2
if 0x1 goto @OnBicycle
compare 0x8000 0x22
if 0x1 goto @OnBicycle
goto @Walking
We're checking for values of 0x2 and 0x22 as its the second halfbyte that determines how fast you're going. If you use the bike via the bag or enter a new map the speed value will be set to 0x22, but change to 0x2 after a single step. If you use the bike via the select button it will automatically be set to 0x2.

There's probably an easier way to check whether the player is on a bike, but this method works just fine.
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old May 12th, 2018 (3:22 AM). Edited May 12th, 2018 by Sakakii.
Sakakii's Avatar
Sakakii Sakakii is offline
 
Join Date: Nov 2017
Posts: 242
Thanks a lot, tested your code and it works.

Do you know if there's a way to dismount the bike with code? I did a little bit of research and special 0x157 is used to get on the bicycle, but it doesn't work other way around (can't call that special to get off the bike).

GOT IT TO WORK!

Quote:
#org @OnBike
writebytetooffset 0x1 0x02037079
playsong 0x135 0x0
release
end
This seems to work like just a regular dismount. Without the playsong, the bike music still plays.
However, the dismount doesn't seem to happen until after the script ends, so it can't happen mid-script. Maybe there's some way around this idk.
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.