Main Menu
  • Welcome to The RPG Maker Resource Kit.

(request) Randomness ensues

Started by JFloyd, April 03, 2007, 02:23:07 AM

0 Members and 1 Guest are viewing this topic.

JFloyd

How would I make something like say a bush, that you walk up to, and it asks if you want to forage, and you can get 5-10 berries, and 5 different kinds.
How would I do that.

modern algebra

#1
Use variables. They have an option where you can randomize a number between two bounds. In your case, you would use two variables. The first one would choose between 1 and 5 and then based on those numbers, you would assign what type of berry you find. Then you could reandomize another number between 5 and 10 to determine how many berries you get.

There are a few tuts on variables out there. Look them up. You won't regret it.

EDIT:
Your event would look like this. It would be action key activated with an empty second page (conditioned on Self-Switch A)


Text: Would you like to Forage?
Show Choices (yes, no)
When [yes]
    Control Variables: [001: Berries 1] Random (0, 4)
    Control Variables: [002: Berries 2] Random(5, 10)
    Conditional Branch: Variable [001: Berries 1] = 0
        Change Items: [Red Berries] + Variable [002: Berries 2]
    Branch END
    Conditional Branch: Variable [001: Berries 1] = 1
         Change Items: [Blue Berries] + Variable [002: Berries 2]
    Branch END
    Conditional Branch: Variable [001: Berries 1] = 2
         Change Items: [Black Berries] + Variable [002: Berries 2]
    Branch END
    Conditional Branch: Variable [001: Berries 1] = 3
        Change Items: [Purple Berries] + Variable [002: Berries 2]
    Branch END
    Conditional Branch: Variable [001: Berries 1] = 4
        Change Items: [Orange Berries] + Variable [002: Berries 2]
    Branch END
    Control Self Switch [A] ON
When [no]
    Text: Come back later
Branch END

JFloyd

I have pk so things look different, i get the concept, but ive never used variables...

modern algebra

Two tutorials. One by me, one by Yami. Variables are incredibly useful. Learn to use them or else your first born child will be afflicted with a random, but life-threatening, disease.

http://rmrk.net/index.php/topic,11826.0.html
http://rmrk.net/index.php/topic,14157.0.html

JFloyd

Ok.....variables isnt helping.....
I had it set to random 5/10 and i only got 1 berry....
I cant get the hang of them

modern algebra

you probably added the wrong variable i'd think. See if that's the problem. If not, I'll post a demo

JFloyd

Could I pm my game to you?
It'll have what i did in it.

modern algebra


JFloyd

Dont feel like using an upload site...

modern algebra

I'll get it when I am back home. Expect it back in about an hour.