Interaction in Battle.

Hey there games makers. Just wanted to know if there is a way to put stuff you can interact with in battle.

Stuff like an explosive barrel that if you hit it explodes, a fence that prevents you from attacking enemies unless you destroy them, or something you can hide behind to take less damage.
Hello! I don't know about plugin solutions for this (but it must exist somewhere).

This said, I think it should be possible through eventing but it would be a bit time-consuming to implement as you would have to implement it in every troop you set up.

But if you go down that road, I think it might be possible this way :
For exemple :
EXPLOSIVE BARREL
- Set up the barrel as a monster.
- Then check if the hp went lower on an event page, if it does, force a skill that harms the enemies, and then apply the state "dead" to the barrel so it doesn't start again.

One extra thing : you probably would want to set the evasion rate to 0 for the barrel so that you don't get an awkward "barrel evaded super handsome protagonist power of friendship".

Another method to check if something has been attacked you could do :
- Make attack skills and normal attack systematically apply a state that does absolutely nothing (don't add an icon to it, no message, nothing so that the game won't display it).
- Then in the battle events, just check if the barrel has this state on. Could be useful for other situations as well.

Barrier that protects the party :

- Again make an enemy as the barrier. Set the hp etc to make it as resistant as you wish.
- Make an event page that checks if the barrier is still alive.
- If the barrier is still alive, make it apply a state that raises the party's defense.
- Make so that the same event also checks if the barrier is dead, if it is, make it remove the state to your party.

EDIT : One IMPORTANT point I forgot! Every battle would have to check if all the enemies are dead besides the barrel and barrier to force a win through applying dead state to all the barrels, barriers etc so the battle ends with a regular win.

It's just some guidelines, probably not perfect but it might help.
yes and no

the exploding barrel would be easy - just make a barrel enemy (no skills) with a troop event to be executed when the barrel is killed.

other effects are more problematic, because by default only enemies exist in the battlescreen, and that limits what the objects can do as they have to be enemies just with different skills.
Yeah, just make all of those things as enemies.

EXPLOSIVE BARREL
- Set up the barrel as a monster.
- Then check if the hp went lower on an event page, if it does, force a skill that harms the enemies, and then apply the state "dead" to the barrel so it doesn't start again.
Just to streamline this a bit - I don't see any reason to be manually applying the death state to the barrel. Just give it 1 HP so any damage kills it.

Then you could use a bit of tricky troop events by having it start with an immortal state; use a troop event to check for it to have 0% HP; do the stuff, then remove the immortal state.

Or just use Yanfly's Buffs & States and Auto Passive States. Put a react effect on it so when it takes any damage it does the explosion effect before it dies.

Barrier that protects the party :
- Again make an enemy as the barrier. Set the hp etc to make it as resistant as you wish.
- Make an event page that checks if the barrier is still alive.
- If the barrier is still alive, make it apply a state that raises the party's defense.
- Make so that the same event also checks if the barrier is dead, if it is, make it remove the state to your party.
This again can be made easier with Yanfly's Passive Aura Effects. Put an aura on the fence that increases the team's defense while it's alive.

something you can hide behind to take less damage.
That doesn't really make sense in the context of the default battle system. Since there's no concept of position or movement, "hide behind" doesn't mean anything.

Overall, my biggest piece of advice for you is to spend time doing tutorials and making some practice games. The better you understand how MV's default engine works and how to use events, the easier it will be to modify it with plugins or eventing (and to understand when you'd use each).
Hello! I don't know about plugin solutions for this (but it must exist somewhere).

This said, I think it should be possible through eventing but it would be a bit time-consuming to implement as you would have to implement it in every troop you set up.

But if you go down that road, I think it might be possible this way :
For exemple :
EXPLOSIVE BARREL
- Set up the barrel as a monster.
- Then check if the hp went lower on an event page, if it does, force a skill that harms the enemies, and then apply the state "dead" to the barrel so it doesn't start again.

Barrier that protects the party :

- Again make an enemy as the barrier. Set the hp etc to make it as resistant as you wish.
- Make an event page that checks if the barrier is still alive.
- If the barrier is still alive, make it apply a state that raises the party's defense.
- Make so that the same event also checks if the barrier is dead, if it is, make it remove the state to your party.

It's just some guidelines, probably not perfect but it might help.
Tried this but I'm running into a problem where the battle does not end until all enemies are dead that includes the barrels so I need a way to tell the engine to ignore them. Still good idea though.
Yeah, I edited my initial answer about this problem :

You should make a check on every battle to see if all the real enemies have the state "dead". If they do, give the state "dead" to the barrels etc and voilà! A regular win for your party!
Copy the below into a text editor, save as a *.js file, include as a plugin.

Any enemy with the <doesntcount> notetag will not need to be killed in order to beat the troop.

Code:
Game_Troop.prototype.isAllDead = function()
{
    return this.aliveMembers.filter(enemy => !enemy.enemy().meta.doesntcount).length == 0;
};

Saves you from some annoyingly extensive troop events.
Yeah, I edited my initial answer about this problem :

You should make a check on every battle to see if all the real enemies have the state "dead". If they do, give the state "dead" to the barrels etc and voilà! A regular win for your party!
Thanks for the advice. I'm gonna try to this out.

Copy the below into a text editor, save as a *.js file, include as a plugin.

Any enemy with the <doesntcount> notetag will not need to be killed in order to beat the troop.

Code:
Game_Troop.prototype.isAllDead = function()
{
    return this.aliveMembers.filter(enemy => !enemy.enemy().meta.doesntcount).length == 0;
};

Saves you from some annoyingly extensive troop events.
I just realized that I can use this to make hostages in battles! That two for the price of one!
Copy the below into a text editor, save as a *.js file, include as a plugin.

Any enemy with the <doesntcount> notetag will not need to be killed in order to beat the troop.

Code:
Game_Troop.prototype.isAllDead = function()
{
    return this.aliveMembers.filter(enemy => !enemy.enemy().meta.doesntcount).length == 0;
};

Saves you from some annoyingly extensive troop events.
Oooooh what a time saver! Thank you!
Code:
Game_Troop.prototype.isAllDead = function()
{
return this.aliveMembers.filter(enemy => !enemy.enemy().meta.doesntcount).length == 0;
};
I got an error using this code, I have "this.aliveMembers.filter is not a function"
I got an error using this code, I have "this.aliveMembers.filter is not a function"
show the console.log of it, so it make it easier.

it could be bound to YEP plugin? if it doesn't work as stand alone.
It should be this.aliveMembers(). Note the extra ().
Thanks! It works now.

Original thread: https://forums.rpgmakerweb.com/threads/interaction-in-battle.168874/