How can I turn a switch on?

Does anyone know how to turn a switch on right after an actor is attacked?
Do you mean in battlemor on the map?

My first instinct is to say you do it the same way as usual, so I'm wondering if there's some missing details to your question to make this not just a normal event.

Could you give details of exactly what you want to do and why the normal way doesn't work for you. .
Depending on the circumstances (all actors, all enemies, all skills?) you could do it in the damage formula or you would need a script.
I want to do that during battles and it doesn't matter how enemies attack actors.

For example,an switch is turned on immediately after Slime A attacks Eric and the same switch is promptly turned off after that.

Then,the switch is turned on after Slime B attacks Natalie and the switch is turned off.

The switch is turned on after Slime C attacks Terence...

Is it possible to do this?
What is the purpose of turning the switch on if you're going to turn it off again straight away?


We really need to understand WHAT you're trying to do, so we can give you the best method, which may not be the same as what you have in mind.


You realize, in case you're controlling a common event with that switch, that common events don't run during battle?
Battle backgrounds are all in black in my game and I hate default shakes because the backgrounds are practically not shaken and only enemies are shaken when actors are attacked.

It looks like the enemies attack themselves.

I tried to find a script which enables myself to customize shakes and I finally found one.

It's necessary to make events to shake windows with the script and that's why I need to know how to turn switches on and off during battles.

The script  http://www.geocities.jp/f_itiuma/_geo_contents_/shake_window.txt

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-turn-a-switch-on.49424/