• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

Help Thread: Script Help Thread

Status
Not open for further replies.
So I'm starting a fire red rom hack and I'm trying to figure out how to give the national pokedex at the beginning of the game. I tried using the script in the spoiler AFTER I already had a pokemon in my party and it still didn't work. Can somebody tell me what I'm possibly doing wrong?

Spoiler:
 
So I'm starting a fire red rom hack and I'm trying to figure out how to give the national pokedex at the beginning of the game. I tried using the script in the spoiler AFTER I already had a pokemon in my party and it still didn't work. Can somebody tell me what I'm possibly doing wrong?

Spoiler:

If the player doesn't already have the Pokédex menu activated, that special won't have any noticeable difference, so you'll also need to include setflag 0x829 somewhere, too.
 
This is a level script. It's supposed to be an intro cutscene, played on the bottom floor of the player's house. The player talks to their Dad, Mom comes in, few lines of dialogue, Mom sends player upstairs. The player checks a flag in a separate script, comes back down and receives Pokemon from rival. Intro battle, front door unlocked, player is free.

That is, if everything worked. Which it doesn't.

Here's the script:

Spoiler:

My biggest issue is the hidesprite, movesprite and showsprite commands. Sprite 0x2 is not being hidden or moved. Sprite 0x1 is being hidden only after the player reaches the bottom of the stairs, and the sprite doesn't reappear. I believe everything's correct on A-map's end. It's running as a type 02 level script. My flag work is buggy but I think I can fix that on my own. I can provide more info if needed.
 
Is there a way to insert two level scripts in the same map?
The first should run if 0x4011 is 0x0, the second one if 0x4011 is 0x5 for example.
 
Is there a way to insert two level scripts in the same map?
The first should run if 0x4011 is 0x0, the second one if 0x4011 is 0x5 for example.

Yes! In A-Map, on the Header tab where you normally apply your level script, just hit Add again and choose a new type (01, 02, 03, etc.). If you want two level scripts of the same type (or for more info on level scripts in general), check out diego's level script tutorial, specifically the "BONUS" section:
BONUS: Make multiple level scripts of the same type (type 0x2 or 0x4)!
Even though Advance-Map doesn't let you do it correctly, you can still manually insert your own.

In Step 14, there's a random number underneath the pointer to your script. If you have free space after this, you can instead replace the random number with another variable number, then another variable value, and another script, and so on. Like so:

Code:
'---------------
#org 0x166F6E
#raw word 0x408A
#raw word 0x1
#raw pointer 0x8166F88
#raw word 0x4071
#raw word 0x1
#raw pointer 0x8166FA0
#raw word 0x0

Credit to diegoisawesome, of course
 
Bumping my last question, but I feel guilty demanding answers, so have some screenshots with extra details on the problem. My original post:
Spoiler:

[PokeCommunity.com] Script Help Thread

Here's the scene as the player walks down the stairs. As a placeholders I used the Mom sprite 3 times. Mom 1 is Dad, Mom 2 is Mom, Mom 3 is the player's rival, named Cassie in the script. Sorry about the confusion.

There's some immediate problems. Firstly, all sprites are visible, meaning hidesprite failed to activate. Second, the sprites haven't been "moved" by the movesprite command.

[PokeCommunity.com] Script Help Thread

Now it gets interesting. Even though both sprites have the exact same hidesprite command, only one sprite vanishes. This has me thinking it's more than an issue with the warp transition.

[PokeCommunity.com] Script Help Thread

To make it even more confusing, the sprite that should reappear doesn't. This line of dialogue is supposed to be spoken by the player's mother (as in not the impostor moms).

Here's a repost of my script:
Spoiler:

I'm at my wit's end. What's going on?
 
Last edited:
How would I go about making a gym locked until you do something? I was looking at Viridian City's script box in front of the gym, but its script doesn't check flags or vars to see if it can let you in, so how does the game remove that script box? Another idea is to just use a script box that stays in effect until you set a flag or whatever, but how do you get a script box to keep recurring by default? Since it needs a setvar command at the end for the script box to work in the first place and that command also prevents the script box from running multiple times, I don't know where to start.
 
Bumping my last question, but I feel guilty demanding answers, so have some screenshots with extra details on the problem. My original post:
Spoiler:


