Using event ID in event

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

  1. ninja_tom

    ninja_tom Veteran Veteran

    Messages:
    33
    Likes Received:
    4
    First Language:
    English
    In my enemy ABS event that I am prototyping I have had to hard code the event ID in a couple of places and I am looking to try to make this more generic now.


    As an example, (and this is for EV002) I have used $gameMap.event(2).


    Is there some way I can use a function to get my event ID. I tried $this but it doesn't work.


    Similarly I am trying to keep a control variable to store this enemys HP. For now I have just hardcoded it to Control Variable #0002 but again I would like to base this variable on the event ID using a function/script.


    Thanks for any ideas!
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,941
    Likes Received:
    11,603
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    To be certain, you would need to provide the exact context (what command are you using that in?  A screenshot would be perfect).


    If it's inside an event command like Control Variables, Conditional Branch, or Script, you could use this._eventId or this.eventId() to get the id of the current event.  If you want the current event itself (which is what you'd get if you did $gameMap.event(this.eventId()), you can just use this.character(0) instead.  0 always means "this event".


    If the event command is a Move Route, you would use this._eventId or this.eventId() instead, to get the id, or just this to get the event itself.
     
    Last edited by a moderator: Nov 26, 2016
    #2
  3. ninja_tom

    ninja_tom Veteran Veteran

    Messages:
    33
    Likes Received:
    4
    First Language:
    English
    This is working for me thanks!
     
    #3
    Yitzi Litt likes this.

Share This Page