Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**<
- * Tutorial showing how to use the "Say" menu from dialogues.
- * Author: Slowhand.
- */
- #include "_defines.fos"
- #include "_macros.fos"
- /**<
- * This simple script will repeat what you say to it, using the Say menu.
- */
- uint dlg_UsingSayDialogue(Critter& player, Critter@ npc, string@ say)
- {
- // Check if the player used the Say dialogue menu said something, if not, return to this same dialogue node.
- if (!IS_DIALOG_SAY_MODE(say))
- return 0;
- // The text the player gave, will be stored in the say paramter of the function, and this is used to say it back.
- player.Say(SAY_DIALOG, "You said: " + say
- + " using the Say menu. If you want to try again, just press Say or try the given dialogue options.");
- // Returning 0, will call the same dialogue node again, this means,
- // that the player can type a text using the "Say" menu and the NPC will quote him again.
- // If you need to jump to a different dialogue, just return the node number, or -1 to exit form dialogue screen.
- // Note: You should use defines for jumping to dialogue nodes, instead of numbers, unlike I did.
- return 0;
- }
- /**<
- * It will ask the user a riddle, which he has to answer using the Say dialogue menu.
- * The question in the dialogue file is: What turns around everything, yet does not move?
- * The answer, as specified below is: Mirror or mirror.
- * If the player does not answer correctly, he can try again.
- */
- uint dlg_AskRiddle(Critter& player, Critter@ npc, string@ say)
- {
- if (!IS_DIALOG_SAY_MODE(say))
- return 0;
- if (say == "Mirror" || say == "mirror")
- {
- // Jump to dialogue node 4, congratulates the player for guessing the correct answer.
- return 4;
- }
- else
- {
- player.Say(SAY_DIALOG, say + "? This is not the answer I was looking for! Try again.");
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement