Pokemon Gba Scripting Tutorial
Essay Preview: Pokemon Gba Scripting Tutorial
Report this essay
Getting Started
#ORG $StartScript
Lock
Faceplayer
#ORG : beginning of a script
Lock : Locks down the character you activate in the game so that they wont 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 cant be any puntuation in it.
Displaying a message
#ORG $ShowText
Lock
Faceplayer
message $NoCookie
$NoCookie 1 = Im not made of cookies!lYou only get one.
boxset 6
release
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 youre 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
#ORG $GotCookie
Lock
Faceplayer
message $NoCookie
$NoCookie 1 = Im not made of cookies!lYou only get one.
boxset 6
release
#ORG $DontGet
Lock
Faceplayer
message $AllMine
$AllMine 1 = All the more for me!
boxset 6
release
checkflag 0x200 : used to check to see if weve done this script already.
The ONLY way to store this value so that it wont 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 its 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. Its 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

Get Your Essay

Cite this page

Lastresuilt B And Only Way. (June 14, 2021). Retrieved from https://www.freeessays.education/lastresuilt-b-and-only-way-essay/