can event follow player with no delay?

Discussion in 'RPG Maker MV' started by pasunna, May 6, 2019.

  1. pasunna

    pasunna Veteran Veteran

    Messages:
    113
    Likes Received:
    17
    First Language:
    thai
    Primarily Uses:
    RMMV
    I want to use event below character to create booster effect like in the picture
    (booster additive blend mode)

    Capture.JPG
    but can't make the event follow the player smooth enough
    there always some lag delay
    even if I use event set location and parallel
    it still delay in 1 frame
    I had try to use bind picture with player plugin
    but the picture can't bind below actor

    any Idea?
    thank you
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,343
    Likes Received:
    6,451
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    show us how you made the event (screenshot of the event page) and we can try to help you optimize it.
     
    #2
  3. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,117
    Likes Received:
    694
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    The 1-frame delay is due to the order in which the map scene updates: events update first, then the player. This means an event will not see the player having moved until the next frame. I just wrote a very simple override for this, just save as a .js file and import as a plugin:
    Code:
    Scene_Map.prototype.updateMain = function() {
        var active = this.isActive();
        $gamePlayer.update(active);   // swapped the order
        $gameMap.update(active);    // of these two lines
        $gameTimer.update(active);
        $gameScreen.update();
    };
    I tested it very quickly and it seemed OK...I'm not sure if it'll break anything. :kaoswt:

    Also, it's an override, so place it near the top of your load order. :kaothx:

    As an aside: by default a move route processes at most one move command per frame, so to truly eliminate frame delays from complex move routes (without plugins) you'll need to bundle them into a single Script command. :kaoswt2:

    Edit: Script for move route (stay in sync with player, accounts for player speed changes)~
    Code:
    this.setMoveSpeed($gamePlayer.realMoveSpeed()); if (!this.pos($gamePlayer.x, $gamePlayer.y)) this.moveTowardPlayer();
     
    Last edited: May 7, 2019
    #3
    pasunna likes this.
  4. pasunna

    pasunna Veteran Veteran

    Messages:
    113
    Likes Received:
    17
    First Language:
    thai
    Primarily Uses:
    RMMV
    thank you caethyril but it's still not good enough
    the effect I want is the event always really under the character
    anyway I will not continue this
    just give up on additive blend and go with plain sprite draw
    it's not that bad just not perfect
    again thank you!
    Capture.JPG
     
    #4
    caethyril likes this.

Share This Page