a whole list of conditions?

Hi there,


If the answer has already been covered, I apologize in advance. 


Here's my dilemma! I'm trying to create situations where a randomly assigned variable will be called in a given event, and that value will trigger one of a handful of responses.  I believe I understand how to make random variables call in an event.  However, the only way I know how to use that data( the variable randomly called) is to make a chained series of  conditions, where the 'else' statement is just another nested 'if' statement. 


For example, I have an event that I want to call up 1 of 10 random actions.  It rolls a 4.  my event chain reads like: if 1, then A, else (if 2 then B, else (if 3 then C, else (if 4, then D, else))))


In the game I'm making, I want random events to occur each day, the event called is the new day event, and it would randomly grab one of these things to hit the player with.  This gets miserable when I want to have 30+ random things that could happen on a given day.  It can be done, but i feel like my lack of programing understanding is making this problem a lot harder than it needs to be. Can someone suggest a better way to do this?  If it requires specific scripting, if you could provide an explanation or a link to a tutorial, i would appreciate it.  It's such a specific thing I haven't had much luck searching it out online ._.
Just use the "If" part - you can uncheck a box at the bottom that says "set handling when conditions do not apply" to remove the else part. So then you will have a neat list of "If = 1, do ...", "If = 2, do ...".
If your Events are Common Events (could be called, then, from any Map...), one may call a Common Event using a line of Script...


$gameTemp.reserveCommonEvent(n);


...where 'n' is the ID of the Common Event. If the Common Events are created using a range of consecutive ID's, then a Random Number generated for one of these ID's could call a Random Common Event. Supposing 30 Common Events, numbered from 21 to 50. Generating a Random Number from 21-50 (using Variable ID #0012,  "Rand_Even"...) might bring up, say, 43. Using, then, this Variable on the Script call, we'd have...


$gameTemp.reserveCommonEvent($gameVariables.value(12));


...which would take the Random Number found in Variable 12, and thus call Common Event 43. Any (reasonable...) number of Common Events could be called in this way.


Hope this helps.
While this would work, OP would still have to create all the random things that could occur, there's really no getting around that.
True indeed, although, depending on exactly what's required, sometimes Maths can help out there, too. As an example, I have NPC's which will give a random reply consisting of 2 phrases. Yes, I had to create the phrases, but I made 2 sets of 10 sets of 10 phrases. The first phrase is randomly chosen, firstly from a set of 10, then as one of that 10. The second phrase is chosen, equally randomly, firstly from the second set of 10, then as one of that 10. This gives a very low probability that any NPC encounter gives the same conversation as another. So from having written 200 phrases (and made them compatible, so as not to be complete nonsense, or contradictory, such as 'Hello' followed by 'Goodbye'..!), I've a quite rich inter-action with the NPC's. Interspersed in the phrases are various clues, or encouragements for the Player. It's certainly better than individual conversations 'hard-wired' into each NPC..!


Just sayin'.
wow, thank you for these suggestions!   I will definitely give them a try. 🙂
R91KekF.gif

Original thread: https://forums.rpgmakerweb.com/threads/a-whole-list-of-conditions.68957/