New account registration is temporarily disabled.

[RMVX ACE] NON PLAYER EVENT COLLISION

Posts

Pages: 1
Here's approximately what I want to do:

Imagine a map full of events in two categories: blue and red.
Each will have their own movement routines.
And I want specific commands to be triggered when a red event touches another red event, and a different commands when red touches blue. And another when blue touches blue.
None of these events are the player.


What comes to mind is having each event store his X/Y coordinates on variables, and have zillions of branches checking if that event has touched each other event. But that is a ton of work, hopefully unnecessary.

Is there a way to do it with commands? If not, with scripts?

Btw, I'll be using many different types of events, not just "red" and "blue". I said that just to make my question simpler.
How many events in each category?

I can't think of a way at the moment and have it be less work. Unless.. maybe if you used variable reference calls and create an automated system that checks a group of variables on it's own.

Make the variables like this

var10 Event 1 X
var11 Event 2 X
var12 Event 3 X

var20 Event 1 Y
var21 Event 2 Y
var23 Event 3 Y

Seperate X and Y and keep them sequential for however many events.

Then have a system on each event that compares it's own X with the next one in the list, if they are not equal add 1 to the machine, which will check the next variable in the list.

Event code would be like:

As parallel process
Set var 10(event 1 X) = this event map X coordinate
Set var 20(event 1 Y) = this event map Y coordinate
Set label = 1
set var 1(event check position) = 11 "so it will check the next events X"
IF var 10(event 1 X) = var reference(var 1)
Turn a switch ON based on value of var1, so lots of branches "you know event 1 X is same as event 2 X"
ELSE
Add 1 to var 1
IF var 1 > 20 "whatever the limit of events is"
Set var 1 = 10 "whatever the first one is, if this starts with event 5 it would need to cycle around and check event 1"
Jump to Label 1 "so it repeats the check with a new value"


"this is missing a check for which event its starting with, so it knows which event to stop checking when it cycles around"


It will systematicaly compare it's own X with every other X. Turn ON a switch or something when it finds a match until it does them all. Then it does the same code for Y coords. The switches will turn on for every match and another event checks for an events 2 switches to be on, indicating a collision. Turn off the switches after the check.

This is just a very basic example and would need serious modifying to account for multiple checks and everything. But it conveys the idea. I'm imagining a system where 1 event contains all the code, which can be copy/pasted with only having to alter a few lines to prevent it from checking against itself.

This is fun to think about :)
Pages: 1