• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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✓] rock smash fails to hide sprite.

  • 853
    Posts
    4
    Years
    • Seen Nov 9, 2023
    I'm trying to write a script to access rock smash without any prior checks, and I thought I succeeded in this
    but, every time I take a step in any direction the sprite pops back up.

    Here's my code.

    Code:
    lockall
    setanimation 0x0 LASTRESULT
    bufferpartypokemon 0x0 LASTRESULT
    bufferattack 0x1 0xF9
    msgbox 0x81BE09D MSG_YESNO '"This rock appears to be breakable...."
    compare LASTRESULT 0x0
    if 0x1 goto 0x81BE09A
    msgbox 0x81BDFD7 MSG_KEEPOPEN '"[buffer1] used [buffer2]!"
    closeonkeypress
    doanimation 0x25
    waitstate
    goto 0x81BE06F
    
    '---------------
    #org 0x1BE09A
    closeonkeypress
    releaseall
    end
    
    '---------------
    #org 0x1BE06F
    applymovement LASTTALKED 0x81BE08F
    waitmovement 0x0
    hidesprite LASTTALKED
    releaseall
    end
    
    
    '---------
    ' Strings
    '---------
    #org 0x1BE09D
    = This rock appears to be breakable.\nWould you like to use ROCK SMASH?
    
    #org 0x1BDFD7
    = [buffer1] used [buffer2]!
    
    
    '-----------
    ' Movements
    '-----------
    #org 0x1BE08F
    #raw 0x68 'mov68
    #raw 0xFE 'End of Movements
     
    Last edited:
    I'm trying to write a script to access rock smash without any prior checks, and I thought I succeeded in this
    but, every time I take a step in any direction the sprite pops back up.

    Here's my code.

    Code:
    lockall
    setanimation 0x0 LASTRESULT
    bufferpartypokemon 0x0 LASTRESULT
    bufferattack 0x1 0xF9
    msgbox 0x81BE09D MSG_YESNO '"This rock appears to be breakable...."
    compare LASTRESULT 0x0
    if 0x1 goto 0x81BE09A
    msgbox 0x81BDFD7 MSG_KEEPOPEN '"[buffer1] used [buffer2]!"
    closeonkeypress
    doanimation 0x25
    waitstate
    goto 0x81BE06F
    
    '---------------
    #org 0x1BE09A
    closeonkeypress
    releaseall
    end
    
    '---------------
    #org 0x1BE06F
    applymovement LASTTALKED 0x81BE08F
    waitmovement 0x0
    hidesprite LASTTALKED
    releaseall
    end
    
    
    '---------
    ' Strings
    '---------
    #org 0x1BE09D
    = This rock appears to be breakable.\nWould you like to use ROCK SMASH?
    
    #org 0x1BDFD7
    = [buffer1] used [buffer2]!
    
    
    '-----------
    ' Movements
    '-----------
    #org 0x1BE08F
    #raw 0x68 'mov68
    #raw 0xFE 'End of Movements

    In Advance Map, assign any of these flags (11, 12, 13, 14) to the breakable rock and test it out, this is most likely a flag issue.
     
    In Advance Map, assign any of these flags (11, 12, 13, 14) to the breakable rock and test it out, this is most likely a flag issue.

    The default script doesn't involve setting any flags. And if I add that flag, to the code, would it negatively affect all other rocks, since every rocksmash in the game uses the same offset. Like would breaking, break every other one in the game, or prevent me from breaking them?

    My other question is would that cause problems with the rock coming back later, since its supposed to reset when you change maps?
     
    The default script doesn't involve setting any flags. And if I add that flag, to the code, would it negatively affect all other rocks, since every rocksmash in the game uses the same offset. Like would breaking, break every other one in the game, or prevent me from breaking them?

    My other question is would that cause problems with the rock coming back later, since its supposed to reset when you change maps?

    I didn't clarify, but you should assign this flag to the person ID box in Advance Map, not the code itself, and yes, it would negatively affect other rocks in the map if used in the code.

    So, just add any of those flags to the person ID box in Advance Map and don't add any flags to the code. Rocks would automatically reset themselves upon leaving the map if they have any of those flags assigned to them, but since you probably didn't set them in Advance Map, the rock would disappear once and reappear after the player took a step in any direction.
     
    I didn't clarify, but you should assign this flag to the person ID box in Advance Map, not the code itself, and yes, it would negatively affect other rocks in the map if used in the code.

    So, just add any of those flags to the person ID box in Advance Map and don't add any flags to the code. Rocks would automatically reset themselves upon leaving the map if they have any of those flags assigned to them, but since you probably didn't set them in Advance Map, the rock would disappear once and reappear after the player took a step in any direction.

    Alright that sounds good, took a look and I see that each one has its own individual person id, throughout the game.

    Now I just need to now "how" to set a flag to the person Id box, and if I need only that one flag or will I have to find a flag for every rock in the game?

    And you said flag 11-14, does it actually matter what flag I use as long as its "clean" unused?

    Thank-you very much for the help.
     
    Alright that sounds good, took a look and I see that each one has its own individual person id, throughout the game.

    Now I just need to now "how" to set a flag to the person Id box, and if I need only that one flag or will I have to find a flag for every rock in the game?

    And you said flag 11-14, does it actually matter what flag I use as long as its "clean" unused?

    Thank-you very much for the help.

    You can use any of these 11 - 14 flags for those rocks and it will work well. If you have four rocks, one will have a flag of 11, one will have a flag of 12 and so on till ag 14. You can reuse these flags for rocks on other maps too.

    And you can just click the rock and write any of those flags to the person ID box in Advance Map, just type it in while the rock overworld sprite is selected. (person event number.)

    And you should only use flags 11 - 14 because they automatically set and reset themselves upon using rock smash (flag gets set) and while leaving the map (flag is cleared.)
     
    You can use any of these 11 - 14 flags for those rocks and it will work well. If you have four rocks, one will have a flag of 11, one will have a flag of 12 and so on till ag 14. You can reuse these flags for rocks on other maps too.

    And you can just click the rock and write any of those flags to the person ID box in Advance Map, just type it in while the rock overworld sprite is selected. (person event number.)

    And you should only use flags 11 - 14 because they automatically set and reset themselves upon using rock smash (flag gets set) and while leaving the map (flag is cleared.)

    So I select the rock and then replace the person ID number with 0x11? like one map the person ID is 0012, so I write 0x11 in place of that?

    it'll probably take some working but I'll give it a try, and try to find some more temporary flags I may be able to use, since some locations can have over 4 rocks in one map.
     
    So I select the rock and then replace the person ID number with 0x11? like one map the person ID is 0012, so I write 0x11 in place of that?

    it'll probably take some working but I'll give it a try, and try to find some more temporary flags I may be able to use, since some locations can have over 4 rocks in one map.

    You can actually use flags from 11 to 1F, so you can have more rocks on a map.

    If you have only one rock on the map assign any of the flags from 11 - 1F to it, and if you have more, assign any of the flags from 11 - 1F to it but make sure it's different from the flag of the first rock.
     
    You can actually use flags from 11 to 1F, so you can have more rocks on a map.

    If you have only one rock on the map assign any of the flags from 11 - 1F to it, and if you have more, assign any of the flags from 11 - 1F to it but make sure it's different from the flag of the first rock.

    Ok that sounds perfect, alright I'll try replacing the id with one of the flags and let you know how it goes later on.
    Regardless of if it works thanks for the advice.
     
    You can actually use flags from 11 to 1F, so you can have more rocks on a map.

    If you have only one rock on the map assign any of the flags from 11 - 1F to it, and if you have more, assign any of the flags from 11 - 1F to it but make sure it's different from the flag of the first rock.


    IT WORKED!! :)
     
    Back
    Top