Temporary Switch States

yoluko

Villager
Member
Joined
Mar 9, 2020
Messages
17
Reaction score
2
First Language
English
Primarily Uses
RMMV
In my game I have a scene where the players are running from a guard. If the guard catches them, it triggers a fight. That event is working fine, but I want to set it so that when the battle ends, the guard collapses. I want to set it up so that the guard will stay down until the player leaves the room. Then if they walk back in, the guard will be back up.

I set it up with a self switch onto a second page (with the "damage" form of the guard sprite"). The problem is when I walk back in, the guard has gone back to their original position but is still collapsed and refuses to chase the player (presumably because the self switch is still activated).

Is there a way to reset the self switch when the player leaves the room? Or to accomplish this through some other method? Failing that, is there some way to give the player time to escape after winning the battle, so that the guard doesn't immediately trigger another combat?
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
836
Reaction score
466
First Language
Poland
Primarily Uses
RMMV
$gameSelfSwitches.setValue([mapID, eventID, swtich], true/false);
where switch can be "A", "B", "C", or "D"

use it in event like this (replace values with your own)
 

yoluko

Villager
Member
Joined
Mar 9, 2020
Messages
17
Reaction score
2
First Language
English
Primarily Uses
RMMV
Thanks for that.

Presumably that needs to be set on the guard's scripting? How can I set a condition for the player leaving the room to apply it? (I know how to set a conditional branch: but I'm not sure of what code I could use to do this.)

EDIT: Actually, the MAP ID and Event ID is used to locate the self switch, right? So I can add it anywhere, such as the transfer event between rooms? Perfect.
 
Last edited:

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
836
Reaction score
466
First Language
Poland
Primarily Uses
RMMV
For the second part of question Yes, for first use conditional branch event, select 4th tab with script option and Type in text field

if ($gameSelfSwitches.value([mapid, eventid, switch]))

This mean if self switch on your map with following event is True then do something.

Right now im at work SO i cannot show screenshot of This conditional branch and im on phone
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

being able to transition music seamlessly is amazing. my main character's theme has lyrics and it goes from vocal version to istrumental when he leaves his room. and vice versa. and thanks to a plugin, the transition is seamless. I love it.
All of the auditions for our game are so good, I'm so glad I'm not in charge of choosing completely. lol I just can't with some of them. I listen to them on repeat. XD
Working on a Patch to integrate AlphaABS into random generated Dungeons. Was a bit tricky, but the outcome is a real Life Changer!!

Will release it the next days!
Been pretty busy... but I got a better headset for recording and listening today. Dad says that he'll consider taking me to Great Wolf Lodge for the first time once I finish summer classes (my final semester!) I'll be taking my plushie friends with me: Bendy, Lolbit, and Helen Henny. (I WUV PLUSHIES!)
SF_Monster3,4 added!

Forum statistics

Threads
105,651
Messages
1,015,293
Members
137,327
Latest member
Mezzy
Top