• 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.

Script Help Thread (DO NOT REQUEST SCRIPTS)

Status
Not open for further replies.

wwmb

Watcher
20
Posts
13
Years
  • Seen Jan 18, 2016
Hello!
I'm hacking Pokémon emerald; I'm writing my scripts in XSE; and I am trying to create a script-tile that when stepped upon teleports the player (with animation) to a random location on the map. Realizing this would be a scripting nightmare (due to getting stuck in the walls) I simply made the script choose a random of 8 predefined locations to teleport to.

Here
Code:
warpteleport 0x22 0x0 0xFF 0x4 0x4
is one of the 8 lines of code executed, and are doing so almost exactly how I want them to be. The problem I am having is that this reloads the map; causing my map script to trigger, refresh flags and re-randomize the dungeon. So now I'm here asking: what command I should be using instead?

Thanks!


-------------------------------------------------------------------------------



I just have two quick questions. First I don't know which flags are available in emerald and secondly I want to create a give pokedex script, but I dont even know where to begin. I use pokescript, not XSE so can anyone give me any advice?

You should start by opening up the script in which the professor gives you the pokédex


(Hmmm, I can't seem to find it... I searched using PKSV-UI and found the script 1FA3B5
Spoiler:


I am not entirely sure where the script is called from however.

Anyways, set the flag 0x861 and you will have set the pokédex in emerald.

(Hmmmm, I wonder where that script is.....)
 
Last edited:

Renegade

Time for real life...
995
Posts
12
Years
I have a question. Hope someone can answer.

Is there a way to check if a var has been set? Maybe something like "checkvar 0x5004".
Thank you for your time in advance!
 

itman

Back to ROM hacking. :D
98
Posts
16
Years
  • Age 30
  • Seen Feb 5, 2014
I have a question. Hope someone can answer.

Is there a way to check if a var has been set? Maybe something like "checkvar 0x5004".
Thank you for your time in advance!

Use the "compare" command.
So if you want to see if variable 5004 is equal to 1, do this:

compare 0x5004 0x1
if 0x1 goto @Wherever
...

So basically, in this script, it's checking if the var is set to 1. If it is, it goes to @Wherever.
Now, if a var is not set, it will equal zero, so...

compare 0x5004 0x0
if 0x1 goto @Wherever
...

There you go, that's how to check if a var is not set.
 
8
Posts
11
Years
  • Seen Mar 29, 2013
Hi guys I have a problem with this script.
Spoiler:


It should do nothing when you first pass over it, and after a flag is set it should stop you from moving on. However when you first pass over it the game freezes.
 

wwmb

Watcher
20
Posts
13
Years
  • Seen Jan 18, 2016
Hi guys I have a problem with this script.
Spoiler:


It should do nothing when you first pass over it, and after a flag is set it should stop you from moving on. However when you first pass over it the game freezes.

Check the "var number" and "var values" on the script tile in A-Map.

Another way you could do this (much like how you rival sits and waits for you in OLDALE TOWN after battling him/her in RSE) is to have a variable start at 0, and then go up to 1 (or what ever number 'var value' equals) when you want the player stopped, and then make it change to 2+ after that event is done. (You would still need to set a flag to hide any sprites... but anyways: the script tiles like variables.)

Good luck!
 

Herpahermaderp

I liek Mudkipz
66
Posts
11
Years
  • Age 25
  • USA
  • Seen Jan 3, 2017
Hi guys I have a problem with this script.
Spoiler:


It should do nothing when you first pass over it, and after a flag is set it should stop you from moving on. However when you first pass over it the game freezes.

Where does the movement come into play? Also, flag 511 is a flag already used by the game, you need to use one over 1000. You also don't need a release if you don't have a lock.

#dynamic 0x800000

#org @start
checkflag 0x1111
compare LASTRESULT 0x1
if 0x1 goto @done
release
end

#org @done
lock
checkflag 0x828
compare LASTRESULT 0x1

if 0x1 goto @end
msgbox @1 0x6
applymovement 0xFF @move
release
end

#org @end
release
end

#org @move
#raw 0x10
#raw 0xFE

#org @1
= [blue_fr]Oak: Where are you\ngoing?\pPick a Pokemon.

All bold parts are the things you need to add, slashes must be removed...
 
4
Posts
11
Years
  • Seen Dec 29, 2016
NOTE: Reposted from the Simple questions thread, and now bumped, this place seems like a better place for it, even if it is a little hardcore

Game: Pokemon FireRed
Type: HEX/XSE/Pokescript for music
Editor: XSE/PKSV

I've been on these forums awhile, but never posted posted once, hiya!

Anyway, I'm not EXACTLY sure if my question fits this thread, so apologies.
Question:
So far the only way to change what music plays at any given time in FireRed (specifically in battle) is MMX's Music Replacement hex code thing, right?

I'm trying to use it, but I've only been learning hex for about 3 weeks (because relying on tools is for noob hackers).
Here's the main routine, as you can see it's not changed from the one at sfc.pokefans.net
(just go to the lessons page, "Fancy Knowledge #3." I'm not at 15 posts yet and I don't think you would appreciate me gumming up your forum trying to reach 15 before posting this. The site is just there for reference, hopefully all the information needed is in this post)

Spoiler:


And my edited musicloader:
Spoiler:


The game loads perfectly, all music and sounds: check.
however, I have been, as of yet, unable to actually REPLACE any music.
quick example:
Spoiler:

The music values are just there for test, I forgot which is which, I actually created TWO scripts that flops them around.
I'm TRYING to replace basic battle music. What I replace it with isn't important at the moment, I'm testing this in a clean ROM before even daring to attempt it on my hack, which uses an extended music table.
I am not EXACTLY sure what the problem is, but I may have narrowed it down:
a. I'm just using the wrong music values?
b. I'm just using the setvar command wrong? (unlikely imo, setvar isn't that hard)
c. There has been some babble about variable values being the cause of most, if not all problems had with this loader, if that is the case, help me out!
d. I derped up a pointer or something. Very likely.

