Checking a Conditional Branch when an Event is on a region

Discussion in 'JS Plugin Requests' started by KazukiT, Jul 11, 2019.

  1. KazukiT

    KazukiT Veteran Veteran

    Messages:
    74
    Likes Received:
    25
    First Language:
    English
    Primarily Uses:
    RMMV
    I apologize if this is in the wrong thread but, does anyone know how do you create a conditional branch for when an event walks on a certain region tag it checks a conditional branch to see if they are on that region.

    For example Event 1 walks onto Region 3 how would I check if that event is on that region?
     
    #1
  2. Bex

    Bex Veteran Veteran

    Messages:
    1,152
    Likes Received:
    248
    First Language:
    German
    Primarily Uses:
    RMMV
    Do you need that as Java Script Code?
    If not, with Events it could look like this:
    Code:
    ◆Control Variables:#0012 MyEventMapX = Map X of This Event (or direct Event ID)
    ◆Control Variables:#0013 MyEventMapY = Map Y of This Event (or direct Event ID)
    
    ◆Get Location Info:My Variable Location Info for me, Region ID, ({MyEventMapX},{MyEventMapY})
    
    ◆If:Location Info for me = 1 (If the Event is on Region 1)
    - Do your stuff
    end
     
    #2
  3. ShadowDragon

    ShadowDragon Veteran Veteran

    Messages:
    391
    Likes Received:
    114
    Location:
    Netherlands
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    like the above, you for an scriptcall using

    $gameMap.event(x).regionId() === y

    X as being the ID number, and Y being the region ID
    both ways works though.
     
    #3
    Bex likes this.
  4. Bex

    Bex Veteran Veteran

    Messages:
    1,152
    Likes Received:
    248
    First Language:
    German
    Primarily Uses:
    RMMV
    It looks like that this is a very short and useful Script Line. Thank you for sharing.

    This could have Safed me some time i spent puzzling around =).
     
    #4
    ShadowDragon likes this.
  5. KazukiT

    KazukiT Veteran Veteran

    Messages:
    74
    Likes Received:
    25
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks guys for helping me out. I was able to implement the code suggested by Shadow Dragon into my game.
     
    #5
  6. ShadowDragon

    ShadowDragon Veteran Veteran

    Messages:
    391
    Likes Received:
    114
    Location:
    Netherlands
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    I used it for my player $gamePlayer.regionId === x
    so for events its almost the same, but slightly different.
     
    #6

Share This Page