• 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.
81
Posts
11
Years
    • Seen Jun 9, 2017
    Hey, guys. I was wondering how you script a sprite to be invisible until an event concerning them goes into motion. Like how Prof.Oak only appears in Fire Red to stop after you try going into the Route. He can't be seen before that. I've been messing around with hidesprite and showsprite, but I've had no luck keeping the sprite hidden beforehand. I'm trying to hack fire red, using XSE.
    Thanks in advance.
     
    81
    Posts
    8
    Years
    • She/her/hers
    • Seen Oct 26, 2023
    Hey, guys. I was wondering how you script a sprite to be invisible until an event concerning them goes into motion. Like how Prof.Oak only appears in Fire Red to stop after you try going into the Route. He can't be seen before that. I've been messing around with hidesprite and showsprite, but I've had no luck keeping the sprite hidden beforehand. I'm trying to hack fire red, using XSE.
    Thanks in advance.

    When you go into Advance Map and select a person event, there's a box on the right called "Person ID". You put a flag in this box, and while the flag is set, that person will be invisible.

    What I do is give the person a flag as their Person ID, and set that flag in a script earlier in the game. Then, during the script in which they are supposed to appear, use showsprite and clearflag to make them appear.
     

    destinedjagold

    You can contact me in PC's discord server...
    8,593
    Posts
    16
    Years
    • Seen Dec 23, 2023
    Hey, I'm currently learning how to use givepokemon scripts in conjunction with 0x5 message boxes. However, if I choose yes when asked whether or not I want to nickname my Pokémon, the game freezes. Similarly, if I choose "no", the text box fails to disappear from the screen and when I talk to the NPC, the game freezes.

    Spoiler:

    Fixes are in red. Questions are in blue.
    Code:
    #dynamic 0x71ABE4
    
    #org @start
    checkflag 0x666
    if 0x1 goto @greedy
    msgbox @1 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @givepokemon
    msgbox @2 0x6
    release
    end
    
    #org @2
    = Oh okay then. Prick.
    
    #org @greedy
    [color="red"]msgbox @7 0x6
    release
    end
    
    #org @7[/color]
    = DON'T BE GREEDY YOU\nLITTLE ****.
    
    #org @nickname
    = \c\h01\h07Would you like to give\nArceus a nickname?
    
    #org @name
    call 0x1474EB
    setflag 0x828
    setflag 0x829
    [color="red"]return[/color]
    
    #org @5
    = Take good care of my chai-I mean\nArceus...\p...\p...
    
    #org @3
    = \c\h01\h02You just got a free Magi-\nI mean Arceus!
    
    #org @6
    = As a bonus take these random shoes I stole!
    
    #org @1
    = \ch01\h04Hey kid, want some dru-\pI mean a Pokemon? 
    
    #org @givepokemon
    givepokemon 0x81 [color="blue"]0x99[/color] 0x44 0x0 0x0 0x0 [color="blue"]//the hex number 0x99, when converted to decimal, is 153. Are you seriously trying to give the player a level 153 'mon? Also, please make sure that you know the proper hex values. If you are not sure, then you can simply write [givepokemon 25 99 44 0 0 0] and XSE will automatically convert it to their proper hex values.[/color]
    fanfare 0x13E
    msgbox @3 0x4
    waitfanfare
    [color="red"]closeonkeypress[/color]
    setflag 0x666
    msgbox @nickname 0x5
    [color="red"]compare LASTRESULT 0x1[/color]
    if 0x1 call @name
    msgbox @5 0x6
    msgbox @6 0x6
    [color="red"]setflag 0x82F[/color]
    release
    end
     

    BadEgg~

    Pokémon: Volant Version Developer
    112
    Posts
    8
    Years
  • Spoiler:

    Thanks man ^ - ^) -- turns out the 99 was a typo xD
     
    Last edited:
    81
    Posts
    11
    Years
    • Seen Jun 9, 2017
    When you go into Advance Map and select a person event, there's a box on the right called "Person ID". You put a flag in this box, and while the flag is set, that person will be invisible.

    What I do is give the person a flag as their Person ID, and set that flag in a script earlier in the game. Then, during the script in which they are supposed to appear, use showsprite and clearflag to make them appear.

    It worked!! Thanks a bunch. I have another question. In Advance Map, when I write a script, I have to put a number in the Unknown and Var number boxes, else, stepping on the script tile causes the game to freeze. Exactly what are these numbers for? And what do I put for multiple scripts? The example given in deigoisawesome's tutorial is 0300 and 4050. This doesn't always work. So, what other numbers can I substitute for this? Thanks again.
     

    Sefuree

    Canada Goose
    3,183
    Posts
    10
    Years
  • I am always getting an error when i try to compile a script!

    It says error at line 17, but there is no line 17!

    Using FireRed and XSE.

    Picture of error message:
    Spoiler:


    Script:
    Spoiler:
     

    Alexander Nicholi

    what do you know about computing?
    5,500
    Posts
    14
    Years
  • I am always getting an error when i try to compile a script!

    It says error at line 17, but there is no line 17!

    Using FireRed and XSE.

    Picture of error message:
    Spoiler:


    Script:
    Spoiler:
    It needs to all be on a single line, and for safety make sure there's a newline before the EOF. Unfortunately, if you have incredibly long text (don't think this is the case here), you have to save it somewhere else and recompile it from file, because XSE's disassembler is bugged in that it only reads some stupid maximum (1024 or 4096 IIRC) for a single line. However, you'll still be able to compile for however long you want (up to 65535 as far as I know).
     
    81
    Posts
    8
    Years
    • She/her/hers
    • Seen Oct 26, 2023
    It worked!! Thanks a bunch. I have another question. In Advance Map, when I write a script, I have to put a number in the Unknown and Var number boxes, else, stepping on the script tile causes the game to freeze. Exactly what are these numbers for? And what do I put for multiple scripts? The example given in deigoisawesome's tutorial is 0300 and 4050. This doesn't always work. So, what other numbers can I substitute for this? Thanks again.

    You're welcome. A var is basically a flag, except that rather than having two distinct states (set and cleared), it can be set to any value. You can use setvar 0xX 0xY to set the value of a var. X would be the var and Y would be the value of the var.

    I have a list of safe vars that I refer to, but I can't post the link yet. (Account is too new).
    Google "Flags, Vars, and Script Tiles" and pick the post by karatekid552 in Pokecommunity.

    Put a var into the Var Number box, and put a value into the Var Value box. Then, the script on that script tile will activate, but only if the value of the var in the Var Number box equals what you put in the Var Value box. So, say earlier you set var 0x401A to have a value of 3. If you put 4 in the Var Value box, the script won't run. It won't freeze either, just nothing happens. Put 3 in the Var Value box and the script runs. The advantage here is that at the end of your script, you can setvar 0x401A 0x4 and the script will never run again.

    You need to have a var in the Var Number box or the game will freeze (though I don't know why). I don't know what Unknown does, but I've never touched it and I've been fine.
     
    6
    Posts
    12
    Years
    • Seen Jul 21, 2015
    I'm trying to make a rival script in xse for firered, where depending on the starter you chose he has the opposite type (typical rivals). it keeps telling me error on line 8 "overflow", im pretty sure theres several errors in this script :(

    Spoiler:
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • I'm trying to make a rival script in xse for firered, where depending on the starter you chose he has the opposite type (typical rivals). it keeps telling me error on line 8 "overflow", im pretty sure theres several errors in this script :(

    Spoiler:

    Code:
    if 0x840 goto @grass
    ^ What's this? Flags are either true or false, set or unset, 1 or 0. This line itself makes no sense, unless you're trying to checkflag 0x840.
    You'd basically just do the same thing as before - checkflag 0x840, if 1 goto @grass
     
    81
    Posts
    11
    Years
    • Seen Jun 9, 2017
    i may have misunderstood his original post. see the quote below.


    from what i understood, he was asking if there was a way for the script to continue even after you lost to a trainerbattle.

    but if i understood it wrong, then NewDenverCity's suggestion is the way to go.

    I've always wanted to run a script like this. Trainerbattle 0x9 allows for the script to continue after the battle is lost. But every time I script it, Prof. Oak talks you through the battle as in the lab with the first battle with your rival. Is there a way for me to stop him from doing that?
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • I've always wanted to run a script like this. Trainerbattle 0x9 allows for the script to continue after the battle is lost. But every time I script it, Prof. Oak talks you through the battle as in the lab with the first battle with your rival. Is there a way for me to stop him from doing that?

    From the PRPB log:
    Code:
    put 00 for the 8 bytes at 0x080484 to make trainerbattle 0x9 not have oak's text

    Credits to knizz for finding that
     
    14
    Posts
    10
    Years
    • Seen Jan 20, 2020
    Hello, I'd need some help with my script here. If anybody knows the answer (likely everybody except of me will so -_-*) please let me know it.

    What I want:
    If the player steps on the script-tile, it shall check for Badge Nr. 7 and a sprite shall appear to tell me the text.

    What happens: If I don't have the Badge, the game freezes.

    Further Information: The Person-ID of the sprite is 2 the flag of the sprite is set to 212. In an earlier script I alredy used this flag to hide the sprite.

    The Script:
    Spoiler:
     
    215
    Posts
    11
    Years
    • Seen Jul 14, 2020
    I have a question.

    So with JPANs Hack Applier, He has made it so trainer battle scripts don't always have to start with the trainerbattle part in the script. Now when you change the 'Unknown' in Advanced Map to anything but 00, you can make the script start with anything and the trainer will run up to you. This is all great, however I'm not happy with it.

    If you have the Trainerbox set to 00 instead of 01, the OW will never run up to you for a battle, you need to talk to him. If you set the Trainerbox to 01, The trainer will run up to you, but when you leave the map and come back, the trainer will run up to you again. (When the trainer runs up to you again it doesn't do the battle again but it's still not fun to have OWs running up to you telling you the battle was fun). Is there a way to make this work?

    Here is the context in which I am trying to make this function work.

    I want to make it so the OW has different level Pokemon depending on what stage in the game you are at. So if you have no badges, they will face you with level 10 Pokemon but if you have 1 badge they will face you with level 15 Pokemon. This is the script I have made for it.

    Spoiler:


    It works Perfectly except for the fact that when the Player leaves the map and comes back, the OW runs back at the player and says 'Talking 3'. If these is a way to make the OW not at the player ever again after the battle has taken place I would love to know.

    The way I thought of fixing this way by putting a line of code in the script that changes the OWs 'Trainer' status to be 00 from 01. However I don't know how to do that.

    If anyone knows how to fix this issue, or a code that can change the an OWs Trainer Status, I would be very greatful. Thanks!
     
    Last edited:
    229
    Posts
    8
    Years
  • Spoiler:

    The only fix I have is to ignore JPAN's thing and just write it all out. It will make it a whole lot easier and you'll just have to change "trainerbattle 0x10 0x001 0x0"

    I know it doesn't completely do what you want it to do, but it should work. It just sounds like there may be some bugs with JPAN's thing which is okay.
     
    215
    Posts
    11
    Years
    • Seen Jul 14, 2020
    The only fix I have is to ignore JPAN's thing and just write it all out. It will make it a whole lot easier and you'll just have to change "trainerbattle 0x10 0x001 0x0"

    I know it doesn't completely do what you want it to do, but it should work. It just sounds like there may be some bugs with JPAN's thing which is okay.

    Okay but I don't think you understand. I need the OW to run up to the Trainer. That won't happen if I just make it 0x1 instead of 0x0.

    I guess another way of fixing the problem is asking this. While using JPANs hack Applier, is there a way to make the Trainer run up to you without having the Trainer Box selected and using Level Scripts?
     
    Last edited:
    1,344
    Posts
    14
    Years
    • Seen Dec 10, 2021
    Okay but I don't think you understand. I need the OW to run up to the Trainer. That won't happen if I just make it 0x1 instead of 0x0.

    I guess another way of fixing the problem is asking this. While using JPANs hack Applier, is there a way to make the Trainer run up to you without having the Trainer Box selected and using Level Scripts?

    Well if you don't want to use ASM or anything, you could just use script tiles to mimic a trainerbattle (however the trainer would have to be facing only one direction, as there would be no way to tell if he's looking towards you otherwise). Just place the script tiles in front of him, find out how far away you are with getplayerpos, then do the music, applymovement, etc. Problem is it would be a lot of work if you're intending to use it more than once.
     

    miksy91

    Dark Energy is back in action! ;)
    1,480
    Posts
    15
    Years
  • The way I thought of fixing this way by putting a line of code in the script that changes the OWs 'Trainer' status to be 00 from 01. However I don't know how to do that.
    Since the trainer data is stored in rom, it's (at least in GB/C) impossible to do that unless the data is loaded to ram when the map is entered. If this happens, you could call a "map's script" that changes those values to 00 if the trainers in that map are defeated.
    Other way to achieve the same effect could be done with script tiles, but that way, you would use ram space for no good reason and that kind of solution wouldn't be a "great way" for doing it either.


    Anyway, to achieve this "hack" globally, you would have to do quite a bit of asm hacking and coding. Basically, you would have to find the code for making that person move to you. There you would have to edit that code to not make the person take movement if you have beaten him/her already. This is doable because in that routine, the person is somehow "defined" (because in the game, that specific person walks to you and not anybody else on the same map). You would have to look for the event data of that person, find its script pointer there, and somehow, figure the flag number of that person within its script. This kind of stuff probably happens in the game already when you challenge a trainer?


    There was some idea behind this solution but even so, you would have to have some general way of figuring the flag number of the challenged trainer. And implementing it wouldn't be a piece of cake either. So better to stick with trigger events really unless someone can come up with a better idea than I did. But one thing that you could look into is whether the event data of that trainer is loaded to ram when the map is entered. If it is, you could achieve the this thing straight from map's script.
     
    Status
    Not open for further replies.
    Back
    Top