[SOLVED] Enemies drop reward on the map that disappear if left area

kn1000a

Golden Vampire
Regular
Joined
Dec 21, 2017
Messages
74
Reaction score
5
First Language
English
Primarily Uses
RMMZ
I am not looking to discuss if the idea is silly (after all enemies do have their own system to reward the player when dead, but I want something that involved more interaction).

The setup I desired:
Enemy monster event on the map starts a battle when the player touch it. If they defeat it, instead of getting gold by default the enemy event switches to the next page with self-switch, changes graphic to sparkles, and becomes an action-button event. The player can step on the sparkles and press X to collect “the gold dropped by the enemy”. Then the enemy event deletes itself and the next time the player re-enters this map this enemy event start all over. This at least I can do.

The problem is I have another desired outcome, if the player saw the sparkles (the gold dropped) and decided to leave the current map, I don’t want the enemy event to be stuck on that gold/sparkle page. Instead it will just return back to the first page (walking enemy event). Basically if they don’t pick up the gold, the next time they re-enter this map the gold reward won’t be there; it resets.

I’ve spent a couple days thinking about setting up the second interaction but found no way to efficiently do so. Do I use PP on the gold/sparkle page and have it checks constantly when the player exits/enters the map with a controlled variable? Given there should be multiple enemy events on a map, this feels like a performance hog. Would love to see if anyone else can help me on this!
 

kyonides

Reforged is laughable
Regular
Joined
Nov 17, 2019
Messages
1,773
Reaction score
893
First Language
English
Primarily Uses
RMXP
You would need to use a script call to reset the self switches either at the moment you enter the map or you leave it.
 

Kes

Regular
Regular
Joined
Aug 3, 2012
Messages
23,808
Reaction score
13,729
First Language
English
Primarily Uses
RMMZ
I think it would be safer to do it when you leave the map. If you do it when you enter there is just a chance that the player will see it happening.

EDIT
Unless, of course, you start doing stuff like that in a parallel process which activates before the map loads. But that is just making extra work for yourself.
 

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,324
Reaction score
11,496
First Language
German
Primarily Uses
RMMV
what you7 need is one additional page for controlling the reset.

That third page needs to be conditioned to a reset switch for that map
it needs to be parallel process and should be a series of control switch command to reset all conditions in a way it ends up on the first page, followed by a wait(5) or so

Then you make an autorun for entering the map that has the following commands:

1) control reset switch = on
2) wait 3 frames
3) control reset switch = off
4) wait 3 frames
5) erase event.


That will switch all events to their reset page on entering, and remove the reset after it had time to change all events.
 

SpyroFan67

Regular
Regular
Joined
Apr 27, 2023
Messages
970
Reaction score
594
First Language
English
Primarily Uses
RMMV
I am not looking to discuss if the idea is silly (after all enemies do have their own system to reward the player when dead, but I want something that involved more interaction).
It's fine. I don't think it's silly. I like it. :)
 

kn1000a

Golden Vampire
Regular
Joined
Dec 21, 2017
Messages
74
Reaction score
5
First Language
English
Primarily Uses
RMMZ
what you7 need is one additional page for controlling the reset.

That third page needs to be conditioned to a reset switch for that map
it needs to be parallel process and should be a series of control switch command to reset all conditions in a way it ends up on the first page, followed by a wait(5) or so

Then you make an autorun for entering the map that has the following commands:

1) control reset switch = on
2) wait 3 frames
3) control reset switch = off
4) wait 3 frames
5) erase event.


That will switch all events to their reset page on entering, and remove the reset after it had time to change all events.
I’ll try this out. My first question would be if this allows enough time for the reset to happen since it happens upon entering the map. Could the player sees the enemy events changing in those few frames?

Thanks for the tips from everyone tho!
 

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,324
Reaction score
11,496
First Language
German
Primarily Uses
RMMV
Could the player sees the enemy events changing in those few frames
possibly, but there is the option to fadeout before leaving the previous screen and only fadein after the reset command is finished (just beforte the erase)

