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

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
Does the same go with making someone stay in a different spot after an event?
Sorry about all the questions. :D
When someone is made to disappear, and has a flag, one 0 is changed into 1 in game's ram memory. When that particular bit (can be 0 or 1 naturally) is 1, person event won't show.

Same goes conversely - if people event has a flag and is not there when you check the map the first time, you know that the flag bit is set to 1.
To make that person appear, you've to set that bit to 0 (=clearbit [flag no]).
 
25
Posts
13
Years
  • Seen Nov 13, 2020
Movements aren't applied!

Already having trouble again. To be expected since I'm a noob :]
Anyway... using pksv still, I am trying to get 4 movements applied to 2 people. They both do their first move, but they both won't do their 2nd movements. Is there some kind of command I have to use to reset them so they can do a second movement?
Here's the script
Spoiler:

P.S. the text and movements are temporary.
 
25
Posts
13
Years
  • Seen Nov 13, 2020
I made this script to stop me from moving and then take a few staps back (you can only approach the script from the right). But when I pass the script, nothing happens and I can just continue walking. What is wrong?

Try adding a lock in the beginning?
 

Hacks0rus

Monster Raving Looney
24
Posts
12
Years
  • Seen Nov 9, 2012
That just freezes it up. I cannot move anymore, the music keeps playing, but nothing happens.

This is on a script event right? I always have trouble putting these in, and cant seem to find any place where there is a solution. I managed to find my own less than elegant solution and there probably is a better way to do it though :)

Anyway, the way I have my scripts is with a setvar0x(7000 or above) in at the end. I then put the var number in the var number box in A-map, and copy and paste the script offset into the map script under header, like in a level script. That usually gets rid of the freezing, but i'm sure there is a better way of doing this.
 
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
Already having trouble again. To be expected since I'm a noob :]
Anyway... using pksv still, I am trying to get 4 movements applied to 2 people. They both do their first move, but they both won't do their 2nd movements. Is there some kind of command I have to use to reset them so they can do a second movement?
Here's the script
Spoiler:

P.S. the text and movements are temporary.

M onspot_left is turn left right?

If that's the case then the problem is quite obviously your pointers - all your pointers are set to 0x8EB0DD0, which is all 'turn left'. You haven't given them another movement option.


I made this script to stop me from moving and then take a few staps back (you can only approach the script from the right). But when I pass the script, nothing happens and I can just continue walking. What is wrong?


What is "setfarbyte 0x13 0xE3D3FFFE" doing in your script? Not convinced it belongs there.

Are you using a 'Script' tile event in Advance Map? If you haven't set a Var-Number it might not work.

For example - in A-Map put the Var-Number of the event to 7000, and make sure the Var-Value is 0000. This means that the script will activate when var 7000 is set to 0x0, so setting it (setvar 0x7000 0x1) in a different script later on would disable it.
 
72
Posts
12
Years
  • Seen Sep 30, 2017
'-----------------------
#org 0x800697
lock
msgbox 0x88007D4 '"Hold on!"
applymovement 0x1 0x88007A2
waitmovement 0x0
applymovement MOVE_PLAYER 0x88007D1
pause 0x30
msgbox 0x88007DE '"You need a Pokémon before you do an..."
release
end


'-----------
' Movements
'-----------
#org 0x8007A2
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw FE 'End of Movements

#org 0x8007D1
#raw 3 'Face Right
#raw FE 'End of Movements


'---------
' Strings
'---------
#org 0x8007D4
= Hold on!

#org 0x8007DE
= You need a Pokémon before you do anything else. Follow me.
This is the current script that makes it freeze up. I'll go look into the setvar command, haven't used that yet. I'll let you know if it works.

Thanks for the replies!

Quick question about the setvar command (and setflag for that matter). How do you decide which number to use. You told me to use 7000 and the script seems to work (well, the messagebox doesn't but I'll be able to fix that I think), but how do I know what number to use? Are there numbers I cannot use? And if so, why not?
 
Last edited:
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
This is the current script that makes it freeze up. I'll go look into the setvar command, haven't used that yet. I'll let you know if it works.

Thanks for the replies!

Quick question about the setvar command (and setflag for that matter). How do you decide which number to use. You told me to use 7000 and the script seems to work (well, the messagebox doesn't but I'll be able to fix that I think), but how do I know what number to use? Are there numbers I cannot use? And if so, why not?

You're missing your message type from your script?

You need to put a quantifier, probably 0x6 or MSG_NORMAL in this case. It goes after the pointer.

msgbox 0x88007D4 MSG_NORMAL '"Hold on!"

