How to trigger an event after set number of random encounters?

Drawbunii

Warper
Member
Joined
Feb 9, 2019
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
So I want to have a part in my game that after the player gets 10 specific drops from random encounters the screen will immediately tint to sunset and a different bgm will play. Is there any easy way for me to set this up?

I know how to set up a screen tint event and get the background music to change (though I still need to look into how to keep the new bgm when going to other maps) but for now I just really want to solve my first question.

Thanks!
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,502
Reaction score
412
First Language
German
Primarily Uses
RMMV
1.
Are the Monsters all on 1 Map or split up over several Maps?
2.
10 of 1 Item or up to 10 different Items?

I would guess using a parallel Event on that Map.
Eventcode:
Control VariableX set to Amount of Item in Inventory.
Conditional Branch: Is VariableX equal or more than 10?
if yes:
tint screen and turn off the event (turning on second empty eventpage does the job)
if no: Wait 60 Frames for example (1second = 60Frames)
 

BrandedTales

StoryTeller
Veteran
Joined
Dec 30, 2016
Messages
203
Reaction score
116
First Language
English
Primarily Uses
N/A
I don't know enough about the battle components (my games haven't used them yet) so it's entirely possible this can be done as part of the troop event or with a plugin just after, but since I don't know that, I'll give you my hacky way:

I'd add a check on the load of a map (auto-run event, deletes itself right after) that checks the player's count of the particular whatever.

Conditional branch: If $gameParty.numItems($dataItems[XYZ]) >= 10....
* Where XYZ is the ID of the item in question.

Then if the answer is true, do the stuff to alter the player's world!
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,502
Reaction score
412
First Language
German
Primarily Uses
RMMV
But than he needs to reenter the map before this effect takes place. it read like he wants it to happen after the battle when all 10 items are in inventory.
But your Scriptline to directly use in Eventcommand Conditional Branch, is very useful.
I did not knew it myself. Thanks for sharing.
Code:
$gameParty.numItems($dataItems[XYZ]) >= 10
 

Drawbunii

Warper
Member
Joined
Feb 9, 2019
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
1.
Are the Monsters all on 1 Map or split up over several Maps?
2.
10 of 1 Item or up to 10 different Items?

I would guess using a parallel Event on that Map.
Eventcode:
Control VariableX set to Amount of Item in Inventory.
Conditional Branch: Is VariableX equal or more than 10?
if yes:
tint screen and turn off the event (turning on second empty eventpage does the job)
if no: Wait 60 Frames for example (1second = 60Frames)

1. The area is a forest so it's spread over 2 maps
2. It's 10 of 1 item

I tested this contained to one map and it worked perfectly! If I just copy paste the event to the other map I assume it'll work in both? Or do I need to do something else/more

Thank you for the quick response!
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,502
Reaction score
412
First Language
German
Primarily Uses
RMMV
If Bugs or Errors appear, let us know. Than we can further help adjusting it.
You are welcome.
 

Latest Threads

Latest Posts

Latest Profile Posts

just when I thought one of the greatest game of all time couldn't get any better, they announce a new dlc for it.
For anyone interested: there's another huge humble bundle with JRPG assets + a game jam starting next month - it's for a good cause, so check it out <3
Turning a specific vibe into reality is incredibly difficult. For instance, this song is one of the ones I listen to when working on my post apocalyptic project, and getting it's "feeling" into the game has been a real challenge.

I don't just wanna regurgitate the numbers I see, I wanna actually understand the calculations I'm making so I'm probably gonna make a post later with some calculations and what I THINK they mean to get some advice and corrections.

Edit: All (Most) of these will be tested in game prior. I just wanna make sure I understand what's going on under the hood if you will.
my girlfriend calls all my little chibi art cute lol... funny considering that wasn't the original art style of the game.

Forum statistics

Threads
113,778
Messages
1,077,362
Members
147,808
Latest member
traviscot
Top