MZ Make bosses attack outside of battle

Hey, you guys!

So in my game, when the player crosses into the boss chamber, I'd like for the boss be able to affect the chamber in some way. (For this purpose, let's assume the boss chamber is a separate map that the player is transferred into from a dungeon, where the boss sprite is waiting.) I envision that this would take the form of events spawning around the map, where, if the player touches them then the party will be damaged. To give an example, imagine a cyclops as a boss. The players enter the monster's lair, it sees them, and it stomps the ground causing stalactites to fall from the ceiling in a specific pattern. The players would be damaged if the rocks fall on top of them. Or, perhaps entering a dragon's lair and have it shoot a fireball as the players approach.

To give a little background, the game I'm developing requires the players to approach an enemy on the map and give them a friendly slap in the face before initiating turn based combat.

In short, what seemed relatively simple in concept is now proving to be much more difficult in practice. I mostly thought that I could do it through events, movement routes, and trigger upon Event Touch. However, that is proving to not be the case. So, now leads me to asking you guys- what is the best way to incorporate this feature into my game? Would it be possible to do this through a script command in an event? If not, and I would have to make my own plugin, what recommendations would you guys have for this feature?

Thank you!!
I strongly recommend you include less fluff (that is, thematic descriptions about your game setting) and more mechanics.

Would it be possible to do this through a script command in an event?
I have no clue, because I have absolutely no idea what "this" is. What can't you figure out how to do?

All of the things you touched briefly on that were actually mechanical seem simple enough to achieve with event commands.

So instead of so much description of the dragon and what your boss is doing, please describe what mechanical effect you're trying to achieve, in what way it doesn't work, and include screenshots of the events that are failing.
I strongly recommend you include less fluff (that is, thematic descriptions about your game setting) and more mechanics.


I have no clue, because I have absolutely no idea what "this" is. What can't you figure out how to do?

All of the things you touched briefly on that were actually mechanical seem simple enough to achieve with event commands.

So instead of so much description of the dragon and what your boss is doing, please describe what mechanical effect you're trying to achieve, in what way it doesn't work, and include screenshots of the events that are failing.
You're right, my OP was a little bare bones on the specifics. So, here's a more detailed breakdown of what's going on:

