Message Percentages

So. Interesting idea that I cannot figure out how to implement for the life of me.
Dialogue with NPCs that work with a percentage. Example!
Let's say Sally is a normal woman NPC. She has no special dialogue normally. Just a 'Hello PC! How's you're day?'.
With the percentage she would have multiple chances of different phrases to say, making the NPCs seem more intuitive.
For instance, she may have four different phrases with 20% chances for each, or even more.
The only issue is how to do it? I do have YanFlys Message Core and all its expansions.
Still have no idea. Help, please?

I've moved this thread to MV support. Thank you.



Use a variable. Set the variable to a random value at the start of the event, then a conditional branch which displays a message depending on what the variable is.
Moved to: MV support

Use a variable. Set the variable to a random value at the start of the event, then a conditional branch which displays a message depending on what the variable is.
Huh. Thanks. I'll have to try that. And I'm so sorry. I haven't actually posted on here before. I didn't know where to go. I mostly signed up for the resources to be honest. First time I've actually used the forums.
You can also just set the game variable to a random string/text then on the message box just use \V[variable id] to show the text on the variable, no need for conditional branches.
You can also just set the game variable to a random string/text then on the message box just use \V[variable id] to show the text on the variable, no need for conditional branches.
Okay, thanks. I'll try this one too. Willing to try anything at this point. Eating right now, will dig back into it in a mo. Wanna try to keep you all updated on what works.
bg's method would be easier to implement and format though, so try that first 🙂
It's not working. Sigh. I don't know if I'm explaining this idea well enough. Everything I'm trying keeps showing up with an error or showing all options one after the other, instead of one or another. I'm thinking the closest way to explain it would be rolling a dice to see what dialogue you have, but using percentages.
The result I want to see is talking to the same person three or four times and getting different dialogue or nearly different each time.
Show us the picture of your event so that we can help you to troubleshoot it
Okay, so what do you mean by random variable exactly? I am fairly new to the coding part. I've got my branches, and now all its doing is showing one message. Sigh.
I can't win for losing. And I would, but I'm using my phone to talk on here. Have no way to do a screenshot and my cellphone camera sucks.
You can use Control Variables > Set > Random to store a random value in a variable, then use Conditional Branch commands to check that variable's value, e.g.
Code:
◆Control Variables:#0001 random% = Random 1..100
◆If:random% ≤ 50
  ◆Comment:50% chance
  ◆
:Else
  ◆If:random% ≤ 80
    ◆Comment:30% chance (80 - 50)
    ◆
  :Else
    ◆Comment:20% chance (100 - 80)
    ◆
  :End
  ◆
:End
You can use Control Variables > Set > Random to store a random value in a variable, then use Conditional Branch commands to check that variable's value, e.g.
Code:
◆Control Variables:#0001 random% = Random 1..100
◆If:random% ≤ 50
  ◆Comment:50% chance
  ◆
:Else
  ◆If:random% ≤ 80
    ◆Comment:30% chance (80 - 50)
    ◆
  :Else
    ◆Comment:20% chance (100 - 80)
    ◆
  :End
  ◆
:End
So, it will make it as far as...hold up...
Code:
◆Control Variables : #0001 random% = Random 0..50
◆If : random% ≤ 80
  ◆Text : People(1), Window, Bottom
  :        :Hi, I'm Sally
◆
: Else
  ◆Text : People(1), Window, Bottom
  :        :Hello!
  ◆
: End
◆
When I try to do
Code:
: Else
◆If : random% ≤ 80
  ◆Text : People(1), Window, Bottom
  :        :Hello!
◆
To continue the next line, it stops responding at all. Changing it to
Code:
: Else
◆If : random% ≤ 81
makes it where only the "Hi, I'm Sally" shows up at all.
Btw. Yay! Code thingy. Makes life easy since I'm kinda out of luck on a screenshot
Ha, thought of an idea for the screenshot. Man, was i tired yesterday.
Screenshot (108).png

The last one is me attempting to get it to 100%, and I raised to from 50 to 100 random, cause I'm a blonde. Sigh
OK, that will only show "Hi, I'm Sally", or nothing. That's because if the variable value is less than or equal to 80, the first branch will be true and the others will be skipped; otherwise none of the branches will be true. 😅

Consider changing the numbers for the branches, kind of like my example. If you want each outcome to be equally likely, something like this may be easier to understand:
Code:
◆Control Variables:#0001 random = Random 1..3
◆If:random = 1
  ◆Text:People1(1), Window, Bottom
  :    :Hi, I'm Sally
  ◆
:Else
  ◆If:random = 2
    ◆Text:People1(1), Window, Bottom
    :    :Hello!
    ◆
  :Else
    ◆Text:People1(1), Window, Bottom
    :    :Hi, how are you?
    ◆
  :End
  ◆
:End
This sets the variable to a random number: 1, 2, or 3. Then you'll see "Hi, I'm Sally" if the variable is 1, "Hello!" if the variable is 2, or "Hi, how are you?" otherwise. 😤
OK, that will only show "Hi, I'm Sally", or nothing. That's because if the variable value is less than or equal to 80, the first branch will be true and the others will be skipped; otherwise none of the branches will be true. 😅

Consider changing the numbers for the branches, kind of like my example. If you want each outcome to be equally likely, something like this may be easier to understand:
Code:
◆Control Variables:#0001 random = Random 1..3
◆If:random = 1
  ◆Text:People1(1), Window, Bottom
  :    :Hi, I'm Sally
  ◆
:Else
  ◆If:random = 2
    ◆Text:People1(1), Window, Bottom
    :    :Hello!
    ◆
  :Else
    ◆Text:People1(1), Window, Bottom
    :    :Hi, how are you?
    ◆
  :End
  ◆
:End
This sets the variable to a random number: 1, 2, or 3. Then you'll see "Hi, I'm Sally" if the variable is 1, "Hello!" if the variable is 2, or "Hi, how are you?" otherwise. 😤
It worked! Thank you so much!!!
Lol, I've got like four attempted NPCs on my screen. I was afraid to get rid of them, just in case to be honest.

Original thread: https://forums.rpgmakerweb.com/threads/message-percentages.111744/