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

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
  • 2,475
    Posts
    11
    Years
    It keeps bringing me to the wrong map!

    Spoiler:

    Well first off, you don't need that second fadescreen, but you should replace it with a waitstate then end. No release.
    Secondly, the correct syntax for warp is:
    Code:
    >Byte - Bank # to warp to
    >Byte - Map # to warp to
    >Byte - Exit # to warp to
    >Word - X coordinate
    >Word - Y coordinate

    You shouldn't have an exit number that is 0xFF
    Make sure that you're using decimal numbers since map editors use decimal. 0x19 or 19, make sure you can distinguish the correct one
     

    Sefuree

    Canada Goose
  • 3,183
    Posts
    10
    Years
    Spoiler:

    Like this?

    Spoiler:
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
  • 2,475
    Posts
    11
    Years
    Like this?

    Spoiler:

    Again, why are you using a warp number with 0xFF?
    How did you get from 0x19 to 0x25 when your map number is simply 19?
     
  • 146
    Posts
    11
    Years
    • CO
    • Seen Mar 16, 2023
    So I am having trouble trying to get setmaptile to work for FR...

    This is my script:
    Code:
    #dynamic 0x800000
    
    #org @start
    comparefarbytetobyte 0x3005542 0x6       /6am
    if 0x4 goto @snippet1
    comparefarbytetobyte 0x3005542 0x12   /6pm
    if 0x4 goto @snippet2
    release
    end
    
    #org @snippet1
    setmaptile 0xA 0x5 0x2D5 0x0
    special 0x8E
    release
    end
    
    #org @snippet2
    setmaptile 0xA 0x5 0x2D4 0x0
    special 0x8E
    release
    end

    I am simply trying to have lights turn on at 6pm an then turn off at 6am...
    Using the RTC from DNS of course...

    Also I can't figure out what level script type I am supposed to use....
     
  • 10,078
    Posts
    15
    Years
    • UK
    • Seen Oct 17, 2023
    Again, why are you using a warp number with 0xFF?

    Because he's following diegoisawesome's XSE tutorial, that's how diego suggests warp to position. It's not wrong by any stretch, even if there are other ways.

    So I am having trouble trying to get setmaptile to work for FR...

    This is my script:
    Code:
    #dynamic 0x800000
    
    #org @start
    comparefarbytetobyte 0x3005542 0x6       /6am
    if 0x4 goto @snippet1
    comparefarbytetobyte 0x3005542 0x12   /6pm
    if 0x4 goto @snippet2
    release
    end
    
    #org @snippet1
    setmaptile 0xA 0x5 0x2D5 0x0
    special 0x8E
    release
    end
    
    #org @snippet2
    setmaptile 0xA 0x5 0x2D4 0x0
    special 0x8E
    release
    end

    I am simply trying to have lights turn on at 6pm an then turn off at 6am...
    Using the RTC from DNS of course...

    Also I can't figure out what level script type I am supposed to use....

    What happens when you step on the tile? Does it freeze? Do you just walk over it?
     

    Telinc1

    Weirdo Extraordinaire
  • 168
    Posts
    10
    Years
    What happens when you step on the tile? Does it freeze? Do you just walk over it?
    I'm pretty sure he wants to put that in a level script. As for the question...

    So I am having trouble trying to get setmaptile to work for FR...

    This is my script:
    --CUT--
    I am simply trying to have lights turn on at 6pm an then turn off at 6am...
    Using the RTC from DNS of course...

    Also I can't figure out what level script type I am supposed to use....
    For the script, try swapping the checks. What you're doing now is checking if it's later than 6:00 and if it is you're going to another part of the script. The second check (if it's later than 18:00) will be never run because it can never be later than 18:00 and sooner than 6:00. I might be derping hard, but I'm pretty sure that might fix it (actually, I don't know if that's the problem if there is one as I don't know what tile is what). As for the type, you should use "01 "setmaptile" script". That's what GameFreak use when they want to set map tiles in a level script.
     
  • 325
    Posts
    10
    Years
    Thanks your your suggestion, I've found the main script but it looks a bit confusing.

    This is the main part:

    Spoiler:


    There are a couple standard trainerbattles like "trainerbattle 0x3 0x214 0x0 0x816D65B" but it doesn't show any specials/callasm or anything strange.
    Trainerbattle 0x3 is the kind of battle that will continue after the battle, and obviously it is in Ruby because it's used in that script right there. I think destinedjagold got that one wrong, so try it out.
    trainerbattle 0x3 only has the challenge pointer, and not a defeat pointer, so keep that in mind.
     

    destinedjagold

    I do not exist.
  • 8,593
    Posts
    17
    Years
    • Seen May 26, 2024
    Trainerbattle 0x3 is the kind of battle that will continue after the battle, and obviously it is in Ruby because it's used in that script right there. I think destinedjagold got that one wrong, so try it out.
    trainerbattle 0x3 only has the challenge pointer, and not a defeat pointer, so keep that in mind.
    i may have misunderstood his original post. see the quote below.
    Hi there, quick question!
    Is there any way to make a script continue after a trainer battle is lost in a ruby/emerald rom?

    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.
     
  • 81
    Posts
    8
    Years
    • She/her/hers
    • Seen Oct 26, 2023
    Hey there! I am hacking FireRed. I've hit a snag on a script I'm trying to complete.

    In this script, you're supposed to run into the rival and a group of other people, talk a bit, and then fight the rival. After you beat the rival, those people talk a bit more, and then over time everyone should walk away and disappear. At the end, flag 201 is set. This is the person id of all the npcs.

    When you beat the rival, the script plays exactly how I'd like it to. However, when you lose to the rival, you don't get to try again. When you walk back to where you were, all of the people are gone, even though you shouldn't have finished the script and activated flag 0x201 because you lost.

    Why is this happening, and what can I do to fix this? I am using PKSV-UI. Here is my script. I bolded where the trainer battles are.

    Spoiler:


    Thank you for any help.
     
  • 1,344
    Posts
    14
    Years
    • Seen Dec 10, 2021
    Hey there! I am hacking FireRed. I've hit a snag on a script I'm trying to complete.

    In this script, you're supposed to run into the rival and a group of other people, talk a bit, and then fight the rival. After you beat the rival, those people talk a bit more, and then over time everyone should walk away and disappear. At the end, flag 201 is set. This is the person id of all the npcs.

    When you beat the rival, the script plays exactly how I'd like it to. However, when you lose to the rival, you don't get to try again. When you walk back to where you were, all of the people are gone, even though you shouldn't have finished the script and activated flag 0x201 because you lost.

    Why is this happening, and what can I do to fix this? I am using PKSV-UI. Here is my script. I bolded where the trainer battles are.

    Spoiler:


    Thank you for any help.

    Odd. From a quick look at your script I can't see any problems, but what I would do is run some tests, see if the flag is getting set when you lose somehow, see if it gets set too when you win. I solved a similar problem with my hack just by trial and error, I pinpointed a specific part of my script where for some reason it was activating a flag.
     
  • 81
    Posts
    8
    Years
    • She/her/hers
    • Seen Oct 26, 2023
    Odd. From a quick look at your script I can't see any problems, but what I would do is run some tests, see if the flag is getting set when you lose somehow, see if it gets set too when you win. I solved a similar problem with my hack just by trial and error, I pinpointed a specific part of my script where for some reason it was activating a flag.

    Thanks for the tip! I managed to solve my problem.

    The script was supposed to set both flags 0x201 and 0x223 at the end, so I set up NPCs to tell me if each one was set after I lost. For some reason, 0x201 was being set either way, but 0x223 was only set on a win. So, on the route leading up to this script, I put a map script that checks if 0x223 is set. If it's not, then it clears flag 0x201, and you get a chance to try again.
     

    Telemetius

    Tele*
  • 267
    Posts
    9
    Years
    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.

    Yes that's exactly my problem there. I'm gonna have the main character lose an impossible battle and immediately follow up with the script (without whiteouts or Pokécenters).
     
  • 325
    Posts
    10
    Years
    Yes that's exactly my problem there. I'm gonna have the main character lose an impossible battle and immediately follow up with the script (without whiteouts or Pokécenters).
    Herpderp, my fault. Try trainerbattle 0x9, that's what FR uses for the first rival battle, but I wouldn't bet on it working. But it couldn't hurt to try. If it doesn't work, then you'll have to access the trainerbattle routine and edit it yourself.
     

    Telemetius

    Tele*
  • 267
    Posts
    9
    Years
    Herpderp, my fault. Try trainerbattle 0x9, that's what FR uses for the first rival battle, but I wouldn't bet on it working. But it couldn't hurt to try. If it doesn't work, then you'll have to access the trainerbattle routine and edit it yourself.

    Thanks for the suggestion. I'm not that good with ASM (or hex editing) so I found a safer (and longer) way out that involves a level script and the sethealingpoints editing. It's not hacker-like, but it's a working alternative.
     

    BadEgg~

    Pokémon: Volant Version Developer
  • 112
    Posts
    8
    Years
    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:
     
  • 10,078
    Posts
    15
    Years
    • UK
    • Seen Oct 17, 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:

    Throw in a return at the end of your @name string and a compare LASTRESULT 0x1 after your msgbox @nickname and let me know if that solves your problem :). You also have a floating setflag between some of the messages.
     

    BadEgg~

    Pokémon: Volant Version Developer
  • 112
    Posts
    8
    Years
    Throw in a return at the end of your @name string and a compare LASTRESULT 0x1 after your msgbox @nickname and let me know if that solves your problem :). You also have a floating setflag between some of the messages.

    The nickname box still isn't appearing nor is the nickname flag working. The 2 other flags have been set in order to enable the Pokédex and Pokémon menus in the start bar. I'm going to remake the script, making it more basic - then try and slowly make it more complicated and try and see where I went wrong.
     
    Status
    Not open for further replies.
    Back
    Top