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

Help Thread: Script Help Thread

Status
Not open for further replies.
5,256
Posts
16
Years

Script Help Thread

This thread is for any questions related to the creation of events and scripting in the Pokémon games. Post here with your script embedded in [SPOILER]spoiler tags[/SPOILER], stating somewhere in your post the ROM the script is intended for and the syntax you are using (e.g. XSE, PKSVUI, etc.).

Thread rules

Do not demand for answers to your questions!
People do not have to answer your questions, they do it because they want to! Not only are those posts annoying, they also are completely pointless! If such a post is found, it will probably be deleted.

Wrap your scripts in [SPOILER]spoiler tags[/SPOILER].
This is here to keep the thread as easy to browse as possible, as most scripts tend to take up multiple lines and this can make scrolling through the thread a chore.

When answering, quote the post with the question.
This is here to simply keep organization. It is much easier to read the thread when you have both the question and the answer. The users quoted will also get a notification so they will know their question has been replied to.
 
Last edited by a moderator:

U.Flame

Maker of Short Games
1,326
Posts
15
Years
I'm getting back into my Sapphire hack with scripting. I gave up on finding the follow-up clock script and instead decided to expand the entry script with the intent of bypassing interacting with the clock. Problem is, the script won't add new movements. I encountered this problem once before, and the solution was to use a new offset instead of using the old one. That gave the space needed for the expansion of the script, so naturally I tried using a new offset here. For some reason, that didn't work. I made a small temporary adjustment to the text to test if the script can be edited, and it was successful, meaning the problem is with the movement alone. Why didn't the new offset work? Using XSE by the way.

This is the script before I attempted to expand it:
Spoiler:


Here is my expansion attempt. As you can see, I replaced the offset with a new one from Free Space Finder. The change is on movement string 0x243FEF, where I tried adding new movement:
Spoiler:
 

Blah

Free supporter
1,924
Posts
11
Years
I'm getting back into my Sapphire hack with scripting. I gave up on finding the follow-up clock script and instead decided to expand the entry script with the intent of bypassing interacting with the clock. Problem is, the script won't add new movements. I encountered this problem once before, and the solution was to use a new offset instead of using the old one. That gave the space needed for the expansion of the script, so naturally I tried using a new offset here. For some reason, that didn't work. I made a small temporary adjustment to the text to test if the script can be edited, and it was successful, meaning the problem is with the movement alone. Why didn't the new offset work? Using XSE by the way.

This is the script before I attempted to expand it:
Spoiler:


Here is my expansion attempt. As you can see, I replaced the offset with a new one from Free Space Finder. The change is on movement string 0x243FEF, where I tried adding new movement:
Spoiler:

That's not a good way to do it. Change the pointer to the movements directly. I.e:

Code:
...
applymovement PLAYER 0xOldOffset
pauseevent 0x0
...


Would become

Code:
...
applymovement PLAYER 0xNewOffset
pauseevent 0x0
...

Where NewOffset is the location to the new movement commands. Another thing is, do yourself a favor and hack Emerald or Fire Red. R/S/LG aren't very good choices for ROM bases.
 

U.Flame

Maker of Short Games
1,326
Posts
15
Years
Ah, so I just have to replace that offset instead. Thank you. If serious problems occur down the road, I may switch to a more stable ROM, but Sapphire's really grown on me. Not to mention there are like, no Sapphire hacks (even if it is for good reason), so I'm also kinda trying to prove something here.

Wait, no, that didn't work either. What's the problem here? At this point I'm starting to doubt it's the offsets. I tested altering the text again and confirmed I'm editing the right script, so it's not a mix-up.
Could it be something I'm doing wrong on Free Space Finder?
Capture.jpg
 
Last edited:

Blah

Free supporter
1,924
Posts
11
Years
Ah, so I just have to replace that offset instead. Thank you. If serious problems occur down the road, I may switch to a more stable ROM, but Sapphire's really grown on me. Not to mention there are like, no Sapphire hacks (even if it is for good reason), so I'm also kinda trying to prove something here.

Wait, no, that didn't work either. What's the problem here? At this point I'm starting to doubt it's the offsets. I tested altering the text again and confirmed I'm editing the right script, so it's not a mix-up.
Could it be something I'm doing wrong on Free Space Finder?
Capture.jpg

