Nathan: How are you feeling?% Nathan: You look great today!% Nathan: You seem well.% Nathan: Looking good!Nathan: By the way...% Nathan: Did you sleep well?% Nathan: Have you eaten?% Nathan: Are you staying hydrated?
Nathan: Let me tell you something.% Nathan: Did you know that cats sleep 16 hours a day? Nathan: Fascinating, right?% Nathan: Did you know that honey never spoils? Nathan: Ancient honey is still edible!% Nathan: Actually, I forgot what I was going to say.
One of three outcomes:
Both lines about cats (50% chance, weight 1+1=2 lines)
Both lines about honey (50% chance, weight 1+1=2 lines)
Single line about forgetting (25% chance, weight 1)
Actually, random blocks count as a single weighted item each, regardless of their content. So in the example above, each block has equal weight.
% Nathan: This might be said.% Nathan: Or this might be said.% [if player_level > 5] Nathan: Only if level > 5.% [if has_special_item] Nathan: Only if you have the item.
Lines with false conditions are excluded from the random pool.
You can combine randomization with other dialogue features:
~ greeting% Nathan: [#happy] Hello there!% Nathan: [#neutral] Greetings.% Nathan: [#excited] Oh wow, it's you!Nathan: What brings you here today?- I need help % Nathan: I'd be happy to help! % Nathan: Let me see what I can do. % Nathan: Of course, what do you need? => help_menu- Just browsing % Nathan: Take your time! % Nathan: Feel free to look around. => END
Here’s a complete example using various randomization techniques:
~ start# Weighted random greeting%3 Nathan: Hey there!%2 Nathan: Welcome back!% Nathan: Oh, it's you again!# Random question (separate group)% Nathan: How are you today?% Nathan: What's new with you?% Nathan: How have you been?- I'm doing well # Random positive response % Nathan: That's great to hear! % Nathan: Wonderful! % Nathan: I'm glad! => ask_purpose- Not so great # Random sympathetic response % Nathan: I'm sorry to hear that. % Nathan: That's unfortunate. % Nathan: Hope things improve. => ask_purpose~ ask_purposeNathan: Anyway, what can I do for you?- Quest info => random_quest- Shop => shop- Leave => random_goodbye~ random_quest# Random quest with weighted chances%5 => common_quest%3 => uncommon_quest% [if player_level > 10] => rare_quest% => no_quests~ common_questNathan: I have a simple delivery quest.=> END~ uncommon_questNathan: There's a monster that needs slaying.=> END~ rare_questNathan: I have a legendary quest for experienced adventurers!=> END~ no_questsNathan: Sorry, no quests available right now.=> END~ shopNathan: Here's my inventory.# Random shop keeper flavor text% Nathan: Fresh stock today! Nathan: Just got a shipment in.% Nathan: Prices are negotiable. Nathan: For you, special discount!% Nathan: Same old stuff, but it's good stuff.=> END~ random_goodbye% Nathan: See you later!% Nathan: Take care!% Nathan: Safe travels!% Nathan: Come back soon!=> END
Test your weight distributions to ensure they feel right. A 90% weighted option might get repetitive, while a 1% option might never be seen.
# Probably too extreme%90 Nathan: This will get old fast.%10 Nathan: Players rarely see this.# More balanced%3 Nathan: Common greeting.%2 Nathan: Less common greeting.% Nathan: Rare greeting.
Use random blocks for variety
Random blocks are great for creating variations in multi-line sequences:
% Nathan: I love sunny days. Nathan: Perfect weather for adventure!% Nathan: Rain is nice too. Nathan: Keeps things cool.% Nathan: Any weather is fine by me.
Combine with conditions
Use conditions to make random selections context-aware:
% Nathan: Good morning!% [if time_of_day == "afternoon"] Nathan: Good afternoon!% [if time_of_day == "evening"] Nathan: Good evening!% [if time_of_day == "night"] Nathan: Working late?