Spoiler: What I am trying to do
Here is a picture of the third event in the room.
move route.jpg
The red arrows represent where I want the event to go. I want the event to travel (either actually moving or creating the illusion of movement from the player's perspective) along that route. If the players collide with the event, then they would be dealt damage. Moreover, I want this "attack" to leave behind a trail, of up to two tiles behind it, for a few seconds after moving. This trail would also damage the player upon colliding with it, although not as much. And, It'd be cool if the event can reset itself to its starting position once it's finished.

Spoiler: What I have already tried
I tried using movement routes to move the event. Before, I was using switches to activate other pages within the attack's event (Event 3), then reset the event location when it was finished with it's route. At this point, I was not worrying about the lingering trail that the attack would leave. I sort of just wanted to make the main idea to work first. The big issue I was running into was that the event was too slow to move, even when I cranked up the speed of the movement route to max. The player's could completely outmaneuver it. So, I decided to make a different solution. I do not have any screenshots of that, as I deleted the body of the events. However, I'm willing to do whatever if it'll help. For this solution, I began using variables instead. But after that, the event that damages the player (Event 3) began killing the player outright when I collided with it, when it was only supposed to deal 100 damage. My character's HP is 297.

Spoiler: What I am trying now
Okay, so to solve both the speed issue and give a lingering effect on the map, my idea is to now use multiple events in a premade pattern. In this case, the pattern is the box made of arrows in the previous screenshot. I made a variable, and tied that variable to seconds. And when that variable is a certain number, then Self-Switch A will turn on, activating the attack, and when the variable is between two numbers, then the attack switches to the lingering effect on the map. When the lingering effect first appears, then I want the following event in the route to activate. And, when the lingering effect is around for too long, then it'll turn off. Here are some screenshots of my events:
Boss event screen.jpg
For this screenshot, I set the hydra (Event 2) to a parallel process and made it wait for a second, then do some flavor, and check if a newly created boss variable is less than 1. If so, then set it to 1 and wait some more, increasing the variable if that is not the case. The main idea, here, is to tie the variable to either seconds or milliseconds. The final decision between either the former or the latter can come later, as I just want to get this working for the time being.
Attack page1.jpg
Nothing crazy in this screenshot, just that it'll advance Event 3 to the next page if the variable is equal to 1. It's worth noting that I decided to try self-switches instead of using the variable itself as the condition to run the event, to try and fix the issue of this event outright killing the player when they collide with it. So far, no luck.
Attack page 2.jpg
Now, this Event Page is hopefully where some things become clearer. It activates upon Self-Switch A being on. And you'll notice that the movement route is fixed, but more on that in a second. I set the trigger to event touch. So, when the player touches the event, then some flavor will happen and reduce the party's HP. I do want to allow this to kill them, because it's supposed to be a boss battle, and it wouldn't make much sense if the boss doesn't finish them off. As a side note, I did decide to change the reduction in HP to see if it'll still kill me on touching it. It still does. I then made a conditional branch where, if the variable was between a certain value. If so, then the event will advance to the final page- with the lingering effect on the ground.
Attack page 3.jpg
Keep in mind, the image in this page is just a placeholder. As you can see, when Self-Switch B is on, then this effect will linger on the ground until the variable ticks upwards to 10, in which case it'll turn off, disabling the event.

Spoiler: Issues I am still running into
For whatever reason, the event is not transitioning to page 3, just lingering on page 2, and I still don't know why. It also still kills me when I touch it, which is a head scratcher.
There's no reason to be using the self switches and script condition. You'd just make page 2 have the condition of variable 4 >= 1, then page 3 has the condition of variable 4 >= 5. And then you can make page 1 be Action Button trigger and have no commands.

There's also no reason to be turning self switch A off on page 3 when you already turned it off on page 2.

I admit I didn't thoroughly read the rest of what you wrote because...there's so much of it.

But as far as the damage being off and variable not incrementing, clean up the above stuff first. If it doesn't work, do some basic, logical troubleshooting.

Turn off all plugins, save your project, start a new game and see how it runs.

Add a Show Text command to event 2 that displays the value of variable 4, make sure it's changing when you expect it to, to the values you expect.
What your desired mechanics demand from the RPGmaker system is the need to coordinate multiple event objects, when the engine expects events to run independently from others. This will be challenging even for seasoned coders because you're now directly fighting the engine. I would recommend against using self switches as those are engineered when you need a switch that's not meant to be referenced outside the event. If you want a two-tile long trail, I would first start with creating a variable that describes the position of the head of the trail in a one-dimensional axis like this:
1703647796051.png


However what confuses me is that you cannot have a fast-moving boss, a two-tile long trail, and trail objects lingering for a few seconds after creation all at the same time.

Your trail objects kill you because the event triggers on every frame. If you held the up button against a trail object for half a second, this adds up to the event triggering 30 times during that half second especially if it fails to turn off. Adding a wait command is also unwise since this event is literally a miniature cutscene and will slow down player controls and become clunky. What you want to do to avoid this effect is to create another variable to keep track of the number of frames elapsed since the last time the player took damage, and the event triggers only if enough time has elapsed.

However we also need to be careful of variables as any time a variable is changed, it sends a command to every single event on the map to update its pages which can lead to performance issues on weaker hardware.

Also take care to write variable names to be explicitly descriptive of what its function is. I dunno what "Boss 1 combat" is, but if I understand the intentions, "boss 1 trail position" may work better. Better variable naming conventions can avoid a lot of potential confusion

Original thread: https://forums.rpgmakerweb.com/threads/make-bosses-attack-outside-of-battle.164177/