• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: The Miscellaneous Script Thread

Logan

[img]http://pldh.net/media/pokecons_action/403.gif
10,417
Posts
15
Years
Code:
#dynamic 0x<offset>

#org @start
lock
faceplayer
showmoney 0x0 0x0 0x0
msgbox @msg1 MSG_KEEPOPEN
closeonkeypress
multichoice 0x14 0x1 0x<mcnumber> 0x0
compare 0x800D 0x0
if 0x1 goto @common
compare 0x800D 0x1
if 0x1 goto @uncommon
compare 0x800D 0x2
if 0x1 goto @rare
hidemoney 0x0 0x0
release
end

#org @common
checkmoney 0x1388 0x0
compare 0x800D 0x0
if 0x1 goto @notenough
paymoney 0x1388 0x0
updatemoney 0x0 0x0 0x0
fanfare 0x13E
msgbox @msg3 MSG_KEEPOPEN
closeonkeypress
waitfanfare
hidemoney 0x0 0x0
random 0x5
compare 0x800D 0x0
if 0x1 goto @1
compare 0x800D 0x1
if 0x1 goto @2
compare 0x800D 0x2
if 0x1 goto @3
compare 0x800D 0x3
if 0x1 goto @4
compare 0x800D 0x4
if 0x1 goto @5
release
end

#org @1
giveegg 0x<species>
release
end

#org @2
giveegg 0x<species>
release
end

#org @3
giveegg 0x<species>
release
end

#org @4
giveegg 0x<species>
release
end

#org @5
giveegg 0x<species>
release
end

#org @notenough
hidemoney 0x0 0x0
msgbox @msg2 MSG_KEEPOPEN
closeonkeypress
release
end

#org @uncommon
checkmoney 0x2710 0x0
compare 0x800D 0x0
if 0x1 goto @notenough
paymoney 0x2710 0x0
updatemoney 0x0 0x0 0x0
fanfare 0x13E
msgbox @msg3 MSG_KEEPOPEN
closeonkeypress
waitfanfare
hidemoney 0x0 0x0
random 0x5
compare 0x800D 0x0
if 0x1 goto @k1
compare 0x800D 0x1
if 0x1 goto @k2
compare 0x800D 0x2
if 0x1 goto @k3
compare 0x800D 0x3
if 0x1 goto @k4
compare 0x800D 0x4
if 0x1 goto @k5
release
end

#org @k1
giveegg 0x<species>
release
end

#org @k2
giveegg 0x<species>
release
end

#org @k3
giveegg 0x<species>
release
end

#org @k4
giveegg 0x<species>
release
end

#org @k5
giveegg 0x<species>
release
end

#org @rare
checkmoney 0x61A8
compare 0x800D 0x0
if 0x1 goto @notenough
paymoney 0x61A8 0x0
updatemoney 0x0 0x0 0x0
fanfare 0x13E
msgbox @msg1 MSG_KEEPOPEN
closeonkeypress
waitfanfare
hidemoney 0x0 0x0
random 0x3
compare 0x800D 0x0
if 0x1 goto @rare1
compare 0x800D 0x1
if 0x1 goto @rare2
compare 0x800D 0x2
if 0x1 goto @rare3
release
end

#org @rare1
giveegg 0x<species>
release
end

#org @rare2
giveegg 0x<species>
release
end

#org @rare3
giveegg 0x<species>
release
end

#org @msg1
= Hello, welcome to our Egg Shop!\pWhich kind of Egg would you like?

#org @msg2
= You don't have enough money.

#org @msg3
= [black_fr][player] received a [red_fr]Pokémon Egg[black_fr]!
Here is a public egg shop script. Feel free to change any of the text and any of script. Just give credit to Manipulation; okay? The Multichoice box at the top should contain 'Uncommon, Common and Rare' learn how to change them okay. I'm too lazy to explain it.

Common - $5000
Uncommon - $10000
Rare - $25000
 
Last edited:
535
Posts
15
Years
  • Age 28
  • Seen Jan 4, 2011
Wow!...

I don't know what to say about this, except wow!

This will make hacks cooler. If I use these I will credit the makers.

EDIT: We should sticky this thread, if you ask me.
 
Last edited:

