How To Prohibit Interactions Until Done Moving?

Discussion in 'RPG Maker MV' started by WulfyRoxas, Jan 24, 2017.

  1. WulfyRoxas

    WulfyRoxas Villager Member

    Messages:
    17
    Likes Received:
    0
    Location:
    NC, USA
    First Language:
    English
    I'll try to keep this short and sweet, 
    I've got a parallel process running so that Event 8 moves from point A to point B, but WHILE he is moving, I don't want the player
    to be able to interact with him, because that causes some troubles later with saving the direction when the event's position is being saved.


    Is there some kind of script I can put in, or a plugin I can find so that right where the red arrow is pointing I can add something like
    "Player cannot interact until move route is completed"
    or a way to cut it on at the start and cut it off when he's done moving.

    Script.png
     
    #1
  2. TriceratopsX

    TriceratopsX Veteran Veteran

    Messages:
    264
    Likes Received:
    404
    Location:
    Enabion
    First Language:
    English
    Primarily Uses:
    RMMV
    If you have the "(Wait)" next to the Movement Route: Name, then that means you have it set so the player can't move at all until the movement route is finished processing. So I don't see how they COULD interact with the event, or am I missing something?  :unsure:
     
    #2
  3. WulfyRoxas

    WulfyRoxas Villager Member

    Messages:
    17
    Likes Received:
    0
    Location:
    NC, USA
    First Language:
    English
    It's a parallel process so it runs together with every other event, so it's not waiting on the player, it's waiting on the event.
    I set it to wait or else it would immediately change his Self Switch using the code below it, and then he totally wouldn't work at all.
    I promise he works fine :)  
    Just want a way to stop the player from talking to him WHILE he's moving.
     
    #3
  4. Andar

    Andar Veteran Veteran

    Messages:
    28,418
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    @WulfyRoxas


    I suggest you don't use a parallel process for this at all - use multiple pages and page conditions to link the event to time.


    You'll need to combine hours and minutes to a single time variable for that, but you can have that time variable in addition to those ones and simply have it updated the same way your hour variable gets updated.


    Then first page, conditioned to variable time >= (7:30) containing the first move block


    Second page conditioned to variable time >= (8:30) containing the second block (not completely visible in your screenshot)


    And so on.


    If you don't know how to use multiple event pages, just follow the link in my signature to the "starting point" tutorial and go through the event tutorials there.
     
    #4
  5. WulfyRoxas

    WulfyRoxas Villager Member

    Messages:
    17
    Likes Received:
    0
    Location:
    NC, USA
    First Language:
    English
    @Andar 
    I don't use the pages themselves because a lot of times I wish to have them say somthing depending on where they are and I ALWAYS need them set to parallel so they move depending on what time it is.
    So when they are on Parallel they will keep repeating the lines of code over and over unless I use another event to control all of their switches.

    Honestly all I was looking for was to see if there was a script you could put in a move route to prevent the player from talking to that person until the move route is complete.
    As for the whole pages and times I've already had to spend a lot of time editing it to fix other problems and my problems are solved and I'm learning how to use what I' using better, but dealing with these pages and switches aren't what I'm looking for right now.
     
    #5
  6. WulfyRoxas

    WulfyRoxas Villager Member

    Messages:
    17
    Likes Received:
    0
    Location:
    NC, USA
    First Language:
    English
    @Andar 
    I know I'm going to have several issues with the way I'm linking times and switches and stuff but I want to encounter those and learn how to fix them
    through trial and error or else I'll never really get better.

    But as for the script I'm trying to find, that's not that easy..??
     
    #6
  7. WulfyRoxas

    WulfyRoxas Villager Member

    Messages:
    17
    Likes Received:
    0
    Location:
    NC, USA
    First Language:
    English
    Oh and before I forget to mention, my hours and minutes are assigned to two different variables using different amounts so i can't combine them into one variable unless i find some while entire way to change how I do this and oh boy.... ??
     
    #7
  8. Andar

    Andar Veteran Veteran

    Messages:
    28,418
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    @WulfyRoxas, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


    If you have something to add and your own post is the last one, simply edit that instead of posting three times after one another.


    And you're wrong, you don't need a parallel process to move the events - that is what the autonomous movement is for, and that can be set differently on each page.


    Effectively you don't need a single command in the content section for what you're doing, it could simply be handled by giving each page its own autonomous movement for that part.


    EDIT: And about stopping the player from interacting - you only need to do that because your parallel processes prevent the engine from handling this automatically, you need to remove them to clear up timing problems. That is exactly the reason why the autonomous movement option is there - to prevent you from placing set move route inside a parallel process unless absolutely neccessary (and unless you know exactly what you're doing).


    Simply let the movement be handled by autonomous movement instead of set move route will clear up a lot of your problems.
     
    Last edited by a moderator: Jan 24, 2017
    #8
  9. WulfyRoxas

    WulfyRoxas Villager Member

    Messages:
    17
    Likes Received:
    0
    Location:
    NC, USA
    First Language:
    English
    But I don't want to use the autonomous movement section with multiple pages because he will keep repeating the movement over and over or if I set it to stop he will repeat it from his current location every time I enter the map.
    I want him put at specific points so that's why I'm using move routes under if statements.
    The parallel processing event I have has more than several if statements constantly checking for the exact time it is, what he should do depending on what time and where he's at, and where to move to.
    It works like a charm for me, it's just really messy.


    I don't have any 'problems' currently I just want it so the player can't interact with the person while they're moving because then when the script "this.SavePos()" goes to save, it saves whatever direction the person is playing when the player talks to them and then once they are done moving they are facing the wrong way..
     
    Last edited by a moderator: Jan 25, 2017
    #9
  10. DuncanS

    DuncanS Veteran Veteran

    Messages:
    160
    Likes Received:
    96
    Location:
    Toronto, Ontario, Canada
    First Language:
    English
    This is a bit kludgy, but you can add a script before the move route that disables player interaction altogether:


    $gamePlayer.canInteractWithEvents = false;
    $gamePlayer.canStartLocalEvents = function() {
    return this.canInteractWithEvents && !this.isInAirship();
    };


    Then after the move route, re-enable interaction:


    $gamePlayer.canInteractWithEvents = true;


    Note this will disable interaction with all events for the duration of the move-route; you could probably jerry-rig something similar that would exclude only certain events.
     
    Last edited by a moderator: Jan 25, 2017
    #10
  11. WulfyRoxas

    WulfyRoxas Villager Member

    Messages:
    17
    Likes Received:
    0
    Location:
    NC, USA
    First Language:
    English
    Can it not be, like, 
    $gamePlayer.canInteractWith.thisEvent() = False
    or something? x'D

    I've never honestly worked with scripts
     
    #11
  12. DuncanS

    DuncanS Veteran Veteran

    Messages:
    160
    Likes Received:
    96
    Location:
    Toronto, Ontario, Canada
    First Language:
    English
    Good question. The key piece in the above snippet is this part:


    $gamePlayer.canStartLocalEvents = function() {
    return this.canInteractWithEvents && !this.isInAirship();
    };


    This is an existing function in the Game_Player class. The default looks like this:


    Game_Player.prototype.canStartLocalEvents = function() {
    return !this.isInAirship();
    };


    The above code assigns that function to each instance of the Game_Player class. The snippet overrides that function, which is used in multiple places, for example:


    Game_Player.prototype.checkEventTriggerHere = function(triggers) {
    if (this.canStartLocalEvents()) {
    this.startMapEvent(this.x, this.y, triggers, false);
    }
    };


    and


    Game_Player.prototype.checkEventTriggerThere = function(triggers) {
    if (this.canStartLocalEvents()) {
    // ... do some stuff
    }
    };


    So by overriding the function that handles event checks, all checks for event triggers are routed through the new test (whether canInteractWithEvents is true).


    The canInteractWithEvents variable is arbitrary (it's a new variable we tack onto the player object), and assigned to the object in the script so it can be referenced in the updated function.


    If you want to disable interaction with specific events, you probably need to override Game_Player.prototype.startMapEvent:


    $gamePlayer.eventToIgnore = 4; // ID of event to ignore
    $gamePlayer.startMapEvent = function(x, y, triggers, normal) {
    if (!$gameMap.isEventRunning()) {
    $gameMap.eventsXy(x, y).forEach(function(event) {
    if (event.eventId() != $gamePlayer.eventToIgnore && event.isTriggerIn(triggers) && event.isNormalPriority() === normal) {
    event.start();
    }
    });
    }
    };


    Then after the move route:


    $gamePlayer.eventToIgnore = -1;




    Similarly kludgy, but will only ignore the specific event.
     
    Last edited by a moderator: Jan 25, 2017
    #12

Share This Page