Upon entering the map, parallel processes are executed before autoruns, so using that might improve the timing.
Other than each waitframe is one sixtieth of a second under normal conditions, although the load delays on mapload distort that a bit as well
 

Roninator2

Gamer
Regular
Joined
May 22, 2016
Messages
5,122
Reaction score
1,505
First Language
English
Primarily Uses
RMVXA
You could also use a variable.
Set your enemy event with the conditions to continue when losing (in order to get the condition options - you probably already did that). When winning add 1 to a variable you want to use.
Set the second page of the event to activate when the variable is 1 or above.
This will be the sparkle event you describe. Add 1 to the variable when item picked up.
Set the third page to when the variable is 2 or above.

On the exit map set the variable to 0.
If you do the same on multiple maps that you transfer to then you will only see a slight delay for the enemies to show up after the variable is set to 0.
 
Last edited:

kyonides

Reforged is laughable
Regular
Joined
Nov 17, 2019
Messages
1,773
Reaction score
893
First Language
English
Primarily Uses
RMXP
Well, I finished crafting a brand new script that will handle it IF you only use self switches.
I'll post it soon but I dunno when the moderators will ever approve it. :p
 

kn1000a

Golden Vampire
Regular
Joined
Dec 21, 2017
Messages
74
Reaction score
5
First Language
English
Primarily Uses
RMMZ
Well, I finished crafting a brand new script that will handle it IF you only use self switches.
I'll post it soon but I dunno when the moderators will ever approve it. :p
For those that are looking, seems like he posted the script here! https://forums.rpgmakerweb.com/index.php?threads/refreshable-events-ace.157995/ Thank you kyonides :D

You could also use a variable.
Set your enemy event with the conditions to continue when losing (in order to get the condition options - you probably already did that). When winning add 1 to a variable you want to use.
Set the second page of the event to activate when the variable is 1 or above.
This will be the sparkle event you describe. Add 1 to the variable when item picked up.
Set the third page to when the variable is 2 or above.

On the exit map set the variable to 0.
If you do the same on multiple maps that you transfer to then you will only see a slight delay for the enemies to show up after the variable is set to 0.
I think this works if there’s only one walking enemy event, but usually for mob enemies there are 5+ in a map, to need a variable for every specific mob event on the map might feel a bit clunky. If I use 10 walking enemy events I would need 10 different variables to set to 0 whenever I exit the map. But it is an alternative I didn’t think of so thanks!
 

Roninator2

Gamer
Regular
Joined
May 22, 2016
Messages
5,122
Reaction score
1,505
First Language
English
Primarily Uses
RMVXA
I think this works if there’s only one walking enemy event, but usually for mob enemies there are 5+ in a map, to need a variable for every specific mob event on the map might feel a bit clunky. If I use 10 walking enemy events I would need 10 different variables to set to 0 whenever I exit the map. But it is an alternative I didn’t think of so thanks!
True, My mind must have been on a single path there.
Kyonides script should work. If I had thought of it I would have tried something, as I just remembered that CSCA dungeon tools has a reset option so something like that would have worked.
 

Latest Threads

Latest Profile Posts

Things you can say about your RPG maker project, but not about your partner:
I’m so lucky! Simone got referred to a feline cardiologist and had I not called this morning the moment there was a cancellation the next opening would have been SEVEN months from now! The other heart hospital would have been on the other side of Michigan. Who knew that animal specialty appointments were also terrible to get!?
Scalemail project is one step closer to completion. Ordered scales from a local metalworking company, ordered some split rings... now all I need is to wait. :>
And pray that the split rings will be flexible enough to handle that.
A spooky banner and a spooky pfp for a spooky season.
Spooky-Season.png
Broke: Actually making the stuff you need to make before the game can progress.
Woke: Wasting time instead by making a sidequest where you can recruit an imaginary friend to the party.
1696264391516.png

Forum statistics

Threads
134,994
Messages
1,252,704
Members
177,900
Latest member
LinkIncGames
Top