A question about switches...I think.

Status
Not open for further replies.

Umpikuja

Villager
Member
Joined
Sep 15, 2016
Messages
12
Reaction score
1
First Language
English
Primarily Uses
I am a beginner. I apologize if this has been asked before. I have been looking around for an answer before coming here.


I want to create an autorun event that happens every time the player enters the map. I want to enter an elevator, shake the screen and rumble a bit, play a ding, end the event and walk out. I see how to do this much with switches. But I want this to happen every time I enter that elevator.

autoruntest01.png
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Good try, but not quite right.


Using switches or self switches to active a new event page is a permanent thing.  It doesn't get reset when you re-enter the map, but only when you deliberately change the switch or self switch again.


To have something run every time you enter a map, you simply use an Erase Event command.  That removes the event for the remainder of the time you're on the map, but when the map is next loaded, that event will be loaded again too.


Also, unless this is something that takes some time to run and you don't want the player to be able to move while it's happening, I suggest you change it to parallel process trigger instead of autorun.  Autoruns remove control from the player, and if you have several, only one of them will run at a time (and I'm not sure if they will queue up, but if they do, you have no control over the order).  Parallel process events will all run at the same time, and will allow the player to keep doing stuff as well.


So to fix your event, remove any references to self switches and remove the second page, and add Erase Event as the last command.
 
Last edited by a moderator:

Dad3353

Veteran
Veteran
Joined
Mar 9, 2016
Messages
421
Reaction score
110
First Language
English
Primarily Uses
Assuming that the Map on which this Event is placed is the inside of this Elevator itself, remove the Self Switch and Page 2, replace the Self Switch with Erase Event. The Event will run, as before, automatically, then erase itself until the next time that the Map is entered.


The Self Switch is inappropriate as, once triggered, it remains triggered. Re-entering the Map does not reset the Self Switch.


Try it..?
 

BehemothRPG

Villager
Member
Joined
Sep 3, 2016
Messages
20
Reaction score
3
First Language
German
Primarily Uses
Well in fact you COULD reset a self switch by calling:


$gameSelfSwitches.setValue([mapId, eventId, 'A'], false);


But in this case it would just be unproper coding ;)
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Because they don't need to reset the switch at all. If it is supposed to happen every time, there is no purpose to turning the switch on then back off. What would be better is to either do erase event (so it is there next time), or do what Shaz suggested.
 

Umpikuja

Villager
Member
Joined
Sep 15, 2016
Messages
12
Reaction score
1
First Language
English
Primarily Uses
Thanks everyone! You are awesome, all of you! It works perfectly!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,842
Reaction score
5,222
First Language
Dutch
Primarily Uses
RMXP

Liftyfied, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top