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

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
I guess I'll try asking this again because I honestly don't know why this isn't working...
Game: Emerald

I need some help. I'm utterly confused at the moment... I have a script where you can battle somebody 3 different times, each time having stronger Pokémon. He should give you 3 different items each time you beat him, until he is rebattle-able. He's suppose to give you Leftovers the first time you beat him, PP Max the second, and a Master ball the third. When rebattle-able, he should give a PP Up each time you beat him. As of right now, he only gives the Leftovers and Master ball. No PP Max and no PP Up. What is going on with this script?

Code:
#dynamic 0x6C4340

#org @start
checkflag 0x850
if 0x1 goto @start1
trainerbattle 0x1 0xa1 0x0 @before @after @later
end

#org @start1
checkflag 0x851
if 0x1 goto @start2
trainerbattle 0x1 0x29b 0x0 @before1 @after1 @later1
end

#org @start2
settrainerflag 0x29d
trainerbattle 0x1 0x29d 0x0 @before2 @after2 @later2
end

#org @later
setflag 0x850
msgbox @msg1 0x2
giveitem 0xc8 0x1 0x0
release
end

#org @later1
setflag 0x851
msgbox @msg2 0x2
giveitem 0x47 0x1 0x0
release
end

#org @later2
checkflag 0x852
if 0x1 goto @beaten
setflag 0x852
msgbox @msg3 0x2
giveitem 0x1 0x1 0x0
release
end

#org @beaten
msgbox @msg4 0x2
giveitem 0x45 0x1 0x0
release
end

#org @before
= I am legend.

#org @after
= I... am...\pI'm speechless...

#org @msg1
= You are truly gifted...\lBut next time, you will fail.\pTake this, and remember me.

#org @before1
= This time, you will not be so\nlucky.

#org @after1
= How is this possible!?

#org @msg2
= I promise...\nI will defeat you.

#org @before2
= This time, you will lose.

#org @after2
= Again, I am beaten...

#org @msg3
= You are a King among peasants.

#org @msg4
= For the umpteenth time, I have\nfailed.\pClearly, you are the greatest.\pSo long as you defeat me, you\nmay have this.

It took me a bit to figure out. You have it in the wrong oder. The "checkflag 0x852" and "if 0x1 goto @beaten" need to be the first lines of your script. @Later2 will only run directly after the trainerbattle, not the next time you talk to him.
 

ExitWound

Boggle
79
Posts
16
Years
  • Age 32
  • Seen Sep 22, 2016
It took me a bit to figure out. You have it in the wrong oder. The "checkflag 0x852" and "if 0x1 goto @beaten" need to be the first lines of your script. @Later2 will only run directly after the trainerbattle, not the next time you talk to him.

Actually it all runs in the right order. The messages all appear correctly, when I want them to, and the right battles are executed at the right times. The only thing that is wrong is that he wont give the PP Max or the PP Ups and I am unsure why. I understand what you mean, though. But I made it so you can rebattle the trainer the last time and by beating him, you get PP Ups.
 
Last edited:

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Actually it all runs in the right order. The messages all appear correctly, when I want them to, and the right battles are executed at the right times. The only thing that is wrong is that he wont give the PP Max or the PP Ups and I am unsure why. I understand what you mean, though. But I made it so you can rebattle the trainer the last time and by beating him, you get PP Ups.

You don't understand. It wasn't in the right order. Everything up to the last battle was, but your placement of checkflag 0x852 was off.

Here is the correct script:

Code:
#dynamic 0x6C4340

#org @start
checkflag 0x852
if 0x1 goto @beaten
checkflag 0x850
if 0x1 goto @start1
trainerbattle 0x1 0xa1 0x0 @before @after @later
end

#org @start1
checkflag 0x851
if 0x1 goto @start2
trainerbattle 0x1 0x29b 0x0 @before1 @after1 @later1
end

#org @start2
settrainerflag 0x29d
trainerbattle 0x1 0x29d 0x0 @before2 @after2 @later2
end

#org @later
setflag 0x850
msgbox @msg1 0x2
giveitem 0xc8 0x1 0x0
release
end

#org @later1
setflag 0x851
msgbox @msg2 0x2
giveitem 0x47 0x1 0x0
release
end

#org @later2
setflag 0x852
msgbox @msg3 0x2
giveitem 0x1 0x1 0x0
release
end

#org @beaten
msgbox @msg4 0x2
giveitem 0x45 0x1 0x0
release
end

#org @before
= I am legend.

#org @after
= I... am...\pI'm speechless...

#org @msg1
= You are truly gifted...\lBut next time, you will fail.\pTake this, and remember me.