Logan

[img]http://pldh.net/media/pokecons_action/403.gif
10,417
Posts
15
Years
Just to inform everyone I've edited the script, if you're using it or plan to please update it with the newest version. The post was edited today.
 

NarutoActor

The rocks cry out to me
1,974
Posts
15
Years
Okay well I liked harry's Idea for an egg shop, but I thought of a way where rare just gives you a higher percentage, while common just gives you a low percentage at a rare pokemon. This method means that even if you pick common you can get a rare egg(with luck), and if you pick rare you can get an un common pokemon(bad luck)

If you pick Rare
Chance of Rare Egg: 80%
Chance of Uncommon Egg: 20%
Chance of Common Egg:0%

If you pick uncommon:
Chance of Rare Egg:40%
Chance of Uncommon Egg:50%
Chance of Common Egg:10%

If you pick common:
Chance of Rare Egg:~13.33%
Chance of uncommon Egg:~16.66
Chance of Common Egg:70%

The way I would implement this is adding a message that states that you can buy a ticket, and green ticket has the best chance of a rare pokemon egg.Also that blue was the worse chance, but it is the cheapest.

Credits:
Manipulation (for original Egg Shop Script)
NarutoActor (For new method. )

Code:
Code:
#dynamic 0x<offset>

#org @start
lock
faceplayer
showmoney 0x0 0x0 0x0
msgbox @msg1 MSG_KEEPOPEN
closeonkeypress
multichoice 0x14 0x1 0x<mcnumber> 0x0
compare 0x800D 0x0
if 0x1 goto @common
compare 0x800D 0x1
if 0x1 goto @uncommon
compare 0x800D 0x2
if 0x1 goto @rare
hidemoney 0x0 0x0
release
end

#org @common
checkmoney 0x1388 0x0
compare 0x800D 0x0
if 0x1 goto @notenough
paymoney 0x1388 0x0
updatemoney 0x0 0x0 0x0
fanfare 0x13E
msgbox @msg3 MSG_KEEPOPEN
closeonkeypress
waitfanfare
hidemoney 0x0 0x0
random 0x1E
goto @com

#org @com
compare 0x800D 0x0
if 0x1 goto @1 'Uses only 2 rare pokemon, which was ment only for an example; you can add more.
compare 0x800D 0x1
if 0x1 goto @1
compare 0x800D 0x2
if 0x1 goto @2
compare 0x800D 0x3
if 0x1 goto @2
compare 0x800D 0x4
if 0x1 goto @3
compare 0x800D 0x5
if 0x1 goto @6
compare 0x800D 0x6
if 0x1 goto @3
compare 0x800D 0x7
if 0x1 goto @3
compare 0x800D 0x8
if 0x1 goto @4
compare 0x800D 0x9
if 0x1 goto @4
compare 0x800D 0xA
if 0x1 goto @5
goto @7 'stop comparing, since all other posiablitys would take you to a common pkmn.

#org @1
giveegg 0x<rare_species>
release
end

#org @2
giveegg 0x<rare_species>
release
end

#org @3
giveegg 0x<uncommon_species>
release
end

#org @4
giveegg 0x<uncommon_species>
release
end

#org @5
giveegg 0x<common_species>
release
end

#org @6
giveegg 0x<common_species>
release
end

#org @7
random 0x1
compare LASTRESULT 0x0
if true goto @5
goto @6

#org @notenough
hidemoney 0x0 0x0
msgbox @msg2 MSG_KEEPOPEN
closeonkeypress
release
end

#org @uncommon
checkmoney 0x2710 0x0
compare 0x800D 0x0
if 0x1 goto @notenough
paymoney 0x2710 0x0
updatemoney 0x0 0x0 0x0
fanfare 0x13E
msgbox @msg3 MSG_KEEPOPEN
closeonkeypress
waitfanfare
hidemoney 0x0 0x0
random 0xA
goto @com

#org @rare
checkmoney 0x61A8 
compare 0x800D 0x0
if 0x1 goto @notenough
paymoney 0x61A8 0x0
updatemoney 0x0 0x0 0x0
fanfare 0x13E
msgbox @msg1 MSG_KEEPOPEN
closeonkeypress
waitfanfare
hidemoney 0x0 0x0
random 0x5
goto @com

