Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Horror Story Teller NPC

Junior Spellweaver
Joined
Jul 19, 2011
Messages
152
Reaction score
2
Fun NPC that tells horror stories. (11 Stories, you can add your own ofcourse.)
Just for entertainment nothing big. :): For the bored Mapler that just sits there. :)

Looks a lot better in the NPC ofc.

Code:
/* Story Teller NPC. Author: King from YoungMS. */

var status = -1; 

function start() 
{ 
    status = -1; 
    action(1, 0, 0); 
}

function action(mode, type, selection) { 
    if (mode == 1) 
    status++; 
    else
    status--;
    if (status == -1) {
        cm.dispose();
    } else if (status == 0) { 
    cm.sendSimple("#rWhich story would you like to read?\r These are all real stories! #b\r\n#L0#Three in one. \r\n#L1#Wristbands. \r\n#L2#The Girl In The Photograph. \r\n#L3#Device for self-beheading. \r\n#L4#5 in one.");
    } else if (status == 1) {
    if (selection == 0) {
    cm.sendOk("#rThree stories in one #g \r\n\r\n\Pretending to be asleep doesnt work.#b\r A young boy is sleeping in his bed on a usual night.\r He hears footsteps outside his door, and peeks out of his eyes to see what is happening.\r His door swings open quietly to reveal a murderer carrying the corpses of his parents. After silently propping them up on a chair, he writes something on the wall in the blood of the dead bodies.\r He then hides under the childs bed.\r The child is scared beyond belief.\r He cant read the writing on the wall and he knows the man is under his bed.\r Like any child, he pretends that he slept through the whole thing and hasnt awoken yet.\r He lays still as the bodies, quietly hearing the breathes from under his bed.An hour passes, and his eyes are adjusting more and more to the darkness.\r He tries to make out the words, but its a struggle. He gasps when he finally makes out the sentence.I know youre awake.\r He feels something shift underneath his bed. \r \r #gMommys home.#b\r I heard one, a father is laying in bed after just waking up, he grabs the baby monitor and walks to his desk in his office at home.\r He has his baby on the baby monitor and hears his wife singing to her.\r He cracks a smile as he hears his wife Go to sleep... go to sleep...\r When suddenly the front door opens up and his wife comes in with groceries. \r \r #gWhatss in the basement?\r #bMommy told me never to go in the basement, but I wanted to see what was making that noise.\r It kind of sounded like a puppy, and I wanted to see the puppy, so I opened the basement door and tiptoed down a bit.\r I didnt see a puppy, and then Mommy yanked me out of the basement and yelled at me.\r Mommy had never yelled at me before, and it made me sad and I cried.\r Then Mommy told me never to go into the basement again, and she gave me a cookie.\r That made me feel better, so I didnt ask her why the boy in the basement was making noises like a puppy, or why he had no hands or feet.");
cm.dispose();
    } else if (selection == 1) {
    cm.sendOk("#rWristbands #b\r When you are admitted to a hospital, they place on your wrist a white wristband with your name on it.\r But there are other different colored wristbands which symbolize other things.\r The red wristbands are placed on dead people.There was one surgeon who worked on night shift in a school hospital.\r He had just finished an operation and was on his way down to the basement.\r He entered the elevator and there was just one other person there.\r He casually chatted with the woman while the elevator descended.\r When the elevator door opened, another woman was about to enter when the doctor slammed the close button and punched the button to the highest floor.\r Surprised, the woman reprimanded the doctor for being rude and asked why he did not let the other woman in.\r The doctor said: That was the woman I just operated on. She died while I was doing the operation didnt you see the red wristband she was wearing?\r The woman smiled, raised her arm, and said, Something like this?");
cm.dispose();
    } else if (selection == 2) {
    cm.sendOk("#rThe Girl In The Photograph #b \r\n\r\n\One school day, a boy named Tom was sitting in class and doing math.\r It was six more minutes until after school.\r As he was doing his homework, something caught his eye.His desk was next to the window, and he turned and looked to the grass outside.\r It looked like a picture. When school was over, he ran to the spot where he saw it.\r He ran fast so that no one else could grab it.He picked it up and smiled. It had a picture of the most beautiful girl he had ever seen.\r She had a dress with tights on and red shoes, and her hand was formed into a peace sign.\r She was so beautiful he wanted to meet her, so he ran all over the school and asked everyone if they knew her or have ever seen her before.\r But everyone he asked said No. He was devastated.When he was home, he asked his older sister if she knew the girl, but unfortunately she also said No.\r It was very late, so Tom walked up the stairs, placed the picture on his bedside table and went to sleep.In the middle of the night Tom was awakened by a tap on his window.\r It was like a nail tapping. He got scared.\r After the tapping he heard a giggle.\r He saw a shadow near his window, so he got out of his bed, walked toward his window, opened it up and followed the giggling.\r By the time he reached it, it was gone.\r The next day again he asked his neighbours if they knew her.\r Everybody said, Sorry, no.\r When his mother came home he even asked her if she knew her.\r She said No.\r He went to his room, placed the picture on his desk and fell asleep.\r Once again he was awakened by a tapping.\r He took the picture and followed the giggling.\r He walked across the road, when suddenly he got hit by a car.\r He was dead with the picture in his hand.\r The driver got out of the car and tried to help him, but it was too late.\r Suddenly he saw the picture and picked it up.\r He saw a cute girl holding up three fingers.");
cm.dispose();
    } else if (selection == 3) {
    cm.sendOk("#rDevice for self-beheading.\r \r #bA man beheaded himself using pretty tricky device specifically developed for this purpose.\r Sounds like the veriest nonsense or a plot of low budget horror film.\r Nonetheless, thats the way it actually happened.\r In 2011 the wife of one of the citizens of Yorktown (Virginia, USA) turned her husband out of doors.\r He attached family trailer to his car and stuffed all his goods and chattels there.\r Then he drove off the house several districts away.. and set the trailer on fire.\r Heaven-sent police found the trailer on fire and the cast-off spouse locked in the car.\r There someone turned attention to wire that glanced around the mans neck.\r It turned out it extended from the car window to the nearest tree about 10 meters away.\r Before policemen responded, the man hit the gas pedal and... lost his head.");
cm.dispose();
    } else if (selection == 4) {
    cm.sendOk("#gDaddy? Check under my bed. #b\r I begin tucking him into bed and he tells me, Daddy check for monsters under my bed.\r I look underneath for his amusement and see him, another him, under the bed, staring back at me quivering and whispering, Daddy theress somebody on my bed.\r \r #gI can't move.\r #bI cant move, breathe, speak or hear and its so dark all the time.\r If I knew it would be this lonely, I would have been cremated instead.\r \r #gAnyone?\r #bThere was a picture in my phone of me sleeping.\r I live alone.\r \r #gMom? I mean other mom?.\r #bYou hear your mom calling you into the kitchen.\r As you are heading down the stairs you hear a whisper from the closet saying: Don't go down there honey, I heard it too.\r \r #gMiauw. \r #bI always thought my cat had a staring problem, she always seemed fixated on my face.\r Until one day, when I realized that she was always looking just behind me.");
cm.dispose();
        }
    }
}
 
