A Bomb Event In MV in A certain Way

(Note, I do not need help with bombs in battle or being used as items. They are not a normal item in this game.)

And so I return after a day of experiments. Experimenting... with script calls!!!

Let's start with what I have already learned (that is actually relevant to this bomb event) and why it matters so advice can be doled out in a proper fashion. Also it let's me check if I'm understanding what is going on under the hood.

Code:
$gameMap.event($gameVariables.value(6)).start();
makes the event matching variable 6 happen, like magic!!! I love it and it makes me smile. 🙂 This is super useful and relevant to what I'm doing. [dances]

This means when the bomb event is on a matching square it will activate and by reading the value of variable 6 the game will know that the proper event must happen too.

Code:
$gameMap.event($gameVariables.value(6)).requestAnimation(5);
will call the animation on the event that is equal to the value of variable 6. Gee wilkers that is certainly something, to bad it's not what I need! 😀 (It will be useful of course, but not for this.)

You see, for my bomb event I want the event to play on tile in front of the player even if there is no event there.

Code:
$gameMap.tileId(($gameVariables.value(4), ($gameVariables.value(5), 0).requestAnimation(5);
Did not do what I thought it would do (make the animation play on the corresponding tile)- in fact it did nothing in this circumstance. This made Mikey sad because he thought he was finally understanding something. 🙁
I either entered information wrong, or misunderstood the use of this script call.


So what do I need? (Which is not what I want per-say, but the bare minimum I need.)

A couple of things but here is the event as it stands for testing reasons:
3.png



What I need is a common event that works like this:
Press Keyboard Button (check) -> Event reads for the spot in front of player (check) -> Bomb animation plays in front of player ( no check ) -> Check if Event is bomb-able (sorta check?) Event reacts (check) -> Happy Mikey ( no check )

of course there are some problems present in using
Code:
$gameMap.event($gameVariables.value(6)).start();
to make the event activate. It activates ANY event in that spot.

In this I saw you could use the note tag to differentiate but that was for MZ and I'm not sure MV can pull that off. I did experiment with it and couldn't get it to work, but I was actually EVEN LESS proficient with script calls at the time. If I can figure this out I can remove some hassle because as it stands I can merely have events check if they are bomb-able from within themselves, but it's a bit more time consuming.

But the short and sweet of it is I am trying to get the animation to play regardless of if there is an event because I think it would be cute - also - see below. (Plus I am wondering if there is a more simple method to checking what events CAN be bombed)

Spoiler: Example of a Bombable Event at the moment
Bombable Rock Event.png


SO What do I Want!?

Now comes the idealistic ramblings of a beginner.

I'd love it if I could figure out THIS!

XXX
XBX
P
​

B being Bomb, P being player, X (and B being bombs area of effect.
I'm like 87% sure it's possible (even if it would take a lot of variables.)

See one of the things bombs can do is destroy enemies on the field (although you won't get experience and they do come back when you re-enter the map) and it would help if bombs covered a bit more area to make them more effective at this extra task.

So I could use advice on eventing this.

Anyway, sorry this was a little long. I tend to ramble even in text format.
Hard to understand due to TMI...
After re-reading several times trying to understand your problem, this is just my assumption...

Basically, you want to be able to trigger a check, similar to a normal action button BUT using another button instead? IDK why would you want that, but that's exactly what your first phase event does. We will get to the "Bomb AoE" later.

Anyway, if that's the case, unless there are other things I'm missing, It will be much easier and less problematic to make the events run the check itself instead of running a common event that checks, identify, and execute whatever event is in front of the player. You are expecting your event to trigger another event, but that's just make things complicated.

Here's how I will do the check with few script line:

Code:
var ev = $gameMap.event(this._eventId);
var pl = $gamePlayer;
var rx = pl.x - ev.x;
var ry = pl.y - ev.y;
var pdir = (pl.direction() / 2) - 1;
var check = [ry==-1, rx==1, rx==-1, ry==1];
check = (rx==0 || ry==0) && check[pdir];
$gameSelfSwitches.setValue([this._mapId, this._eventId, 'A'], check);

I'm currently on a phone, so I might mistype...
I will test it later once I'm back.


The script code checks if this event is right in front of the player.
If it does, it turns ON self switch A, else turn it OFF.
The check is running in parallel process page.

Make use of that by making a self switch A condition.
Then put your desired button condition inside of it.

Here's how it should look like.
In this case, I use shift as the button. And that's how you are able to trigger this event
1628927103084.png


To not causes future conflict, do NOT run the execution inside the button condition.
Instead turn ON self switch B and execute the event in the second page, under autorun trigger.
Turn OFF both self switch after you are done, and erase the event.
1628927187133.png


Copy paste the event as much as you want everywhere.
It shouldn't conflict with each other.

And that's only the first phase...
Seems you want the event "area explosion" to be able to trigger / affect other event?

It will be the same concept, but with area check instead.
I will see into that once I'm back once you confirm is this what you wanted.

Please confirm.

EDIT: I just returned.
Actually my main concern was :
A) Getting the animation to play in front of the player even when there is no event there.
B ) Maybe having the part that activates the event only happen when the event has a certain notetag (if possible and if not, something similar).
C) The area effect thing.

Sorry - I get excited and I post way to much information. I'm using a script that allows you to tie common events to buttons.

The "joke" is the character - she carries an infinite amount of bombs (for "cleaning") and the player can put them down anywhere whenever they want.

Don't get me wrong, the infomation you provided will be very useful for future projects.
Greetings Overlordmikey,

I'm confused on A. Why would you play I bomb animation if there is no event?

Edit: Pasted in the proper script call.
B is answered in your reference article. Just create a conditional branch (eventing or script) for $gameMap.event(ID).event().meta.yournotetaghere and run your explosion code inside the if.

Wait, do you mean haven't figured out C? That's the most important part! No doubt you can tweak Kuro DCupu's code to check for events next to the explosion. But I think you will need either
JavaScript:
$gameMap.eventsXy(x, y);
which checks for all events at a coordinate and returns the event objects in an array that you can loop through...
OR
JavaScript:
$gameMap.eventIdXy(x, y);
which returns just the eventID of the events at x,y in an array.

I would use the eventsXy method because then you can easily check the events' meta property to see if it has a <destroyable> or maybe <undestroyable> event tag, and if so change the self switch of the other events' (if they exist) with $gameSelfSwitches.value([$gameMap._mapId, eventID, selfswitch])
I'm confused on A. Why would you play I bomb animation if there is no event?
I thought it would look cool. Encourage the player to try bombs on more than obvious "bomb here" spots. Maybe it's a stupid idea.

Edit: Pasted in the proper script call.
B is answered in your reference article. Just create a conditional branch (eventing or script) for $gameMap.event(ID).event().meta.yournotetaghere and run your explosion code inside the if.
Oh, okay that DOES work. I'll try it again now that I understand the stuff more.

Wait, do you mean haven't figured out C? That's the most important part! No doubt you can tweak Kuro DCupu's code to check for events next to the explosion. But I think you will need either
JavaScript:
$gameMap.eventsXy(x, y);
which checks for all events at a coordinate and returns the event objects in an array that you can loop through...
OR
JavaScript:
$gameMap.eventIdXy(x, y);
which returns just the eventID of the events at x,y in an array.

I would use the eventsXy method because then you can easily check the events' meta property to see if it has a <destroyable> or maybe <undestroyable> event tag, and if so change the self switch of the other events' (if they exist) with $gameSelfSwitches.value([$gameMap._mapId, eventID, selfswitch])

Okay, I'll experiment with this and see if I can pull it off.
a) Oh, you mean place a bomb and have it explode. With the wording I thought you mean without the bomb event.Yes, that would be really cool to implement.