#org @msg1
= Hello, welcome to our Egg Shop!\pWhich kind of Egg would you like?

#org @msg2
= You don't have enough money.

#org @msg3
= [black_fr][player] received a [red_fr]Pokémon Egg[black_fr]!

Side Notes: Feel Free to add more than 7 to change the percentages around, also re-arranging the Random <number> will change the percentages.
 

PeregrineFig

Starting Pokémon Obsidian
202
Posts
14
Years
Name: Random Clefairy Battle script
ROM: FireRed (US Version)
Description: This is a simple little script, but it might come in handy for a newbie hacker. When you talk to the Clefairy a random value between 0 and F is drawn, and if it's 0, you battle the Clefairy for a chance to catch it, otherwise, it bounces away into the mountains and disappears until you re-enter the map.
Script:
Spoiler:

Comments: Obviously you can change the flag, pokemon and level, movements, etc to whatever you want. Just make sure to set the person ID to the same as the flag used, or the Clefairy won't vanish after battling it. Of course, you might also want it to stay there even after battling it once, in that case just get rid of the setflag command and leave the ID as 0000.
Credits: I wrote this myself, however, diegoisawesome's tutorial taught me quite a few things about XSE scripting.
 

Flowerchild

fleeting assembly
8,709
Posts
13
Years
effect: a random weather script
game: all gba games
credit: sab
script:
Spoiler:


I tried the random weather script and it just said
"No dynamic start offset specified."
Does anyone know how to fix it?
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
Reviving this hella old thread for a script I just made and tested in Emerald. It's quite simple, but still pretty cool. The purpose of it is this:





Anyways, it's for Emerald and here's how it works. Italics means you can change anything there, and I just have it there to show the script.

Code:
#dynamic 0xE40000
#org @start
lock
faceplayer
msgbox @1 0x6 //just had that there, obviously not mandatory
goto @choose
end

#org @choose
special 0x28 //stores party in RAM
fadescreen 0x1
special 0x2A //Pokemon choosing screen
waitstate
compare LASTRESULT 0x0
if 0x5 goto @it //if all went well, like no cancelling, go to @it 
special 0x29 //restores party (In my case it won't be mandatory since I'm forcing the player to choose in @no, obviously you can change that like in the steven battle where he tells you to get ready or something
goto @no //if something bad did happen, goto @no

#org @it
special 0xFB //it updates your party I guess? Without it I still had 6 pokemon
msgbox @3 0x6
trainerbattle 0x3 0x10 0x0 @win
msgbox @4 0x6
special 0x29 //restore your party
release
end

#org @win
= Oh no.

#org @4
= I will now return your party.

#org @3
= Battle begin.

#org @no
msgbox @2 0x6
goto @choose //here for all of @no you can make it do something else, and it will be fine because your party has already been restored back with special 0x29

#org @2
= I said choose.

#org @1
= Choose.

and without my comments, and erased all of my stuff

Spoiler:

NOTE:As of now, losing the battle will leave you only with the pokemon you choose. I guess a solution for that would be putting special 0x29 in a level script, perhaps you can put a sethealingplace command IN the script somewhere, so when they lose they will go to that one and have a special 0x29 there. Sorry about that
 
Last edited:

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
Hate to double post but it doesn't seem like anyone is gonna post here soon.
Okay, so my other script I'd like to share.
What it does: Okay, so you know when you use cut or an HM, your pokemon appears with the cool little background? Well, I found out how to make that happen with pokemon that aren't in your party. This could be good for scenes that a villain uses a pokemon to do something. I would post a video, but seeing as how I put a video in my other post, I don't wanna advertise or anything.
Code:
special 0x28 //stores party in RAM
callasm 0x8E40AA1 //Hackmew's routine, erases pokemon from party
callasm 0x8E40AA1
callasm 0x8E40AA1
callasm 0x8E40AA1
callasm 0x8E40AA1
callasm 0x8E40AF1 // Hackmew's routine, erases last pokemon from party
givepokemon 0x15F 0xA 0x0 0x0 0x0 0x0 //the pokemon you want to appear
checkattack 0x96 //like you would in an HM script, but put an attack you're 100% sure it has. Make the pokemon a level 1 if you want.
bufferpokemon 0x0 LASTRESULT
setanimation 0x0 LASTRESULT
doanimation 0x25
waitstate
special 0x29 //restores your party
Bugs I know: The player does an animation as well (raises pokeball). To fix that, move the camera 7 tiles or more to where you can't see the player like I did and then the script. Oh, it's for emerald, and for FR I haven't tried it, but if you wanna do it, replace special 0x28 to 0x27 and 0x29 to 0x28. Again, I haven't tried it, but it SHOULD work.
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
Reviving this hella old thread for a script I just made and tested in Emerald. It's quite simple, but still pretty cool. The purpose of it is this:





