// dlg.txt

begintalkscript;

variables;

short i;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(131,3) == 0;
	question = "special";
	text1 = "You are on the outskirts of the Memorial Grounds, arguably the most revered and solemn place in Avernum. This is where the bravest of warriors who died defending your land are brought to be buried.";
	text2 = "To the southwest, you can see the Mound of Ashes, where the fallen heroes are cremated. The ashes are then placed in one of the many stone mounds filling the cemetery.";
	text3 = "There are many offerings by the graves. Stealing them is thought to be in very bad taste.";
	text4 = "As you near the memorial, you feel a chill. Alas, because of the faint magic that rests over much of Avernum, the presence of many bodies in one place tends to attract unsavory elements.";
	action = SET_SDF 131 3 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(131,4) == 0 && gf(170,1) > 4;
	question = "special";
	text1 = "You see movement coming from the graveyard to the west. Lurching movements. You turn and see several skeletons, making their awkward way out of the cemetery toward you.";
	text2 = "The Memorial Grounds are normally patrolled by a large contingent of soldiers, in case of just such an occurrence. Sadly, this place, like everywhere else, is short-handed."; 
	action = SET_SDF 131 4 1;
	code =
		activate_hidden_group(13);
	break;
	
begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = get_sdf(131,5) == 0;
	question = "special";
	text1 = "There are scuff marks in the mold on the floor, and you think you can hear soft voices nearby. Someone is down here. Right now.";
	text2 = "There are no doors or passages visible. And yet, there must be a different exit. You look around carefully, wondering if there might be a way to open a secret door.";
	action = SET_SDF 131 5 1;

begintalknode 4;
	state = -1;
	condition = get_sdf(131,6) == 0;
	question = "special";
	text1 = "You are at the base of the Mound of Ashes. Nobody is being cremated here now, but it can't be long. New bodies, freshly fallen to the Slith Horde, arrive from the Eastern Gallery every day.";
	text2 = "A wide assortment of clay pots at the base of the hill provides grim testimony to what will happen if you are not careful.";
	action = SET_SDF 131 6 1;

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "There are three soldiers patrolling the Memorial Grounds. Two of them are far too creeped out to be able to speak coherently. They suggest that you speak with Private Deneray.";

begintalknode 6;
	state = -1;
	nextstate = -1;
	condition = get_quest_status(155) == 2 && get_terrain(1,339,619);
	question = "special";
	text1 = "As you explore this grim, empty pit, you feel a sudden chill. It takes a minute to stop shuddering uncontrollably.";
	text2 = "When you have composed yourself, you realize that there is a passage in the west wall. You are sure it wasn't there before.";
	code =
		set_terrain(1,339,619,0);
	break;
	
	
//

begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Name";
	text1 = "Alas, the current contingent of guards in the Memorial Grounds is far too small to properly honor those interred here. The tiny patrol is led by this man. He is plainly young and inexperienced, but is probably the best that could be spared.";
	text2 = "When he sees that you are a soldier and not a grave robber, he nods to you. _Welcome. It is rare to see someone friendly and alive out here. I am Private Deneray._";
	text5 = "Private Deneray constantly watches the graves and mausoleums, looking for signs of theft or undead invasion. Though this patrol is clearly incapable of dealing with just about anything that might happen.";
	action = INTRO;

begintalknode 11;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "Tell me about the grounds.";
	text1 = "He looks at your insignia. When he sees that you are a private too, he visibly relaxes.";
	text2 = "He looks at your insignia. When he sees that you outrank him, he becomes visibly nervous.";
	text3 = "_This is where every soldier in Avernum wants to end up. If they die, that is. I'm sure none of them want to die._";
	text4 = "_There's always a guard. An honor guard. Well, not always an honor guard. Sometimes just a guard._";
	code =
		if (gf(170,0) == 0)
			rs(2);
			else rs(1);
	break;
	
begintalknode 12;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "Is anyone else defending the grounds?";
	text1 = "_No._ He looks embarrassed. _Just us. We've asked for more, but ..._ He shakes his head.";
	text2 = "_The Slith Horde really is a greater threat._";

begintalknode 13;
	state = 10;
	nextstate = 13;
	condition = 1;
	question = "How goes the patrol?";
	text1 = "_Monotonous. We walk the paths as long as we can, and then we rest. We have to sleep and soak our feet sometimes._";

begintalknode 14;
	state = 11;
	nextstate = 12;
	condition = 1;
	question = "How does a soldier get buried here?";
	text1 = "_They have to die bravely and selflessly in the defense of Avernum. Nobody who dies from accidents or while fleeing. They have to do something exceptional._";
	text2 = "_Then they are brought here, cremated with honors, and put in one of the mounds._ He points to the south, where several of the mounds look newer. _Those who fall to the Slith Horde go there._";

