Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Randomizing

Hey, this is probably a pretty easy thing to do, but i cant seem to figure out any way to make it work.

Im adding a crafting side thing so the player can harvest materials and make their own goods. Such as Potions and armor.
Enemies have a chance to drop modifier built right in, so things such as hide, and teeth, are no problem gathering.
But potions require herbs. I have them all written up in the items tab. and theyre ready to go. I can make it so each plant puts out X (eg. X=1) amount of materials. but Id like most plants to have a X-Y (eg. x=0 y=2). or a 60% drop rate.
i cant figure out how to make this. any help would be appreciated
 
mmm, if i'm understanding this right.
say on a map, you have an event that is a plant you can collect from?
here is what i can think of:
control variable, set to, random 1-5
then conditional branch based on that variable. greater than or equal to 3.
under that add the item. else case, "there isn't enough plant to collect"

that way it randomly sets, if it's 3,4,5 then they get the item. 1,2 and they get nothing. i think that's about 60% if not you can modify the numbers.

then after your branch put a self switch if you don't want them to collect from that plant again. on the 2nd page put a graphic with less leaves :grin:
and this way you can use the same variable for every plant. it simply sets it at each event.
is that what you needed? :thumb:
 

Nachos

Sponsor

We'll its pretty simple.
Create a variable called "Number" or something similar, we'll call it V1. Set it to "Random" ( Theres an option when setting the variable) and set the Max. and Min. variables. Done, when that line runs V1 will have a random number between Max. and Min.
Now, you want to set the drop rate, np. Just create conditional branches wherever you want and set them like this:
Code:
 

Conditional branch: If Variable1 = 1 then

  You got Magical Herb!

else

end

 

--

Conditional branch: If Variable1 = 2 then

  You got Magical Herb!

else

end

 

--

 

Conditional branch: If Variable1 = 3 then

  You got Holy Herb!

else

end

 

 

1,2,3 being between your Mix. and Max.

Just reply with your doubts
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top