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.
MV (Chrono Engine) make bushes drop hearts and gold like they do in Zelda Games
Javascript/Plugin SupportFor 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.
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?
Math.random is a function, make sure you're calling it instead of referencing it
so use
or whatever
so use
Code:
Math.random()>0.1
Original thread: https://forums.rpgmakerweb.com/threads/chrono-engine-make-bushes-drop-hearts-and-gold-like-they-do-in-zelda-games.138854/