begintalknode 15;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "What do you need to guard against?";
	text1 = "_Grave robbers, mainly. They want to break into the sarcophagi or steal food offerings. That is how desperate people are. They're usually easy to chase off, though. Just hungry, scared people._";

begintalknode 16;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "Is more than one soldier buried in the same mound?";
	text1 = "_Yes. Their pots share mounds. After all, Avernum gets into a lot of wars, but we have only so much space to bury people._";

begintalknode 17;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "And who watches the grounds while you rest?";
	text1 = "_Nobody. Nobody at all._ Admitting this makes him miserable.";

begintalknode 18;
	state = 10;
	nextstate = 14;
	condition = get_quest_status(154) == 2 && gf(131,1) == 0;
	question = "I'm looking for an organized group of grave robbers. Seen anything?";
	text1 = "He thinks. _You know, I keep thinking I hear things around the southeast crypt. I keep thinking it's my imagination, but ... Well, I hope it's my imagination. It's worth a look._";

begintalknode 19;
	state = 14;
	nextstate = -1;
	condition = gf(131,19) == 0;
	question = "Can you unlock it for me?";
	text1 = "_Of course. I'll take care of it right away._";
	action = SET_SDF 131 19 1;
	
begintalknode 20;
	state = 10;
	nextstate = 15;
	condition = get_quest_status(155) == 2 && gf(131,2) == 0;
	question = "The grounds have been infested by a crypt wight. Seen any signs of it?";
	text1 = "He shudders. _A crypt wight? I reported that things were ... Well, we don't go near the southwest crypt anymore. Too cold. Too ... odd._";
	text2 = "_I'm glad we stayed away._";

begintalknode 21;
	state = 15;
	nextstate = -1;
	condition = gf(131,20) == 0;
	question = "Can you unlock it for me?";
	text1 = "_Of course. I'll take care of it right away._";
	action = SET_SDF 131 20 1;

begintalknode 30;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The crypt wight, its brittle bones shattered by your blows, begins to fall apart. The creature crumbles into dust. All that is left is a faint nimbus of light.";
	text2 = "The faint light floats over to one of the piles of skulls and bones. Instantly, several of them knit together, forming a host of complete skeletons. The light settles into one of them, and the crypt wight is regenerated.";
	text3 = "The light doesn't fade, though. Instead, it floats over to one of you, settling into your mind. In an instant, you lose control of your actions.";
	code =
		rs(2);
		rs(3);
		inc_flag(131,9,1);
		if (num_chars_in_group(0) > 1) {
			as(3);
			i = random_group_member(0);
			force_char_status(i,5,4);
			sf(131,8,3);
			}
			else {
				as(2);
				spawn_creature(14177 + gf(131,9));
				activate_hidden_group(15);
				set_level(14181,22);
				set_level(14182,22);
				set_level(14183,22);
				set_level(14184,22);
				set_new_abil(14181,15);
				set_new_abil(14182,15);
				set_new_abil(14183,15);
				set_new_abil(14184,15);
				}
	break;
	
begintalknode 31;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The nimbus of light floats out of its victim, leaving confusion in its wake.";
	text2 = "It floats over to one of the piles of skulls and bones. Instantly, several of them knit together, forming a host of complete skeletons. The light settles into one of them, and the crypt wight is regenerated.";
	code =

				spawn_creature(14177 + gf(131,9));
				activate_hidden_group(15);
				set_level(14181,22);
				set_level(14182,22);
				set_level(14183,22);
				set_level(14184,22);
				set_new_abil(14181,15);
				set_new_abil(14182,15);
				set_new_abil(14183,15);
				set_new_abil(14184,15);
	break;

begintalknode 32;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The crypt wight, its brittle bones shattered by your blows, begins to fall apart. However, its efforts defending itself from you have drained too much of its energy.";
	text2 = "The foul creature collapses into a pile of dust. The cave instantly feels a little warmer.";

begintalknode 33;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  Castle Gates - East";
	text3 = "  Portal Keep - South";
	text4 = "  Dharmon - West";
	text5 = "  Gnass - Northwest";
	
begintalknode 34;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The obelisk says:";
	text2 = "  MEMORIAL GROUNDS";
	text3 = "  Do not take offerings!";
	text4 = "  Do not dig in burial mounds!";
	text5 = "  Report all mobile corpses to patrol on duty!";
	
	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 51;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

	
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 53;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 54;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 55;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 56;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 57;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 58;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 59;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 60;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 61;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 62;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 63;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 64;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

////

begintalknode 299;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
		