A chest that closed when you leave the map?

jcmilkyway

Warper
Member
Joined
Sep 29, 2020
Messages
1
Reaction score
0
First Language
chinese
Primarily Uses
RMMV
hey guys thanks for check my question

I want to make a chest that closed when you leave the map, so that when you come back you can open it again.

here is what I have done(sorry for the Chinese)

I created a chest by default and deleted the tag page "2"
than I add erase event in the end, also show some text like "magic chest will respawn...etc"


here is the code
2.png


Then I add a erase event in the map so it can redo its job every time the character comes back.

like this
1.png


But I realized that this will cause all map event to redo its job.

is there any solutions to control only a single chest to closed when leaving the map?

thx
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,910
Reaction score
7,449
First Language
German
Primarily Uses
RMMV
no, erase event will ONLY erase the event the command is in, no other event.
So to affect that chest it needs to be in the chest event.

you'll need a different structure for this-
1) make the treasure quick event as usual. Do NOT delete the second page
2) add a third page conditioned to a general switch called "reset all chests" or so.
3) on that event page, control self-switch OFF to reset the chest, plus anything else you want to happen on reset.
4) switch the third page to parallel
5) on all exit transfer events, add asequence of three commands BEFORE transfer command:
control switch "reset all chests" ON
wait two frames
control switch "reset all chests" OFF

and before leaving the player will have all chests reset.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,577
Reaction score
875
First Language
Dutch
Primarily Uses
RMMV
basicly, you dont need a third page,
you basicly put a different switch instead of a selfswitch,, use that switch on page 2,
when you leave that area, turn off the switch when you exit the map, and the chest
will resetted back.

easier and simpler, but you can use the switch for all chest you want to be resetted
when you change maps.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,910
Reaction score
7,449
First Language
German
Primarily Uses
RMMV
@ShadowDragon
there is a problem with your idea: if there is more than one chest with that switch, then all of them will switch to open as soon as the first chest is opened. That is the reason why the chest event uses a self-switch in the first place.

if you were to use a different switch for every chest and controll them off when leaving that would work, but it would use up much more switches than my solution...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
If you want the chest to disappear, it should just work by adding Erase Event instead of Control Self Switch.

You don't need additional pages or additional events or additional switches.

Chest appears, player opens it, chest opens, you get the loot, you get the message, chest disappears. Player leaves the map and returns, chest is there again, closed.
 

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

Latest Threads

Latest Profile Posts

Honestly. Didn't sleep for a day. ONCE
Hi! I've been working on some character sprites for my pirate themed game.
Still somewhat new to pixel art, so feedback or inputs would be appreciated ^^
TRIVIA: I love Japanese food and culture! I've never been to Japan, but someday I'm going to go to Tokyo and do some touring, including Disneyland Tokyo and DisneySea! And I even prepared myself for earthquake safety.
The virus really doesn't want us to do this GameJam. v .v' Even if we don't meet the deadline because of it, still plan on making it a game we'll release.
Has anybody else noticed in the freebie Sci-fi tilesets that they have a hologram of Cybertron from Transformers?

Forum statistics

Threads
104,244
Messages
1,004,954
Members
135,764
Latest member
MinazukiYukin
Top