Advertiser Content

Development The Miscellaneous Script Thread Page 4

Started by Spherical Ice December 20th, 2008 10:47 AM
  • 26963 views
  • 77 replies
Male
Seen September 13th, 2019
Posted December 28th, 2017
93 posts
4.4 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 - Pokmon 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:
'---------------
//Before starting game, make sure JPAN's Special 0x2E is in the game
#erase 0x800000 0x81 //Change with your offset
#dynamic 0x800000 //Change with your offset
#org @start
//If you put this script in a person event, add faceplayer
lock //Erase if you are using a script instead
special2 0x800D 0x2E //Special to check for keypress, then stored in LASTRESULT
compare 0x800D 0x2 //0x0 is no keypress, 0x1 is R, 0x2 is L, 0x3 is both
if 0x1 goto @left //Checks if the compare is valid. If so, goes to @left
goto @end //Goes to @end
#org @left
msgbox @msg 0x6 //displays @msg normally
release
end
#org @end
msgbox @msg2 0x6 //displays @msg2 normally
release
end
#org @msg
= Did you just hold the L button?
#org @msg2
= Try holding the L button, before\ntalking to me.
#org @nothing //Makes finding how much space to erase easier, does nothing else

BluRose

blu rass

Age 18
Male
michigan tech
Seen 9 Hours Ago
Posted 1 Day Ago
768 posts
5.6 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 - Pokmon 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:
'---------------
//Before starting game, make sure JPAN's Special 0x2E is in the game
#erase 0x800000 0x81 //Change with your offset
#dynamic 0x800000 //Change with your offset
#org @start
//If you put this script in a person event, add faceplayer
lock //Erase if you are using a script instead
special2 0x800D 0x2E //Special to check for keypress, then stored in LASTRESULT
compare 0x800D 0x2 //0x0 is no keypress, 0x1 is R, 0x2 is L, 0x3 is both
if 0x1 goto @left //Checks if the compare is valid. If so, goes to @left
goto @end //Goes to @end
#org @left
msgbox @msg 0x6 //displays @msg normally
release
end
#org @end
msgbox @msg2 0x6 //displays @msg2 normally
release
end
#org @msg
= Did you just hold the L button?
#org @msg2
= Try holding the L button, before\ntalking to me.
#org @nothing //Makes finding how much space to erase easier, does nothing else
just a nitpicky thing
Spoiler:
delete goto @end and put everything in @end where the goto was for optimization purposes
'---------------
//Before starting game, make sure JPAN's Special 0x2E is in the game
#erase 0x800000 0x81 //Change with your offset
#dynamic 0x800000 //Change with your offset
#org @start
//If you put this script in a person event, add faceplayer
lock //Erase if you are using a script instead
special2 0x800D 0x2E //Special to check for keypress, then stored in LASTRESULT
compare 0x800D 0x2 //0x0 is no keypress, 0x1 is R, 0x2 is L, 0x3 is both
if 0x1 goto @left //Checks if the compare is valid. If so, goes to @left
msgbox @msg2 0x6 //displays @msg2 normally
release
end
#org @left
msgbox @msg 0x6 //displays @msg normally
release
end
#org @msg
= Did you just hold the L button?
#org @msg2
= Try holding the L button, before\ntalking to me.
#org @nothing //Makes finding how much space to erase easier, does nothing else
am i cool yet
Male
Seen September 13th, 2019
Posted December 28th, 2017
93 posts
4.4 Years
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 - Pokmon Fire Red v1.0 (BPRE)
Effect: Gives a randomized starter from gen 1-3 if you don't have one.
Script:
Spoiler:
//Before starting game, make sure JPAN's Special 0x3E and Special 0x40 is in the game
#erase 0x800081 0xCD //Change offset with the one your using
#dynamic 0x800081 //Change offset with the one your using
#org @start
faceplayer //Erase if you are using a script or signpost instead
lock //Erase if you are using a script instead
countpokemon //Counts how much pokemon the player has
compare LASTRESULT 0x0 //Compares ammount of pokemon with 0
if 0x1 goto @givepokemon //If comparison is valid goto givepokemon
release
end
#org @givepokemon
random 0x9 //How many pokemon to choose from
copyvar 0x8000 0x800D
setvar 0x8001 0x0 //sets variable 0x8001 to 0
copyvar 0x8002 0x8000 //sets variable 0x8002 to 0x8000
addvar 0x8002 0x1 //adds variable 0x8002 with 1
compare 0x8000 0x0 //Compares random with 0
if 0x4 call @give3 //If greater than or equal to call @give3
compare 0x8000 0x3 //Compares random with 3
if 0x4 call @give2 //If greater than or equal to call @give2
copyvar 0x8000 0x800D //Copies the random result to 0x8000
compare 0x8000 0x6 //Compares random with 6
if 0x4 call @give1 //If greater than or equal to call @give1
setvar 0x8003 0x3 //sets 3 to variable 0x8003
Writebytetooffset 0x02 0x0203f4d8 //Sets variable 1 to special 0x40 and special 0x3E
Writebytetooffset 0x80 0x0203f4d9 //Sets variable 1 to special 0x40 and special 0x3E
Writebytetooffset 0x03 0x0203f4da //Sets variable 2 to special 0x40 and special 0x3E
Writebytetooffset 0x80 0x0203f4db //Sets variable 2 to special 0x40 and special 0x3E
special 0x40 //Multiply 0x8002 with 0x8003
subvar 0x8002 0x3 //Subtracts 0x8002 by 1
copyvar 0x8003 0x8001 //Copies pokemon species to 0x8003
special 0x3E //Adds 0x8002 with 0x8003
bufferpokemon 0x0 0x8002 //Buffers pokemon species to 0x0
fanfare 0x13E //Get pokemon fanfare
msgbox @getpokemonmsg 0x4 //Get pokemon msg
givepokemon 0x8002 0x5 0x0 0x0 0x0 0x0 //Gives pokemon species stored in 0x8002
waitfanfare //Waits for fanfare to complete
closeonkeypress //Allows msg to close
release
end
#org @give1
//Gen 3 starters
addvar 0x8001 0x7D //adds 0x8001 with 0x7D
subvar 0x8002 0x3 //subtracts 0x8002 with 0x3
return
#org @give2
//Gen 2 starters
addvar 0x8001 0x97 //adds 0x8001 with 0x97
subvar 0x8002 0x3 //subtracts 0x8002 with 0x3
return
#org @give3
//Gen 1 starters
addvar 0x8001 0x1 //adds variable 0x8001 with 1
return
#org @getpokemonmsg
= [player] received [buffer1].
#org @nothing

P.S. This script is flexible and expandable, so if you have for example generation 4 in the game, just add:
Spoiler:
//Replace Random 0x9 with 0xC
//Place this after 'if 0x4 call @give3'
copyvar 0x8000 0x800D //Copies the random result to 0x8000
compare 0x8000 0x9 //Compares random with 9
if 0x4 call @give4 //If greater than or equal to call @give4
//place this after @give3
#org @give4
//Gen 4 starters
addvar 0x8001 0xXX //replace XX with (Turtwigs hex number - Treecko's hex number)
subvar 0x8002 0x3 //subtracts 0x8002 with 0x3
return
Advertiser Content