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

Moving This Stubborn NPC

19
Posts
10
Years
    • Seen Dec 31, 2014
    Alright, you've seen my name on this forum pop-up countless times before, and when you do, note that I do go through my problem for hours until I legitimately cannot come up with a way to fix it.

    In this case, I am trying to move an NPC.

    (TL;DR version is towards the end, in case you don't want to read all of this)

    Of course, this sounds so simple: just use "Set Move Route" and call it a day, right? Not in this situation.

    I have a scene where the player stops in their tracks while an NPC comes walking from the other side of the screen, towards the player, reminiscent of Blue in Pokemon Red and Blue. Now, I made a switch to activate when the player steps on the tile, where the player cannot move and turns on this switch. This switch makes my NPC appear.

    What the most vexing part about this is that I set the move route for the NPC and the NPC just keeps going one direction. My ideal movement route is "Move Down, Move Down, Move Right, Move Right," as there are two open tiles below the NPC and two open tiles to the right of the last "down" tile in that route. I set the move route to the aforementioned route, and the NPC just keeps wandering into the wall below the second "down" tile, never going right.

    I then eliminated some of the route, making it "Move Down, Move Right": Still kept walking into the wall. I then tested it on the player, selecting "Move Down, Move Right," and the player character goes well beyond ten open tiles down, hitting the wall and never going right.

    I tried this out with the NPC again by setting its move route to be "Move Towards Player," which I don't want to do because I want the NPC to be next to the player, not in front of them. The NPC arbitrarily (yeah, that sounds dumb, but it sure felt like it was arbitrary) selected its path, going two tiles down, two tiles right, then going one tile right, one tile down to confront the player. I then tried fixing the NPC's route to "Move Bottom Right," and the NPC moved all the way diagonally down-right until they collided with the player, which it was only two diagonal spaces away from.

    My question essentially is: Apparently I'm programming the move route incorrectly, so what is the proper way to plan a move route of the NPC moving ONLY two (unhindered, may I remind you) tiles down, and two tiles to the right, without the NPC going all the way into the end of the map?

    TL;DR: I try making a move route to make an NPC only go a certain amount of steps, and the NPC keeps going all the way to the end of the map in only the first direction in the move route. How can I rectify this problem and get the NPC to only move one tile per command?

    Additional information:
    -I have the event on Parallel Process (every other method failed to either move the NPC or load the NPC's graphic)
    -I tried using the drop-box feature above the Event Trigger menu to fix their movement, and it only fixes their movement to be like a roaming NPC outside of scenes like this.
    -I have watched videos on movement routes for RMXP and their NPC's movement routes are one tile per command within the route, so I don't know why my NPC is "misbehaving."

    Thank you very much for addressing this notice and possibly helping me out.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    -I have the event on Parallel Process (every other method failed to either move the NPC or load the NPC's graphic)
    There's one of your problems right there. A Parallel Process event keeps on working and repeating itself, which is why your NPC keeps walking down.

    You know there's an example of exactly this kind of thing in the Essentials example maps, right? Route 3 north, the flowery corridor. I don't suppose you looked at that?

    One problem I did notice when I made that example event is that, if the NPC event is originally at the place where it starts walking from, it won't move. I have no idea why. That's why I placed the NPC event in the middle of nowhere (where it can't be seen) and then move it to the beginning spot at the start.
     

    thor348

    That's Oak to You
    137
    Posts
    11
    Years
  • Try this. Place the NPC where you want it to start from. But, with the first page with nothing on it. Then, in the same NPC event, create the second page with the graphic and nothing else other than the self switch set to "A" and Move Animation checked in the Options Section. Then, place an event where you want the Player (\PN) to trigger the NPC movement. Now, go to your Script editor. Insert a new script above main and put this code in:

    Code:
    def pbSetSelfSwitch2(map,event,swtch,value)
      $game_self_switches[[map,event,swtch]]=value
      $game_map.need_refresh = true
    end
    *This is so you don't waste a precious Switch or Variable ;)

    Now go back to the NPC Trigger event. Set it to Player Touch (So the Player must be on top of it). Now go to page 3 of the event commands and click the "Script" call. In it paste this code:

    Code:
    pbSetSelfSwitch2(5,19,"A",true)
    *5 is the Map Number, 19 is the Event Number and "A" is the switch, and true/false is setting it to on or off

    So now when the Player steps on the Trigger event, it should make the NPC appear. So what you do now, is in the NPC event, the page with "A" as the self switch, set it to Parallel Process. And for the Autonomous Movement, set it to 'Custom'. Then put what you want to NPC to do. Doing that will make the NPC move where you want it to when the player activates the Trigger Event.

    Or, when the Player Triggers the NPC, in the Trigger Event you can have the NPC move from within the Trigger Event. This way, you can use the Event Command, 'Wait For Move's Completion' on page 2 (This is so the NPC will wait till he/she is done moving to talk). Then, just use the Trigger event as if it were the NPC. (Control the NPC and messages, etc etc etc from within the Trigger Event) It's easier that way.

    Hope that helped
     
    19
    Posts
    10
    Years
    • Seen Dec 31, 2014
    @Thor348: It did help, a lot! The event is ALMOST nailed down, but the NPC seems to wait about 10-15 frames per movement. At least they aren't going to the end of the map like before, but by golly are they slow.

    @Maruno: I tried using the rival script as seen in route three, but the NPC just didn't move...
     

    thor348

    That's Oak to You
    137
    Posts
    11
    Years
  • Have you altered the "Speed" and "Frequency" of the NPC at all? Try setting them both to 4. See if that speeds it up.
     
    19
    Posts
    10
    Years
    • Seen Dec 31, 2014
    It worked when I set the movement to Event Page 2 of the NPC's commands.

    Thanks a lot, thor348!
     
    Back
    Top