One event affecting the properties of another

Right, I started on this about an hour ago with another question that's probably doomed to rot in the js support forum for how monstrously specific it is, so I'm gonna' go about it differently with another query that's more generic, but will solve the same problem:

Is there a way to have one event (Hereto referred to as the "Affector") influence the properties of another event on impact (The "Affected") or any other means?

By properties, I mean stuff like the Affected's name, event id, self switches (or self variables if there's a plugin), etc.
Whether this help comes in the form of savvy eventing or through plugins doesn't really matter, as long as any Affected event has properties (or can be given new properties somehow) that can be directly influenced by an Affector.

I remember back when I used Game Maker, it had collision functions for when two events would collide, and could be worked to affect either one event or the other (RMMV's "Event Touch" thing isn't nearly as useful.)

Some caveats:
  • No part of this calculation can rely on the Affector event's X/Y position (But can use the Affected's)
  • No part of this can rely on the Affector's event id (Though can use its name)
  • Ideally this should be easily repeatable, across different maps
You can use $gameMap.events(eventID) to point at a certain event.
Look into this library of Game_Event script calls, especially the Methods section, for the commands you need. For example, $gameMap.events(10).setPosition(2,8) will position event number 10 at the map coordinates (2, 8).
$gameMap.eventIdXy(x, y) will return the event ID of an event that's in the coordinates (x, y), which will be useful to select an event whose ID isn't predictable.
If you can't find what you're trying to do, feel free to reply and I'll look it up in the link above.
Huh, well that link looks a little more comprehensive than the googledoc spreadsheet I use to check all the usual script calls, so thanks for that.

That method would be incredibly useful, however my current problem is assigning the event's id to it dynamically.

For instance, if there are 3 potential Affected events on the map, and I want whichever event I hit with an arrow (Affector event) to change position, how do I tell the engine that I want specifically that one event that I hit?

I would use the in-built "Get Location Info" command to check the event id of the Affector's location, but that would require use of the Affector's X/Y position, which I can't use right now due to what I'll refer to as "Plugin Reasons" for now, hah.

So it'd be more:
$gameMap.events("the event i bumped into?").setPosition(2,8)

I should have probably specified that not only can there be many potential Affected events, but they move unpredictably, so I can't use that return either.
You could put a tag in an event's note box to let script commands identify the properties you give them.
For example, to identify which events have an <Affected> tag:
JavaScript:
affectedEvents = [];
for(i = 0; i < $gameMap.events().length; i++) {
    if($gameMap.events()[i].meta.Affected) {
        affectedEvents.push($gameMap.events()[i].eventId());
    }
}
The affectedEvents array now contains the event IDs of each event with the <Affected> tag.
Otherwise, you can use the arrow's location to locate the first event hit (if there is none, eventIdXy should return -1, I'll let you check that), and see if that event has the Affected tag on it. If that's the case, process the hit as you wish.

If that's not possible for plugin reasons, we need at least a way to know where the arrow is.
You could try this plugin to allow events to trigger other events upon touching.
That script has pre-empted another problem I was going to run into when it comes to spawning more Affected events from other maps, as it can hopefully just add them to the array when necessary.

I tested out the linked Plugin, and though it does almost exactly what I need it to do, my project still has the problem where the Affector event doesn't have an id or real position, so I can't set it up in the parameters to do things.

I think the way I'll work around this is to just have any action that would spawn an Affector event just spawns two events instead, one to perform its usual function in the battle system (Damage and the light) and another to act as a position tracker that can perform these script functions.

Thanks both of ya', gonna' hope this works out.
Obviously I don't know what your code is doing, but I don't understand how/why you can't use the built-in functions to retrieve the coordinates of the Affector arrow.

And some of your problems with not knowing IDs could be solved by putting some of the work in the event itself, which then calls external functions as necessary and would be able to reference "this"
The problem comes with the Chrono Engine, and its ability to spawn template projectiles from a set map.
I'm not entirely sure exactly how it does what it does, but from what I can gather after all the testing I've done in the past, projectile events that are spawned on the map in this fashion do not have an event id, nor do they have an X/Y position, and so are weirdly difficult to track the exact position of, despite the plugin itself clearly knowing where they're supposed to be as it has collision for them.

Were I more knowledgable of how the plugin (or collection of plugins, I should say) works, then I'd probably be able to warp some stuff to fit what I want it to do, by finding where in the code it makes these checks.

Last time I made the arrow track its own X/Y position and set them to a variable, they both came up as 0 - Trying to set its ID to the variable ended with a string of text so long that I couldn't read it in the debug window, hah~

Peculiarly, both Yanfly's Event Spawner and Galv's Event Spawner have methods to obtain the event ID of events spawned using them, but as I can't use them as projectiles in the same way, I have to use them in addition to the Chrono Engine's defaults.

It's a mess, but all game development is a mess, surely.
Just reading through a bit of the Chrono Engine, it seems its Game_events have ._x and ._y member variables you should be able to make use of. But I haven't used the system, nor read it extensively.
If it uses the Game_Event class, you can use everything in the Game_Event library as long as you find the event ID of the one that you created to identify it.
Try to catch one in a specific position, and use $gameMap.eventsXy(x,y) to find out what it looks like as a Game_Event element. This could take you a step towards making it all work.
Should I move this into Plugin Support for you?

Original thread: https://forums.rpgmakerweb.com/threads/one-event-affecting-the-properties-of-another.134814/