Closed Periwinks closed 5 years ago
Okay, solution accepted.
For NPC scripts, to add pieces of information on next windows you use what is called the talk status
. Let's assume the NPC Base script, slightly modified like this:
var status;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && type > 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if(status == 0) {
cm.sendNext("Sample text.");
} else if(status == 1) {
cm.sendNextPrev("More sample text.");
} else if(status == 2) {
cm.sendYesNo("Understood?");
} else if(status == 3) {
cm.sendOk("Bye~");
cm.dispose();
}
}
}
From there, a few points can get made:
When the player inputs click on Ok, Next buttons, if (mode == 1) status++;
will get triggered, this means an increase on the next time the script runs. The No button, as expected, decrease the status for the next run time.
The script will run again as many times the player inputs a response or until cm.dispose()
happens or an if status <number>
is not caught -- e.g. status 4, it doesn't exist in the script above, but again the script disposes at status 3.
Also note, whenever cm.dispose();
happens, that's the main condition point for the script to finish the NPC conversation.
Hope to have made this clear for you... Thanks for contributing!
Background
Info
Additional notes / follow up
I'm new to all of this :sweat_drops:, so if this isn't the best way to do it, let me know and I hope to do it right next time! :grin: (such as adding it in a next window rather than being squishied into the same one) :cake: