Any way to check if an event is next to another event?

Discussion in 'RPG Maker VX Ace' started by gregbaby, Aug 11, 2017.

  1. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hey all,

    I'm trying in vain to to come up with a way for an event to activate via a parallel process when it is next to another event (X or Y, so when it is in the radius directly around an event)

    So far I've tried putting both Events X,Y locations into seperate variables and using conditional branches to compare them but I can't quite get my head around it.

    Has anybody managed this, any ideas would be awesome!

    EDIT: I'm also using Galv's Move Route Extras for extra functionality but I think this query can be solved without having to borrow script calls from that script, if however you're familiar with this script and have an idea/workaround let me know!

    Cheers.
     
    #1
  2. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    This actually is correct, saving events' X and Y locations into variables and then compare it in conditional branches. However, you have to watch out. There are X, Y and Screen X, Screen Y. You need to choose the X,Y. Screen X, Screen Y serves for capturing their position in pixels on the screen.
     
    #2
  3. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hey dude,

    So at the moment I have 2 events that have a parallel process tracking their location that updates every 10 frames. I'm using Map X/Map Y not Screen X/Y (This is right yeah?)

    I have 4 Variables:

    EVENT 1 USES: X FRIENDLY, Y FRIENDLY
    EVENT 2 USES: X ENEMY, Y ENEMY

    How do I get it so that when X FRIENDLY is next to X ENEMY (or Y FRIENDLY is next to Y ENEMY) to activate one of my events?

    I have a conditional branch that checks a Variable X FRIENDLY == X ENEMY then Y FRIENDLY == Y ENEMY running on a parralel process but it doesn't activate for me so I'm doing something wrong.
     
    #3
  4. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,402
    Likes Received:
    10,415
    First Language:
    English
    Primarily Uses:
    RMVXA
    'Game Mechanics Design' is for looking at aspects of game play from a more conceptual level. Implementation "How do I...?") questions belong in the Support forum for the engine you are using. Based on the info under your avatar...

    I've moved this thread to RPGMaker VX Ace. Please be sure to post your threads in the correct forum next time. Thank you.

     
    #4
  5. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Screenshots would be better, because if you are describing it like this, it is not so easy to track your mistake.
    Because you can have it set in a way where it checks if the two variables are equal, but completely ignore the Y if they are not,
    or you can set it in a way that the X gets checked and then regardless of the result Y gets checked.

    Or there can be other problems, like scripts overwriting these variables (which I doubt) or a badly set parallel process event location thing).
     
    #5
  6. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    I'll whip a few screenshots together shortly.
     
    #6
  7. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    Ok the parallel process:

    ParallelProces.png

    The condtional branch:

    Conditonal Branch.png

    At present the event recognizes the other event is at X or Y and play an animation but it doesnt matter how far away the event is it still play the animation.

    I need it so that when the event is 1 tile away from this event it then plays said animation.

    Any ideas guys?
     
    #7
  8. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    That is because the X and Y comparisons are running independently of each other. You need to make the conditional branch like this.
    Code:
    If their x are equal:
        if Friendly Y - Enemy Y is equal to +1 or -1:
            do the stuff you want to do.
    Else:
        if their Y are equal:
            If friendly X - Enemy X is equal to +1 or -1:
                do the stuff you want to do.
     
    #8
  9. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    Thanks a bunch dude I'll give that a try and post my results!! This knowledge will create some really powerful systems in my project!
     
    #9
  10. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    It is a basic feature of Action battle systems. But the potential of basics in rpg maker is infinite :)
     
    #10
  11. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    Ok I'm trying to get my head around it.

    " if Friendly Y - Enemy Y is equal to +1 or -1:" how do i put this in a conditonal branch?

    (I'm using Pearl ABS but trying to create AI so certain "NPCS" (technically need to be classed as enemies in the ABS) attack other enemies which is sadly not an in built feature of the ABS.)
     
    #11
  12. Lord Vectra

    Lord Vectra Master Eventer Veteran

    Messages:
    186
    Likes Received:
    323
    Location:
    The Abyss
    First Language:
    English
    Primarily Uses:
    RMVXA
    Var.Friend Y - Var.Enemy Y
    If Var.Friend Y < 0
    Var.Friend Y * - 1
    end

    If Var.Friend Y == 1
    blah blah blah
    End

    That should work.
     
    #12
  13. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Or simply

    if variable is equal to 1:
    code
    else:
    if variable is equal to -1:
    code.
     
    #13
  14. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    * - 1 = What does this translate too in terms used in a conditional branch?

    "Less than Or Equal Too"
    "Greater Than or equal too"

    etc
     
    #14
  15. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hey!

    Var.Friend Y * - 1

    What does the * equate too in my conditional branch or is this called via a script call?
     
    Last edited: Aug 12, 2017
    #15
  16. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Nope, he meant this:
    If the Y-Y variable is less than 0: Multiply it by -1, to make sure the absolute value is 1.
     
    #16
    Lord Vectra likes this.
  17. Lord Vectra

    Lord Vectra Master Eventer Veteran

    Messages:
    186
    Likes Received:
    323
    Location:
    The Abyss
    First Language:
    English
    Primarily Uses:
    RMVXA
    ^this
     
    #17
  18. gregbaby

    gregbaby Evil Genius. o_O Veteran

    Messages:
    255
    Likes Received:
    11
    Location:
    The world.
    First Language:
    English
    Primarily Uses:
    RMVXA
    I've been trying my damdest to get this working but I'm banging my head against a wall here lol

    I've uploaded a bare bones project file all setup. (All you need to do is paste it into a new project (I've removed various DLLS and the Executable files due to filesize being to big at 1.4mb lol)

    The NPC named FRIENDLY has the move route I'm trying to accomplish when they are 1 tile away from the ENEMY event.

    If anybody can have a crack at it for me I'd be eternally grateful, I'll keep trying on my end but I'm tending to make one thing work and breaking something else haha.
     

    Attached Files:

    #18

Share This Page