Anyways, it's for Emerald and here's how it works. Italics means you can change anything there, and I just have it there to show the script.

Code:
#dynamic 0xE40000
#org @start
lock
faceplayer
msgbox @1 0x6 //just had that there, obviously not mandatory
goto @choose
end

#org @choose
special 0x28 //stores party in RAM
fadescreen 0x1
special 0x2A //Pokemon choosing screen
waitstate
compare LASTRESULT 0x0
if 0x5 goto @it //if all went well, like no cancelling, go to @it 
special 0x29 //restores party (In my case it won't be mandatory since I'm forcing the player to choose in @no, obviously you can change that like in the steven battle where he tells you to get ready or something
goto @no //if something bad did happen, goto @no

#org @it
special 0xFB //it updates your party I guess? Without it I still had 6 pokemon
msgbox @3 0x6
trainerbattle 0x3 0x10 0x0 @win
msgbox @4 0x6
special 0x29 //restore your party
release
end

#org @win
= Oh no.

#org @4
= I will now return your party.

#org @3
= Battle begin.

#org @no
msgbox @2 0x6
goto @choose //here for all of @no you can make it do something else, and it will be fine because your party has already been restored back with special 0x29

#org @2
= I said choose.

#org @1
= Choose.

and without my comments, and erased all of my stuff

Spoiler:

NOTE:As of now, losing the battle will leave you only with the pokemon you choose. I guess a solution for that would be putting special 0x29 in a level script, perhaps you can put a sethealingplace command IN the script somewhere, so when they lose they will go to that one and have a special 0x29 there. Sorry about that

So diegoisawesome showed me that your stats don't update after. To fix that, first insert this routine:

Code:
.text
.align 2
.thumb
.thumb_func
.global ParkHack

start:		ldr r0, addr1
		ldr r1, val1
		ldr r0, [r0]
		add r0, r0, r1
		ldr r1, addr2
		ldrh r1, [r1]
		strb r1, [r0]
		mov r1, #0x0
		strb r1, [r0, #0x2]
		strb r1, [r0, #0x4]
		strb r1, [r0, #0x6]
		strb r1, [r0, #0x8]
		strb r1, [r0, #0xA]
		bx lr

.align 2
addr1:		.word 0x03005D90
addr2:		.word 0x020375F0
val1:		.word 0x00000CAA

(credit diegoisawesome for it)

And then this

#org @it
callasm 0x(offset + 1) //sets proper slot for 0xEA
special 0xFB //removes all other Pokémon
msgbox @3 0x6
trainerbattle 0x3 0x10 0x0 @win
msgbox @4 0x6
setvar 0x8004 0x6
special 0xEA //store new stats into temporary space
special 0x29 //restore your party from temporary space
release
end
 
Last edited:
232
Posts
12
Years
  • Seen Sep 10, 2019
Name: Stats Judge
ROM info: Pok?mon: FireRed Version [BPRE] (U) v1.0
Effect: Reads selected Pok?mon's IVs and stores them at vars 0x8004-0x800A
Script:
Spoiler:

Comments & Bugs: No bugs. Inefficient, which is due to my lack of ASM knowledge but nonetheless works exactly like Emerald ingame. Change flags if needed. Must use my asm routine for this script (change the orange text in the script as instructed): https://www.pokecommunity.com/showpost.php?p=9648919&postcount=1182
Credits: tkim
 
Last edited:

bitelaserkhalif

Falcon Punch!!
69
Posts
10
Years
Here's some of my scripts that would appear in my rom hack.

1. Gives the Tickets for Lugia Ho-oh and Deoxys, and makes them check both.
Spoiler:



2.Pokemon Shop, buy pokemon here!
Spoiler:


3. Mining Rocks
Spoiler:


4.Fossil Guy+
Spoiler:
 

Lunos

Random Uruguayan User
3,108
Posts
15
Years
Name: Randomized Berry Tree
ROM info: Pok?mon Ruby v1.0 (AXVE) (USA), Pok?mon Fire Red v1.0 (BPRE) (USA), Pok?mon Emerald (BPEE) (USA)
Effect: May give a random berry to the Player upon interacting with whatever you put the script to.
Script:
Spoiler:
Comments & Bugs: Insert the script as a signpost in Advance Map. Having clarified that, the script is working as intended but I'd prolly make it so #org @berry once per day (if I knew how to do that.. hahaha), in which case, I would also remove or modify the chance of getting a berry in the 8th Line of the script to make it a little bit easier, but that's just me.
 
Last edited:
92
Posts
8
Years
  • Age 33
  • Seen Dec 8, 2022
Here is a script that I used a lot in a romhack not too long ago. Needs Special 0x2E from JPAN's Hacked Engine.

Name: LR Text Change
Rom Info: 1636 - Pok?mon Fire Red v1.0 (BPRE)
Effect: Holding the L button will change the offset it goes to, i.e. a different message box.
Script:
Spoiler:
 

BluRose

blu rass
811
Posts
9
Years
Here is a script that I used a lot in a romhack not too long ago. Needs Special 0x2E from JPAN's Hacked Engine.

Name: LR Text Change
Rom Info: 1636 - Pok?mon Fire Red v1.0 (BPRE)
Effect: Holding the L button will change the offset it goes to, i.e. a different message box.
Script:
Spoiler:
just a nitpicky thing
Spoiler:
 
Last edited:
92
Posts
8
Years
  • Age 33
  • Seen Dec 8, 2022
Well, either way is acceptable, so I guess it works. Anyways, I have a new script. Needs JPAN's hacked engine in order for the math to work.
Name: Randomized starter
Rom Info: 1636 - Pok?mon Fire Red v1.0 (BPRE)
Effect: Gives a randomized starter from gen 1-3 if you don't have one.
Script:
Spoiler:

P.S. This script is flexible and expandable, so if you have for example generation 4 in the game, just add:
Spoiler:
 
Last edited:

sylingga

Red Everywhere
86
Posts
10
Years
  • Age 32
  • Seen Mar 27, 2024
Hate to double post but it doesn't seem like anyone is gonna post here soon.
Okay, so my other script I'd like to share.
What it does: Okay, so you know when you use cut or an HM, your pokemon appears with the cool little background? Well, I found out how to make that happen with pokemon that aren't in your party. This could be good for scenes that a villain uses a pokemon to do something. I would post a video, but seeing as how I put a video in my other post, I don't wanna advertise or anything.
Code:
special 0x28 //stores party in RAM
callasm 0x8E40AA1 //Hackmew's routine, erases pokemon from party
callasm 0x8E40AA1
callasm 0x8E40AA1
callasm 0x8E40AA1
callasm 0x8E40AA1
callasm 0x8E40AF1 // Hackmew's routine, erases last pokemon from party
givepokemon 0x15F 0xA 0x0 0x0 0x0 0x0 //the pokemon you want to appear
checkattack 0x96 //like you would in an HM script, but put an attack you're 100% sure it has. Make the pokemon a level 1 if you want.
bufferpokemon 0x0 LASTRESULT
setanimation 0x0 LASTRESULT
doanimation 0x25
waitstate
special 0x29 //restores your party
Bugs I know: The player does an animation as well (raises pokeball). To fix that, move the camera 7 tiles or more to where you can't see the player like I did and then the script. Oh, it's for emerald, and for FR I haven't tried it, but if you wanna do it, replace special 0x28 to 0x27 and 0x29 to 0x28. Again, I haven't tried it, but it SHOULD work.

Sorry to reply old post.
Wanna know, do we need to insert other routine before,
or we can just use the script in Vanilla FR rom?
 
Back
Top