• 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.
  • 26
    Posts
    8
    Years
    • Seen Nov 25, 2017
    For movements and reappearing you have both 0xC and 0x12, is that correct or did you just mean 0xC cause if so that may be one cause of your issues. (And 0x5004 is too high of a var dont go past 0x40FF)

    Yeah, that was just me forgetting to change everything into hex xD. I believe I saw somewhere that said that 5000+ vars are safe, but it seems that that isn't the case. Anyway, var has been changed and hex updated, but the problem persists.
    The problem was that I forgot the 0x1 in the trainer battle to tell the script to continue after the battle.
     
    Last edited:
  • 5,256
    Posts
    16
    Years
    Do writebytetooffset commands do permanent alterations to the rom itself or is it temporary?

    ROM stands for read-only memory; it cannot be edited during runtime. Writebytetooffset can change the RAM, though, yes. Whether or not it is temporary depends on whether the area you're writing to is used by other parts of the game (it likely is). So, for most intents and purposes, yes.
     

    Splash

    But nothing happened.
  • 658
    Posts
    14
    Years
    ROM stands for read-only memory; it cannot be edited during runtime. Writebytetooffset can change the RAM, though, yes. Whether or not it is temporary depends on whether the area you're writing to is used by other parts of the game (it likely is). So, for most intents and purposes, yes.

    That gave me an idea.. Thanks sphice!
     

    leyn09

    Truant Trainer
  • 84
    Posts
    13
    Years
    How can I hide the player's OW sprite? using #raw 0x60 in applymovement nor hidesprite 0xFF results to freezing. Thanks!
     

    EViLGRiN

    Banned
  • 37
    Posts
    8
    Years
    Hi, noob here. I would like to check the level of a particular pokemon and I'm having a hard time figuring it out. I'm using XSE with FireRed. I know that the level for the first pokemon in my party would be at 0x02024284 + 0x54, but I'm not sure how that helps me. Basically I want to check to see if a pokemon on my team has Hypnosis, if they do, I want to check their level, if level is greater than X continue, if not skip. Any ideas? Is this possible?

    Spoiler:
     

    Sniper

    ふゆかい
  • 1,412
    Posts
    10
    Years
    How can I hide the player's OW sprite? using #raw 0x60 in applymovement nor hidesprite 0xFF results to freezing. Thanks!

    Your results were like that because of your script probably. Show us your script instead.
    I've used hidesprite hundreds of times and they never made the game freeze. Better put a setflag there, mate.
     
  • 1,682
    Posts
    8
    Years
    • Seen yesterday
    Hi, noob here. I would like to check the level of a particular pokemon and I'm having a hard time figuring it out. I'm using XSE with FireRed. I know that the level for the first pokemon in my party would be at 0x02024284 + 0x54, but I'm not sure how that helps me. Basically I want to check to see if a pokemon on my team has Hypnosis, if they do, I want to check their level, if level is greater than X continue, if not skip. Any ideas? Is this possible?

    Spoiler:

    Hey EViLGRiN, your research is correct, that is the location of the level for the first pokemon in the party. To get the others, you just need to add 0x64 to it for each additional party member. So the second pokemon's level is at 0x02024284 + 0x54 + 0x64.
    As for checking the level, you need the comparefarbytetobyte command which takes a pointer and a byte as arguments, as well as the comparison operators. Here's a list of them.
    Code:
    0x00 = A is less than B
    0x01 = A is equal to B
    0x02 = A is greater than B
    0x03 = A is less than or equal to B
    0x04 = A is greater than or equal to B
    0x05 = A is not equal to B
    Finally we need the if/goto command.
    So a script snippet to check if the second pokemon is at least level 10 would look like this:
    Spoiler:

    The rest of your script looks fine to me, but I don't use the animation commands much.
     

    EViLGRiN

    Banned
  • 37
    Posts
    8
    Years
    Hey EViLGRiN, your research is correct, that is the location of the level for the first pokemon in the party. To get the others, you just need to add 0x64 to it for each additional party member. So the second pokemon's level is at 0x02024284 + 0x54 + 0x64.

    Thanks so much, this makes so much more sense now. I just need to figure out how to determine which slot the pokemon with Hypnosis is in. Would I have to go through each slot and say, do they have Hypnosis > Yes > Is there level greater than X? > Continue. Or, are you able to determine the slot of the pokemon using the checkattack command? Am I hoping for to much?
     

    Syrex

    [b][i][COLOR=black][font=Rock Salt][glow=green]Hen
  • 653
    Posts
    15
    Years
    I'm not sure if this is how you achieve what i am going for but you leave the starting map (Your room) and walk down stars and i want it to start an event with someone using dialog, ect. THEN i want another person to come into the house and have more dialogue.

    Would this be achieved by using Two Level scripts?
    If so How do i time the two apart? I dont want the 2nd NPC coming into the house until after the 1st is finished talking.

    If not achieved with two level scripts, then how would i get my desired result?
     
  • 1,682
    Posts
    8
    Years
    • Seen yesterday
    Thanks so much, this makes so much more sense now. I just need to figure out how to determine which slot the pokemon with Hypnosis is in. Would I have to go through each slot and say, do they have Hypnosis > Yes > Is there level greater than X? > Continue. Or, are you able to determine the slot of the pokemon using the checkattack command? Am I hoping for to much?

    The checkattack command returns the index of which pokemon knows the attack into the 0x800D var. But XSE has no math related commands, so you have to to set the offset manually. So you just check for the value of the var, and use the comparefarbytetobyte command and then jump again to the effect of your field move.
    You've done it already when you checked LASTRESULT (var 0x800D) if the var was 0x6. Same idea.

    I'm not sure if this is how you achieve what i am going for but you leave the starting map (Your room) and walk down stars and i want it to start an event with someone using dialog, ect. THEN i want another person to come into the house and have more dialogue.

    Would this be achieved by using Two Level scripts?
    If so How do i time the two apart? I dont want the 2nd NPC coming into the house until after the 1st is finished talking.

    If not achieved with two level scripts, then how would i get my desired result?

    You don't need two level scripts for this. One is enough. Just have a copy of the NPC on that map that's invisible and make him visible when it needs to show up. The NPC won't show until the player clicks through the dialogue from the first one. And if you need a longer delay, try the pause command (I know XSE has one).
     
    Last edited:

    Syrex

    [b][i][COLOR=black][font=Rock Salt][glow=green]Hen
  • 653
    Posts
    15
    Years
    The checkattack command returns the index of which pokemon knows the attack into the 0x800D var. But XSE has no math related commands, so you have to to set the offset manually. So you just check for the value of the var, and use the comparefarbytetobyte command and then jump again to the effect of your field move.
    You've done it already when you checked LASTRESULT (var 0x800D) if the var was 0x6. Same idea.



    You don't need two level scripts for this. One is enough. Just have a copy of the NPC on that map that's invisible and make him visible when it needs to show up. The NPC won't show until the player clicks through the dialogue from the first one. And if you need a longer delay, try the pause command (I know XSE has one).

    aah! using hide sprite until the end of the first? i may not know how to do this because i want the 2nd npc to walk and talk instantly after the first.
     
  • 1,682
    Posts
    8
    Years
    • Seen yesterday
    aah! using hide sprite until the end of the first? i may not know how to do this because i want the 2nd npc to walk and talk instantly after the first.

    Oh sorry, I guess I wasn't very clear.
    It's supposed to be like this (not an actual script):
    Spoiler:

    [walk-in] is your NPC that walks in. The whole thing can be in one script. I would give you a better example but I don't have XSE on this device.

    EDIT: Here an XSE script that might be a better example.
    Spoiler:
     
    Last edited:

    EViLGRiN

    Banned
  • 37
    Posts
    8
    Years
    I thought I had this figured out, but I guess I was wrong. It works fine if the pokemon in slot 1 is the correct level, but if I move them to a different slot, it doesn't work. I'm under the impression that checkattack gives me the slot of the pokemon, so then I say is it slot 1? Yes, check if slot 1 is higher than 10. No, continue. Is it slot 2? Yes, check if slot 2 is higher than 10. etc...

    Here's my code for checkattack.:
    Spoiler:


    Here's the code I have for comparefarbytetobyte:
    Spoiler:
     
  • 1,682
    Posts
    8
    Years
    • Seen yesterday
    I thought I had this figured out, but I guess I was wrong. It works fine if the pokemon in slot 1 is the correct level, but if I move them to a different slot, it doesn't work. I'm under the impression that checkattack gives me the slot of the pokemon, so then I say is it slot 1? Yes, check if slot 1 is higher than 10. No, continue. Is it slot 2? Yes, check if slot 2 is higher than 10. etc...

    Here's my code for checkattack.:
    Spoiler:


    Here's the code I have for comparefarbytetobyte:
    Spoiler:

    Just noticed your offsets for slot 3 and 4 are the same and as a result, the rest of the offsets have been messed up.
    Code:
    Slot 2: 0x0202433C <- This one is correct in your script
    Slot 3: 0x020243A0
    Slot 4: 0x02024404
    Slot 5: 0x02024468
    Slot 6: 0x020244CC
    Could be the cause of the issue. And if it's not, still something you'll need to fix.
     

    colonelsalt

    Guaranteed to raise the smile
  • 111
    Posts
    11
    Years
    Does the warp command not work when executed at the end of a long script?

    To finish a relatively long (400+ lines) script (activated by a script tile in A-Map), I try to use the warp command to move the player to a different map. The foot-shuffling sound plays as it should and the screen fades to black, but from there the game freezes (without the player having moved at all). I've tried using the warp command in the very same area as this script using a basic person event, and it works just like it should. What's going on here?

    Does anybody know of a possible solution?
     
  • 5,256
    Posts
    16
    Years
    Does the warp command not work when executed at the end of a long script?

    To finish a relatively long (400+ lines) script (activated by a script tile in A-Map), I try to use the warp command to move the player to a different map. The foot-shuffling sound plays as it should and the screen fades to black, but from there the game freezes (without the player having moved at all). I've tried using the warp command in the very same area as this script using a basic person event, and it works just like it should. What's going on here?

    Does anybody know of a possible solution?

    You need to add the waitstate command after the warp, and then end. The freezing is likely just because you're spamming A because the script is too long and trying to activate a non-existent script, or something.
     

    colonelsalt

    Guaranteed to raise the smile
  • 111
    Posts
    11
    Years
    You need to add the waitstate command after the warp, and then end. The freezing is likely just because you're spamming A because the script is too long and trying to activate a non-existent script, or something.

    Thanks for answering.

    Adding a waitstate and end after the warp seems to cause absolutely no change, though. I've made sure to keep my hands way off the A button when the warp is about to execute, but the screen still goes all black. warpmuted and warpwalk appear to give exactly the same outcome.

    This is what the part of the script that uses the warp command looks like (I've highlighted the relevant lines):
    Code:
    #org @script2
    msgbox @pettalk6 0x6
    pause 0x10
    spriteface PETREL FACE_LEFT
    pause 0x20
    msgbox @pettalk7 0x6
    pause 0x10
    spriteface PETREL FACE_RIGHT
    pause 0x10
    msgbox @pettalk7extra 0x6
    spriteface PETREL FACE_LEFT
    pause 0x15
    applymovement PETREL @onestep
    waitmovement 0x0
    pause 0x30
    msgbox @pettalk8 0x6
    pause 0x20
    spriteface PETREL FACE_LEFT
    pause 0x10
    applymovement PETREL @stepL
    waitmovement 0x0
    pause 0x10
    msgbox @pettalk9 0x6
    sound 0x15 // exclamation
    applymovement RONNIE @exclamation
    waitmovement 0x0
    applymovement RONNIE @stepR
    waitmovement 0x0
    msgbox @desperateron 0x6
    pause 0x10
    applymovement PETREL @stepL
    waitmovement 0x0
    msgbox @pettalk10 0x6
    pause 0x20
    spriteface PETREL FACE_DOWN
    pause 0x25
    applymovement PETREL @petleave
    waitmovement 0x0
    pause 0x15
    sound 0x9 // feet shuffle
    checksound
    hidesprite PETREL
    pause 0x10
    applymovement RONNIE @ronfinalwalk
    waitmovement 0x0
    pause 0x10
    msgbox @ronfinaltalk 0x6
    pause 0x10
    applymovement RONNIE @petleave
    waitmovement 0x0
    pause 0x15
    sound 0x9 // feet shuffle
    checksound
    hidesprite RONNIE
    applymovement SUPERNERD @nerdfinalwalk
    waitmovement 0x0
    msgbox @nerdfinaltalk 0x6
    applymovement SUPERNERD @petleave
    waitmovement 0x0
    pause 0x15
    sound 0x9 // feet shuffle
    checksound
    hidesprite SUPERNERD
    pause 0x15
    setflag 0x205
    fadeout 0x2
    pause 0x30
    [B]warp 0x1 0x2A 0xFF 0x0C 0x06
    waitstate
    end[/B]

    Just in case I might have caused this error to happen somewhere else, this is what the rest of my script looks like (the star symbols, I suppose, are just PC censoring my naughty language):
    Spoiler:

    EDIT: After countless attempts I finally solved the issue: Apparently warp does not work if used directly following a fadeout -- everything else being equal, the warp works just as it should once I removed the fadeout. Why in the world this is the case, though, I have no idea.
     
    Last edited:
    Status
    Not open for further replies.
    Back
    Top