npc moving while player is on another map

Discussion in 'Learning Ruby and RGSSx' started by AwesomeCool, Apr 27, 2015.

  1. AwesomeCool

    AwesomeCool Bratty and spoiled little sister Veteran

    Messages:
    2,877
    Likes Received:
    1,953
    Location:
    Behind you! BOOOO!
    First Language:
    English
    Primarily Uses:
    N/A
    I have been pondering this idea for a while and can't quite figure out a way to execute it.

    The idea being npcs moving to different locations while the player is in another map. (good for harvest moon style games)

    I can get npcs to save there locations when the player changes maps and goes back, but I need help figuring out how to get the npcs to change positions while the player is in another map.

    Anybody have any ideas?
     
    #1
  2. ??????

    ?????? Diabolical Codemaster Veteran

    Messages:
    6,264
    Likes Received:
    2,312
    Location:
    Your OS
    First Language:
    Binary
    Primarily Uses:
    RMMV
    could create some updater module that stores & updates a set of variables, then when you re-enter a map, it sets the event to the variable stored within the updater. :)
     
    #2
  3. AwesomeCool

    AwesomeCool Bratty and spoiled little sister Veteran

    Messages:
    2,877
    Likes Received:
    1,953
    Location:
    Behind you! BOOOO!
    First Language:
    English
    Primarily Uses:
    N/A
    hmmm.

    So I could get the map passability and save a grid for certain maps and have them update like real maps.  I like the idea. :)
     
    #3
  4. kerbonklin

    kerbonklin Hiatus King Veteran

    Messages:
    1,728
    Likes Received:
    281
    First Language:
    English
    Primarily Uses:
    RMMV
    Normally the engine will never process events outside the current map the player is in, but what you can do is either 1) save the event NPC location and have it spawn + resume from there when the map is entered again, or 2) make the event NPC randomly spawn in a specific area when re-entered. Having it in real-time is, I believe, impossible for the engine.

    Some advanced AAA game engines have the ability close enough to real-time, where based on elapsed time between two different maps, event NPCs will spawn at certain distances from where you last left them when you left the map. For example if I left the map for 5 seconds and re-entered, an NPC would move 5 feet away. If I left and re-entered 15 seconds later, they would move 15 feet instead.
     
    Last edited by a moderator: Apr 27, 2015
    #4
  5. supercow

    supercow Artist Veteran

    Messages:
    383
    Likes Received:
    143
    Location:
    Indonesia
    First Language:
    indonesia
    or make 1 giant insanely big map :guffaw:
     
    #5
  6. Shaz

    Shaz Veteran Veteran

    Messages:
    37,572
    Likes Received:
    11,273
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You can use my Remember Event Position script. You can call it directly with the map and event id, and the location you want the event to be at. Next time you go to that map, the event will be at that location.
     
    #6

Share This Page