Hello! So, I'm working on a game where once you obtain a certain amount of currency, you can go to a location, and summon new allies to fight. The only problem is, how do I make what ally you get random? There will be a lot of different allies in the possible list of summons, so how would I go about setting up those variables?
Random Variables
RPG Maker MV SupportCould you describe what you're looking for a little more?
To create a random variable, all you need to do is go under the control variable section, create a variable (i prefer to name it as if it was a dice so a D10 would be a variable name I would use for a random variable I wanted to pick a random number between 1-10), choose set for operation, and choose random x ~ y (e.g. 1 ~ 10) for the random number.
Without knowing more of what you're trying to do, it's hard to say what should come next. Taking a stab in the dark, I would say you could set up a parallel event which checks to see which random number was chosen for the random variable, and turns on a switch connected to a specific ally while another event provides the ally connected to that switch.
To create a random variable, all you need to do is go under the control variable section, create a variable (i prefer to name it as if it was a dice so a D10 would be a variable name I would use for a random variable I wanted to pick a random number between 1-10), choose set for operation, and choose random x ~ y (e.g. 1 ~ 10) for the random number.
Without knowing more of what you're trying to do, it's hard to say what should come next. Taking a stab in the dark, I would say you could set up a parallel event which checks to see which random number was chosen for the random variable, and turns on a switch connected to a specific ally while another event provides the ally connected to that switch.
Basically, here's an example.
Say I have 20 different possible allies for you to summon. Your character gains enough to summon, and has a random chance to get any one of those allies, and then the summon ends. I basically need to know, how would I set up the event that decides what random ally I get, and how do I attach that variable to an ally.
I've not got anything at all set up as I have no idea how to even start with it. I'm also about to go to sleep so I can't do much right now.
Here are a few videos that talk briefly about summoning:
If you combine these basic ideas with my example, so instead of creating a generic summon common event as RPGDon does in the shorter video you could try the extended variable method - where the skill runs the common event which first sets a variable to a random number and then runs through a series of if, else branches where each of the possible random numbers is tied to a specific summon and then that summon is selected. Having tested this, I can tell you it does work, though there are probably better methods. Also, it creates additional complications you'll have to control for like what if you decide to summon multiple times? So you might want to add a learn/forget (change) skill variable. For example, put a forget skill at the end of the summon common event and a learn skill in the battle over map event to make the skill one time use.
Still, without knowing more of what you would like to happen, hopefully this will point you in the right direction. Here is a picture of the common event I used for summoning (s1-s5 were quick actors I created to test it).

But thatway he dont get an Actor if a number is the same than in the last random char sumoning/party member gaining.
If Variable "All Heroes Archieved" is 10
if yes: exit event processing (this prevents an endless loop in case all heroes are archieved)
Label: "retry"
Control VariableX Random 1 to 10
Conditional Branch VariableX is 1
Conditional Branch Switch 1 is OFF
If yes: Add character1 Variable "All Heroes Archieved" add 1, turn switch 1 to ON and do your stuff
else: Jump to Label "retry"
Conditional Branch VariableX is 2
Conditional Branch Switch 2 is OFF
If yes: Add character2,Variable "All Heroes Archieved" add 1, turn switch 2 to ON and do your stuff
else: Jump to Label "retry"
If Variable "All Heroes Archieved" is 10
if yes: exit event processing (this prevents an endless loop in case all heroes are archieved)
Label: "retry"
Control VariableX Random 1 to 10
Conditional Branch VariableX is 1
Conditional Branch Switch 1 is OFF
If yes: Add character1 Variable "All Heroes Archieved" add 1, turn switch 1 to ON and do your stuff
else: Jump to Label "retry"
Conditional Branch VariableX is 2
Conditional Branch Switch 2 is OFF
If yes: Add character2,Variable "All Heroes Archieved" add 1, turn switch 2 to ON and do your stuff
else: Jump to Label "retry"
I think you guys might be mis-understanding me. You don't summon them in a fight and then they leave. Here's another example. Say you start with one "summon" in your party, and then you obtain enough currency to summon again, for a permanent ally. It's completely random what ally you obtain. I just need an event that activates once you talk to some one, and then you get a completely random ally. Although, abishaigames1 is on the right track I think. I forgot to mention, It's fine if you summon the same person in a row, That's the random aspect.
Additionally, summoning a second time is perfectly fine, because all this event should be doing is adding someone to your party.
Additionally, summoning a second time is perfectly fine, because all this event should be doing is adding someone to your party.
Perhaps the word summon is the problem. I understand that in your game's world it is a 'summon' but could the more general term of follower apply? Let's say for example, that I make a game where your main character is a soldier. He goes around and fights things. He can hire mercenaries to fight with him. To hire a mercenary he walks up to the mercenary temp agency and talks to a person who says, "Hire a mercenary for 20 gold?" If you say yes, a random mercenary joins your party for good (or for a limited time, it doesn't really matter) and is part of your party regardless of where your party is (overworld, outside, inside, in battle, etc.).
If this is the case, the follow up question is do you want the summon (mercenary in my example) to have randomized stats, or to be randomly selected from an existing list of summons you've already created? Also, are you limiting the number of summons (i.e. the new summon replaces the old summon) or does each summon get added (so now you have two summons). I don't know how to do the randomized stats, but if you wanted your ally to be randomly selected from an existing list of allies, you could use my common event example and modify it slightly. Just create whatever event/person you want to be the 'summoning' event, set a requirement for the amount of gold, and then add my variable chain from the common event pictured above. If you want a resummons to replace the old summon, you could do this by adding at the start of the event a chain of remove party members which removes all possible summons, so that paying for a new summon removes any current one you have. If you want summons to be added there are a number of other things you would have to consider.
Ah yes, you have a great example with the mercenaries. That's more what I mean. As for the second part of your question, I have everything else figured out. Your example that you previously posted with the common event is truly what I needed. Thank you for the help!
Ignore the box below, It will not go away.
@Snazzler: To get a random something, you need a sequence of one control variable command and a number of several conditional branches. It doesn't matter where or what you want to achieve, could be actor joining, item gained, enemy to fight or whatever.
First you make a control variable with a random result like described above.
Then, for each possible result, you use one conditional branch checking if that result was rolled (cour be either a single number or a range of numbers).
If the conditional is true, that result will be placed inside that conditional branches true branch - wether adding another actor (like you seam to want) or whatever.
However, be default each actor can only be added once - if you want the possibility of getting an actor more than once, you either have to provide the same data multiple times in the database (only pretending to get the same result by tricky eventing), or you'll need a clone actor script/plugin.
First you make a control variable with a random result like described above.
Then, for each possible result, you use one conditional branch checking if that result was rolled (cour be either a single number or a range of numbers).
If the conditional is true, that result will be placed inside that conditional branches true branch - wether adding another actor (like you seam to want) or whatever.
However, be default each actor can only be added once - if you want the possibility of getting an actor more than once, you either have to provide the same data multiple times in the database (only pretending to get the same result by tricky eventing), or you'll need a clone actor script/plugin.
I think I have it all figured out now, thank you to everyone. abishaigames1 made an excellent example in one of her previous posts. I have the result I want now, being able to "hire" new allies, and still get some you've already summoned(which is bad luck).
I forgot one last thing, is there any way I can create a party that doesn't have the actor shown on screen in it?
Use Eventcommand change player graphic, than the on Map Player is not equal the Graphic of Group Member1.
Original thread: https://forums.rpgmakerweb.com/threads/random-variables.62717/