From 7997abb62a551caeaf227f69023964b0eecced35 Mon Sep 17 00:00:00 2001
From: Reid <reidyaro@gmail.com>
Date: Fri, 29 Apr 2016 01:43:26 +0200
Subject: Improve the goodbye() function and add goodbye_msg() function that
 stores every goodbye-lines.

---
 npc/functions/goodbye.txt | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/npc/functions/goodbye.txt b/npc/functions/goodbye.txt
index c23aeeac..c02f40ec 100644
--- a/npc/functions/goodbye.txt
+++ b/npc/functions/goodbye.txt
@@ -6,23 +6,28 @@
 // Variables:
 //    .@rand = Random number between the number of "goodbye" choice.
 
+function	script	goodbye_msg	{
+    setarray .byemsg$[0], l("See you!"),
+                          l("See you later!"),
+                          l("See you soon!"),
+                          l("Bye!"),
+                          l("Farewell."),
+                          l("Bye then!"),
+                          l("Goodbye."),
+                          l("Bye for now."),
+                          l("Talk to you soon!"),
+                          l("Talk to you later!"),
+                          l("Have a good day!"),
+                          l("Cheers!"),
+                          l("Take care!");
+
+    return .byemsg$[rand(getarraysize(.byemsg$))];
+}
+
 function	script	goodbye	{
     closedialog;
 
-    .@rand = rand(13);
-    if (.@rand == 0) npctalk3 l("See you!");
-    if (.@rand == 1) npctalk3 l("See you later!");
-    if (.@rand == 2) npctalk3 l("See you soon!");
-    if (.@rand == 3) npctalk3 l("Bye!");
-    if (.@rand == 4) npctalk3 l("Farewell.");
-    if (.@rand == 5) npctalk3 l("Bye then!");
-    if (.@rand == 6) npctalk3 l("Goodbye.");
-    if (.@rand == 7) npctalk3 l("Bye for now.");
-    if (.@rand == 8) npctalk3 l("Talk to you soon!");
-    if (.@rand == 9) npctalk3 l("Talk to you later!");
-    if (.@rand == 10) npctalk3 l("Have a good day!");
-    if (.@rand == 11) npctalk3 l("Cheers!");
-    if (.@rand == 12) npctalk3 l("Take care!");
+    npctalk3 goodbye_msg();
 
     close;
 }
-- 
cgit v1.2.3-70-g09d2