How to make NPC say different sentence everytime it is interacted?

Mactadilis

Villager
Member
Joined
Jan 6, 2019
Messages
10
Reaction score
2
First Language
Croatian
Primarily Uses
RMMV
I'm having a jester actor in town, who is making jokes. He has 100 jokes. Everytime player interacts with him, he tells a joke and interaction ends. Then, if player wants to hear another joke, he needs to walk again to jester and interact with him. But this time, it needs to be second joke. And so on until it reaches 100 jokes and jester will leave. I know i need variables to do this. And I've done it with variables and conditions, but I've only managed to made it do random number joke, which is something I don't want. (I need this for story which needs "hear every joke from jester". So I'm brain stuck right know. Anyone has any idea how to program this? Thank you very much.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,542
Reaction score
6,874
First Language
German
Primarily Uses
RMMV
use a variable to count how often he has been talked to, and conditional branches to react based on the number stored in the variable
basically each conditional branch needs to tell the joke and then increase number by one, and you need to start checking the highest number.

if var = 100 exit event processing
if var = 99 tell joke 99 and var +1
if var = 98 tell joke 98 and var +1
and so on
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,350
Reaction score
332
First Language
German
Primarily Uses
RMMV
I believe what Andar ment was:

if var = 0 tell joke 1 and var +1 +Exit Event Procesing (<--This to Skip the rest of the Event)
if var = 1 tell joke 2 and var +1 +Exit Event Procesing
and so on
if var = 100 Textbox: I told you all my Jokes

Edit: Ah now i understand why @Andar started with the highest number^^ if i dont insert exit event processing, he would tell me all 100 jokes in a row. What a starter mistake of mine =). I dont delete my example because than OP got 2 possible solution ways and sees that things can have more than one Way at times.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,617
Reaction score
3,791
First Language
English
Primarily Uses
RMMV
Like everyone else said, the variable method. 100 is a lot though lol.
 

Mactadilis

Villager
Member
Joined
Jan 6, 2019
Messages
10
Reaction score
2
First Language
Croatian
Primarily Uses
RMMV
And how do i check how many times he has been talked to? +1 to variable at start?

Edit: That worked, but exit event processing now, doesen't work. I can't interact him after exit event processing. And if i don't put that, he just tells them all
 
Last edited:

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,617
Reaction score
3,791
First Language
English
Primarily Uses
RMMV
Put the condition for 100 at the top, then go down (meaning in the event page, the first conditional branch would be var == 100, the second would be var == 99, then var == 98, etc.) At the end of the event page, after the 100 conditional branches, add a last condition branches with a condition that is (if var == 0). Inside it, set var to 100, and in the else part add +1 to var.
 

Mactadilis

Villager
Member
Joined
Jan 6, 2019
Messages
10
Reaction score
2
First Language
Croatian
Primarily Uses
RMMV
Got it, works like a charm! Thank you all for your awesome and smart help! Now, anyone got some jokes? :kaoangry:
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,617
Reaction score
3,791
First Language
English
Primarily Uses
RMMV
Your welcome!

Just curious though, did you really create 100 different dialogues?
 

Mactadilis

Villager
Member
Joined
Jan 6, 2019
Messages
10
Reaction score
2
First Language
Croatian
Primarily Uses
RMMV
No, just 5 for test. Though I'm thinking 100 is a bit too much work :D
 

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

Latest Threads

Latest Posts

Latest Profile Posts

My new animated paths are beautiful, and look fantastic next to my improved lake/river maps. :LZSexcite:

My sister is a saint. Specifically Saint Peter. Because shes my best friend until other ppl are around then shes all "nope, dont know him, dont like him."
Making it a rule that I don't do any world building for my new game before the actual gameplay is concrete and working. I have 16 years of lore to work with anyway.

Forum statistics

Threads
95,699
Messages
931,141
Members
126,051
Latest member
LordAwesome
Top