It sounds like you would really benefit from using an event spawner (check out Galv's). It allows you to spawn a duplicate (template) of an event you created and put it any where you want (on any map). This would allow you to have actual bomb events anywhere, not just in the spots you are eventing.

Otherwise, my poor eventing skills would lead me to have a hidden bomb event that I can show whenever the button common event is called (I'd probably have to limit the amount of bombs available like bomberman).
Actually my main concern was :
A) Getting the animation to play in front of the player even when there is no event there.
B ) Maybe having the part that activates the event only happen when the event has a certain notetag (if possible and if not, something similar).
C) The area effect thing.

Oooh! I get it now...
It's something like this?
rm - chainbomb.gif


I still stick with my approach, allowing the event to run the check by itself.
I simulate the common event button but end up just turning on a switch on a dummy event to execute the animation.
The "explodable" event then check themself if they are in the ignite location or within the explosion AoE (in this case the AoE range is 2).

The problem is I use a single variable to handle the AoE source, and knowing how parallel processes work, it tends to glitch the numbers when there are lots of them.

I was thinking to use an array, but I will see if this meet your expectation.
I make a sample of it.
Make a new project, and extract this data folder inside the project to try it out.
The ignite button is [Page Up]
Oooh! I get it now...
It's something like this?
...
Make a new project, and extract this data folder inside the project to try it out.
The ignite button is [Page Up]
It's not 100% what I needed, but I think I can reverse engineer it to work the way I want, thank you! 🙂 If you come up with ways of improving it let me know! 😀
a) Oh, you mean place a bomb and have it explode. With the wording I thought you mean without the bomb event.Yes, that would be really cool to implement.
I really need to work on my wording. ^_^ It really encourages the player to mess around with the various field skills in the game. 😀
I think if I combine yer suggestion with KuroDCupu's approach I may be able to pull this off.

Original thread: https://forums.rpgmakerweb.com/threads/a-bomb-event-in-mv-in-a-certain-way.139575/