#org @before1
= This time, you will not be so\nlucky.

#org @after1
= How is this possible!?

#org @msg2
= I promise...\nI will defeat you.

#org @before2
= This time, you will lose.

#org @after2
= Again, I am beaten...

#org @msg3
= You are a King among peasants.

#org @msg4
= For the umpteenth time, I have\nfailed.\pClearly, you are the greatest.\pSo long as you defeat me, you\nmay have this.

After you battle him the third time, it goes to @later2. However, the next time you talk to him, it it will not. So, you put that check right at the begining and it will work. Give it a try.
 

ExitWound

Boggle
79
Posts
16
Years
  • Age 32
  • Seen Sep 22, 2016
You don't understand. It wasn't in the right order. Everything up to the last battle was, but your placement of checkflag 0x852 was off.

Here is the correct script:

Spoiler:

After you battle him the third time, it goes to @later2. However, the next time you talk to him, it it will not. So, you put that check right at the begining and it will work. Give it a try.

That would just make it so if you beat him the 3rd time, you could keep talking to him and get unlimited PP Ups. I didn't want it like that, I wanted to make it so you had to rebattle him for each PP Up that you wanted. But that' doesn't even matter because he doesn't give the PP Up anyway. For some reason, giveitem 0x47 0x1 0x0 and giveitem 0x45 0x1 0x0 do not work. And that is what I'm trying to figure out.
 

Zemekis

The Booze Cruise
22
Posts
11
Years
Hi, I have applied the following to a script event in Advance Map but when I walk over it NOTHING HAPPENS, but sometimes if I change this or that, my character just gets stuck in place and freezes there. I read in diegoisawesome's Script Tutorial that I need to change the Unknown to 0300 and the Var Number to 4050...but it still lets me walk right over the event.

#dynamic 0x71AF2D
#org @start
checkflag 0xCB
if 0x0 goto @playsweettunes
checkflag 0xCA
if 0x0 goto @getstuff
checkflag 0x828
if 0x1 goto @done
goto @getstuff
end

#org @playsweettunes
playsong 0x7 0x0
fadesong 0x7
fadesong 0xC
fadesong 0x47
setflag 0xCB
msgbox @wtfwasthat 0x6

#org @wtfwasthat
= [grey_fr]What was that sound? You should\ninvestigate!

#org @done
checkflag 0xC9
if 0x1 goto @superend
lock
msgbox @999 0x6
setflag 0xC9
release
end

#org @999
= [grey_fr]Looks like you have your wallet\nand Pokedex, it's time to get\lgoing!

#org @superend
end

#org @getstuff
msgbox @hue 0x6

#org @hue
= [grey_fr]You should get your wallet and\nPokedex you left on the table\lbefore you leave!
applymovement 0xFF @move

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

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Hi, I have applied the following to a script event in Advance Map but when I walk over it NOTHING HAPPENS, but sometimes if I change this or that, my character just gets stuck in place and freezes there. I read in diegoisawesome's Script Tutorial that I need to change the Unknown to 0300 and the Var Number to 4050...but it still lets me walk right over the event.

#dynamic 0x71AF2D
#org @start
checkflag 0xCB
if 0x0 goto @playsweettunes
checkflag 0xCA
if 0x0 goto @getstuff
checkflag 0x828
if 0x1 goto @done
goto @getstuff
end

#org @playsweettunes
playsong 0x7 0x0
fadesong 0x7
fadesong 0xC
fadesong 0x47
setflag 0xCB
msgbox @wtfwasthat 0x6

#org @wtfwasthat
= [grey_fr]What was that sound? You should\ninvestigate!

#org @done
checkflag 0xC9
if 0x1 goto @superend
lock
msgbox @999 0x6
setflag 0xC9
release
end

#org @999
= [grey_fr]Looks like you have your wallet\nand Pokedex, it's time to get\lgoing!

#org @superend
end

#org @getstuff
msgbox @hue 0x6

#org @hue
= [grey_fr]You should get your wallet and\nPokedex you left on the table\lbefore you leave!
applymovement 0xFF @move

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

The fact that nothing happenes at all is usually a flag/var problem. Check this out: http://www.pokecommunity.com/showthread.php?t=302347

That would just make it so if you beat him the 3rd time, you could keep talking to him and get unlimited PP Ups. I didn't want it like that, I wanted to make it so you had to rebattle him for each PP Up that you wanted. But that' doesn't even matter because he doesn't give the PP Up anyway. For some reason, giveitem 0x47 0x1 0x0 and giveitem 0x45 0x1 0x0 do not work. And that is what I'm trying to figure out.

