• 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!
  • 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] 1st Shiny on a route with a higher shiny chance script

  • 16
    Posts
    6
    Years
    Hi,

    I'm using Ruby for this script.

    So I'm trying to write a script alongside the Shinyzer tool that has a high shiny chance until a shiny appears on a map. (i.e. you're pretty much guaranteed to find a shiny once per route)

    I thought I could achieve this with the setflag and check flag and it does work but I can't reuse this for routes 101 & 102 for example (As the script in route 101 then sets the flag so using the same script in route 103 yields no shiny in 103) as the flag has already been set in a previous route).

    My question is this: Is there anyway for the script to detect what map it is being run from so I can just have one script for every route?

    I thought about getplayerpos but this only seems to be for the map the player is currently in, not the map itself.

    If not I'll have to rinse and repeat the script changing the initial offset and the flags for each route. Please have a look over my script to see if more experienced eyes can pick up on things mine cannot.

    Thanks,

    Script:
    '---------------
    #org 0x800900
    random 0x3
    compare LASTRESULT 0x0
    if 0x1 goto 0x8800929
    compare LASTRESULT 0x1
    if 0x1 goto 0x8800929
    compare LASTRESULT 0x2
    if 0x1 goto 0x880092C
    end

    '---------------
    #org 0x800929
    end

    '---------------
    #org 0x80092C
    checkflag 0x1203
    if 0x1 goto 0x8800929
    callasm 0x8800481
    setvar 0x8003 0x1
    setflag 0x1203
    end
     
    Hi,

    I'm using Ruby for this script.

    So I'm trying to write a script alongside the Shinyzer tool that has a high shiny chance until a shiny appears on a map. (i.e. you're pretty much guaranteed to find a shiny once per route)

    I thought I could achieve this with the setflag and check flag and it does work but I can't reuse this for routes 101 & 102 for example (As the script in route 101 then sets the flag so using the same script in route 103 yields no shiny in 103) as the flag has already been set in a previous route).

    My question is this: Is there anyway for the script to detect what map it is being run from so I can just have one script for every route?

    I thought about getplayerpos but this only seems to be for the map the player is currently in, not the map itself.

    If not I'll have to rinse and repeat the script changing the initial offset and the flags for each route. Please have a look over my script to see if more experienced eyes can pick up on things mine cannot.

    Thanks,

    Script:
    '---------------
    #org 0x800900
    random 0x3
    compare LASTRESULT 0x0
    if 0x1 goto 0x8800929
    compare LASTRESULT 0x1
    if 0x1 goto 0x8800929
    compare LASTRESULT 0x2
    if 0x1 goto 0x880092C
    end

    '---------------
    #org 0x800929
    end

    '---------------
    #org 0x80092C
    checkflag 0x1203
    if 0x1 goto 0x8800929
    callasm 0x8800481
    setvar 0x8003 0x1
    setflag 0x1203
    end

    Just use a "clearflag" command.
     
    In regards to the clear flag command, when I added it, it would always clear the flag upon entry to a previously visited route.

    Example: Go to route 103, find a shiny zigzagoon and catch it, adds the setflag to stop the 1/3 shiny chance. Leave route 103 to heal newly acquired shiny, re-enter route 103, the clear flag has now reset this routes shiny, reactivating the 1/3 chance.

    What I am looking for is a command or offset etc. that can check to see what route/map the player is currently in so I can write the script to check the route before the checkflag.

    Hope this helps clarify, though the more I look into this, the more I feel like there isn't going to be any such command and I'll have to write a similar script for each individual map.

    Thanks for the response though!
     
    In regards to the clear flag command, when I added it, it would always clear the flag upon entry to a previously visited route.

    Example: Go to route 103, find a shiny zigzagoon and catch it, adds the setflag to stop the 1/3 shiny chance. Leave route 103 to heal newly acquired shiny, re-enter route 103, the clear flag has now reset this routes shiny, reactivating the 1/3 chance.

    What I am looking for is a command or offset etc. that can check to see what route/map the player is currently in so I can write the script to check the route before the checkflag.

    Hope this helps clarify, though the more I look into this, the more I feel like there isn't going to be any such command and I'll have to write a similar script for each individual map.

    Thanks for the response though!

    What I meant was, using two flags, the script can see which flag has been set and which has not, and then just clear the flag (via "checkflag" command or whatever you want).
     
    PokeChu, would you be able to give an example or elaborate what that would do in terms of the script?

    I apologise in advance, I'm a scrub at scripting at the moment but I'm getting there piece by piece.

    Would the second flag's usage just to be to check if the first flag has been triggered/set?

    Or do you mean have multiple flags one for each route in the game and have the script check each route's respective flag?

    Thank you for both your patience and help :)
     
    PokeChu, would you be able to give an example or elaborate what that would do in terms of the script?

    I apologise in advance, I'm a scrub at scripting at the moment but I'm getting there piece by piece.

    Would the second flag's usage just to be to check if the first flag has been triggered/set?

    Or do you mean have multiple flags one for each route in the game and have the script check each route's respective flag?

    Thank you for both your patience and help :)

    What I am talking about is, I don't know, advanced, or something?
    But you can have different flags for each route.
     
    I think I got what you meant, I trialed a script that calls on an edited one of the one I posted (See Below)

    Good news is... it works! The script checks to see if a shiny has been encountered on the route and if it hasn't it calls the Base script.

    I'll post it here in case anyone wants to improve on it but glad I could get this working :)

    Route Script:
    '---------------
    #org 0x800000
    checkflag 0x8C4
    if 0x1 goto 0x8800019
    call 0x8800373
    checkflag 0x8C3
    if 0x1 goto 0x8800022
    end

    '---------------
    #org 0x800019
    end

    ___________________________________________
    Revised Base Script (Which is called on by above)

    '---------------
    #org 0x800373
    clearflag 0x8C3
    random 0x3
    compare LASTRESULT 0x0
    if 0x1 goto 0x8800929
    compare LASTRESULT 0x1
    if 0x1 goto 0x8800929
    compare LASTRESULT 0x2
    if 0x1 goto 0x880092C
    end

    '---------------
    #org 0x800022
    setflag 0x8C4
    end

    '---------------
    #org 0x800929
    end

    '---------------
    #org 0x80092C
    callasm 0x8800481
    setvar 0x8003 0x1
    setflag 0x8C3
    return
     
    I think I got what you meant, I trialed a script that calls on an edited one of the one I posted (See Below)

    Good news is... it works! The script checks to see if a shiny has been encountered on the route and if it hasn't it calls the Base script.

    I'll post it here in case anyone wants to improve on it but glad I could get this working :)

    Route Script:
    '---------------
    #org 0x800000
    checkflag 0x8C4
    if 0x1 goto 0x8800019
    call 0x8800373
    checkflag 0x8C3
    if 0x1 goto 0x8800022
    end

    '---------------
    #org 0x800019
    end

    ___________________________________________
    Revised Base Script (Which is called on by above)

    '---------------
    #org 0x800373
    clearflag 0x8C3
    random 0x3
    compare LASTRESULT 0x0
    if 0x1 goto 0x8800929
    compare LASTRESULT 0x1
    if 0x1 goto 0x8800929
    compare LASTRESULT 0x2
    if 0x1 goto 0x880092C
    end

    '---------------
    #org 0x800022
    setflag 0x8C4
    end

    '---------------
    #org 0x800929
    end

    '---------------
    #org 0x80092C
    callasm 0x8800481
    setvar 0x8003 0x1
    setflag 0x8C3
    return

    Haha, you got it! Good job.
     
    Back
    Top