Is there a solution for "Event touching other Event"?

I know there's no standard trigger for this (unfortunately, there really should be), but I'm wondering i there is some solution to it besides making a new custom plugin (I don't have the skills to do that). If one already exists that I have missed, please do tell.

Otherwise, is there maybe some kind of script command or anything that could be used in what I want to do, which is:

For the player to be able to push certain objects onto enemy on-map sprites and have them take damage/destroy them.

If it was just one object the player could push and one enemy, I could simply do the rather tedious solution of tracking both event's x and y position and see if they overlap. But I can't do that for a large dungeon with several monsters and several objects to be used by the player. Or well, I guess I technically could but... you know, that would be kind of painful to execute.

(just to be clear, the "push the object" part is not what I'm asking about. I'm asking about how to trigger the collission between the enemy sprite and object being pushed).
If the objects being pushed are all the same, and the objects they're being pushed onto are all the same, I'd just give all the 'target' events the same name, and set up a common event that gets called by the pushed objects, to move away from player, check if there is another event on the destination tile, and if there is, does it have the 'target' event name? If it does, then turn on a self switch on the 'target' event which does the damage/destruction you're after.

You don't need a plugin, but you will need several script calls. And you'll need a way to allow the pushed item to go onto the 'target' item but not onto other events.
@Shaz

Would you be able to help me with those script calls? I'm not too savy with those.

The "push the object" was actually more of an umbrella expression. I've not yet done any push:able objects (although, it doesn't seem too hard as I've done such puzzles before). A mechanic I have in place though is Mog hunters "Throw Event" plugin, which allows the player to lift an event and throw it.

Although now upon closer inspection, that plugin doesn't seem to allow for objects to be thrown ONTO another event. Which I guess makes it ind of useless....
If one of the events is set to Through, will it let you throw something onto another event?
@Shaz

Yes it will. It also works if the target event is set to bellow player (although that may introduce other problems).

I’m trying to see if I can create gameplay inspired by what’s in the game Goof Troop for SNES. In case you were curious.

So the enemies need to be able to walk into the player and damage them as well some how.

If there’s any ”magical” script commands that might help, that would be great.
You might have problems getting the enemies to walk into the player and cause damage if you have them set to above or below player - that would require them to be on the same tile as the player, so they really should be set to same as characters. Which means the event you're throwing will have to be thrown onto a 'same as characters' priority event. If it can't, the event being thrown would have to be set to above/below characters, which could cause issues with the picking up side of things. I'm not sure if setting the event to same as characters, and through, will cause the same potential issues.

Experiment with that a bit, and see what's possible with the pick-up-and-throw plugin. I'll look up some script calls for determining what it lands on after I get home.
Allow me to put forth my current favorite plugin for event interaction...

https://galvs-scripts.com/2016/08/14/mv-puzzle-functions/

...The "Galv.PUZ.isAt(t,e)" script it has, allows it to check to see if the event ID (or player if you use 0) is at the same location as another event ID. Just set it in a conditional branch and run whatever code you want if they match.
Let us know if that works for you. I'm lazy, and don't want to look up the info if you already have a solution 😀
Okay, I've just done some simple testing so there could still be complications down the road I'm not yet aware of but Galv's plugin seems to do the trick when it comes to checking if the event in question is overlapping another event or if it's a specific x/y position.

This is also very usable when doing push-block-floor-switch puzzles.

But I've yet to figure out a good way to throw or push the blocks in question ONTO enemy events. It could be, there's no elegant solution to it besides asking (which would mean paying, probably) someone to modify Moghunter's plugin for me. If he even allows such things?

I dunno. I'm still open to suggestions regarding this. But worst case scenario, I might just scrap all enemies from the entire game and make a straight up puzzle game out of it instead.... If there is no good solution to be had that is.
Oh it's quite possible, I myself use event based projectiles. I have repurposed one as a boulder. On the first page it simply plays whatever boulder lifting animation you want. The second page covers all the "magic", I've commented the interesting areas. This particular solution is using Yanfly's Self Variables & Switches but you can obviously use whatever variables/switches you want. Here I'm making the boulder check the space in front of it for an event, then if it finds one it moves one step forward (to give the illusion of being on top of it), then turns on that event's self switch D, and the boulder's self switch B.

Oh and pardon the rough code, I opted for an earlier prototype projectile to make the example easier to understand. Later ones started differentiating between what types of events. I'm a bit worried if I'm left alone long enough with them, my projectiles will become self-aware. :hwink:
@ImaginaryVillain
That might work, but I'd have to scrap the "lift/throw object" plugin made by MogHunter I've been using. It's really neat, has a great "feel" to it and simplify things a lot. So I'm a little hesitant to try to event the solution myself instead.
Ah yes, Mog's notoriously hard to work with plugins. I took a look at that plugin and played with Mog's Master file to see how it works. As best I can tell it literally ignores all other code on the event page and just runs the throw code. As my knowledge of editing plugins is currently very little, I can't really advise how to edit the plugin directly. However I have a potential idea to work around it

The first image is an event, put it on any map you where you want to throw stuff. The second is just the code for the target event. I just edited the events in Mog's Master file, so if you have that around it's an easy copy and test.
Here is a Version of @caethyril "For Loop", he and others helped with it in the past.

I use EventId 1 as Bullet/Bomb/Sword/Whatever, in a parallel Event i check if EventId1 is Hiting Event Ids 2 to 100 or 999. Or i do the check one time when needed, for example when the item hits the place its thrown to.
Its very basic structured, but maybe something to build upon. You can also combine it with the Other Solutions.
Atleast its safes one from creating dozens if not hundrets of conditional branches.

Code:
for (var a = 2; a <= 100; a++) {
 if (!!$gameMap.event(a)) {   // prevents game crash if event id not existing
    hitDist = Math.hypot($gameMap.event(a).screenX() - $gameMap.event(1).screenX() , 
                         $gameMap.event(a).screenY() -  $gameMap.event(1).screenY());
    if (hitDist <= 24) {  // Circular Pixel Range (24=same map tile)

        $gameSelfSwitches.setValue([$gameMap.mapId(), a, 'A'], true)
      } } }  // turns on the Self Switch A of Hit Event Ids
@ImaginaryVillain
Thank you. And yes, Mog's script ignores all eventing done on the liftable object. You mean to say that using those two events can make this work without abandoning Mog's plugin? If so, that would be great. I'll give it a try for sure.

(EDIT; Hm, I might just be tired (just work up) but I fail to see how the first and second events you've screenshoted connects to each other?)

@Bex
Wow, that seems useful but since I'm very unfamiliar with JavaScript I'm not sure how to use or apply it. I assume it's meant to be copy pasted into a "Script" event command but I'm still somewhat confused.
The first event is just capturing the event ID of whatever is in front of the player in variable 1 whenever they hit the okay button. Then the other is the switch code that compares variable 1 against the position of the button. I tested it in Mog's own Master project, and it worked perfectly. The downside is you have to have the first event appear on any map you want to use the pick up and throw. So maybe use Yanfly's Event Copier in case you edit it in the future.
Okay, it's mostly the other event that confused me be it might clear up as I eat breakfast and actually tests it out in MV.

Else, I'll be back here asking questions again I guess 🙂
Here is a Version of @caethyril "For Loop", he and others helped with it in the past.

I use EventId 1 as Bullet/Bomb/Sword/Whatever, in a parallel Event i check if EventId1 is Hiting Event Ids 2 to 100 or 999. Or i do the check one time when needed, for example when the item hits the place its thrown to.
Its very basic structured, but maybe something to build upon. You can also combine it with the Other Solutions.
Atleast its safes one from creating dozens if not hundrets of conditional branches.

Code:
for (var a = 2; a <= 100; a++) {
if (!!$gameMap.event(a)) {   // prevents game crash if event id not existing
    hitDist = Math.hypot($gameMap.event(a).screenX() - $gameMap.event(1).screenX() ,
                         $gameMap.event(a).screenY() -  $gameMap.event(1).screenY());
    if (hitDist <= 24) {  // Circular Pixel Range (24=same map tile)

        $gameSelfSwitches.setValue([$gameMap.mapId(), a, 'A'], true)
      } } }  // turns on the Self Switch A of Hit Event Ids
Hi! This code is great! But im kind of a newbie when it comes to coding. I would like 'a' to be an array of eventIDs for instance eventID 75 and EventId 4. I've tried rewriting the code and testing but it doesn't seem to work. I would be very greatful if you could help me with this!

@HomelessWilliam , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


If you want to ask a similar question you can create a new thread. No need to revive an old thread.

I'm closing this thread.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-solution-for-event-touching-other-event.114005/