Dude, your bag is full.-_- If you look at any script that gives items during it (not just a giveitem like one you find on the ground, but a regular talking script) you will see that it checks how many items you have in your bag and then gives you the item if you have room. Without that check, if the bag is full, nothing happens.
 
Last edited:

Varion Bluefire

A.K.A The Glitch
655
Posts
11
Years
  • Age 29
  • Seen Jan 3, 2015
So I'm making a multichoice script, just a simple yes/no kind of thing.

This is the script; (FR BTW)
#dynamic 0x800723
#org @start
faceplayer
msgbox @1 0x6
preparemsg @2
waitmsg
multichoice 0xE 0x0 0x0 0x0
copyvar 0x8003 0x8004
compare 0x8003 0x0
if 0x1 goto @yes
compare 0x8003 0x7F
if 0x2 goto @no
release
end

#org @yes
msgbox @3 0x6
fadescreen 0x1
fanfare 0x100
special 0x0
fadescreen 0x0
msgbox @4 0x6
release
end

#org @no
msgbox @5 0x6
release
end

#org @1
= Morning, \v\h01!\nHow are you today?

#org @2
= Would you like to rest for a bit?

#org @3
= Oh goodie, here's your room key.

#org @4
= Have a nice sleep?

#org @5
= Well, come back anytime.

But, Whenever I press no, or cancel it still does option 1 (yes)
 

ExitWound

Boggle
79
Posts
16
Years
  • Age 32
  • Seen Sep 22, 2016
Dude, your bag is full.-_- If you look at any script that gives items during it (not just a giveitem like one you find on the ground, but a regular talking script) you will see that it checks how many items you have in your bag and then gives you the item if you have room. Without that check, if the bag is full, nothing happens.

Bahahaha!! Should I shoot myself now or later? I guess I was just confused because he was giving me the Leftovers... I must have only had 1 item slot left until my bag was full. So yeah, I feel like a dumbass now. Thanks anyways, friend.
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
So I'm making a multichoice script, just a simple yes/no kind of thing.

This is the script; (FR BTW)

Spoiler:


But, Whenever I press no, or cancel it still does option 1 (yes)

You're incorrectly copying the variable that holds the answer you selected in the multichoice. The answer is always immediately saved to the variable 0x800D rather than 0x8004. Your compare functions are also a little bit messed up, at this point you are stating 'If it is no (0x0) then go to @yes and if it is greater (0x2) than cancel (0x7F) go to @no'. Here's what your script should look like:

Code:
#dynamic 0x800000

#org @start
faceplayer
msgbox @1 0x6
preparemsg @2
waitmsg
multichoice 0xE 0x0 0x0 0x0
compare [COLOR="red"]0x800D 0x1[/COLOR] // You are initially checking if the answer is yes. I have also removed the second check for @no so there is no need for the copyvar command as we are only checking 0x800D once
if 0x1 goto @yes
[COLOR="red"]msgbox @5 0x6
release
end[/COLOR] // @no can be moved up here immediately after the variable check because if the player does not continue to @yes any other answer (0x0/ 0x7F) can be assumed to be no

#org @yes
msgbox @3 0x6
fadescreen 0x1
fanfare 0x100
special 0x0
fadescreen 0x0
msgbox @4 0x6
release
end

#org @1
= Morning, \v\h01!\nHow are you today?

#org @2
= Would you like to rest for a bit?

#org @3
= Oh goodie, here's your room key.

#org @4
= Have a nice sleep?

#org @5
= Well, come back anytime.
 

kearnseyboy6

Aussie's Toughest Mudder
300
Posts
15
Years
  • Seen Jun 22, 2019
If I set an overworld to have this script

#dynamic 0x800000

#org @1
msgbox @2 MSG_YESNO
closeonkeypress
compare LASTRESULT 0x1
if 0x1 goto @3
end

#org @3
giveitem 0x8C 0x2 MSG_FIND
end


#org @2
= HEY!\pThere are 2 PSNCURE BERRIES.\nDo you want to pick them?

^Now if I assign a Person ID the script stops it from reappearing, if not it appears again.

How does this work?? There is no setflag in the script...
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
If I set an overworld to have this script

#dynamic 0x800000

#org @1
msgbox @2 MSG_YESNO
closeonkeypress
compare LASTRESULT 0x1
if 0x1 goto @3
end

#org @3
giveitem 0x8C 0x2 MSG_FIND
end


#org @2
= HEY!\pThere are 2 PSNCURE BERRIES.\nDo you want to pick them?