I tried it and it worked for me. :o
Try this:

Code:
...
applymovement PLAYER 0xOld
...

Code:
...
call 0x8NewOffset
...

and at new offset compile this:

#org @newOffset
applymovement PLAYER @something
pauseevent 0x0
return

#org @something
m movements end


If that doesn't work, just scrap the whole script and redo it all :D
 

U.Flame

Maker of Short Games
1,326
Posts
15
Years
Alright, I'm going to try using a new script. I want to copy and paste some parts of the script over, but XSE doesn't have the paste option working, whether I copy or cut. It used to work before, is there some setting for it?

Anyway, I tried a new script, and now I can't get any movement at all! It's as simple as possible and there's still some kind of conflict? What's wrong here?

Spoiler:
 
Last edited:

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
Alright, I'm going to try using a new script. I want to copy and paste some parts of the script over, but XSE doesn't have the paste option working, whether I copy or cut. It used to work before, is there some setting for it?

Anyway, I tried a new script, and now I can't get any movement at all! It's as simple as possible and there's still some kind of conflict? What's wrong here?

Spoiler:

...erm... you forgot the [waitmovement 0x0] command after your [applymovement]. :/
 

U.Flame

Maker of Short Games
1,326
Posts
15
Years
...oh. Well let's see if that works. Thanks!
Holy crap that's been the problem since the beginning. Thanks man, that was embarrassing.

So I'm having a bit of a problem implementing the clock event. Here's what I have so far:
Spoiler:

It activates the clock event, but doesn't continue the script after that part. The extra spoiler'd part there was a small extra movement I wanted to add, but it stops the clock event from activating for some reason. I could do without it, but I'd like to fix it if possible. How do I continue the script after setting the clock, and is there a way to add that extra movement part?
 
Last edited:

Telemetius

Tele*
267
Posts
9
Years
Lighten 0x1 script command

Ok so I'm trying to do a level script so that if a certain flag is active the entire cave should light up, but I can't fully comprehend the lighten command. The entire level script (type 2 right?)doesn't start at all.

Here's my script:

#dynamic 0x800000
#org @start
setvar 0x5004 0x1
checkflag 0x3
if 0x1 goto @flash
release
end

#org @flash
msgbox @uno 0x5
compare LASTRESULT 0X1
if 0x1 goto @flash1
msgbox @none 0x6
release
end

#org @flash1
lighten 0x2
release
end

#org @uno
= wanna use the torch?

#org @none
= test
 
Last edited:
6,355
Posts
18
Years
  • Seen Apr 16, 2020
Ok so I'm trying to do a level script so that if a certain flag is active the entire cave should light up, but I can't fully comprehend the lighten command. The entire level script (type 2 right?)doesn't start at all.

Here's my script:

Spoiler:

Moved your post to the Script Help thread. Your map should be a type 5 one (on entering and on menu close) since you want it to happen every time, otherwise if it's a type 2 it'll only work once and exiting the map and entering again or opening the menu and closing it would mean the cave would be dark again. The script you posted should work even as a type 2 though, at least once.

Make it a type 5 level script, and make it so that after the player chooses to light up the cave another flag is set. So at the beginning of the script there should be a check for that flag, so that the cave will stay lit up if you've chosen to use the torch.

There might be a different way to do this, but I've used something similar in a gym map of mine in Fire Red, based on Brawly's gym level script in Emerald. The script uses darken commands instead of lighten, so the script is the opposite of yours. So in your case, your script should check for the flag that is set after you choose to use the torch, and if it's not set, it should use the darken 0x4 command and ask you if you want to use the torch, otherwise it should end, and the cave would be normal.
 

Telemetius

Tele*
267
Posts
9
Years
Moved your post to the Script Help thread. Your map should be a type 5 one (on entering and on menu close) since you want it to happen every time, otherwise if it's a type 2 it'll only work once and exiting the map and entering again or opening the menu and closing it would mean the cave would be dark again. The script you posted should work even as a type 2 though, at least once.

Make it a type 5 level script, and make it so that after the player chooses to light up the cave another flag is set. So at the beginning of the script there should be a check for that flag, so that the cave will stay lit up if you've chosen to use the torch.

