Event needs to reset even without player interaction [solved]

Status
Not open for further replies.

Kovos_Datch

Potatomancer
Veteran
Joined
Jun 6, 2015
Messages
84
Reaction score
39
First Language
English
Primarily Uses
RMMV
Like the titles says, I need an event to reset without player interaction when the player leaves the map.

The first picture below is the event I have for one of the mushrooms that can randomly appear on a map in my game. If the random # roll is less than or equal to 10, the mushroom spawns, otherwise it is erased. If it spawns, the player must interact with it to harvest it, thus causing it to be erased (otherwise it stays on the map). I don't want this mushroom to be persistent on the map (because it's a rarer item in my game), so I would like for it to be removed when the player leaves the map and be forced to try to respawn when the player returns to the map.

I've tried using events to get the mushroom to disappear by using a global switch when they player touches the move-to-different-map-event (causing the player to move to a new map area) to trigger a 3rd event sheet (picture below) and turning the global switch off as an auto-run when the player returns to the map, but that doesn't seem to work every time.

Am I going about this the wrong way? Is there any way to reset the event like I need it to without scripts? Or are scripts my best option? If so, does anyone have a lead on a script that can do that?

Edit: I am using an autorun event elsewhere on the map to determine if the mushroom spawns. Also, I don't want it's spawn as a one-time-event. I could set it to a blank event if that was the case, but unfortunately, I want it to respawn so players can possibly stumble across more in the same *general* area.
 

Attachments

Last edited:

Windyhouser

Veteran
Veteran
Joined
Oct 6, 2015
Messages
40
Reaction score
29
First Language
English
Primarily Uses
RMMV
I would do it by setting the mushroom to be turned on with a global switch, moving that first page to a separate event that does the check, turns the switch on if it's true and off if it isn't, then erases itself regardless of the outcome of the check.
Edit:
If that doesn't make sense, I'll grab a screenshot of what I mean.
Also, where are you randomizing the variable? It isn't being randomized in the event.
 

Kovos_Datch

Potatomancer
Veteran
Joined
Jun 6, 2015
Messages
84
Reaction score
39
First Language
English
Primarily Uses
RMMV
Also, where are you randomizing the variable? It isn't being randomized in the event.
Right, I forgot to mention that. When the player enters the map, there is an auto-run event that rolls two variables before erasing itself. One of those options is the random spawning variable.

I would do it by setting the mushroom to be turned on with a global switch, moving that first page to a separate event that does the check, turns the switch on if it's true and off if it isn't, then erases itself regardless of the outcome of the check.
I think I understand what you mean, but the issue isn't the spawning, but rather the de-spawning of the mushrooms when the player leaves. The lore behind the mushrooms is that they don't last long, so I need them removed if a player leaves the map and force the mushrooms to re-roll spawning when the player returns.

Basically, as it is, if the player comes into the map, and doesn't harvest the mushroom, the mushroom will stay until the player harvests it. I need it to despawn so the map doesn't become innundated with a bunch of mushrooms (since the mushrooms are rare). As it works now, it would allow for the player to keep re-entering and exiting the map, forcing a bunch to grow quickly, and collecting large amounts of those mushrooms easily, breaking my alchemy system.
 

Windyhouser

Veteran
Veteran
Joined
Oct 6, 2015
Messages
40
Reaction score
29
First Language
English
Primarily Uses
RMMV
Hm. Do you want a mushroom to respawn ever if it's been harvested before?
Edit:
Also, do you want to have multiple of the same mushroom on the same map?
 

Kovos_Datch

Potatomancer
Veteran
Joined
Jun 6, 2015
Messages
84
Reaction score
39
First Language
English
Primarily Uses
RMMV
Hm. Do you want a mushroom to respawn ever if it's been harvested before?
Yes. I don't want it as a one-time-event. I could set it to a blank event if that was the case, but unfortunately, I want it to respawn so players can possibly stumble across more in the same *general* area.

P.S. Thank you for your assistance in looking into this problem with me!
 

Windyhouser

Veteran
Veteran
Joined
Oct 6, 2015
Messages
40
Reaction score
29
First Language
English
Primarily Uses
RMMV
You're very welcome! I love solving problems like this.
If a mushroom spawns, and the player leaves the map without picking it, do you want it to stay, or be rerolled?
Edit:
Need to get my reading comprehension looked at, because I'm pretty sure you already answered that. :rswt
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,541
Reaction score
6,874
First Language
German
Primarily Uses
RMMV
your third page is the correct idea, you just made it the wrong way.

you erase the event before switching off the self-switch, and that of course means that the event is gone before the control self-switch command can be processed...

EDIT: you also need a wait(1) on the reset switch to turn it off again before allowing the player to leave, otherwise you risk either not resetting (if the player goes without the wait) or having the reset remain active on returning
 

Kovos_Datch

