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

RetroRoller

Trailer Trash
111
Posts
12
Years
Problems have arisen again.
The script decompiles fine now :)
but the flag isn't set and I can't run -.-'

Also, I have a script here:
Spoiler:


I put it as a Script in A-Map. Freezes my character, but not the game. Help please. I haven't decompiled it yet.

Thanks in advance. Again.
 
25
Posts
13
Years
  • Seen Nov 13, 2020
Problems have arisen again.
The script decompiles fine now :)
but the flag isn't set and I can't run -.-'

Also, I have a script here:
Spoiler:


I put it as a Script in A-Map. Freezes my character, but not the game. Help please. I haven't decompiled it yet.

Thanks in advance. Again.

If you want an event to happen once you have to use variables, unless you want the character talking to disappear. If so, set the flag number 202 to the person id. If you want the person to stay you'll have to use a variable and set that variable to a different value instead of setting the flag.

Oh, and you don't have a give item line in the script for the running shoes.
 
5,256
Posts
16
Years
If you want an event to happen once you have to use variables, unless you want the character talking to disappear. If so, set the flag number 202 to the person id. If you want the person to stay you'll have to use a variable and set that variable to a different value instead of setting the flag.

Oh, and you don't have a give item line in the script for the running shoes.

Um, no, you can use flags OR variables for events to occur once. The difference between flags and variables is basically that variables are used for level scripts and for being set at different values and flags are for hiding sprites and only have two values, true or false.

As for the actual code, I reccommend you update your XSE to version 1.1.1 RetroRoller, and then adjust your code to something like this:

Code:
#dynamic 0x800000

#org @start
checkflag [B]0x202[/B]
if 0x1 goto @done
applymovement 0x1 @profalarmed
waitmovement 0x0
msgbox @1 MSG_NORMAL
applymovement 0xFF @move
applymovement 0x1 @proflooksdown
waitmovement 0x0
msgbox @2 MSG_NORMAL
setflag [B]0x202[/B]
release
end

#org @done
release
end

#org @proflooksdown
#raw 0x0
#raw 0xFE

#org @profalarmed
#raw 0x62
#raw 0x2
#raw 0xFE

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

#org @1
= \c\h01\h06 Prof. Williams\c\h01\h02c\h01\h08 So that move would make[.]\pOh! \v\h01!\nTake your seat.

#org @2
= \c\h01\h08Anyways, I graded all your exam\npapers.\pAll you guys did well. I just have to\nmention \v\h01 and \v\h06 though!\pYou guys were the only ones to get A's.\nI wanted to give you both a little\lpresent for doing so well[.]\nYour very own\c\h01\h08 Pokémon!\pGo home now guys. And I'll see you\ntwo in the Lab later!

Also, I wouldn't recommend using the flag 202. I tend to use flags 0x850, they have proved to be quite safe and functional in most cases. So yeah.
 

RetroRoller

Trailer Trash
111
Posts
12
Years
Um, no, you can use flags OR variables for events to occur once. The difference between flags and variables is basically that variables are used for level scripts and for being set at different values and flags are for hiding sprites and only have two values, true or false.

As for the actual code, I reccommend you update your XSE to version 1.1.1 RetroRoller, and then adjust your code to something like this:

Code:
#dynamic 0x800000

#org @start
checkflag [B]0x202[/B]
if 0x1 goto @done
applymovement 0x1 @profalarmed
waitmovement 0x0
msgbox @1 MSG_NORMAL
applymovement 0xFF @move
applymovement 0x1 @proflooksdown
waitmovement 0x0
msgbox @2 MSG_NORMAL
setflag [B]0x202[/B]
release
end

#org @done
release
end

#org @proflooksdown
#raw 0x0
#raw 0xFE

#org @profalarmed
#raw 0x62
#raw 0x2
#raw 0xFE

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

#org @1
= \c\h01\h06 Prof. Williams\c\h01\h02c\h01\h08 So that move would make[.]\pOh! \v\h01!\nTake your seat.

