Pokemon Gba Scripting Tutorial

Only available on StudyMode
  • Topic: The Script
  • Pages : 8 (1165 words )
  • Download(s) : 2829
  • Published : December 27, 2007
Open Document
Text Preview
Getting Started

#ORG $StartScript
Lock
Faceplayer

#ORG : beginning of a script
Lock : Locks down the character you activate in the game so that they won't move around while the script is running. Faceplayer : makes them turn to face the player.
GotCookie : What is highlighted in blue is a Variable name. You can use any word you want for a variable name but there can't be any puntuation in it.

Displaying a message

#ORG $ShowText
Lock
Faceplayer
message $NoCookie
$NoCookie 1 = I'm not made of cookies!\lYou only get one.
boxset 6
release
end

\l : To write next line chacters.
\n : To write end of line characters.
\p : To write next page characters.
Release : The opposite of the lock command.
End : Finishes the script.

Boxsets

Boxset 6: displayes a normal textbox.
(used in Displaying a messsage)

Boxset 5: displays a "Yes/No" dialog so the user can select one. The way messagebox works is by placing you're response into a location in memory referred to as LASTRESULT. To find out what this is we need to use a compare statement first.

compare LASTRESUILT B_TRUE
if B_False goto $DontGet

B_True: Refers to Yes
B_False: Refers to No

Note:
B_TRUE can also be written as 1 or 0x1

Receiving Items

#org $Startscript
Lock
Faceplayer
checkflag 0x200
if B_TRUE goto $GotCookie
message $AskMe
$AskMe 1 = Would you like a Lava Cookie?
boxset 5
compare LASTRESUILT B_TRUE
if B_False goto $DontGet
giveitem 0x26 1
setflag 0x200
Release
end

#ORG $GotCookie
Lock
Faceplayer
message $NoCookie
$NoCookie 1 = I'm not made of cookies!\lYou only get one.
boxset 6
release
end

#ORG $DontGet
Lock
Faceplayer
message $AllMine
$AllMine 1 = All the more for me!
boxset 6
release
end

checkflag 0x200 : used to check to see if we've done this script already. The ONLY way to store this value so that it won't be forgotten when you restart the game is by using the command setflag.

Note:
There are aproximately 6000 true/false flags available in the program however there are a large number inside the range of 0x300 - 0x400 and 0x800 to 0x900 that are used by the program itself so it's best to avoid these numbers. Flags are usually written in hex. So pick a value.

giveitem 0x26 1 : The user receives an item. The value representing the item (cookie) is 0x26. The digit 1 following the value represents the quantity given.

Trading Items

#Org $StartScript
checkflag 0x201
if B_True goto $GotBall
checkitem 0x26
compare LASTRESULT 1
if B_ Greater Than (2)
B_= Greater than or Equal to (4)
B_!= Not exactly equal to (5)
removeitem 0x26 1 : Just like giveitem the properties for removeitem are the item number followed by the number of items to remove.

Vanishing Sprites
At the end of each script so far we have been using the command setflag. In advanced map (right underneath the script offset field) is a field called People ID. To make the character vanish simply plage the number of the flag you set (leave of the 0x) into the peopl ID. It's that simple! When you set the flag the character will vanish when the screen updates next. There is a condition. For this to work you must Release the sprite before updating the screen or it wont vanish. By vanishing the sprite you can also leave the checkflag command off the beginning of the script.

Note:
Vanishing sprites: Must use Release before updating the screen.

Receiving Pokémon

Code:
#org $StartChik
checkflag 0x800
if B_True goto $NoBall
message $Chick
$Chick 1 = Chikorita!\lThe Fire Bird.\pTake the Chikorita?
boxset 5
compare LASTRESULT 1
if B_False goto $PutBack
givepokemon 152 5 0
jingle
message $GotChick
$GotChick 1 = You Recieved a Chikorita
boxset 6
message $NameChick
$NameChick 1 = Would You like to give Chikorita a name?
boxset 5
compare LASTRESULT 1
if b_False goto $GiveDex
Namepokemon
setflag 0x203
goto $GiveDex

#org $StartShrew
checkflag 0x800
if B_True goto $NoBall
message...
tracking img