View Single Post
  #7365    
Old October 15th, 2012 (09:51 PM).
itman itman is offline
Back to ROM hacking. :D
 
Join Date: May 2007
Age: 21
Nature: Adamant
Posts: 100
Quote originally posted by Teh Blazer:
What is the basic skeleton for an obtain pokemon script? You know, the basic pointers and such if, say, you were already carrying 6 pokemon and received this seventh.

I tried looking at the actual thing on a clean ROM, but it was soo big with flags being set everywhere and variables being changed every second. I know you guys probably have this easy method of doing it (including the "Bill/Someone's PC", party being full, and switching boxes, and that type of stuff) and I'd like to know as well so I'm not putting a bunch of other unneeded variable changes into my script.
This is the skeleton for a givepokemon script at it's very basic.

Spoiler:
#org @begin
givepokemon 01 05 00 00 00 00
end


That gives a Bulbasaur, level 5, holding no item.

The first byte (01) is the pokemon's index number.

The second byte (05) is the level.

The third byte (00) is the item's index number it's holding (00 means it's not holding anything.)

The last three bytes (00 00 00) are just filler bytes and need to be there.

Now, to add the check, you need to add an extra few commands.

So, here's the same script with the added commands:

Spoiler:
#org @begin
countpokemon
compare 0x800D 0x6
if 0x1 goto @no
givepokemon 01 05 00 00 00 00
end

#org @no
end


"Count pokemon" counts your pokemon, obviously. Then it compares the number to the number six. So then it's saying if there is six pokemon (a full party), go to the pointer "no", which will end the script without giving you a pokemon. This of course is the mere outline.