#org @2
= \c\h01\h08Anyways, I graded all your exam\npapers.\pAll you guys did well. I just have to\nmention \v\h01 and \v\h06 though!\pYou guys were the only ones to get A's.\nI wanted to give you both a little\lpresent for doing so well[.]\nYour very own\c\h01\h08 Pokémon!\pGo home now guys. And I'll see you\ntwo in the Lab later!
Also, I wouldn't recommend using the flag 202. I tend to use flags 0x850, they have proved to be quite safe and functional in most cases. So yeah.

Aha, thanks. I already said I use PKSV, but I loaded the script into XSE and changed the flag to 0x850, still froze when I walked on the script.
Any ideas, guys?

Ooh and I would like the sprite to dissappear.
 
5,256
Posts
16
Years
Change the Person ID of the person you want to disappear to 202. Also, does the script tile in Advance Map have the Unknown (the first one) of $03 and the Var Number of 4050? If not, change it so it does.
 
25
Posts
13
Years
  • Seen Nov 13, 2020
Aha, thanks. I already said I use PKSV, but I loaded the script into XSE and changed the flag to 0x850, still froze when I walked on the script.
Any ideas, guys?

Ooh and I would like the sprite to dissappear.

If you want him to disappear use the flag, and set the sprite's person id to the flag number you use.
And for the frozen script tile, just use a variable (start using variables at about 7000) and put that variable in the variable number box and the var value to 0, and the unknown works with 0 too. When you want that script not to run anymore just put the line
setvar 0x7000 0x1
(7000 is the variable you put in the variable number box. 0x1 is the number stored in that variable)
into the script that you want to stop this script.
 
72
Posts
12
Years
  • Seen Sep 30, 2017
The best advice would be to rewrite the script with fresh @pointers so they all get assigned new offsets, then see if the problem persists.

Well, that worked. I still don't understand why the updatecoins line just appeared.

And I still dont understand the non-moving-sprite problem either.
 
25
Posts
13
Years
  • Seen Nov 13, 2020
Well, that worked. I still don't understand why the updatecoins line just appeared.

And I still dont understand the non-moving-sprite problem either.

If you added stuff to the script after you 1st compiled it then it might have overwritten itself over one of the first offsets.
 
72
Posts
12
Years
  • Seen Sep 30, 2017
Since I keep getting problems with the 3 tile-script thing, I have a different question.

With the Oak-stopping-you-script, there are two different tiles where he will stop you. However, even though the script offset is different on the two tiles, most of the script is the same

Only difference:
'---------------
#org 0x1655ED
lockall
setvar 0x4001 0x0
goto 0x8165605
vs
'---------------
#org 0x1655F9
lockall
setvar 0x4001 0x1
goto 0x8165605

The rest of the script is the same. I want to do the same in my map, only for 3 tiles instead of 2. How do I do this? It seems to work with some kind of compare command:
For which way Oak needs to walk to you:
compare 0x4001 0x0
if 0x1 call 0x81656B8
compare 0x4001 0x1
if 0x1 call 0x81656C3
and for which way you and Oak need to walk back to the lab:
compare 0x4001 0x0
if 0x1 call 0x81656CE
compare 0x4001 0x1
if 0x1 call 0x81656E0


I'm guessing that the compare command checks on which of the two tiles you stand, but I can't seem to find the 4001 value anywhere on the tile. How do they do it? And is it possible for 3 tiles instead of 2? I assume it is.
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
Since I keep getting problems with the 3 tile-script thing, I have a different question.

With the Oak-stopping-you-script, there are two different tiles where he will stop you. However, even though the script offset is different on the two tiles, most of the script is the same

Only difference:

vs


The rest of the script is the same. I want to do the same in my map, only for 3 tiles instead of 2. How do I do this? It seems to work with some kind of compare command:
For which way Oak needs to walk to you:

and for which way you and Oak need to walk back to the lab:



I'm guessing that the compare command checks on which of the two tiles you stand, but I can't seem to find the 4001 value anywhere on the tile. How do they do it? And is it possible for 3 tiles instead of 2? I assume it is.

That kind of 'split' scripting is used when you have a sufficiently large script where it would be best to conserve space (by not inserting it two or three times with minor changes) so you have two or more small scripts that set a variable and piggy-back off a larger one that determines which part of the script it should run based on that value. You can link this to as many scripts as you want, so long as you make sure that the larger script has enough movement variations for all possible tiles you can stand on (ie if you step on the first tile set the variable to 0x0, second tile: 0x1, third tile: 0x2 etc).

An important factor you have to remember when making a script that is split up like this is to compile the large section of your script before the smaller sections which set the variable and tell the game which tile you are standing on. For example, let's say that this is a large script that I'm going to insert:

Code:
#dynamic 0x800000

#org @start
compare 0x4001 0x0
if 0x1 goto @OnLeftTile
compare 0x4001 0x1
if 0x1 goto @OnMiddleTile
goto @OnRightTile // I can leave out the compare line since if the player is not standing on either the left or middle tile, they must be on the right-most tile

#org @OnLeftTile
applymovement 0xFF @LeftTileMovement
goto @ScriptContinue

#org @OnMiddleTile
applymovement 0xFF @MiddleTileMovement
goto @ScriptContinue

#org @OnRightTile
applymovement 0xFF @ThirdRightMovement
goto @ScriptContinue

#org @ScriptContinue
waitmovement 0x0
msgbox @talk 0x2
setvar 0x4001 0x3 // You can change the variable again to a totally unused number if you don't want the script tiles to remain active once you've finished
release
end

#org @talk
= Hello world!

#org @LeftTileMovement
#raw 0x11
#raw 0x13
#raw 0x11
#raw 0xFE

#org @MiddleTileMovement
#raw 0x11
#raw 0x11
#raw 0xFE

#org @RightTileMovement
#raw 0x11
#raw 0x12
#raw 0x11
#raw 0xFE

Yes I know it isn't actually that large, but it is good enough to show what is happening

As you can see in this large and hastily written script, I haven't included the 'setvar 0x4001 0x0/1/2' commands that determine which script tile you're standing on. Once you compile this large script, that is when you can make the smaller script that sets the variable - Don't insert this large script into a tile, just write down its address somewhere. For the purpose of this demonstration, let's say I inserted the earlier large script at the offset 0x812345:

Code:
#dynamic 0x800000

#org @start
setvar 0x4001 0x0 // Change the variable's value for each tile you have the possibility of stepping on 
call 0x8[COLOR="Red"]812345[/COLOR]

When you compile this small script in XSE and then reopen it through Advance Map, you will find that the large script that was written above and compiled earlier has been added to the end of this small script. The 'call' function allows you to use scripts and data that has already been inserted into the ROM, so when the small script is played, it will automatically continue where the large script starts (hence piggy-backing off it). That's about all you have to do when you have a large script that you don't want to insert two, three or even four times because of the extraordinary amount of space they could all occupy :)


The 4001 command can't be found on the tiles in A-Map because the game is using a different variable to determine whether Professor Oak's script has been completed (0x4050), which you can find being set on the 47th line of the script.
 
Last edited:
25
Posts
13
Years
  • Seen Nov 13, 2020
The script looks ok to me, maybe change the pause 0x40 to waitmovement 0x0? The script might be ending and passing over the movements, but waitmovement should mean it waits for the moving to finish before continuing to 'end'.

Could it have anything to do the characters changing maps?
 
72
Posts
12
Years
  • Seen Sep 30, 2017
That kind of 'split' scripting is used when you have a sufficiently large script where it would be best to conserve space (by not inserting it two or three times with minor changes) so you have two or more small scripts that set a variable and piggy-back off a larger one that determines which part of the script it should run based on that value. You can link this to as many scripts as you want, so long as you make sure that the larger script has enough movement variations for all possible tiles you can stand on (ie if you step on the first tile set the variable to 0x0, second tile: 0x1, third tile: 0x2 etc).