^Now if I assign a Person ID the script stops it from reappearing, if not it appears again.

How does this work?? There is no setflag in the script...

MSG_FIND is commonly used for Pokeballs holding items in the overworld.
If you want an NPC to give an item to the player, then use MSG_OBTAIN instead.
 
Last edited:

kearnseyboy6

Aussie's Toughest Mudder
300
Posts
15
Years
  • Seen Jun 22, 2019
MSG_FIND is commonly used for Pokeballs holding items in the overworld.
If you want an NPC to give an item to the player, then use MSG_OBTAIN instead.

Sorry I don't think I explained it properly...

When I use person ID 200 the script sets that flag, or if I change it to 201 it sets 201 to stop it from reappearing. Does that make more sense?

I want to know how the games script knows to set the correct flag?
 
16
Posts
11
Years
  • Seen Aug 1, 2013
Hi, I've got a question about a problem I'm having. I increased the number of starters that you can choose from in Oak's lab in FireRed from 3 to 10. So I made extra balls and they all seem to work just fine. But after I go get Oak's Parcel and deliver it, when your rival walks in, his character sprite doesn't show up. You get given the Pokédex and everything, but when the rival leaves, I think he's allowed to walk off the screen, but then the game freezes.

I think the person event of your rival isn't loading properly and then it freezes when it tries to unload it, but I'm not sure. Maybe it's trying to load and unload the wrong thing? I think it all worked fine before I increased the number of balls, but I'm not sure. Can anyone help me with this?
 
21
Posts
10
Years
  • Seen Jun 15, 2013
So I'm trying to use the pokepic command for Pokescript for three starter Pokemon (on a FIRE RED ROM). It works perfectly fine for Charmander. However, when I test the script for Totodile and Treecko it shows a picture of a Cacnea and question mark respectively. The scripts work perfectly fine for every other part or if I remove the pokescript commands. I have bolded the lines that I believe are causing the problem.

Charmander (working fine):
Spoiler:


Totodile (displays a Cacnea image):
Spoiler:


Treecko (displays a question mark):
Spoiler:


Update: So I tested it again and it turns out that I receive Charmander and Totodile (the latter's pokepic is still broken) but I instead of Treecko I receive a question mark Pokemon.
 
Last edited:

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Hi, I've got a question about a problem I'm having. I increased the number of starters that you can choose from in Oak's lab in FireRed from 3 to 10. So I made extra balls and they all seem to work just fine. But after I go get Oak's Parcel and deliver it, when your rival walks in, his character sprite doesn't show up. You get given the Pokédex and everything, but when the rival leaves, I think he's allowed to walk off the screen, but then the game freezes.

I think the person event of your rival isn't loading properly and then it freezes when it tries to unload it, but I'm not sure. Maybe it's trying to load and unload the wrong thing? I think it all worked fine before I increased the number of balls, but I'm not sure. Can anyone help me with this?

You can only have a specific number of on screen sprites. Simple as that.
 
2
Posts
11
Years
  • Seen Dec 12, 2019
Hello all!
Just a quick question. Does anyone know the offset for trainerbattle 0x3? I want to edit out the text from the battle. Just deleting the text still makes the text box show up, so I wanted to go to the offset in a hex editor and just scrub out the pointers to the texts.
 

Trev

[span="font-size: 8px; color: white;"][font="Monts
1,505
Posts
11
Years
  • Age 27
  • Seen Nov 15, 2023
Hello all!
Just a quick question. Does anyone know the offset for trainerbattle 0x3? I want to edit out the text from the battle. Just deleting the text still makes the text box show up, so I wanted to go to the offset in a hex editor and just scrub out the pointers to the texts.

That's not a script, it's a command. trainerbattle is a command, 0x3 is a hex code that activates a type of trainerbattle. I'm not even sure what you mean by the offset for it...

If you want to change the text, open the script in XSE, find the offset at the end of the trainerbattle command, delete it and replace it with a different offset, delete the corresponding text string and offset and replace it, and done.
 
2
Posts
11
Years
  • Seen Dec 12, 2019
That's not a script, it's a command. trainerbattle is a command, 0x3 is a hex code that activates a type of trainerbattle. I'm not even sure what you mean by the offset for it...

If you want to change the text, open the script in XSE, find the offset at the end of the trainerbattle command, delete it and replace it with a different offset, delete the corresponding text string and offset and replace it, and done.

I don't want to change the text in the script. I want to find the offset used for the trainerbattle command, and scrub out the text, so your first battle isn't interrupted by Oak talking about how to battle.
 
Status
Not open for further replies.
Back
Top