The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Checking a party member's health

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 January 8th, 2017 (3:41 PM). Edited January 11th, 2017 by Anthroyd.
Anthroyd's Avatar
Anthroyd Anthroyd is offline
Professor
 
Join Date: May 2016
Location: United States
Gender: Male
Posts: 210
Hi there,

Is there any way to check how much health a party member has using a script? I need to check if a member of the player's party has zero health left while in the overworld.
__________________
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old January 11th, 2017 (11:57 AM).
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
Quote:
Originally Posted by Anthroyd View Post
Hi there,

Is there any way to check how much health a party member has using a script? I need to check if a member of the player's party has zero health left while in the overworld.
You need to write an ASM routine and call it via callasm.
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old January 11th, 2017 (2:51 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
You can check it in a script with two copybyte calls, unfortunately, there is no way to load a halfword, so it takes two calls. First step is to free a temporary variable. For example:

Quote:
copybyte 0x20370B8 0x20242DA ' load bottom 8 bits of HP
copybyte 0x20370B9 0x20242DB ' load top 8 bits of HP
This would put in var 0x8000 would have the current HP value for the first Pokemon. For the second Pokemon, you would add 0x64 to 0x20242DB and 0x20242DA respectively, and so on for subsequent Pokemon. You would need to hard code these increments because well...that's scripting for you.
__________________
...
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old January 11th, 2017 (3:00 PM).
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
Quote:
Originally Posted by FBI View Post
You can check it in a script with two copybyte calls, unfortunately, there is no way to load a halfword, so it takes two calls. First step is to free a temporary variable. For example:



This would put in var 0x8000 would have the current HP value for the first Pokemon. For the second Pokemon, you would add 0x64 to 0x20242DB and 0x20242DA respectively, and so on for subsequent Pokemon. You would need to hard code these increments because well...that's scripting for you.
Please add to actually not use this ever and write a simple routine for it. Poor soul may want to try it out {XD}
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old January 11th, 2017 (6:21 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by DizzyEgg View Post
Please add to actually not use this ever and write a simple routine for it. Poor soul may want to try it out {XD}
Sure an ASM solution is ideal, but he is asking for a scripting solution, and this is exactly that. What's wrong with it?
__________________
...
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old January 11th, 2017 (6:28 PM).
Anthroyd's Avatar
Anthroyd Anthroyd is offline
Professor
 
Join Date: May 2016
Location: United States
Gender: Male
Posts: 210
Quote:
Originally Posted by FBI View Post
You can check it in a script with two copybyte calls, unfortunately, there is no way to load a halfword, so it takes two calls. First step is to free a temporary variable. For example:



This would put in var 0x8000 would have the current HP value for the first Pokemon. For the second Pokemon, you would add 0x64 to 0x20242DB and 0x20242DA respectively, and so on for subsequent Pokemon. You would need to hard code these increments because well...that's scripting for you.
It works. Thanks!
__________________
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.