An important factor you have to remember when making a script that is split up like this is to compile the large section of your script before the smaller sections which set the variable and tell the game which tile you are standing on. For example, let's say that this is a large script that I'm going to insert:
Spoiler:

Yes I know it isn't actually that large, but it is good enough to show what is happening

As you can see in this large and hastily written script, I haven't included the 'setvar 0x4001 0x0/1/2' commands that determine which script tile you're standing on. Once you compile this large script, that is when you can make the smaller script that sets the variable - Don't insert this large script into a tile, just write down its address somewhere. For the purpose of this demonstration, let's say I inserted the earlier large script at the offset 0x812345:
Spoiler:

When you compile this small script in XSE and then reopen it through Advance Map, you will find that the large script that was written above and compiled earlier has been added to the end of this small script. The 'call' function allows you to use scripts and data that has already been inserted into the ROM, so when the small script is played, it will automatically continue where the large script starts (hence piggy-backing off it). That's about all you have to do when you have a large script that you don't want to insert two, three or even four times because of the extraordinary amount of space they could all occupy :)


The 4001 command can't be found on the tiles in A-Map because the game is using a different variable to determine whether Professor Oak's script has been completed (0x4050), which you can find being set on the 47th line of the script.

I got it to work, surprisingly enough, thank you! Only problem is that I have EXACTLY the same problem as before. The sprite will not appear on the middle and righttile. Even though it is all combined into one big script + 3 seperate small scripts. It does not skip my own movements, but it does skip the sprite movements who should stop you and take you to the location.

How can this happen? I don't get it.

Spoiler:
This is the script as it is now. The other two versions only have a different first offset and have setvar 0x7001 0x1 (and 0x2) instead of 0x0.
 
Last edited:

RetroRoller

Trailer Trash
111
Posts
12
Years
Okay, more problems -.-'
This is the code I put into XSE (NOT PKSV!)
Spoiler:


I put in the details of the script in A-Map.
The guy has the ! sign above his head, but I don't move and the message box doesn't appear. Also, the script doesn't happen twice, so something else works.

Help? :(
 
Last edited:

Hacks0rus

Monster Raving Looney
24
Posts
12
Years
  • Seen Nov 9, 2012
Okay, more problems -.-'
This is the code I put into XSE (NOT PKSV!)
Spoiler:


I put in the details of the script in A-Map.
The guy has the ! sign above his head, but I don't move and the message box doesn't appear. Also, the script doesn't happen twice, so something else works.

Help? :(

Is this a script event? if so, you'll need to put a var number in the var number box in a-map (use var numbers 7000 and up). That is, if you haven't already.
 

RetroRoller

Trailer Trash
111
Posts
12
Years
Is this a script event? if so, you'll need to put a var number in the var number box in a-map (use var numbers 7000 and up). That is, if you haven't already.

Yeah it's a script event and stuff.
Here's the proof:
Spoiler:


Here's the Script I put into XSE:
Spoiler:


And here is the script after decompiling:
Spoiler:


Scrolling throught the Compiling Log, I noticed no errors or warnings, so it worked fine.
I've corrected the script before, and it still doesn't work. I will try again if you ask but do you have any other solutions?
 

Quickster

Dream or Drop?
351
Posts
16
Years
  • Seen Apr 4, 2016
Yeah it's a script event and stuff.
Here's the proof:
Spoiler:


Here's the Script I put into XSE:
Spoiler:


And here is the script after decompiling:
Spoiler:


Scrolling throught the Compiling Log, I noticed no errors or warnings, so it worked fine.
I've corrected the script before, and it still doesn't work. I will try again if you ask but do you have any other solutions?

Hi, I think you should try putting 4050 as the var number instead of 7000 to see if it works.
 
3
Posts
15
Years
  • Seen Nov 17, 2013
How possible/difficult is it to hack Gold version so the player starts in Kanto instead of Johto?
 
Status
Not open for further replies.
Back
Top