Last edited:
Skilled Illusionist
Joined
Aug 16, 2010
Messages
346
Reaction score
109
Why not store the stories in an array? It'll make it cleaner to add new stories. Just call cm.sendOk(stories[selection]);
 
return null;
Loyal Member
Joined
Dec 21, 2008
Messages
805
Reaction score
130
Consider saving the stories in a file, database or parse and load them from a website so it becomes easier to manage, especially when you have longer stories.:):
 
Skilled Illusionist
Joined
Aug 16, 2010
Messages
346
Reaction score
109
Consider saving the stories in a file, database or parse and load them from a website so it becomes easier to manage, especially when you have longer stories.:):

And we could use

Code:
SELECT * FROM stories ORDER BY RAND() LIMIT 1

to get a random story.

Have an SQL table that stores:
1) Story title
2) Story text

Optional:
3) Likes
4) Dislikes
5) Creation time

Then we can sort by newest stories, most liked, or just get a random story for players to read.

Then you'll need to add commands to NPCConversationManager, getRandomStories(int amount), getTopStories(int amount), getRecentStories(int amount).

Return the stories in an array:
{{story1Title, story1Text, likes, dislikes, creationTime},
{story2Title, story2Text, likes, dislikes, creationTime},
{story3Title, story3Text, likes, dislikes, creationTime}...

Store the story index if required, so players can retrieve a story they like.

Allow for user submissions, preferably via the website to add directly to the database. Or it could be manually input through forums.

There's a lot you can do with a system like this to be honest. If you're willing to try.
 
Supreme Arcanarch
Joined
Apr 1, 2012
Messages
946
Reaction score
329
And we could use

Code:
SELECT * FROM stories ORDER BY RAND() LIMIT 1

to get a random story.

Have an SQL table that stores:
1) Story title
2) Story text

Optional:
3) Likes
4) Dislikes
5) Creation time

Then we can sort by newest stories, most liked, or just get a random story for players to read.

Then you'll need to add commands to NPCConversationManager, getRandomStories(int amount), getTopStories(int amount), getRecentStories(int amount).

Return the stories in an array:
{{story1Title, story1Text, likes, dislikes, creationTime},
{story2Title, story2Text, likes, dislikes, creationTime},
{story3Title, story3Text, likes, dislikes, creationTime}...

Store the story index if required, so players can retrieve a story they like.

Allow for user submissions, preferably via the website to add directly to the database. Or it could be manually input through forums.

There's a lot you can do with a system like this to be honest. If you're willing to try.

writing a story in sql ew
 
Newbie Spellweaver
Joined
Mar 29, 2014
Messages
91
Reaction score
8
Something that hasn't been suggest yet is seperating the stories in parts and sending them via sendNext, much easier reading that rather than a huge wall of text.
 
Newbie Spellweaver
Joined
May 3, 2014
Messages
90
Reaction score
4
Something that hasn't been suggest yet is seperating the stories in parts and sending them via sendNext, much easier reading that rather than a huge wall of text.


That would make it so much easier to read and not an eyesore lol.
 
Newbie Spellweaver
Joined
Mar 29, 2014
Messages
91
Reaction score
8
Doesn't NPC chat automatically add a scroll bar when the text starts to get long?
I don't know about other people, but personally when I read long walls of text I tend to accidentally read the same line more than once.
Look at this now:
Artjom - Horror Story Teller NPC - RaGEZONE Forums


and look at this with sendNext
Artjom - Horror Story Teller NPC - RaGEZONE Forums
 
Skilled Illusionist
Joined
Aug 16, 2010
Messages
346
Reaction score
109
I don't know about other people, but personally when I read long walls of text I tend to accidentally read the same line more than once.
Look at this now:
Artjom - Horror Story Teller NPC - RaGEZONE Forums


and look at this with sendNext
Artjom - Horror Story Teller NPC - RaGEZONE Forums

I see what you mean. But to be fair the text in the first image has a different formatting that the second.

Try adjusting the first image's text into paragraphs, and separate the paragraphs with an empty line.

Edit: Never mind it's the same formatting.

Alternatively just store each story as an array, or just use delimiters, and let the script split them on the spot.
 
Back
Top