JavaScript to turn off a self switch?

Woland

Veteran
Veteran
Joined
Mar 26, 2017
Messages
340
Reaction score
88
First Language
Polish
Primarily Uses
RMMV
I would like to turn off a self switch on an event whenever player dies. I don't want to make the self switch a global switch, I don't like clutter. I just want to be able to add a simple line to the death event saying "turn off self switch A for event X on map Y". How can I do that? :)
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
674
Reaction score
370
First Language
Poland
Primarily Uses
RMMV
with script call

$gameSelfSwitches.setValue([a,b,c], true/false);

where:
a - reference to map ID
b - reference to event ID
c - reference to wich self switch you wish to toggle ("A", "B", "C", or "D")

c - element is a string type so it always must be put in quote marks.
 

Woland

Veteran
Veteran
Joined
Mar 26, 2017
Messages
340
Reaction score
88
First Language
Polish
Primarily Uses
RMMV
awesome, thank you!
 

Woland

Veteran
Veteran
Joined
Mar 26, 2017
Messages
340
Reaction score
88
First Language
Polish
Primarily Uses
RMMV
Fun fact: It doesn't work if you use it outside of the map the event with self switch is on. Not sure why. But whatever :)
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
674
Reaction score
370
First Language
Poland
Primarily Uses
RMMV
It 100% should work, because I use this method in my project, maybe you put wrong map or event id or self switch wasn't set at all?
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I'm making MAGIC!
aww I am sad but happy for brackeys to decide to pursue something new but seing brackeys ending is so sad ;w;
Now RPG Maker has brought him here. He will never be rid of his need for it. He hates and loves the RPG Maker, just as he hates and loves himself. Featherbrain's life is a sad story. Yes, Featherbrain, he was called. Before the RPG Maker found him. Before it drove him mad.
Really struggling with XP animations but my game deserves my best.
I think the characters are really too short. Should at least add a little more
Just the legs should be longer.

Forum statistics

Threads
102,926
Messages
996,020
Members
134,380
Latest member
Marcussss
Top