View attachment 77234

Here's the scene as the player walks down the stairs. As a placeholders I used the Mom sprite 3 times. Mom 1 is Dad, Mom 2 is Mom, Mom 3 is the player's rival, named Cassie in the script. Sorry about the confusion.

There's some immediate problems. Firstly, all sprites are visible, meaning hidesprite failed to activate. Second, the sprites haven't been "moved" by the movesprite command.

View attachment 77236

Now it gets interesting. Even though both sprites have the exact same hidesprite command, only one sprite vanishes. This has me thinking it's more than an issue with the warp transition.

View attachment 77235

To make it even more confusing, the sprite that should reappear doesn't. This line of dialogue is supposed to be spoken by the player's mother (as in not the impostor moms).

Here's a repost of my script:
Spoiler:

I'm at my wit's end. What's going on?

Methinks it would be nicer to see the uncompiled version of your script.

Anyway...

Code:
...
movesprite 0x0 ...
...
hidesprite 0x0
...
I don't think there's a Person event number 0 in there. The very first NPC always has 1 as its Person event number.
[PokeCommunity.com] Script Help Thread
 
How would I go about making a gym locked until you do something? I was looking at Viridian City's script box in front of the gym, but its script doesn't check flags or vars to see if it can let you in, so how does the game remove that script box? Another idea is to just use a script box that stays in effect until you set a flag or whatever, but how do you get a script box to keep recurring by default? Since it needs a setvar command at the end for the script box to work in the first place and that command also prevents the script box from running multiple times, I don't know where to start.

You could put down something like this:
#freespace 0xFF
#dynamic 0x800000
#org @start
lock
compare 0x40XX 0xY
if 0x0 goto @don't
[MESSAGE OR EVERYTHING ELSE]
release
end

#org @don't
[IF YOU WANT IT TO DO SOMETHING JUST PUT IT HERE)
release
end
This way it shows a message only when variable 40XX' value is Y.
Then add a setvar 0x40XX 0xZ in some other script so that when the latter runs it changes what the first script does.
About the door, that's what you could try to do: make two blocks with the same door but put the behaviour that makes doors work as doors just in one of them.
In your map use the "fake door" and create a level script "setmaptile" which changes the fake door to the real door only when variable 40XX value is different from Y.

#freespace 0xFF
#dynamic 0x800000
#org @start
compare 0x40XX 0xY
if 0x1 goto @don't
setmaptile 0x(X coordinate) 0x(Y coordinate) 0x(number of block) 0x1
end

#org @don't
end

Remember to put a warp on the door. It works only if the door has the right behaviour.
 
Question about inserting scripts....

I'll start with the simple question. I understand changing the bolded part, but do I need to change the oxFF to anything, or anything else? Instead of being told yes or no, what does 0xFF do, is it a termination byte? Would rather understand it than have to ask every time I see it change.

#dynamic 0x800000
#freespacebyte 0xFF

Spoiler:


Above is Mr. Dollsteaks fang script. It essentially adds PRZ/FRZ/BRN to the flinch effect (which is 31 in the default effect table), right? So bite would still work normally, and this script just recognizes when fire, ice, or thunder fang have been used, and adds the necessary effect on top of flinch, using the setbyte command, am I still right?

In his script....
Spoiler:

means that moves numbers 0x1AF, 1B0 & 1B1 (432,433,434) in the movetable inherit the effect that setbyte 0x2023E85 controls. So if I didn't want to expand my movetable, I Just change 1AF, 1B0 and 1B1, right?
If I wanted to replace Pound, Karate Chop, and Doubleslap (the first three moves in the table).....

Spoiler:

That would work, right?
 
Last edited:
Question about inserting scripts....

I'll start with the simple question. I understand changing the bolded part, but do I need to change the oxFF to anything, or anything else? Instead of being told yes or no, what does 0xFF do, is it a termination byte? Would rather understand it than have to ask every time I see it change.
FF is the 'free space byte'. It can be a termination byte in certain instances(tables(sometimes) and strings of words use it as their termination byte), but it's mostly just the filler for the ROM. It's usually not being used, which is why we like to overwrite the bytes that are clear, and this dynamic insertion process can be useful.



Spoiler:


Above is Mr. Dollsteaks fang script. It essentially adds PRZ/FRZ/BRN to the flinch effect (which is 31 in the default effect table), right? So bite would still work normally, and this script just recognizes when fire, ice, or thunder fang have been used, and adds the necessary effect on top of flinch, using the setbyte command, am I still right?
Yes, because 0x2023E85 is the byte that controls the status effect to possibly inflict later on, which is read by seteffectwithchancetarget

In his script....
Spoiler:

means that moves numbers 0x1AF, 1B0 & 1B1 (432,433,434) in the movetable inherit the effect that setbyte 0x2023E85 controls. So if I didn't want to expand my movetable, I Just change 1AF, 1B0 and 1B1, right?
I'm not sure what you're going on about here. 0x1AF/1B0/1B1 is the index number of Fire Fang, Ice Fang, and Thunder Fang, in that order. I explained earlier that 0x2023E85 is the byte that gets read for the status. 0x2023D4A is the offset where the last used move is stored, so we read that and decide where to jump based on the index number of the move that was just used.

If I wanted to replace Pound, Karate Chop, and Doubleslap (the first three moves in the table).....

Spoiler:

That would work, right?
Yes.
 
Script help~

Can anyone tell me how to include a var's number in the message box? Like, say, setvar 0x4016 0x5. I wanna display "5" in an NPC's text.


Code:
#dynamic 0x800000

#org @start
lock
faceplayer
setvar 0x4015 0x5
msgbox @1 0x6
release
end

#org @1
= How do you do?\nThe lucky number is [variable].

Thanks~
 
Script help~

Can anyone tell me how to include a var's number in the message box? Like, say, setvar 0x4016 0x5. I wanna display "5" in an NPC's text.


Code:
#dynamic 0x800000

#org @start
lock
faceplayer
setvar 0x4015 0x5
msgbox @1 0x6
release
end

#org @1
= How do you do?\nThe lucky number is [variable].

Thanks~

I'd suggest the buffernumber command.
Format: buffernumber 0x(buffer number) 0x(Variable number)
so for you it would be like this:
Code:
#dynamic 0x800000

#org @start
lock
faceplayer
setvar 0x4015 0x5
buffernumber 0x0 0x4015
msgbox @1 0x6
release
end

#org @1
= How do you do?\nThe lucky number is [buffer1].
 
Hey guys, I've just recently started seriously trying to script and I've hit an early problem. I've seen two other instances of it online, one with an apparent solution, but it didn't work for me. I apologize if this has come up before, but I did quite a bit of searching already.

Essentially when the event runs, the msgbox script is being ignored. Faceplayer will run, but no text will appear. Note: I am attempting to edit Pokemon Shiny Gold, but I have also attempted this on FireRed to no avail. I've tried multiple times, even attempting to copy tutorial scripts line for line, but it still consistently ignores the text.

Is this a common issue, and if so, is there a known solution? A post I saw on reddit said that they discovered the fix was adding callstd before 0x6, but that didn't work for me either. If you have any ideas or solutions I'd really appreciate it! Thanks
 
Hey guys, I've just recently started seriously trying to script and I've hit an early problem. I've seen two other instances of it online, one with an apparent solution, but it didn't work for me. I apologize if this has come up before, but I did quite a bit of searching already.

Essentially when the event runs, the msgbox script is being ignored. Faceplayer will run, but no text will appear. Note: I am attempting to edit Pokemon Shiny Gold, but I have also attempted this on FireRed to no avail. I've tried multiple times, even attempting to copy tutorial scripts line for line, but it still consistently ignores the text.

Is this a common issue, and if so, is there a known solution? A post I saw on reddit said that they discovered the fix was adding callstd before 0x6, but that didn't work for me either. If you have any ideas or solutions I'd really appreciate it! Thanks

Post your script here, wrap it around the
Code:
 tags like so...[/COLOR][/B]
[HTML][CODE]...insert script here...
[/HTML]
Also, tell us what version of XSE you are using.
 
Blah, I'm a doink. Before I posted that I thought I had attempted it on v1.1.1 of XSE. Apparently I had not, or at least not correctly. It appears to be all good now, but thanks for the help anyway. Sorry for the brief waste of time. If it makes you feel any better I spent about 5 hours trying to figure that out xP
 
Status
Not open for further replies.
Back
Top