There might be a different way to do this, but I've used something similar in a gym map of mine in Fire Red, based on Brawly's gym level script in Emerald. The script uses darken commands instead of lighten, so the script is the opposite of yours. So in your case, your script should check for the flag that is set after you choose to use the torch, and if it's not set, it should use the darken 0x4 command and ask you if you want to use the torch, otherwise it should end, and the cave would be normal.

Ok so you're right, it works but just once!

So I put another flag and setted a type 5 level script. This time though nothing happens and the screen is back.
Here's the script:

Spoiler:
 
Last edited by a moderator:
6,355
Posts
18
Years
  • Seen Apr 16, 2020
Ok so you're right, it works but just once!

So I put another flag and setted a type 5 level script. This time though nothing happens and the screen is back.
Here's the script:

Spoiler:

Oh, right, I forgot, type 5 level shouldn't work with messages, only for certain flag and variable setting, and other commands such as darken/lighten. Which ROM are you using? By the way, you should put your scripts in spoiler tags whenever you post here.

So what you could do is have two level scripts. A type 2 level script that will ask if you want to use the torch and set a flag and use the lighten command, and another type 5 that will lighten the cave again whenever you open the menu or re-enter the cave.
 

Telemetius

Tele*
267
Posts
9
Years
Oh, right, I forgot, type 5 level shouldn't work with messages, only for certain flag and variable setting, and other commands such as darken/lighten. Which ROM are you using? By the way, you should put your scripts in spoiler tags whenever you post here.

So what you could do is have two level scripts. A type 2 level script that will ask if you want to use the torch and set a flag and use the lighten command, and another type 5 that will lighten the cave again whenever you open the menu or re-enter the cave.

It all went just like you said, thank you!
Just one little problem, if I say No the first level script will keep repeating until I wont say yes.
 
6,355
Posts
18
Years
  • Seen Apr 16, 2020
It all went just like you said, thank you!
Just one little problem, if I say No the first level script will keep repeating until I wont say yes.

Set the variable of the level script to 1 before the question to use the torch. Though this would make it so that if you choose no you don't get to be asked again, this is how type 2 level scripts work. Only thing I can think of to make it ask you this question whenever you enter the cave map is a variable that would reset after you exit the cave. I don't know if there are such temporary variables but what you could do is have type 5 level scripts on all the maps that have an entrance to the cave, such that if your variable is set to 1 after the cave level script, it would be set back to 0 so that the cave level script can be executed again.
 

Sensual

This should be good.
106
Posts
9
Years
  • Age 29
  • Seen Aug 3, 2018
Yo, I'm having a very simple problem here and I cannot figure it out for the life of me.

The scenario is that an NPC will "enter" a room, say something, and then leave after. The sprite (0x1) is positioned right on the entrance and is supposed to be hidden until the player activates a script, where it will reappear and perform the above scenario. The problem I'm having is that the sprite isn't actually hiding for some reason.

Spoiler:


The Person ID is set to 1066 in A-Map, btw. Any help?
 

DarkenedEclipse

Project Oak
207
Posts
9
Years
Yo, I'm having a very simple problem here and I cannot figure it out for the life of me.

The scenario is that an NPC will "enter" a room, say something, and then leave after. The sprite (0x1) is positioned right on the entrance and is supposed to be hidden until the player activates a script, where it will reappear and perform the above scenario. The problem I'm having is that the sprite isn't actually hiding for some reason.

Spoiler:


The Person ID is set to 1066 in A-Map, btw. Any help?
What program is this
 
31
Posts
14
Years
  • Seen Aug 2, 2015
What's the best scripting program to use? I need to insert missions and scripts for the missions for my team rocket hack of fire red I'm working on
 

Blah

Free supporter
1,924
Posts
11
Years
What program is this
That's PKSV. Also that person's problem is that he needs to set a flag and set the person ID to that flag number for the person to disappear. Clearflag and reappear sprite commands should be used to make the sprite appear again.

OK thanks

Top two are PKSV and XSE. They both have their different perks (someone should update them both using same/similar syntax and increased features :D ).
 
Status
Not open for further replies.
Back
Top