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

Need an npc to stop the player from moving

64
Posts
3
Years
    • Seen May 4, 2024
    As the title said i am trying to make a script that stops the player from moving and forces him to go in a certain direction using XSE for Fire Red.
    i did made the second part: if you talk to this npc the player is forced to move upward (as intended) i tried to make in advance map the visual range for the npc but it doesn't change a thing
    tried to find in the game the script for stopping the player movement (like the guys the needs tea to move or the guy for the safari zone), since i am getting the hang of it i tried to see if there was the script to just copy-paste it but NONE of them had a script that stops the player from a distance (the tea guys have only a message box, nothing else)

    so i tried to find a way to maybe put a tile script that activates the script that works with the NPC (it could look bad but at leat would have worked) but found nothing that helped me to do that

    idk what to do, if i can make the npc "look" at the player like the trainers do, that stops the player and walks to him it could be perfect
    the position is easy, he has 2 tiles on the right and if he just moves once he can push the player upward without issue in any place

    help?

    this is the script i am using (the checkflag is the flag that makes the guy at the end of the bridge disappear, it's in the game itself, i looked for it by myslef to apply there)

    Spoiler:
     
    20
    Posts
    4
    Years
    • Seen Sep 3, 2023
    You may want to take a look at Emerald in Petalburg City. That map uses script tiles to stop you advancing before you perform certain actions, it might give you some inspiration on how to solve your query
     
    64
    Posts
    3
    Years
    • Seen May 4, 2024
    You may want to take a look at Emerald in Petalburg City. That map uses script tiles to stop you advancing before you perform certain actions, it might give you some inspiration on how to solve your query

    I hav an issue about that
    i don't know WHERE i put the script i wrote for the tile...i know how to write the script, i know that it works
    but i don't know where to put it...i don't see anywhere "add tile script" or similar into advance map, i try to add new events via "number of scripts" but i see nothing, i try to click on tiles to see if i can edit some but nothing, i tried goin on "header"->"Map script" and it does add the script offset but...WHERE? i never told him in wich tile to add it so...i have the script in the map...but somewhere...
    i only need this last part
    on internet i can find NOTHING about this, everybosy sais how to write the script but nobody sais where to put it once it's written

    that's why i asked if there was a way to script an NPC to stop you from a distance instead of using a map tile...since i don't know how to put the script in the map tile i want

    edit: touching wandom things i might have solved this...
     
    Last edited:

    Asith

    Uwao
    237
    Posts
    3
    Years
    • Seen today
    i don't see anywhere "add tile script" or similar into advance map, i try to add new events via "number of scripts" but i see nothing.

    Once you increase the "number of scripts" and repoint, a new script tile appears in the very top left of the map
     
    64
    Posts
    3
    Years
    • Seen May 4, 2024
    Once you increase the "number of scripts" and repoint, a new script tile appears in the very top left of the map

    the issue was that i could not see it, but i found out how to, thanks anyway
    still the issue is there, the tile scripts doesn't work somehow

    i litterally copy-pasted a script form another thread where the guy siad it worked and solved his problem, i only changed the checkflag to the one i found inside the game (it's the checkflag for when the guy on top of the nugget bridge leaves)
    this is the script i LITTERALLY copy-pasted (the guy did not use the setvar so i just did this)
    Spoiler:


    so i tried a different thing, looked inside the game itself for similar things so i tried to take parts from the guys that needs tea since they still push you in a direction after walking on a tile, so modified the code like this (adding the lockall and setvar)


    Spoiler:


    still the tile does not activate, plus the guy that already worked while talking to him now stopped working (i tried removing the tiles and going back to the previous situation and the guy just stopped working for good)

    i tried both scripts removing the checkflag at start, making it permanent and just trying if that was the issue but NOPE, still nothing
    idk what's wrong with those scripts T.T

    yes, i set the var number of the tiles to 4050 and the unknown to 0300 (as the other thread said to do to make it work)
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023


    Ok here's the thing, stopping a player is as simple as using the lock command.
    its the same command no matter how its triggered,

    If you stop when talking to a person, if you look at their person event script in xse you will see that the first commands are almost always

    lock
    faceplayer

    which do exactly as you'd expect.

    To stop a person without a a npc interaction you're using an event script, those are the green tiles you see in advance map events tab.

    Now in advance map, open a map, and open the events tab. Next scroll down below open script
    until you see the menu for "amount of scripts" since you want to do this from a distance, you need to add some scripts.

    So look at where you want the player to stop, you need enough scripts to cover the line, (longitude or latitude) of where you want them to stop.
    ex if the space is 3 tiles wide, and you only put one event tile, there's a high chance the player could walk right past your event without even realizing it,
    that's why we need to cover the bases completely.

    [also you seem new to this, so to ensure you have the best set up, in advancemap open settings select grid view, next in settings, click events and show sprites, to make sure that's on, And if "hide other events is on turn it off.]

    That will allow you to see the number of tiles in each space, as well as the physical relation of everything you're changing to other events and other sprites.

    So once you know how many script tiles you need for your event, tap up on the number of scripts button to add how many more you need, and press change events.

    They will appear stacked in the top left corner of the map.

    Drag them where you want. find some free space to set the offset to, and then start writing your scripts.

    Oh before you start writing the script, set the "talking level" of the event script to height 2, that will ensure it activates when you walk on it.

    Now the first command you need, like I said at the start, is lock, or maybe lockall, if you want EVERYONE to freeze in place.
    After that put in your commands for what you want to happen.

    and before you end the script always remember to undo the lock, with the appropriate "release" command. either release, or releaseall.


    That should do it, also its somewhat a bad idea to just go around copying scripts from people,
    you can't learn if you don't understand why the script was written a certain way.

    Good luck.
     
    64
    Posts
    3
    Years
    • Seen May 4, 2024
    Good luck.

    i litterally can't say anything more than
    thank you

    this was an incredible detailed answer
    i litterally did already everything but with this explanation i know that at least it was right (i tried in the last weeks to do it back from scratch and to see what evrything meant) but always missed one thing
    "script height to 2"
    that one...i litterally didn't even know what that was xD

    ps: i tried it just before finishing this reply and i can't find the talking level, or better, i find it only on signposts and not ot script tiles
    i usually check in game other similar scripts to try and understand how things works so i checked the tiles for the guys that stops you in pewter city (either before brock since that's litterally what i want to do) and i don't find the talking level on them (and they are script tiles not signposts)

    i'm terribly sorry to bother you again but i can't figure this out, i am making an estremely simple rom hack but it seems i can't do simple scripts other than adding trainers and modifying pre existing things
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    i litterally can't say anything more than
    thank you

    this was an incredible detailed answer

    Glad that helped you, I know I can get a bit wordy in my responses at times but I just want to cover all the information that could be needed.

    So I took another look, and apparently that feature is only in 1.9.5 but that can be a bit buggy.
    I haven't had issue, but there are issues with the program.

    Since I don't know any other way to set the talking level, I recommend you get advance map 1.9.5.
    Make sure you make constant back ups of your rom if using this program.

    So when you make changes do it from a copy of your working rom.

    Test it to make sure everything is working correctly without issue
    once you know everything is fine, you can start using that as your main copy. and just copy it again when you need to make another change.
    loop.

    Just do some version control every once in a while and delete old roms you no longer need.
     

    Attachments

    • Screenshot (886).png
      Screenshot (886).png
      80 KB · Views: 2
    Last edited:
    40
    Posts
    6
    Years
  • #dynamic 0x800000

    #org @start
    lockall
    checkvar 0x4050 0x1
    if 0x1 goto@denied
    releaseall
    end

    @denied
    msgbox @1 0x6
    applymovement 0xFF @move1
    waitmovement 0x0
    releaseall
    end

    #org @move1
    #raw 0x11
    #raw 0xFE

    #org @1
    = This is the Nugget Bridge, once\nyou\lstart the cahllenge you have to\lfinish it. Don't be a coward, show\lus what you've got

    Okay so this ^ is what your script should look like. But that alone isn't enough.

    You have to set script tiles with a value of 4050 and a value of 0. This means that if var 4050 has not been set to 1, then the tile script won't trigger.

    Now, in your script for when you've started your nugget challenge, you'd include setvar 0x4050 0x1 near the end of it.

    So far: Before starting the nugget challenge script, var 4050 has a value of 0. After starting the challenge, var 4050 has a value of 1.

    So what my script above does, is check if var 4050 has a value of 1. If it does (because you told it to in the start challenge script), then it will move to @denied. If it is not, it'll just skip to releaseall end.

    Then, after finishing the challenge, you'd set var 4050 to 0 again so that you're not told you're a coward after completing the nugget challenge.

    That's a basic idea. I may be wrong with how vars have to be set because like I said it's been years, but that's how they interact with each other anyway. Filter the posts by tutorials and you should find a good scripting tutorial.
     
    Back
    Top