• 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.
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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] Setting Roadblocks

  • 79
    Posts
    6
    Years
    So I thought I knew enough scripting to do this on my own, but since it didn't work, I was clearly wrong. I need to set two NPCs as a roadblock, which will disappear after getting your starter, but the idea I had for making it work, was not the answer. Anyone know how to make this work?
     
    Just use a checkflag command. Once you obtain the starter and the flag has been set you can make the two people blocking your way disappear.

    Example

    #org @dynamic0x800000
    lock
    checkflag 0x200
    if 0x1 goto @done
    msgbox @talk1 0x6
    applymovement 0x05 @move1
    release
    end

    #org @done
    hidesprite 0x01
    hidesprite 0x02
    release
    end

    #org @talk1
    = hey we can't let you pass

    #org @move1
    just put in the movements you want the player to make




    Hope this helps


    or better post your script and we can see what's missing
     
    So I thought I knew enough scripting to do this on my own, but since it didn't work, I was clearly wrong. I need to set two NPCs as a roadblock, which will disappear after getting your starter, but the idea I had for making it work, was not the answer. Anyone know how to make this work?

    You'll want to use level scripts, not a checkflag script. A checkflag script would look terrible. Don't go by the above advice.

    Level scripts are executed upon entering a map. So, rather than having to interact with the two NPCs blocking the road to get them to move, using level scripts would make it so that the NPCs will disappear like magic once a starter Pokémon has been obtained.

    The first level script would happen inside the map where the player receives their starter Pokémon. Let's play it traditionally and say it's in a Pokémon Lab.

    Great, so open up XSE. The first level script would look something like this:

    Spoiler:

    This first level script should involve the entire event up until the player gets their first Pokémon. Once you've written everything, compile it.

    Now, go into AdvanceMap and navigate to your Pokémon Lab map. Navigate to header in the top menu and find the 'map script' section:

    Spoiler:


    Now for this script, you'll want to select script type 02. Fill in the fields and it should look something like this:

    Spoiler:


    It's important to note that AdvanceMap can overwrite the 0000 that you put into the 'value' box, with FFFF. This can cause the level script to glitch.

    To fix this, you go to the header tab, and press Ctrl+H to bring up a section of advanced options. You should see an area called 'map options'.

    Copy the map script offset and open your ROM in XSE. Then paste the map script offset in the decompile box and click on the 'level script' button (button with a wrench on):

    Spoiler:


    Then click on the 'decompile' button (to the left of the level script button) and it will load up your script:

    Spoiler:


    Find the line with '#raw word 0xFFFF' and replace it with '#raw word 0x0' and compile. The compiler log should appear:

    Spoiler:


    Now your level script should work with no issues at all.

    So, we've got the first script but how do you make the NPCs disappear now? It's pretty simple.

    Navigate to the map where you have the two NPCs blocking the road and create another level script. It should look something like this:

    Spoiler:

    A lot easier than the first, right? Obviously change the 'hidesprite' and 'setflag' values according to your own NPC values.

    Compile it and head over to the 'header' section in AdvanceMap again. The fields will look a little bit different this time:

    Spoiler:


    We've set the 'value' field to 0001 because that's what value we set the var to in our previous level script.

    Be sure to double check in the advanced menu of 'header' (Ctrl+H) in case AdvanceMap has created another '#raw word 0xFFFF' problem, and fix if necessary.

    Once sorted, the second level script will play upon entering the map and the NPCs will disappear. After it's completed, the new var value of 4000 will be 0002, meaning the script will not repeat itself if you enter the map again.

    The good thing is that if you decide to use a level script again you can continue from value 0002 as both previous level scripts are mandatory to the storyline. That way you're not wasting valuable vars (like a pro).

    If you want to learn more about level scripts or you're having any issues getting it up and running, feel free to shoot me a DM. I'll be happy to help. Likewise, there's tons of tutorials and advice on level scripts on this forum if you're unsure of anything.
     
    Back
    Top