void ProcessDialogEvent()
{
ref NPChar, PChar, d;
PChar = GetMainCharacter();
aref Link, NextDiag;
DeleteAttribute(&Dialog,"Links");
makeref(NPChar,CharacterRef);
makearef(Link, Dialog.Links);
makeref(d, Dialog);
makearef(NextDiag, NPChar.Dialog);
switch(Dialog.CurrentNode)
{
case "First Time":
d.Text = "Hello, captain! Will you join an old drunkard? I cannot wish you kind morning, Because I went out to take a leak!";
Link.l1 = "(To listen further)";
Link.l1.go = "next1";
Link.l2 = "For a long time I did not belive it, an old drunkard?! Barman! It is time for this person to be freshened!";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next1":
d.Text = "What is the date today, captain? Eh? Not important I know. I knew the person said to me hurry up? No, it is not necessary to answer. It was a rhetorical question!";
Link.l1 = "(To listen further)";
Link.l1.go = "next2";
Link.l2 = "It is time for you to sober up.";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next2":
d.Text = "You decide to keep me company? Look! Bad luck is infectious! You will soon be the same wreck as I!";
Link.l1 = "This does not threaten me, I already knew the risks when I walked into this establishment.";
Link.l1.go = "next3";
Link.l2 = "This is ridiculous! (Go and do something else)";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next3":
d.Text = "Look, captain! Look! Here is a man! Corona of the gods creation! He is pity and drunk, disturbs no one, earns fairly to itself on an old age, to grandsons in diapers. And suddenly, all was changed! By the same foresight, which leaves you without the half gold coin in the purse. It appears, You do believe, captain, but I do not have money even to confess. Are you ready to become my posthumous pastor?";
Link.l1 = "I am preared to hear you out, my son! Go on!";
Link.l1.go = "next4";
Link.l2 = "Barman! Do this poor soul a favor! Give him some fresh air!";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next4":
d.Text = "Here and now! In this dirty tavern, in the God forgotten sea, were angels casting down their golden crowns among these smelly seamen-drunkards. I shall tell you a story, captain. Are you ready to glance into the past and see your the terrible future?";
Link.l1 = "I listen to you, drunkard. Go on!";
Link.l1.go = "next5";
Link.l2 = "(Run! You didn't catch madness from this strange person!)";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next5":
d.Text = "Many years ago I entered as captain for a ship. The commonplace beginning of history, am I correct? But the vessel was very old, legends circulated about it. I have heard one of these rumors in a god forgotten tavern on one of these colonies. I do not remember on what colony. But it is not important. It is more than resembled the anecdote, I was spoken about the first captain of an old tramp on which I then served. During those gray times this I thought was a contemporary fighting ship! Not known to defeat!";
Link.l1 = "I see, you sober in your eyes! Will you tell me about all your life? Can you begin with the secret of your vessel?";
Link.l1.go = "next6";
Link.l2 = "Ach! I wouldn't dare hear your stories, even if I was a pastor. Go and confess to the Lord and save yourself from eternal damnation!";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next6":
d.Text = "In what there was a secret of this vessel, you ask? The Captain did not give an answer. I began to ask an old seaman, who served on my vessel, The first captain of The Dutchman, thus was called the ship on the story of decrepit spinner, he concluded a transaction with Calypso a seagoddess. Such histories are now popular, I know. But you did hear, so that the sea witch would be moved into port and would tempt the captain!";
Link.l1 = "What did Calypso want? How did the captain make a deal with him?";
Link.l1.go = "next7";
Link.l2 = "Excuse me, but it is time for me to go to the ship. Business awaits.";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next7":
d.Text = "Calypso simply wanted to be entertained, but captain it proved to be not oversight! Believe it or not, she did not know what it would do. The son of darkness accustomed to terrestrial joys, has got dependence on Calypso! The captain then married her. Trust it or not, but to be released from this twice vicious communication the she promised to the captain to execute his any desire.";
Link.l1 = "And the captain wished, his ship could never be touched by cannon fire?";
Link.l1.go = "next8";
Link.l2 = "You have bothered me with stories of your imagination! Bartender, give him some water!";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next8":
d.Text = "Yes, captain. Yes! What any person enamoured by the sea could wish! His ship was granted invulnerability with only one payment, to ferry lost souls of the dead and/or dying sailors to the next world in peace. The Captain, after 10 years, when he could come ashore to be with his wife, his wife wasn't there. Engraged and feeling betrayed, he gave up his debt to Calypso and now is forever cursed. The first chance I got I escaped the wretched ship. I was identified at every port I came to, but when I was able to settle down I started seeking my old ship where many of my best mates lost their lives!";
Link.l1 = "Is it all? Do you cry for your shipmates?";
Link.l1.go = "next9";
Link.l2 = "I shall go I shall find and check up on the ship. If it even misses me! Bartender! Get this man some lodgings I'll give ya 20 paisters for a four night stay.";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next9":
d.Text = "No! This is not the end! I served as the fifth first mate of that vessel. As I already spoke, It was an ancient tubby ship. We constantly got into storms! The life on that ship was not sweet. Once after a storm we have appeared near to a tiny island on which an Indian died of famine. To me and it was not possible to achieve from it the answer to the question I seek. It did not know any of the civilized languages. But once at night the body awoke and commanded in terrible shouts! The sailors were so malicious, that they nearly would have thrown it overboard if it weren't for me.";
Link.l1 = "This is getting more interesting by the second! Go on!";
Link.l1.go = "next10";
Link.l2 = "It is necessary for you to go to the doctor, Drunkenness can be a fatal illness! I shall go I shall find somebody.";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next10":
d.Text = "Only by efforts of the captain it was possible to stop them. Better sailors would throw out the native overboard! Then he could not show us what he knew. On a lower deck there was a pantry filled up by old ropes. The native found in that pantry a secret door for which was the captain's sanctuary for Calypso! The native was in horror, he continuously spent hours doing rituals. But what happened next began later! Naturally, all the junk from that room was thrown out to sea. But in the week the native took his own life. Within six months we wandered in the sea on cards for a long time! To fear I had suffered much in those days! All the time I attended the terrible visions, which I fear to recall, and especially to describe.";
Link.l1 = "(To listen further)";
Link.l1.go = "next11";
Link.l2 = "Devils hide behind a mental screen of vain imaginations! I will have the pastor perform an exorcism!";
Link.l2.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "next11":
d.Text = "Thank you captain! Thank you for listening to me. I did not think that to me it would be easier to live after I have told my story. I still was surprised that it was possible to live in general before today! Here. Take this money as my gratitude for that help which you have rendered me. I stored this gold to the funeral, but, I think, I should not yet pass over to the promised land. Here's a paper about the whereabouts of my ship.";
Link.l1 = "Keep your money. We will descend to the priest together and confess before god. All the stigma and stench of sin will be buried, The Father shall save his people from their sins, as the Judge of atonement. I will find this ship that you speak of and bring it back to you. (+20,000 Experience and +10,000 Gold)";
Link.l1.go = "Exp";
Link.l2 = "Thank you kindly sir for letting me listen to your stories. Keep half of what you intend to give me. The rest you shall donate to the pastor. Even a small donation will forgive you of your sins in God's eyes. I will find this ship that you speak of and bring it back to you. (+20,000 Gold and +10,000 Experience)";
Link.l2.go = "Money";
Link.l3 = "Enough! Enough of this madness! Keep your money. You were meant to rot in Lucifer's hot hell forever while you beg your god forgiveness. Bartender! This man needs some coffee. Give him a round on my tab.";
Link.l3.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "Lose":
d.Text = "Do not prevent me to drink for my lost shipmates!";
Link.l1 = "Keep well, drunkard!";
Link.l1.go = "exit";
NextDiag.TempNode = "Lose";
break;
case "Win":
d.Text = "Hello, captain! How is your life?";
Link.l1 = "Perfectly, my friend! Perfectly!";
Link.l1.go = "exit";
NextDiag.TempNode = "Win";
break;
case "Money":
NextDiag.CurrentNode = "Win";
DialogExit();
pchar.money = makeint(pchar.money) + 20000;
pchar.Experience = makeint(pchar.Experience) + 10000;
break;
case "Exp":
NextDiag.CurrentNode = "Win";
DialogExit();
pchar.money = makeint(pchar.money) + 10000;
pchar.Experience = makeint(pchar.Experience) + 20000;
break;
case "exit":
NextDiag.CurrentNode = NextDiag.TempNode;
DialogExit();
break;
If NextDiag.CurrentNode = "Win";
GiveItem2Character(pchar, "pslip");
break;
//start check: exit to sea
pchar.quest.Exit_to_sea.win_condition.l1 = "location";
pchar.quest.Exit_to_sea.win_condition.l1.location = "Barbados";
pchar.quest.Exit_to_sea.win_condition = "Exit to sea";
break;
case "Exit to sea":
iChar = GenerateCharacter(PIRATE, WITH_SHIP, "officer", MAN, 1, BOSS);
characters[iChar].id = "Davy Jones";
characters[iChar].name = "Davy";
characters[iChar].lastname = "Jones";
characters[iChar].model = "pirate_5";
characters[iChar].Ship.Type = GenerateShip(SHIP_DUTCHMAN, 1);
characters[iChar].ship.name = "The Flying Dutchman";
characters[iChar].skill.Fencing = 10;
characters[iChar].skill.Gun = 10;
LAi_SetHP(CharacterFromID("Davy Jones"), 1000.0, 1000.0);
GiveItem2Character(CharacterFromID("Davy Jones"), "blade15");
EquipCharacterByItem(CharacterFromID("Davy Jones"), "blade15");
characters[iChar].cannotsurrender = 1;
break;
//start check: exit to grenada sea
pchar.quest.Exit_to_G_sea.win_condition.l1 = "location";
pchar.quest.Exit_to_G_sea.win_condition.l1.location = "Grenada";
pchar.quest.Exit_to_G_sea.win_condition = "Exit to G sea";
break;
case "Exit to G sea":
//generate encounter
iChar = GetCharacterIndex("Davy Jones");
DeleteAttribute(&characters[iChar], "seaai");
Group_CreateGroup("dutchman");
Group_AddCharacter("dutchman", "Davy Jones");
Ship_SetTaskDefend(PRIMARY_TASK, iChar);
SetCharacterRelation (iChar, RELATION_FRIEND);
Group_SetGroupCommander("dutchman", "Davy Jones");
string sLocator = "quest_ship_1" + (rand(2)+4);
Group_SetAddress("dutchman", "grenada", "quest_ships", "quest_ship_1");
SetCharacterRelationBoth(nMainCharacterIndex, iChar, RELATION_ENEMY);
Group_SetTaskAttack("dutchman", PLAYER_GROUP);
Group_LockTask("dutchman");
UpdateRelations();
//start check: kill ships
pchar.quest.Kill_ships.win_condition.l1 = "npc_death";
pchar.quest.Kill_ships.win_condition.l1.character = iChar;
pchar.quest.Kill_ships.win_condition = "Ship dead";
trace("!!! sea spawned");
break;
//start check: kill boss
LAi_SetCheckMinHP(CharacterFromID("Davy Jones"), 200.0, 0, "Killed Jones");
case "Ship dead":
//start check: exit to grenada sea
pchar.quest.Exit_to_G_sea.win_condition.l1 = "location";
pchar.quest.Exit_to_G_sea.win_condition.l1.location = "Grenada";
pchar.quest.Exit_to_G_sea.win_condition = "Exit to G sea";
break;
case "Killed Jones";
GiveItem2Character(pchar, "blade19");
GiveItem2Character(pchar, "gun6");
TakeItemFromCharacter(pchar, "pslip");
break;
}
}