Getting Event ID of newest event?

Discussion in 'RGSSx Script Support' started by Matt Beer, Nov 11, 2019.

  1. Matt Beer

    Matt Beer The Friendly Dev That Could Veteran

    Messages:
    116
    Likes Received:
    120
    Location:
    Canada
    First Language:
    English
    I have a script that generates new events onto the current map from another map. The way that I use it, means that the player can create new events on the map, on multiple maps (place furniture)

    I'd like to grab the event id of the newest item placed. I imagine event id's for maps are stored in an array, is there a way to check what the newest entry in that array is from an event script call?

    Can I store the event id of the newest event into a variable?

    Alternatively, is there a way to find out how many total events are on a given map? this would solve what I'm working on as well.

    Thanks in advance.
     
    #1
  2. Wavelength

    Wavelength Pre-Merge Boot Moderator

    Messages:
    4,521
    Likes Received:
    3,773
    Location:
    Florida, USA
    First Language:
    English
    Primarily Uses:
    RMVXA

    I've moved this thread to RGSS Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

    RGSS3 Scripts is for releasing scripts you have created to the public. When you have questions about scripts or scripting, use one of the following subforums:
    • For questions about how to use an existing script: RGSS Script Support
    • If you think you need a new script or large enhancement to an existing script made to solve your problem: RGSS Script Requests
    • For questions about writing a line or two of your own scripting to do something: Learning Ruby/RGSS
    The way you'd store the newest event probably depends on the Script itself and the way it creates/instantiates events. Therefore, I recommend linking to the script you're using.

    There should be a way to determine the total number of events. Again, though, if you're using a script to instantiate events, the general solution for this might need to be modified, so link us up.
     
    #2
    Matt Beer likes this.
  3. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    658
    First Language:
    English
    Primarily Uses:
    RMMV
    @Matt Beer Which script are you using? Yanfly's Spawn Event?
     
    #3
  4. Matt Beer

    Matt Beer The Friendly Dev That Could Veteran

    Messages:
    116
    Likes Received:
    120
    Location:
    Canada
    First Language:
    English
    I'm using EST - COPY EVENT v1.5 by Estriole.

    However I have solved this topic myself. I realized you could use $game_map.events.size and store it into a variable. That will give you the number of events on the map which in most cases (not all) will also give you the event id of the newest event because if you have 10 events, your newest event should be event 10.

    Like I said, there are some exceptions.

    This can be marked as solved if that's a thing. Sorry, I'm new to this part of the forums.
     
    #4
  5. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    658
    First Language:
    English
    Primarily Uses:
    RMMV
    @Matt Beer Ah, I see. I had edited Yanfly's Event Spawn to return the ID of the spawned event, and you could also set a tag to an event to more easily locate it. But, if you have it solved, then good!
     
    #5

Share This Page