RMMV (Chrono Engine) make bushes drop hearts and gold like they do in Zelda Games

CyrusVisser

Villager
Member
Joined
Jun 18, 2021
Messages
12
Reaction score
0
First Language
english
Primarily Uses
RMMV
I'm trying to make it where bushes drop either a heart or 1 gold or nothing but randomly like they do in Links Awakening. I've been playing around in the event editor trying to do this but i cant seem to find an option that allows for randomness, but maybe im missing something. Or there is maybe a way to do this with like a plugin or script. If anyone knows how to achieve this please let me know.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
848
Reaction score
705
First Language
English
Primarily Uses
RMMV
For randomness, use a conditional branch with a script call. In javascript Math.random() will generate a random number between 0 and 1.

So do something like

Conditional Branch: Math.random < 0.1 //Decide if anything will drop
Inner Conditional Branch: Math.random < 0.5 with an ELSE block //okay we know something is dropping, figure out what it is
>Give Heart
ELSE>give money



I'd recommend using an event cloner plugin for those grass tiles, since that way if you want to change something, you only have to change one instance of the grass event to update all of them. It will save a TON of time if you want to tweak things later.
 

CyrusVisser

Villager
Member
Joined
Jun 18, 2021
Messages
12
Reaction score
0
First Language
english
Primarily Uses
RMMV
For randomness, use a conditional branch with a script call. In javascript Math.random() will generate a random number between 0 and 1.

So do something like

Conditional Branch: Math.random < 0.1 //Decide if anything will drop
Inner Conditional Branch: Math.random < 0.5 with an ELSE block //okay we know something is dropping, figure out what it is
>Give Heart
ELSE>give money



I'd recommend using an event cloner plugin for those grass tiles, since that way if you want to change something, you only have to change one instance of the grass event to update all of them. It will save a TON of time if you want to tweak things later.
Im using that script and its always doing the else option on the conditional branch even when i set it to 1. I also tried it on a separate event to make sure the bushes had nothing to do with it and it still didn't work; any ideas why this might be happening?
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
848
Reaction score
705
First Language
English
Primarily Uses
RMMV
Math.random is a function, make sure you're calling it instead of referencing it

so use
Code:
Math.random()>0.1
or whatever
 

Latest Threads

Latest Profile Posts

Noriko_Human.png
Worked on some face-sets. Need to finish up the lot and cut some out of the game. She's looking pretty cute.
Even though I'm not going for the first time in...ten years or something...ordered my Gen Con dice!
Will be focusing on map making today and adding locked chests :LZSsmile:Screenshot 2021-09-16 095316.png
It's hard to stay consistent for at least a week
new enemies for the game I'm working on...

Forum statistics

Threads
115,106
Messages
1,087,272
Members
149,573
Latest member
sdfsdfa
Top