Quote:
Originally Posted by JordanB500
Hello, i want to remove restrictions on legendary pokemon in the battle frontier.
|
Check out this post.
Quote:
Originally Posted by JordanB500
Edit: i altered the cut bush script to use a random number generator to determine if the cut bush is a dudowoodo still cant figure out how to make the wild pokemon have reduced hp.
|
In order to change the starting HP of a wild Pokemon you need to generate the Pokemon, edit the HP in the RAM and then initiate the battle. Thankfully this is pretty easy to do with just a few script commands:
Code:
...
setwildbattle 0xB9 0xA 0x0 // Generates a level 10 Sudowoodo
writebytetooffset 0x1 0x0202479A // Overwrites the Sudowoodo's current HP with 1
dowildbattle // Begins the battle
waitstate
...
Here's a link to
how the data structure of Pokemon is arranged and here's
some info on where your party/ enemy's party is in the RAM. Since you're using Emerald, in order to find the correct spot in the RAM to edit, you just need to find the start point of the first opposing Pokemon (0x02024744) and then add 0x56 (86 in decimal) to reach the current HP. If the player is going up against higher level Sudowoodo with a possible total HP over 255 you will also need to change 0x0202479B in the RAM to 0x0 as it will need to use that extra byte to properly store the HP.
If you don't want the Sudowoodo to have static HP (i.e its always at 1 HP) and instead want dynamic HP (e.g you want it to have half health or you want remove 5 HP after cutting it) you can make the HP dynamic by doing some variable maths.
Here's how you can remove a set number from the Sudowoodo's current HP:
Code:
...
setwildbattle 0xB9 0xA 0x0 // Generates a level 10 Sudowoodo
copybyte 0x020375D8 0x0202479A
copybyte 0x020375D9 0x0202479B // Moving the enemy's current HP to variable 0x8000 in the RAM
subvar 0x8000 0x5 // Removing 0x5 from variable 0x8000's value. Change this to alter how much HP is removed
copybyte 0x0202479A 0x020375D8
copybyte 0x0202479B 0x020375D9 // Moving variable 0x8000 to the enemy's current HP in the RAM
dowildbattle // Begins the battle
waitstate
...
Here's how you can make the HP a fraction of its total just with scripting alone. It would probably be better to use ASM for something like this, but I felt like writing it out in script form~
Code:
...
setwildbattle 0xB9 0xA 0x0 // Generates a level 10 Sudowoodo
copybyte 0x020375D8 0x0202479A
copybyte 0x020375D9 0x0202479B // Moving the current HP to variable 0x8000 in the RAM
setvar 0x8001 0x1 // This is your numerator
setvar 0x8002 0x2 // This is your denominator
setvar 0x8003 0x0 // Counter number 1: Helps keep track of where we are in relation to our chosen fraction. Just leave as 0x0.
copyvar 0x8004 0x8000 // Counter number 2: Lets us know how many times we will repeat @loop
goto @loop
#org @loop
comparevars 0x8003 0x8001 // Compares variables 0x8003 and 0x8001
if 0x4 call @removehp // If our numerator is greater than or equal to counter 1, go to @removehp
subvar 0x8004 0x1 // Removes 1 from counter 2
compare 0x8004 0x0 // Check if counter 2 has finished
if 0x1 goto @next // If this is true, exit the loop
addvar 0x8003 0x1 // Add 1 to counter 1
comparevars 0x8003 0x8002 // Compares counter 1 and the denominator
if 0x5 goto @loop // If they are not equal to each other, continue the loop immediately
setvar 0x8003 0x0 // If they are equal, reset counter 1
goto @loop
#org @removehp
subvar 0x8000 0x1 // This will remove one HP from the generated Sudowoodo
return
#org @next
copybyte 0x0202479A 0x020375D8
copybyte 0x0202479B 0x020375D9 // Moving variable 0x8000 to the enemy's current HP in the RAM
dowildbattle // Begins the battle
waitstate
...
Hopefully one of those is what you're looking for.