EDIT:
Ran a quick test, trying to change the overworld music for Pallet, didn't work. Not sure if it's just the map header overriding what I put in, but that leads me to think it might be a problem with the hex or syntax, not the actual music values.

Whatever the problem is, please point me in the right direction for fixing it! (Or if this is the wrong thread, please point me to the right one!)

Thank you so much in advance!
 
215
Posts
11
Years
  • Seen Jul 14, 2020
Hello, this is such a simple question yet I can't find the answer anywhere!
What kind of trainbattle do I use to make the script keep going regarless of defeat? Kinda like the one where you face your rival but without prof oak talking.
 

itman

Back to ROM hacking. :D
98
Posts
16
Years
  • Age 30
  • Seen Feb 5, 2014
Hello, this is such a simple question yet I can't find the answer anywhere!
What kind of trainbattle do I use to make the script keep going regarless of defeat? Kinda like the one where you face your rival but without prof oak talking.

There is none. -_- Unfortunately. BUT, you can get around this.

Using JPAN's hacked engine, you can set anywhere to be a healing place.
So before you battle, set that spot as a healing place.
When you whiteout, nothing will show up because in the hacked engine, there is an option to do so.
Then make a level script continuing the script.
As for the losing money, it'll still say you lost it...but if that's REALLY that big of a deal, you can store the players money in a variable before hand and blahblahblah return it afterward.
 
5
Posts
11
Years
  • Seen Nov 15, 2012
Spoiler:


I cant get this script to work. It should be a regular trainerbattle then you should be able to use VS Seeker for rematch. But when the trainer sees me in the map the screen goes red.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Spoiler:


That should work. Your mistake was having normal scripting code at the start of the script. In trainerbattle scripts of type 0x0 and 0x2, you MUST have the trainerbattle command itself FIRST in the script. The game is quite clever, it only executes it when necessary, and skips it at all other times.

Hope that helps! (Also, I fixed a spelling error. :P)
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
And my edited musicloader:
Spoiler:

It is, quite frankly, a miracle that your game doesn't crash on all music changes, because you haven't done this part correctly.

