Reset event

Discussion in 'RPG Maker MV' started by ninja_tom, Nov 18, 2016.

  1. ninja_tom

    ninja_tom Veteran Veteran

    Messages:
    33
    Likes Received:
    4
    First Language:
    English
    I have a map, it has various areas. I am using a MapScroll plugin to show the next area when I reach the border.


    I have events in each area that correspond to "enemies".


    These enemies have three states:


    1. Active - slime graphic - on "event touch" enable self switch A


    2. Lootable (Self Switch A) - carcass Image - on "event touch", increment gold, enable self switch B and disable self switch A


    3. Defeated (Self Switch B ) - no graphic - "parallel" trigger (doing nothing)


    I want enemies to respawn when I return to an area so I use a different event on the border to flip self switch B for the "enemy" events which puts them back to state 1 (Active).


    This seems to work but I have a few issues:


    1. It doesn't work on Android, the enemy does not re-appear


    2. It works intermittently on PC, the enemy sometimes re-appears


    2. I think state 3 (Defeated) could be causing lag (which might explain issue 1 and 2).


    The reason I think state 3 is causing lag is because I have a parallel event that does nothing (so I can remove the graphic) but I think it could be a tight loop of nothing from RPG Maker MV point of view. If I add a text box in state 3 instead the message is printed in a loop so I therefore think the engine just calls this parallel event constantly but I am doing nothing.


    Is there an API I can call that means I wouldn't need state 3 and instead can "Erase Event" at state 2. There must be something because when you re-enter maps all events reset by default, I would possibly settle to be able to call whatever the engine calls when you re-enter the map but I don't know how to find that.


    Thanks!
     
    #1
  2. Waterguy

    Waterguy Veteran Veteran

    Messages:
    1,231
    Likes Received:
    257
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    DO NOT LEAVE AN EMPTY PARALLEL PROCESS! OR AUTORUN! As you said yourself, it keeps starting the event, but since it does nothing it just wastes time. And without a wait it wastes that time every. frame.


    Seriously, if it does nothing set it to press button.


    And always leave a wait at the end of a parallel process if it already doesn't have a wait inside.


    Anyway, if you want to reset self-switches you unfortunatelly WILL need something to do it. The Erase Event command removes the event until you exit and re-enter the map (thus eliminating the need for your third page) but self-switches need to be reset by hand, either by the event itself or through a script call.


    I suggest an Autorun event that erases itself after reseting all self-switches you want.
     
    Last edited by a moderator: Nov 18, 2016
    #2
  3. Andar

    Andar Veteran Veteran

    Messages:
    28,672
    Likes Received:
    6,594
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    all you need to do to remove your problems is change the third page to action button and above player (because that way the player can't trigger it anyway).


    And I really suggest you follow the link "bughunting" in my signature and read the background info there about what parallel processes really are and why yu should NOT use them unless absolutely neccessary.
     
    #3
  4. Dad3353

    Dad3353 Veteran Veteran

    Messages:
    421
    Likes Received:
    108
    Location:
    France
    First Language:
    English
    @ninja_tom...


    If there are many Self-Switches to reset, a one-off script can be used, as suggested above, as an Auto-run at Map opening, which erases itself. Here is such a Script...

    ◆Comment:...Turn off Self-Switches of selected Events...
    ◆Script:// The ID's of all Events needing a reset...
    :      :var eventsToCheck = [55,71,72,73,74,75,76,77,78,79,80,81,82,83,84,105, 107];
    :      :// The map ID on which the Events are located...
    :      :var mapId = 58;
    :      :// Just storing the length of the array in a variable...
    :      :var eventsLength = eventsToCheck.length;
    :      :// Iterate through the eventId's and turn off Self-Switch 'A'...
    :      :for(var i = 0; i < eventsLength; i++){


    :      :// Repeat the following line if 'B', 'C' or 'D' switches are to be reset, changing for the appropriate letter...
    :      :    $gameSelfSwitches.setValue([mapId, eventsToCheck, 'A'], false);
    :      :}

     


    The Event ID's and Map ID (in Bold...) would have to be adjusted for those of the Events and Map you wish to reset, of course. The Self-Switch letter here is 'A', but a line could be added for each letter needing resetting.


    Hope this helps.
     
    Last edited by a moderator: Nov 18, 2016
    #4
  5. ninja_tom

    ninja_tom Veteran Veteran

    Messages:
    33
    Likes Received:
    4
    First Language:
    English
    Thanks all - that seemed to work for me!
     
    #5

Share This Page