Did you edit this decompiled script and take it out by accident maybe?


For flags/variables, the game itself uses many flags and variables for mechanics as well as trainers and events from FR. Whilst it might be a good idea to reuse the ones used in events generally its advantageous to start at a safe point, so you don't overwrite something important.

Flags, start 0x1000 and work your way up.
Variables I've always been told to start at 0x7000 and go up.
 
72
Posts
12
Years
  • Seen Sep 30, 2017
You're missing your message type from your script?

You need to put a quantifier, probably 0x6 or MSG_NORMAL in this case. It goes after the pointer.

msgbox 0x88007D4 MSG_NORMAL '"Hold on!"

Did you edit this decompiled script and take it out by accident maybe?


For flags/variables, the game itself uses many flags and variables for mechanics as well as trainers and events from FR. Whilst it might be a good idea to reuse the ones used in events generally its advantageous to start at a safe point, so you don't overwrite something important.

Flags, start 0x1000 and work your way up.
Variables I've always been told to start at 0x7000 and go up.

First of all, thank you. I didn't add the quantifier. Probably the dumbest mistake I made in my short, very short career as a scripter. Second of all, thank you again, I always have trouble understanding the numbers with those kind of commands.

My command now works, so I'm happy!

'-----------------------
#org 0x800697
lockall
setvar 0x7000 0x0
msgbox 0x88007D4 '"Hold on!"
callstd 0x2
applymovement 0x1 0x88007A2
waitmovement 0x0
applymovement MOVE_PLAYER 0x88007D1
pause 0x30
msgbox 0x88007DE '"You need a Pokémon before you do an..."
callstd 0x2
applymovement MOVE_PLAYER 0x8800819
releaseall
end


'-----------
' Movements
'-----------
#org 0x8007A2
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw 13 'Step Right (Normal)
#raw FE 'End of Movements

#org 0x8007D1
#raw 2 'Face Left
#raw FE 'End of Movements

#org 0x800819
#raw 13 'Step Right (Normal)
#raw FE 'End of Movements


'---------
' Strings
'---------
#org 0x8007D4
= Hold on!

#org 0x8007DE
= You need a Pokémon before you do anything else. Follow me.
For the people who wonder what I changed, this is the command as it is now.
 
25
Posts
13
Years
  • Seen Nov 13, 2020
M onspot_left is turn left right?

If that's the case then the problem is quite obviously your pointers - all your pointers are set to 0x8EB0DD0, which is all 'turn left'. You haven't given them another movement option.

Spoiler:


Even now after I give them other move options they still don't do the other moves, just their first ones.
Oh, and it's not turn left, it walk left while in place.
 
Last edited:
72
Posts
12
Years
  • Seen Sep 30, 2017
Ok, I've got the movement script working, I get warped into the room I wanted at the position I wanted. But what I want now, is that the moment I get into that room, I continue walking to the place I have in mind, just like you do in Oak's Lab. Except, I have no idea how to do that. I think I have to use a map script, the one used in the Header, but how do I make sure it doesn't begin every time I enter that particular map? Do I have to use flags, variables or something like that?

In short: I want a script that starts the second I enter the room, but only activates once. I'm not looking for a complete script, just a few pointers on how to start.

Thanks in advance!
 
5,256
Posts
16
Years
Ok, I've got the movement script working, I get warped into the room I wanted at the position I wanted. But what I want now, is that the moment I get into that room, I continue walking to the place I have in mind, just like you do in Oak's Lab. Except, I have no idea how to do that. I think I have to use a map script, the one used in the Header, but how do I make sure it doesn't begin every time I enter that particular map? Do I have to use flags, variables or something like that?

In short: I want a script that starts the second I enter the room, but only activates once. I'm not looking for a complete script, just a few pointers on how to start.

Thanks in advance!

For a level script to only occur once, at this at the beginning of the script:

Code:
#org @setup
#raw 0x2
#raw pointer @setup1
#raw 0x0

#org @setup1
#raw word 0x7000 //This variable can be whatever you like, but it has to be set to 0x1 sometime in the script.
#raw word 0x0
#raw pointer @start
#raw word 0x0

#org @start

Then you can add the rest of the script as usual. Make sure you include the "setvar 0x7000 0x1" part in the script, though!

Compile this script, then paste the offset in the Map Script Offset box in AdvanceMap's Header tab of the map you want the script to take place in. Remember to go into Professional View to find the box (Ctrl+H).
 

Hacks0rus

Monster Raving Looney
24
Posts
12
Years
  • Seen Nov 9, 2012
25
Posts
13
Years
  • Seen Nov 13, 2020
