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

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
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.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
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.
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
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.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
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...
[move]RPGMaker VX Ace[/move]
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
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).
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
First Language
English
Primarily Uses
RMVXA
I'll whip a few screenshots together shortly.
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
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?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
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.
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
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!
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
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 :)
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
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.)
 

Lord Vectra

Master Eventer
Veteran
Joined
Dec 6, 2015
Messages
211
Reaction score
336
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.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Or simply

if variable is equal to 1:
code
else:
if variable is equal to -1:
code.
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
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
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
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:

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
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.
 

gregbaby

Evil Genius. o_O
Veteran
Joined
Jan 20, 2013
Messages
257
Reaction score
11
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.
 

Attachments

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:
attack on titan final season is airing tomorrow, I'm excited and scared at the same time!

Forum statistics

Threads
105,882
Messages
1,017,230
Members
137,607
Latest member
Maddo
Top