The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Script Checking a party member's health (https://www.pokecommunity.com/showthread.php?t=387141)

Anthroyd January 8th, 2017 3:41 PM

Checking a party member's health
 
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.

DizzyEgg January 11th, 2017 11:57 AM

Quote:

Originally Posted by Anthroyd (Post 9542463)
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.

Blah January 11th, 2017 2:51 PM

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.

DizzyEgg January 11th, 2017 3:00 PM

Quote:

Originally Posted by FBI (Post 9545241)
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}

Blah January 11th, 2017 6:21 PM

Quote:

Originally Posted by DizzyEgg (Post 9545248)
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?

Anthroyd January 11th, 2017 6:28 PM

Quote:

Originally Posted by FBI (Post 9545241)
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!


All times are GMT -8. The time now is 9:14 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.