That 20 (the one I bolded) should be a 21. You MUST ALWAYS add 1 to a pointer when putting in a piece of custom THUMB ASM (which is what this is). In practice, your ROM should crash, because you're telling it to execute the wrong type of code. The fact that it doesn't is just down to sheer luck.

Make that change, and that'll be a good start.

Spoiler:
Spoiler:
 
26
Posts
13
Years
Game: Pokemon Fire Red
Type:XSE
Editor:XSE
Script:
Spoiler:

Screenshots and/or videos: http :// imgur.com/a/jD4yh (remove the spaces because i can't post url)

Guys please help me i made a wildbattle script with XSE to battle pikachu and i have 2 problems, 1st the message box don't appear and 2nd after i finish the battle the pikachu's sprite get's removed but when i move again it appears again! and i can battle it over and over again but i want it only once to battle it please help me.
 

tajaros

Hi I'm dawg
855
Posts
11
Years
Game: Pokemon Fire Red
Type:XSE
Editor:XSE
Script:
Spoiler:

Screenshots and/or videos: http :// imgur.com/a/jD4yh (remove the spaces because i can't post url)

Guys please help me i made a wildbattle script with XSE to battle pikachu and i have 2 problems, 1st the message box don't appear and 2nd after i finish the battle the pikachu's sprite get's removed but when i move again it appears again! and i can battle it over and over again but i want it only once to battle it please help me.

I am quite sure that you got this script from my tutorial... :/

Nothing seems to be wrong with the msgbox it's just there's an extra 0x0 in the wildbattle script. And if you want to make pikachu disappear completely you have to put 1000 to Pikachu's Person ID in A-map because, you have set flag 0x1000.

Here's the fixed script. although I just removed the 0x0... :D
#dynamic 0x800000

#org @start
lock
faceplayer
cry 0x19 0x0
msgbox @roar 0x6
waitcry
wildbattle 0x19 0x5 0x0
fadescreen 0x0
hidesprite 0x800F
fadescreen 0x1
setflag 0x1000
release
end

#org @roar
= PIKACHU: PIKA!

Hope this helps.
 
26
Posts
13
Years
Ok thanks man, i putted the last 0x0 because XSE requires 4 of those 0x that's why. :P
but still i have the problem with the msgbox..
 
Last edited by a moderator:

tajaros

Hi I'm dawg
855
Posts
11
Years
Ok thanks man, i putted the last 0x0 because XSE requires 4 of those 0x that's why. :P
but still i have the problem with the msgbox..

Also the script works perfectly fine with me, maybe you missed some things when compiling and getting the offset.
 
Last edited by a moderator:

M.L

Invisible
761
Posts
13
Years
  • Seen Dec 21, 2017
#dynamic 0x800000

#org @start
applymovement 0x04 @move
waitmovement 0x0
checkflag 0x828
if 0x1 goto @done
msgbox @1 0x5
compare LASTRESULT 0x1
if 0x1 goto @take
msgbox @2 0x6
checkflag 0x828
if 0x1 goto @start
release
end

#org @take
givepokemon 0x84 0x5 0x0 0x0 0x0 0x0
fanfare 0x13E
msgbox @3 0x4
waitfanfare
closeonkeypress
setflag 0x828
msgbox @4 0x5
compare LASTRESULT 0x1
if 0x1 gosub @name
msgbox @5 0x6
setflag 0x829
msgbox @6 0x6
msgbox @7 0x6
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
setflag 0x8A0
release
end

#org @name
call 0x1A74EB
return

#org @done
release
end

#org @move
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @1
= Hello.\nI am Proffessor Riley.\nyour pokemon was transfere from\nKanto..\pSo I am here to give it to you\nWill you take it?

#org @2
= You don't want you pokemon?

#org @3
= [black_fr]You received a DITTO!

#org @4
= [black_fr]Would you like to give a\nnickname to DITTO?

#org @5
= I also have a pokedex for you.

#org @6
= [black_fr]You received the Pokedex.

#org @7
= Your brother had sent a\npackage for you, although\lit appears to have ended up in\nResno town.\pYou may want to go fetch it.



I compile it and insert it, as i walk on the script nothing happens. did i miss something?
 
Status
Not open for further replies.
Back
Top