I figured out the problem... finally! :) It turns out I just needed to add an "end" command at the end of the movements! I'm so happy!
 
179
Posts
12
Years
  • Seen Aug 10, 2014
I really don't understand how to make/fiddle with movement scripts. For example I tried editing Prof.Oak's in the beginning by writing walk_right an extra few times so that he would correctly meet my spot.. but instead he walked down all the way off the screen?
 
25
Posts
13
Years
  • Seen Nov 13, 2020
I really don't understand how to make/fiddle with movement scripts. For example I tried editing Prof.Oak's in the beginning by writing walk_right an extra few times so that he would correctly meet my spot.. but instead he walked down all the way off the screen?

There could be multiple problems here. Are you sure the offset pointer is equal to the offset of the script? If so then I'm guessing that you are overwriting the offset at some point. I had this problem before I learned how to read hex. Anyway, another script you wrote, it could have written over the offset you are using changing the desired results. I would suggest learning about hex if that's the case. I'll always be glad to help. To check this just decompile your script after saving it and if it changes then that's probably the problem.
 
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
I've been trying to change the location (and which facing behaviour) of a sprite on the map by writing new bytes over the old data ala:
...
writebytetooffset 0x13 0x87297B4
writebytetooffset 0x2 0x87297B6
writebytetooffset 0x8 0x87297B9
...

However it doesn't seem to be working... The address in the compiled script is right, I've double checked everything.

It comes at the end of a talking script, just for testing purposes, but on leaving/returning to the map the sprite is in exactly the same place.
 
25
Posts
13
Years
  • Seen Nov 13, 2020
New sprite

I've been trying to change the location (and which facing behaviour) of a sprite on the map by writing new bytes over the old data ala:
...
writebytetooffset 0x13 0x87297B4
writebytetooffset 0x2 0x87297B6
writebytetooffset 0x8 0x87297B9
...

However it doesn't seem to be working... The address in the compiled script is right, I've double checked everything.

It comes at the end of a talking script, just for testing purposes, but on leaving/returning to the map the sprite is in exactly the same place.

You could go about a different approach. You could create a new sprite just like the one you have now and give it the properties you want, and in an earlier script just set his flag number and instead of doing that you'd just have to clear his flag and set the flag of the person you want to disappear.
 
72
Posts
12
Years
  • Seen Sep 30, 2017
Ok, so I added the part to that Spherical Ice gave me and made the following script:
#dynamic 0x800000
#org @setup
#raw 0x2
#raw pointer @setup1
#raw 0x0

#org @setup1
#raw word 0x7005
#raw word 0x0
#raw pointer @start
#raw word 0x0

#org @start
lockall
setvar 0x7005 0x1
checkflag 0x1001
if 0x0 goto @done
msgbox @1 0x6
applymovement 0xFF @move1
setvar 0x7005 0x1
clearflag 0x1001
releaseall
end

#org @done
release
end

#org @1
= This way please!

#org @move1
#raw 0x10
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x11
#raw 0x11
#raw 0x11

After compiling however, I get 5 offsets, three of which seem to matter:
@setup 8002D5
@setup1 8002DC
@start 8002E7

Which one do I put where? And is this script even working? Cause it doesn't seem to respond if I put any of the three on the 'Script Offset 2' box in the Header (script type is 04 Validates Value, Flag=1001, Value:7005).

Oh and the Script Offset box is greyed out and has $71A276. The reason I have checkflag 0x1001, is because in the previous movement script that takes me to the map has just set the flag. So what I intended was that if the script starts it just checks to see if the flag is set. If not, just proceed with your business. If it is, the script as mentioned above is set.

Have no idea what more I can tell, so if you have any questions about the script, do ask.
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
I've been trying to change the location (and which facing behaviour) of a sprite on the map by writing new bytes over the old data ala:
...
writebytetooffset 0x13 0x87297B4
writebytetooffset 0x2 0x87297B6
writebytetooffset 0x8 0x87297B9
...

However it doesn't seem to be working... The address in the compiled script is right, I've double checked everything.

It comes at the end of a talking script, just for testing purposes, but on leaving/returning to the map the sprite is in exactly the same place.
Have those bytes in ram turned back to normal when you re-enter the map ? If so, the game likely reads data from map header ([in ROM]) to 0x8[ROM] area of RAM memory. Basically, what I mean by this is that the map header is accessed to check what happens in the map and re-writes that data in ram memory --> ROM area section.

What you could do though is to set a script loaded from map's script header to change the location and facing of that person.
 
Status
Not open for further replies.
Back
Top