Potatomancer
Veteran
Joined
Jun 6, 2015
Messages
84
Reaction score
39
First Language
English
Primarily Uses
RMMV
Rerolled. I've been scratching my head as to how I can get it erased so it will reroll when the player re-enters the map.
 

Kovos_Datch

Potatomancer
Veteran
Joined
Jun 6, 2015
Messages
84
Reaction score
39
First Language
English
Primarily Uses
RMMV
your third page is the correct idea, you just made it the wrong way.

you erase the event before switching off the self-switch, and that of course means that the event is gone before the control self-switch command can be processed...

EDIT: you also need a wait(1) on the reset switch to turn it off again before allowing the player to leave, otherwise you risk either not resetting (if the player goes without the wait) or having the reset remain active on returning
If I turn off the self-switch before erasing the event, wouldn't that throw it back to the first page and have it spawn again before the player leaves, causing it to be harvested over and over and over?
Edit: Or would it finish that section of the event before switching back over?

Also I'm not entirely sure what you mean on your edited section. Could you please elaborate? Thank you!
 

Ronove

♫꒰・‿・๑꒱
Veteran
Joined
Mar 12, 2012
Messages
1,031
Reaction score
346
First Language
English
Primarily Uses
RMMV
I mean you aren't wrong. When you turn off Self-Switch A, it will probably want to do the first page again because it's set to Autorun.

A way to do it that's probably not the best is to just use the script call button thing and do like:

$game_self_switches[[map_id,event_id,"A"]] = true

in the event that transfers you off the map.

Just change the ids to numbers (so if it's map001 and event001, it'll just be [[1, 1, "A"]] and then do false instead of true. It'll turn off the switch so when they return to that map, it'll restart the process like you want it to.

If you have a LOT of these events, it might get tedious, however. If you do want to use this, I would reccommend doing the script call AFTER the transfer just so I guess it doesn't try to redo the first page of the event before the transfer finishes.
 
Last edited:

Windyhouser

Veteran
Veteran
Joined
Oct 6, 2015
Messages
40
Reaction score
29
First Language
English
Primarily Uses
RMMV
Turning off the self-switch first will allow the event to finish processing that section, while the erase event triggers immediately.
I believe that Andar means, that because of the way events work, without a wait to give the event time to process, the transfer could run before the resent event finishes.
 

Kovos_Datch

Potatomancer
Veteran
Joined
Jun 6, 2015
Messages
84
Reaction score
39
First Language
English
Primarily Uses
RMMV
Okay, so after you all built on top of what I was already doing, I built on top of what you all suggested and got this. I do believe this is the solution, as I have tested it a handful times and it seems to work properly!

Thank you so much for allowing me to bounce ideas off you all and you all bouncing your ideas off me! I am so appreciative with how helpful this community is and how understanding and patient you all are. Thank you so much for working with me on stuff I've never attempted in RPG Maker VX Ace!

P.S. Ignore the Random GPS on the Random Number generator in the screenshot. That's for another thing I'm tackling.
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,541
Reaction score
6,874
First Language
German
Primarily Uses
RMMV
one additional tip:
keep switch 1 unused and off in all your games.

Switch ID 1 is the default for common events set to autorun or parallel process, and there are also several scripts that have that switch as default for controlling some of their functions.
So if you ever forget to configure something of that, it will react to switch 1 being used - and you might not understand that directly.

So it is usually a good idea not to use that specific switch until you are more experienced and know exactly what you're doing.
 

Kovos_Datch

Potatomancer
Veteran
Joined
Jun 6, 2015
Messages
84
Reaction score
39
First Language
English
Primarily Uses
RMMV
one additional tip:
keep switch 1 unused and off in all your games.

Switch ID 1 is the default for common events set to autorun or parallel process, and there are also several scripts that have that switch as default for controlling some of their functions.
So if you ever forget to configure something of that, it will react to switch 1 being used - and you might not understand that directly.

So it is usually a good idea not to use that specific switch until you are more experienced and know exactly what you're doing.
Okay, I'll bump down the first global switch I was using and leave Global Switch 001 blank. Thank you for the advice.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
21,795
Reaction score
11,009
First Language
English
Primarily Uses
RMVXA
@Kovos_Datch If your query is fully resolved please Report your opening post and ask for it to be closed. Mods may not see a post or topic title change but they will see a Report.

However, as I'm here I'll do it.
[CLOSED].[/CLOSED]
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

My sister is a saint. Specifically Saint Peter. Because shes my best friend until other ppl are around then shes all "nope, dont know him, dont like him."
Making it a rule that I don't do any world building for my new game before the actual gameplay is concrete and working. I have 16 years of lore to work with anyway.
Cheesy power metal makes everything better. No matter what you do, you'll feel heroic doing it.
Starting to really like the first of my madness areas. I think the eyes looking at them really helps to sell the place. :LZSexcite:

Forum statistics

Threads
95,698
Messages
931,109
Members
126,043
Latest member
rpgteck
Top