[Help!] How do I call Random Common Events?

Status
Not open for further replies.

Carri

Veteran
Veteran
Joined
Aug 16, 2013
Messages
35
Reaction score
13
First Language
English
Primarily Uses
I'm working on a small fortune telling script where the player picks a card.  I made a few common events where the picture of the card will pop up on screen and give a message.  I need to make it so the card common event that is shown is random.  And I don't know how to set the code to simply pick a random common event from numbers 1-5.  

I want it to simply be:  Choose your card.  Player chooses a card.  Random Common Event for card pops up.

I can get it to pop up any card common event on its own, and even a few at once, but I need to make this random.  I'm just not doing it right.  This is a screenshot of what I've done so far.

cards1.jpg
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Use a script call

$game_temp.reserve_common_event(rand(5) + 1)This picks a random number from 1 to 5 and calls that common event.This assumes your ID's are 1 through 5.

You probably want

Code:
ids = [2,5,12,19,23]random_id = ids.sample$game_temp.reserve_common_event(random_id)
Where you pick a random ID from the list of ID's and call that common event.
 
Last edited by a moderator:

Liak

Veteran
Veteran
Joined
Mar 13, 2012
Messages
1,788
Reaction score
270
First Language
German
Primarily Uses
If the player picks a card and the result is random, you can also copy everything under "Far Left" to after the end of the choices branch. That way, it doesn't matter what the player picks, it will always give you one of the 4 random results. It's a little strange to lead the player to believe he has a choice if he actually hasn't, but oh well. I think that's how the fortune teller is supposed to work. :)
 

izanamikun

Veteran
Veteran
Joined
Nov 19, 2013
Messages
34
Reaction score
1
First Language
English
Primarily Uses
Or without scripting, you could just use a random variable from the normal eventing system and set conditional branches for each random number chosen to correspond with a different common event.

In your picture, you aren't using conditional branches for the random variable- you are asking the variable to be random and then you have another control variable setting the variable to something else entirely, completely negating the random call feature. You need to use conditional branches there, so the random variable triggers the path you want it to have.

Basically, after your random variable call, change all other control variable commands into conditional branch when variable = x and it should work like you meant it to.

**Although after staring at it again for a moment, I wonder why you don't have a path set for when the random values are 1, 3, and 4 for middle, 1, 2, and 4 for right and 1, 2 and 3 for far right? You will need to set those up too, otherwise nothing will happen if the variable is anything besides the number you have set.
 
Last edited by a moderator:

Carri

Veteran
Veteran
Joined
Aug 16, 2013
Messages
35
Reaction score
13
First Language
English
Primarily Uses
ids = [2,5,12,19,23]random_id = ids.sample$game_temp.reserve_common_event(random_id)Where you pick a random ID from the list of ID's and call that common event.
Thank you!  This worked.  I kind of know what I'm going to do with it now.  I can put timer delays and do a few random cards at a time so the player gets a reading.  I've only coded five cards in so far.  I'm thinking of doing the whole major arcana, 22 cards. 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,848
Messages
1,016,974
Members
137,562
Latest member
visploo100
Top