Hello all,
I made a way to have random wild battles which also randomize not only the Pokemon but the level as well.
I got the idea and the know how from a thread called "
PokeMart as debug input ".
Anyway here is the XSE script.
Code:
Code:
//wildbattle2hex
00 B6 | ?? ?? | ?? 00 | ?? ?? | B7 03 |
cmd | pkid | lvl | item |
4100 | 4101 | 4102 | 4103 | 4104 |
Hand to put B7 03 place of(25 39 01 27) wich means dowildbattle followed by '03' return.
Also to get the address of vars 0x4000+ you need to take the pointer stored at 0x3005008 and add 0x1000 to it.
To get var 0x4100 you would add 0x1200 to the pointer at 0x3005008.
//
#dynamic 0xD00000
#org @start
random 0x64
compare 0x800D 0x8
if 0x2 goto @snippet1
random 0x64
copyvar 0x4000 0x800D
setvar 0x4100 0xB600
copyvar 0x4101 0x4000
random 0xFF
copyvar 0x4102 0x800D
setvar 0x4103 0x0000
setvar 0x4104 0x03B7
setvar 0x5006 0x1
setvar 0x800D 0x0
call @snippet2
setvar 0x5006 0x0
release
end
#org @snippet1
release
end
#org @snippet2
writebytetooffset 0x4 0x20370D0
copybyte 0x20370D1 0x3005008
copybyte 0x20370D2 0x3005009
copybyte 0x20370D3 0x300500A
copybyte 0x20370D8 0x20370D2
copybyte 0x20370D9 0x20370D3
addvar 0x8011 0x12
copybyte 0x20370D2 0x20370D8
copybyte 0x20370D3 0x20370D9
copybyte 0x20370D4 0x300500B
writebytetooffset 0x3 0x20370D5
writebytetooffset 0xFF 0x20370D6
writebytetooffset 0x0 0x20370D7
call 0x20370D0
return
At the moment it still uses the default vars from the debug input thread.
But I will make a different version that uses the safe vars hack.
Just in case.
To use this,
Simply compile and place on green script tile then set the tiles var to 0x5006 and the value to 0.
The default script is made so you have an 8% chance of a wildbattle to happen.
What this does:
It takes a script command and writes it in hex into vars 0x4100 - 0x4104.
Then it changes the certain values to the random number (PokemonID and Level),
after that it sets up vars 0x800D - 0x8012 and then calls the 0x800D to execute the code at 0x4100-0x4105.
Then returns.
Hope it can help someone out there.