%%
%%   ***********************************
%%   ***   THE  LEADERSHIP  SERIES   ***
%%   ***********************************
%%
%% In order to gain lancemate slots 2 and 3, the PC must demonstrate leadership.
%% These quests are linked to the Cavalier's Club, meaning that they'll always
%% appear in the PC's hometown. There are three rungs on the leadership ladder:
%%
%%  1) LM1: Gain an ally, available from start
%%  2) LM2: Gain a second lancemate slot, available from Renown 30
%%  3) LM3: Gain the third lancemate slot, available from Renown 50
%%

%%
%%  *:Q_LeadershipSeries
%%
%% This is the root quest; it will activate the subquests as needed.
%%

Content
	name <The Leadership Series>
	desc <Quests which allow the PC to earn a lancemate, a second lancemate slot, and a third lancemate slot.>
	requires <*:Q_LeadershipSeries>

	% Element1 is the cavalier's club. Since everything starts here, might as well
	%  hand it out as an element.
	% Element2 is the quest villain, to be kept frozen until needed.
	% Element3 is the veteran in the CavClub, who gives advice and maybe a reward.
	% Element4 is the VIP Room, which is needed in tasks 2 and 3
	% Element5 is the entrance (of the VIP Room)
	Element1 <Scene cavclub>
	Element2 <NewNPC 0 1 villainous>
	Place2 </>
	Element3 <Prefab>
	Place3 <1 (Guards) sd ally>
	Element4 <QuestScene>
	Place4 <1>
	Element5 <Prefab>
	Place5 <1>

	% P%id%01 = Email Timer
	% P%id%02 = Part 3 timer; after SP2 complete, wait a while before starting SP3

	update <if= PlotStatus %plotid1% 0 SetPlotStatus %plotid1% %id1%>
	pumpnews <if= PlotStatus %plotid2% 0 else GoCheckSP3 ifG PCRenown 24 SetPlotStatus %plotid2% %id2% SetNPC %2% email %id%01 P= %id%01 ComTime P+ %id%01 86400>
	GoCheckSP3 <if= PlotStatus %plotid3% 0  ifSubPlotOver %plotid2%  ifG PCRenown 49  P+ %id%02 1  ifG P%id%02 d6  SetPlotStatus %plotid3% %id3% SetNPC %2% email %id%02 P= %id%01 ComTime P+ %id%01 86400>
	% At the ending, clear the emails as appropriate
	end <ifG ComTime P%id%01 SetNPC %2% email 0>

	Msg%id%01 <Admin@CavClub:// Congratulations, you have earned access to the VIP room at the Cavalier's Club. Enjoy our hospitality the next time you're in \SCENE PCHomeTown .>
	Msg%id%02 <%name2%@ \SCENE PCHomeTown :// I've tried doing this the nice way, now it's time to get serious. Your stupid Cavalier's Club is off-limits. Anyone who tries to open it back up again is gonna have to answer to me.>

	% SubPlot1 is the first lancemate
	% SubPlot2 is the LM2 badge
	% SubPlot3 is the LM3 badge
	% SubPlot4 is the ultimate dungeon
	SubPlot1 <*:Q_LS_Task1 #10 1 2>
	SubPlot2 <*:Q_LS_Task2 #40 1 2 4>
	SubPlot3 <*:Q_LS_Task3 #65 1 2 4>
	SubPlot4 <*Q_LS_Ultima #100 3>

	sub
		Persona 3
		*greeting <*NiceToMeetYou GoCheckWin3>
		% % V1 = Have given final quest
		% V2 = Have given final quest
		% GoCheckWin3 <if= V1 0 else GoCheckOver3 ifSubPlotWon %plotid3% else GoCheckOver3 ifSubPlotWon %plotid2% else GoCheckOver3 ifSubPlotWon %plotid1% else GoCheckOver3 ifG PCRenown 80 else GoTeaser NewChat Say 10 AddCHat 6>
		GoCheckWin3 <if= V2 0 else GoCheckOver3 ifSubPlotWon %plotid3% else GoCheckOver3 ifSubPlotWon %plotid2% else GoCheckOver3 ifSubPlotWon %plotid1% else GoCheckOver3 ifG PCRenown 80 else GoTeaser NewChat Say 10 AddCHat 6>
		GoTeaser <NewChat Say 9>
		GoCheckOver3 <ifSubPlotOver %plotid3% else GoMainMenu NewChat Say 8>
		GoMainMenu <NewChat Say 1 AddChat 1 AddChat 2 AddChat 3 AddChat 4>
		GoMission <NewChat AddChat 3 AddChat 4 AddChat 5 Goto GoCheckPro3>
		GoCheckPro3 <if= PlotStatus %plotid3% %id3% else GoCheckWin2 Say 7>
		GoCheckWin2 <ifSubPlotOver %plotid2% else GoCheckPro2 Say 5>
		GoCheckPro2 <if= PlotStatus %plotid2% %id2% else GoCheckWin1 Say 6>
		GoCheckWin1 <ifSubPlotOver %plotid1% else GoCheckPro1 Say 2>
		GoCheckPro1 <if= PlotStatus %plotid1% %id1% else GoNoAdvice Say 3>
		GoNoAdvice <Say 4>
		result1 <V= 1 1 Goto GoMission>
		result2 <Goto GoMission>
		*result3 <*MENTOR_WhatDoFirst 1 2 4>
		*result4 <*MENTOR_WhatEquipment 1 2 3>
		*result5 <*GoodBye>
		% result6 <V= 1 1 Goto .%id4%_GoInit>
		result6 <V= 2 1 Goto .%id4%_GoInit>
		Msg1 <I've been a mecha pilot for a long time. If you've got any questions about adventuring, I'll do my best to answer.>
		Msg1_1 <>
		CMsg1_1 <ifNPCSociable Accept>
		Msg1_2 <>
		CMsg1_2 <ifNPCShy Accept>
		Msg1_3 <>
		CMsg1_3 <ifNPCEasygoing Accept>
		Msg1_4 <>
		CMsg1_4 <ifNPCPassionate Accept>
		Msg1_5 <>
		CMsg1_5 <ifNPCCheerful Accept>
		Msg1_6 <>
		CMsg1_6 <ifNPCMelancholy Accept>
		Msg2 <There's not much going on around here right now. Come back after you've gained some experience and maybe they'll let you into the VIP lounge upstairs.>
		Msg3 <If you help people out, often they'll be inclined to return the favor. Ask around here and I'm sure you can find someone in need of a little assistance.>
		Msg4 <There's nothing else I can teach you.>
		Msg5 <%name2% is gone for now, but \SPR %2% 's sure to be back. Train hard so you're ready when that happens.>
		Msg6 <I've heard that the management of this place is having some problems with a troublemaking cavalier. What we need is for someone to demonstrate a bit of leadership and set things right.>
		Msg7 <Go deal with %name2%... Since \SPR %2% 's been acting up I've lost my favorite hangout!>
		Msg8 <There's nothing else for me to teach you, \PC . You've become a master cavalier.>
		Msg9 <You've done well in defeating %name2%, \PC , but even greater challenges lie before you. Come back after you've gained even more experience and I'll let you in on a little secret.>
		Msg10 <You've grown a lot since the first time I saw you here, \PC , but if you're in the mood for a real challenge I've got something that might be difficult even for you.>
		Prompt1 <How can I become a great cavalier?>
		CPrompt1 <if= V1 0 Accept>
		Prompt2 <Do you have any more advice?>
		CPrompt2 <if# V1 0 Accept>
		Prompt3 <What should I do first?>
		Prompt4 <What do I need?>
		Prompt5 <That's all the advice I need for now, thanks.>
		Prompt6 <A challenge? Tell me more.>

		MetaScene 4
		name <the VIP Room>
		type <building private mall rich meeting>
		mapwidth 15
		mapheight 15
		MallMap
		Ceiling
		Tolerance 15
		NeededCells 3
		Content1 <Some 1 100 Sub *INTRO_HEALTHCLUB na>
		Content2 <Some 1 100 Sub *MECHA_SHOP na>
		Content3 <Fill Sub *SHOP_RANDOM na>
		Start <Print 1>
		Msg1 <You enter \SCENE SceneID .>
		sub
			team 1

			team 2
			name <Citizens>
			SetAlly 1
			Passive

			team 3
			name <Guards>
			SetAlly 2

			room
			name <Foyer>
			desig <EntranceGrid>
			Content <Some 3 50 Here *URBAN_X>
			Content2 <Some 1 100 Here *ANTI_ATTACK_SECURITY 2>
			sub
				StairsDown
				Destination -1
			end
		end

		MetaScene 5
		sub
			room
			desig <HOME>
			minimap <#######1###...##...##...#>
		end
	end
	inv
		NPC Mecha Pilot
		chardesc old old old renowned

		StairsUp
		desig <ENTRANCE %4%>
		use <if# PlotStatus %plotid2% 0 else GoNotYet  Print 1 Exit StatVal 4>
		GoNotYet <Print 99>
		Msg99 <The VIP Room is by invitation only.>
	end

%%
%%  *Q_LS_Ultima
%%
%% The PC has completed the Leadership Series; time for the ultimate dungeon.
%%
%%  PARAM1: The veteran pilot from the Cavalier's Club
%%

Content
	name <Ultimate Asteroid Mine>
	requires <*Q_LS_Ultima>

	% E1 is the veteran
	% E2 is an outdoors scene in which to place the dungeon
	% E3 is the dungeon itself
	Element2 <Scene Outdoors Asteroid>
	Element3 <QuestScene>
	Place3 <2>

	start <if= SceneID %3% Alert %id%01 History %id%02 XPV 200 WinSubPlot %plotid%>
	% Msg%id%01 <You have reached the final level of %name3%.>
	% Msg%id%02 <You reached the pentultimate level of %name3%.>
	Msg%id%01 <You reached the pentultimate level of %name3%.>
	Msg%id%02 <You have reached the final level of %name3%.>

	% SubQuest1 is a DungeonTreasure.
	SubPlot1 <*:Q_DungeonSecret #120 3>

	sub
		Persona 1
		.%id%_GoInit <NewChat Say %id%01 History %id%02 SetEncounterActive %3%>
		Msg%id%01 <%name3% wasn't shut down, exactly- it had to be abandoned because of all the shroom-beasts. People say there's loads of valuable stuff down there, but no-one has ever returned from its lower depths alive.>
		Msg%id%02 <%name1% told you about %name3% in %name2%.>

		STC QS_Dungeon_AsteroidMine
		SetID 3
		entrance <*QUEST-INACTIVE>
		MapWidth 40
		MapHeight 40
	end

Content
	name <Ultimate Asteroid Cave>
	requires <*Q_LS_Ultima>

	% E1 is the veteran
	% E2 is an outdoors scene in which to place the dungeon
	% E3 is the dungeon itself
	Element2 <Scene Outdoors Space>
	Element3 <QuestScene>
	Place3 <2>

	start <if= SceneID %3% Alert %id%01 History %id%02 XPV 200 WinSubPlot %plotid%>
	% Msg%id%01 <You have reached the final level of %name3%.>
	% Msg%id%02 <You reached the pentultimate level of %name3%.>
	Msg%id%01 <You reached the pentultimate level of %name3%.>
	Msg%id%02 <You have reached the final level of %name3%.>

	% SubQuest1 is a DungeonTreasure.
	SubPlot1 <*:Q_DungeonSecret #120 3>

	sub
		Persona 1
		.%id%_GoInit <NewChat Say %id%01 History %id%02 SetEncounterActive %3%>
		Msg%id%01 <According to legend %name3% used to be a haven for space pirates. People say there's loads of valuable stuff in there, but the place is so dangerous that no-one has ever returned from it alive.>
		Msg%id%02 <%name1% told you about %name3% in %name2%.>

		STC QS_Dungeon_AsteroidCave
		SetID 3
		entrance <*QUEST-INACTIVE>
		MapWidth 40
		MapHeight 40
	end

Content
	name <Ultimate Derelict>
	requires <*Q_LS_Ultima>

	% E1 is the veteran
	% E2 is an outdoors scene in which to place the dungeon
	% E3 is the dungeon itself
	Element2 <Scene Outdoors Space>
	Element3 <QuestScene>
	Place3 <2>

	start <if= SceneID %3% Alert %id%01 History %id%02 XPV 200 WinSubPlot %plotid%>
	% Msg%id%01 <You have reached the final level of %name3%.>
	% Msg%id%02 <You reached the pentultimate level of %name3%.>
	Msg%id%01 <You reached the pentultimate level of %name3%.>
	Msg%id%02 <You have reached the final level of %name3%.>

	% SubQuest1 is a DungeonTreasure.
	SubPlot1 <*:Q_DungeonSecret #120 3>

	sub
		Persona 1
		.%id%_GoInit <NewChat Say %id%01 History %id%02 SetEncounterActive %3%>
		Msg%id%01 <Have you heard of %name3%? It's an old prezero wreck in %name2%. People say there's loads of valuable stuff inside, but the place is so dangerous that no-one has ever returned from it alive.>
		Msg%id%02 <%name1% told you about %name3% in %name2%.>

		STC QS_Dungeon_Derelict
		SetID 3
		entrance <*QUEST-INACTIVE>
		MapWidth 50
		MapHeight 50
	end

Content
	name <Ultimate Hellhole>
	requires <*Q_LS_Ultima>

	% E1 is the veteran
	% E2 is an outdoors scene in which to place the dungeon
	% E3 is the dungeon itself
	Element2 <Scene Outdoors City>
	Element3 <QuestScene>
	Place3 <2>

	start <if= SceneID %3% Alert %id%01 History %id%02 XPV 200 WinSubPlot %plotid%>
	% Msg%id%01 <You have reached the final level of %name3%.>
	% Msg%id%02 <You reached the pentultimate level of %name3%.>
	Msg%id%01 <You reached the pentultimate level of %name3%.>
	Msg%id%02 <You have reached the final level of %name3%.>

	% SubQuest1 is a DungeonTreasure.
	SubPlot1 <*:Q_DungeonSecret #120 3>

	sub
		Persona 1
		.%id%_GoInit <NewChat Say %id%01 History %id%02 SetEncounterActive %3%>
		Msg%id%01 <There's an abandoned research complex in %name2% called %name3%. People say there's loads of valuable stuff in there, but the place is so dangerous that no-one has ever returned from it alive.>
		Msg%id%02 <%name1% told you about %name3% in %name2%.>

		STC QS_Dungeon_UrbanHellHole
		SetID 3
		entrance <*QUEST-INACTIVE>
		MapWidth 40
		MapHeight 40
	end

Content
	name <Ultimate Sewer>
	requires <*Q_LS_Ultima>

	% E1 is the veteran
	% E2 is an outdoors scene in which to place the dungeon
	% E3 is the dungeon itself
	Element2 <Scene Outdoors Urban>
	Element3 <QuestScene>
	Place3 <2>

	start <if= SceneID %3% Alert %id%01 History %id%02 XPV 200 WinSubPlot %plotid%>
	% Msg%id%01 <You have reached the final level of %name3%.>
	% Msg%id%02 <You reached the pentultimate level of %name3%.>
	Msg%id%01 <You reached the pentultimate level of %name3%.>
	Msg%id%02 <You have reached the final level of %name3%.>

	% SubQuest1 is a DungeonTreasure.
	SubPlot1 <*:Q_DungeonSecret #120 3>

	sub
		Persona 1
		.%id%_GoInit <NewChat Say %id%01 History %id%02 SetEncounterActive %3%>
		Msg%id%01 <There used to be a secret research station at the bottom of %name3%. People say there's loads of valuable stuff in there, but the place is so dangerous that no-one has ever returned from it alive.>
		Msg%id%02 <%name1% told you about %name3% in %name2%.>

		STC QS_Dungeon_Sewer
		SetID 3
		entrance <*QUEST-INACTIVE>
		MapWidth 50
		MapHeight 50
	end


%%
%%  *:Q_LS_Task3
%%
%% It's time for the final confrontation with the series villain. Things get
%% started when the PC enters the Cavalier's Club and finds it deserted. After
%% that, activate a MISCHIEF mood and let the PC discover the NPC's secret
%% base.
%%
%%  PARAM1: The Cavalier's Club
%%  PARAM2: The series villain
%%  PARAM3: The VIP Room
%%

Content
	name <Mischief Master>
	desc <The villain is bullying the younger cavaliers. Time to set things right one last time.>
	requires <*:Q_LS_Task3>

	% E1 is the Cavalier's Club
	% E2 is the series villain, who may very well get defeated this time around
	% E3 is the VIP Lounge
	% E4 is an outdoors scene
	% E5 is E2's private club
	% E6 is the MischiefMaker mood
	% E7 is the Master Token, which prevents the Sentinel from attacking E2
	Place2 <5 (Guards) sd>
	Element4 <Scene Outdoors>
	Element5 <QuestScene>
	Place5 <4>
	Element6 <Prefab>
	Element7 <Prefab>
	Place7 <2>

	% P%id%01 = Have entered CavClub first time/deployed mood
	% P%id%02 = Have picked up the Master Token

	% VICTORY:
	%  The PC must locate E2 and stop this bullying. This can be achieved
	%  in several ways: E2 can be killed, E2 can surrender, or the PC can
	%  talk E2 down. The sentinel may be made to switch sides by either
	%  physically hacking it or by obtaining E2's Master Token.

	Faint%2% <SetPlotStatus %plotid1% %id1% if= P%id%02 0 DeleteItem %7%>
	Surrender%2% <TeamNeutral 2 TeamNeutral 3 TeamNeutral 4 ForceChat %2%>
	Get%7% <P= %id%02 1 TeamNeutral 4 TeamAttackTeam 4 3>

	% The mood gets deployed the first time the PC enters the CavClub or
	% the VIP Room after quest activation. While this plot is active, both
	% buildings will be empty.
	start <if= SceneID %1% else .%id%_GoCheckVIP  Goto .%id%_GoEmptyRoom>
	.%id%_GoCheckVIP <if= SceneID %3%             Goto .%id%_GoEmptyRoom>
	.%id%_GoEmptyRoom <Retreat 2 Retreat 3 if= P%id%01 0 P= %id%01 1 Alert %id%01 Alert %id%02 QMemo %plotid% %id%03 SetMood %6% %4% NPCLevel %2% %threat%>

	Msg%id%01 <The Cavalier's Club is deserted. You see a note prominently tacked to the message board.>
	Msg%id%02 <Anyone who sets foot in the Cavalier's Club is gonna have to defeat my challenge. THIS GOES FOR THE SHOPKEEPERS AND CLEANING STAFF AS WELL. Keep out or suffer the consequences. -%name2%>
	Msg%id%03 <%name2% scared everybody away from the Cavalier's Club.>

	% SubPlot1 = The victory condition; moving it to a subplot because it's
	% complicated and otherwise I'd have to copy the same script all over
	% the place.
	SubPlot1 <*Q_LS_Win3 2 1>

	sub
		Persona 2
		special <UNLISTED>
		greeting <if= PlotSTatus %plotid% %id% else GoChat ifChatNPCSurrendered else GoGreet EndChat Say 1 Print 9 FreezeNPC %2% SetPlotStatus %plotid1% %id1%>
		GoChat <NewChat SayAnything>
		*GoGreet <*YouWentThroughALotOfTrouble&IsEnemy GoChallenge>
		GoChallenge <NewChat Say 2 AddChat 1 AddChat 2 AddChat 3>
		result1 <NewChat Say 3 AddChat 4 AddChat 5 AddChat 6 AddChat 19 AddChat 20>
		result2 <EndChat Say 4 AddChat 7>
		result3 <NewChat Say 5 AddChat 8 AddChat 4>
		result4 <NewChat Say 6 AddChat 9 AddChat 10 AddChat 11 AddChat 12>
		result5 <EndChat Say 8 Print 9 PCEnemy %2% FreezeNPC %2% SetPlotStatus %plotid1% %id1%>
		result6 <NewChat Say 10 AddChat 13 AddChat 14>
		result7 <EndChat Say 11 AddChat 15>
		result8 <NewChat Say 12 AddChat 16 AddChat 14>
		result9 <Goto result1>
		result10 <Goto result2>
		result11 <Goto result3>
		result12 <NewChat Say 7>
		result13 <EndChat Say 13 TeamAttack 3 TeamAttack 2 if= P%id%02 0 TeamAttack 4>
		result14 <Goto result4>
		result15 <NewChat Say 14 AddChat 17 AddChat 18 AddCHat 4>
		result16 <NewChat Say 15 PCFriend %2% Cash+ -50000 SetPlotStatus %plotid1% %id1%>
		result17 <Goto result6>
		result18 <EndChat Say 16 Print 9 PCFriend %2% FreezeNPC %2% SetPlotStatus %plotid1% %id1%>
		result19 <EndChat Say 17 Print 9 PCEnemy %2% FreezeNPC %2% SetPlotStatus %plotid1% %id1%>
		result20 <Goto result5>
		Msg1 <You win. I'll leave \SCENE RootSceneID ... Perhaps we'll meet again, or perhaps not...>
		Msg2 <As you can see, I planned to open my own place, but for now I find myself quite satisfied with destroying the Cavalier's Club.>
		Msg3 <You can't stop me. Take a look at my bodyguard, there- I found it in a PreZero military base, and had it reprogrammed to follow my orders. As long as I'm holding this token it will protect me from everything.>
		Msg4_1 <You want to know why I hate the Cavalier's Club? I'll tell you, it all started in my childhood...>
		Msg4_2 <You want to know why I hate the Cavalier's Club? If you must know, it's the fault of my mother...>
		Msg4_3 <You want to know why I hate the Cavalier's Club? You mean, you don't already know about my first love...?>
		Msg5 <Yes, isn't it? Of course it's not finished yet, and I've had some trouble finding employees who are willing to put up with the menagerie, but once I secure some investors this will be the greatest place in \SCENE RootSceneID !>
		Msg6 <Thinking, thinking... so what else do you have to say?>
		Msg7 <You don't need to hurry back.>
		Msg8 <Er... Alright, let's make a deal. I'll leave \SCENE RootSceneID , and you'll do absolutely nothing until I'm gone. Fair? Good. Goodbye!>
		Msg9 <%name2% has left this area.>
		Msg10 <Now, I'm perfectly willing to kill you, but none of my robots have been outfitted to clean blood splatter. Are you sure you want to die?>
		Msg11_1 <Obviously a preschool teacher can't be expected to recognize true genius, but what about the others? I learned quickly that I'd have to look out for myself and no-one else. It was around this time that my family purchased a new sofa...>
		Msg11_2 <How I learned that to be ignored is the price of greatness! And the more I was ignored, the greater I became! None of them knew, except maybe Mr. Flopsy, but since he was a rabbit I knew I'd have to leave a mark somehow...>
		Msg11_3 <You don't know how I was criticized! All I wanted was to have my greatness recognized; of course by then it was too late, and I had to make do with admittance to a liberal arts college. How I loathe the mesopotamians...>
		Msg12 <You'd do that? Hmm... It's going to take at least $50,000 to get the utilities turned back on, and after that I can start working on the interior design again...>
		Msg13 <As you wish.>
		Msg14_1 <They wouldn't even validate my parking! After all that, I began stocking up on canned food and vintage character goods. So, you can see why I couldn't allow the Cavalier's Club to exist.>
		Msg14_2 <My application was rejected three times. I am a very patient person, but whoever invented paperwork deserves a special punishment in the ninth circle of hell. So, you can see why I couldn't allow the Cavalier's Club to exist.>
		Msg14_3 <That's when I discovered that he wasn't even my father! Of course it was too late to get my pyjamas back, but I knew I'd have my revenge. So, you can see why I couldn't allow the Cavalier's Club to exist.>
		Msg15 <Thank you! I promise that I won't let you down, unlike all those other investors who are still waiting for my place to open...>
		Msg16 <You're so right... I've done enough here, I think I've worked the aggression out of my system. Thank you, \PC ... Maybe we'll meet again, or maybe not...>
		Msg17 <You're right about that... You win this time, \PC , but we'll meet again!>
		Prompt1 <I'm here to put a stop to that.>
		Prompt2 <What do you have against the CavClub, anyhow?>
		Prompt3 <Cool place you have here.>
		Prompt4 <Maybe I should think about this some more...>
		Prompt5 <Is it fast enough to stop a bullet?>
		CPrompt5 <ifIntimidation HardSkillTar %threat% Accept>
		Prompt6 <I'll fight you, if I have to.>
		Prompt7 <[Continue]> % E2's origin story...
		Prompt8 <I could help you out, if you quit harassing the cavaliers.>
		CPrompt8 <ifShopping HardSkillTar %threat% Accept>
		Prompt9 <I'll put you out of business, %name2%.>
		Prompt10 <Could you tell me a bit more about yourself?>
		Prompt11 <I'm just admiring the architecture here.>
		Prompt12 <I'll get back to you in a while.>
		Prompt13 <Absolutely sure!>
		Prompt14 <No, not just yet...>
		Prompt15 <[Continue]> % E2's origin story, part 2...
		Prompt16 <Here. Get busy and stay out of trouble. [Give $50k]>
		CPrompt16 <ifG PC$ 49999 Accept>
		Prompt17 <Your story made no sense whatsoever.>
		Prompt18 <Isn't it time that you moved on from these painful memories?>
		CPrompt18 <ifConversation HardSkillTar %threat% Accept>
		Prompt19 <Your bodyguard doesn't look so healthy.>
		CPrompt19 <if= T4 0 Accept>
		Prompt20 <You mean this token?>
		CPrompt20 <ifKeyItem %7% ifG T4 0 Accept>

		MetaScene 2
		%% Contains E2's office and "Enforcer".
		%% Note that at this point in the game, a Sentinel is serious OOD,
		%% which should encourage the player to seek a nonviolent resolution.
		sub
			room
			name <%name2%'s Office>
			desig <HOME>
			minimap <......1.2...........#---#>
			inv
				monster SENTINEL
				MiniMapComponent 2
				% Improved ranged combat score; really, you don't want to fight this thing.
				RangedCombat 9
				SetTeam 4
				%% It's possible to hack this particular Sentinel
				%% and make it attack E2, which should greatly even
				%% the odds in a fight.
				CLUE_CODEBREAKING <if= PlotStatus %plotid% %id% ifSelfOK ifCodeBreaking HardSkillTar %threat% else GoNoHack  Goto GoHack>
				CLUE_REPAIR <if= PlotStatus %plotid% %id%       ifSelfOK ifRepair       HardSkillTar %threat% else GoNoHack  Goto GoHack>
				CLUE_SCIENCE <if= PlotStatus %plotid% %id% ifSelfOK else GoBorked ifScience HardSkillTar %threat% else GoNoHack  Goto GoHack>
				GoHack <Print 11 TeamAttackTeam 4 3>
				GoNoHack <Print 12>
				GoBorked <Print 13>
				Msg11 <You hack the Sentinel's AI to remove %name2%'s control routine.>
				Msg12 <You examine %name2%'s modifications to the Sentinel, but aren't skilled enough to change them.>
				Msg13 <%name2%'s modifications have messed up the fire control system.>
			end
		end

		MetaScene 5
		name <%name2%'s Private Club>
		entrance <*QUEST-INACTIVE>
		type <building private>
		special <ADDEXIT SHOWALL>
		MallMap
		MapWidth 15
		MapHeight 15
		Ceiling

		% L1 = Initialization Counter
		start <Print 1>

		Msg1 <You enter %name2%'s Private Club.>

		neededcells 2
		Content1 <Some 1 100 Sub *DECOR_FOR_WEAPON_SHOP na>
		Content2 <Some 1 100 Sub *DECOR_FOR_GENERAL_SHOP na>
		Content3 <Fill Sub *DECOR_FOR_SHOP na>

		sub
			Team 1

			Team 2
			name <Pets>
			type <ROBOT SYNTH MUTANT EXOTIC>
			deploy <if= V1 0 V= 1 1 WMonster 2 %threat% 100>
			SetAlly 3
			Stat 2 1

			team 3
			name <Guards>
			SetAlly 2 4

			team 4
			name <Enforcer>
			SetAlly 3

			room
			name <Foyer>
			desig <EntranceGrid>
		end
	end
	inv
		MinorMood 1
		name <%name2%'s Mischief>
		plot_type <*Mischief>
		Element1 <Grab 4>
		Element2 <Grab 5>
		Element3 <Grab 2>

		MeleeAddOn 2
		Name <Master Token>
		desc <A mysterious artifact held by %name2%.>
		Category <ACCESSORY>
		Acc 2
		Speed 2
	end

%%
%%  *Q_LS_Win3
%%
%% Conclusion for above.
%%
%%  PARAM1: The Enemy NPC.
%%  PARAM2: The Cavalier's Club.
%%

Content
	requires <*Q_LS_Win3>

	% E1 = the series enemy, who may or may not be dead by now.
	% E2 = the cavalier's club
	% E3 = a victory meme
	element3 <Prefab>

	update <WinSubPlot %plotid% ActivateMeme %3% RootSceneID Alert %id%01 History %id%01 ifMeritBadge NAS_MB_Lancemate3 else .%id%_GoRegular  SilentMeritBadge NAS_MB_Lancemate3 XPV 100>
	.%id%_GoRegular <GiveMeritBadge NAS_MB_Lancemate3 XPV 100>

	Msg%id%01 <You saved the Cavalier's Club from %name1%.>

	inv
		Meme
		MaxMemeViews 3
		MemeTimeLimit
		msg_1 <On behaf of all the cavaliers here, I'd like to thank you for dealing with %name1%.>
		CMsg_1 <if# ChatNPCID %1% ifChatNPCisCombatant Accept>
		msg_2 <>
		CMsg_2 <if# ChatNPCID %1% ifChatNPCisCombatant Accept>
		msg_3 <>
		CMsg_3 <if# ChatNPCID %1% ifChatNPCisCombatant Accept>
		msg_11 <>
		CMsg_11 <if# ChatNPCID %1% ifChatNPCisCombatant ifNPCSociable Accept>
		msg_12 <Thanks for saving the Cavalier's Club, \PC .>
		CMsg_12 <if# ChatNPCID %1% ifChatNPCisCombatant ifNPCShy Accept>
		msg_13 <I'm glad that %name1% is gone. Now we can get back to hanging out and doing nothing just like the old days.>
		CMsg_13 <if# ChatNPCID %1% ifChatNPCisCombatant ifNPCEasygoing Accept>
		msg_14 <I was gonna do something about %name1% myself, I just never got around to it...>
		CMsg_14 <if# ChatNPCID %1% ifChatNPCisCombatant ifNPCPassionate Accept>
		msg_15 <>
		CMsg_15 <if# ChatNPCID %1% ifChatNPCisCombatant ifNPCCheerful Accept>
		msg_16 <This business with %name1% showed us just how brave most of the cavaliers in this town are... thanks for being the only one willing to take a stand, \PC .>
		CMsg_16 <if# ChatNPCID %1% ifChatNPCisCombatant ifNPCMelancholy Accept>
	end

%%
%%  *:Q_LS_Task2
%%
%% In this subquest, the PC has a first encounter with the series villain, and must act to
%% save the Cavalier's Club itself.
%%
%%  PARAM1: The Cavalier's Club
%%  PARAM2: The series villain
%%  PARAM3: The VIP Room
%%

Content
	name <Hostile Takeover>
	desc <The villain will take over the Cavalier's Club unless the PC can pay off their debt.>
	requires <*:Q_LS_Task2>

	% E1 is the Cavalier's Club
	% E2 is the series villain, met here for the first time
	% E3 is the VIP Lounge
	% E4 is the manager, who will run this quest
	Element4 <Prefab>
	Place4 <3 (Guards) ally sd>

	% P%id%01 = First time entering the VIP Room.

	%% FAIL CONDITIONS:
	%% - E4 dies
	end <ifNPCDead %4% LoseSubPlot %plotid%>

	% The first time you enter the VIP Room, you'll see E2 and E4 arguing.
	start <if= P%id%01 0 if= SceneID %3% P= %id%01 1 Alert %id%01 Monologue %4% %id%02 Monologue %2% %id%03 Print %id%04>

	Msg%id%01 <As you enter the VIP Room, you see two people arguing.>
	Msg%id%02 <I just need a little more time! Think of all the young'uns who rely on this place... I promise we can get the money for you soon.>
	Msg%id%03 <This is your final chance, %name4%. When you fail I'll tear down this building and replace it with a bargain store.>
	Msg%id%04 <%name2% leaves the area.>

	% SubPlot1 is the FindMoney task.
	SubPlot1 <*:Q_FindMoney 4>

	sub
		Persona 4
		% This character will handle the FindMoney plot.
		greeting <if= PlotStatus %plotid% %id% else GoChat if# PlotStatus %plotid1% 0 else GoFirstTime NewChat Say 1 AddChat 1 AddChat 2 AddChat 3>
		GoChat <NewChat SayAnything>
		*GoFirstTime <*INeedYourHelp GoListen GoRefuse>
		GoListen <NewChat Say 2 AddChat 4 AddChat 5 QMemo %plotid% 4 SetPlotStatus %plotid1% %id1%>
		GoRefuse <NewChat Say 3 AddSociable -d10 LoseSubPlot %plotid%>
		GoWinQuest <WinSubPlot %plotid%  History 7  AddReact d30  AddHeroic 1  ifMeritBadge NAS_MB_Lancemate2 else GoBasicPrize NewChat Say 6  CustomMecha .meks %threat%  SilentMeritBadge NAS_MB_Lancemate2>
		.meks <GENERAL PDASS \FACTION_DESIG RootSceneFac>
		GoBasicPrize <NewChat Say 8    GiveMeritBadge NAS_MB_Lancemate2>
		result1 <NewChat Say 5 AddCHat 2 AddCHat 6 AddCHat 7>
		result2 <Goto GoWinQuest>
		*result3 <*HurryBackWithMoney>
		result4 <NewChat Say 9>
		result5 <NewChat Say 10>
		result6 <Cash+ -5000000  PCAlly %4%  AddHeroic 1  Goto GoWinQuest>
		result7 <NewChat Say 11 AddSociable -d10 LoseSubPlot %plotid%>
		Msg1 <If we can't get the money for %name2%, the Cavalier Club will have to close down.>
		Msg2 <%name2% inherited a controlling share of the Cavalier's Club, and has threatened to shut us down unless we buy his stock at ridiculously inflated prices.>
		Msg3 <Yeah, well, I'm sure the rest of us can sort this out on our own, then.>
		Msg4 <%name4% needs a lot of money to save the Cavalier's Club from %name2%.>
		Msg5 <It's going to take at least five million. I really don't know where we can find it...>
		Msg6 <Wonderful! The Cavalier's Club has been saved! For your help I'd like you to have this custom mecha, and know that you will always be welcome here.>
		Msg7 <You saved the Cavalier's Club from %name2%.>
		Msg8 <Wonderful! The Cavalier's Club has been saved! You know, I bet the other pilots will be eager to join in your adventure after they learn what you did.>
		Msg9 <You're right, someone should. I'm doing the best I can but so far it hasn't been enough.>
		Msg10 <If you could find a sponsor that'd be great. I know that the other cavaliers around here would appreciate it as well.>
		Msg11 <Well, if you think there's nothing more you can do, don't bother worrying about it. I'm sure that me and the others here will be able to fix things.>
		Prompt1 <How much money do you need, again?>
		Prompt2 <I've found someone to help.>
		CPrompt2 <ifSubPlotWon %plotid1% Accept>
		Prompt3 <Yeah, I'll let you know if I find anything.>
		Prompt4 <Someone ought to do something about that.>
		Prompt5 <Yeah, yeah, I'll see what I can do.>
		Prompt6 <No problem. I can do that myself. [Give $5M]>
		CPrompt6 <ifG PC$ 5000000 Accept>
		Prompt7 <Maybe we should just give up...>
		CPrompt7 <ifSubPlotLost %plotid1% Accept>
	end
	inv
		NPC Soldier
		chardesc old sociable heroic
		MOTIVATION:GreaterGood
	end


%%
%%  *:Q_LS_Task1
%%
%% This subquest will allow the PC to gain a first lancemate, and should also foreshadow the
%% later parts of the series.
%%
%%  PARAM1: The Cavalier's Club
%%  PARAM2: The series villain
%%

Content
	name <Gimme Gimme>
	desc <An artifact has been stolen; the PC can get it back, aid the thief, or keep it.>
	requires <*:Q_LS_Task1>

	% E1 is the Cavalier's Club
	% E2 is the series villain, needed for foreshadowing
	% E3 is the character who lost the artifact
	% E4 is the character who stole the artifact
	% E5 is the artifact
	Element3 <NewNPC 0 1 Easygoing Heroic>
	Place3 <1 (Guards) sd ally>
	Element4 <Prefab>
	Element5 <Artifact>
	Place5 <4>

	% P%id%01 = Have started quest
	% P%id%02 = Have accepted E4's offer to intimidate E3
	% P%id%03 = Have silenced E3
	% P%id%04 = Have obtained E5

	%% Speaking with E3 will set P%id%01 and activate the quest. Locate E4 and maybe get the item
	%% back through negotiation. Alternatively, accept E4's offer to convince E3 to back off.

	%% FAIL CONDITIONS:
	%% - E3 and E4 both die.
	%% - PC has silenced E3, and E4 dies
	%% - PC has obtained E5, and E3 dies
	%% - PC has obtained E5 and silenced E3
	end <ifNPCDead %3% else .%id%_GoCheckF2 ifNPCDead %4% else .%id%_GoCheckF3 LoseSubPlot %plotid%>
	.%id%_GoCheckF2 <ifNPCDead %4% else .%id%_GoCheckF4 if= P%id%03 1 LoseSubPlot %plotid%>
	.%id%_GoCheckF3 <if= P%id%04 1 else .%id%_GoCheckF4 LoseSubPlot %plotid%>
	.%id%_GoCheckF4 <if= P%id%04 1 if= P%id%03 1 LoseSubPlot %plotid%>

	get%5% <if= P%id%04 0  P= %id%04 1  XPV 100 QMemo %plotid% %id%01>
	faint%3% <if= P%id%02 1 P= %id%03 1>

	Msg%id%01 <You retrieved the %name5% for %name3%.>

	% SubPlot1 is E4's hideout
	SubPlot1 <*:Q_NPCHideout 4>

	sub
		Persona 3
		rumor%id% <%name3% has lost the %name5%.>
		&BribeAmount <Threat %threat% 5>
		greeting <if= PlotStatus %plotid% %id% else GoChat if= P%id%03 0 else GoChat if# P%id%01 0 else GoFirstTime  NewChat Say 1 AddChat 1 AddChat 2 AddChat 3 AddChat 4 AddChat 5>
		GoChat <NewChat SayAnything>
		*GoFirstTime <*NiceToMeetYou GoJobOffer>
		GoJobOffer <NewChat Say 2 AddChat 6 AddChat 7 AddChat 8>
		GoSilenceE3 <P= %id%03 1  AddReact -d10  if# P%id%04 0 AddLawful -5>
		*result1 <*ComeBackWhenYouKnowSomething>
		result2 <PCAlly %3% AddHeroic 1 NewChat Say 3 History 4 WinSubPlot %plotid% AddReact d20 DeleteItem %5% SetXXRAttitude %3% XXR_A_Thankful>
		result3 <LoseSubPlot %plotid%   AddLawful -5   Goto GoR3End>
		*GoR3End <*PCWillKeepItem %5%>
		result4 <LoseSubPlot %plotid%   AddRenown -5   Goto GoR4End>
		*GoR4End <*YouLostItem>
		result5 <NewChat Say 5 AddChat 9 AddChat 10 AddChat 11 AddChat 12>
		result6 <NewChat Say 6  QMemo %plotid% 7  P= %id%01 1  SetPlotStatus %plotid1% %id1%>
		result7 <NewChat Say 8 AddReact -d10 LoseSubPlot %plotid%>
		result8 <NewChat Say 9 AddChat 13 AddChat 14>
		result9 <NewChat Say 10 Goto GoSilenceE3>
		result10 <NewChat Say 11 Goto GoSilenceE3>
		result11 <NewChat Say 12  Cash+ -&BribeAmount  AddReact 10  Goto GoSilenceE3>
		result12 <NewChat Say 13>
		result13 <Goto result6>
		result14 <Goto result7>
		Msg1 <Have you recovered the %name5% from %name4%?>
		Msg2 <I just started working as a cavalier, and already I've messed up. I was supposed to guard the %name5% but it's been stolen out from under my nose.>
		Msg3 <Oh, thanks! I need to return this to its rightful owner... Maybe sometime later on the two of us can work together, y'know?>
		Msg4 <You returned the %name5% to %name3%.>
		Msg5 <But it doesn't even belong to me! I've got to keep trying for it, don't I?>
		Msg6 <You'd do that for me? Thanks! The thief who took it is named %name4%... I'm sorry that I don't have any more information to tell you.>
		Msg7 <%name3% asked you to help retrieve the %name5% from %name4%.>
		Msg8 <Sorry... I'll keep my problems to myself.>
		Msg9 <\ITEM_DESC %5% \ITEM_HISTORY %5% So, can you help me recover it?>
		Msg10 <I see what you're saying... It's better to have tried and lost than to have tried harder and gotten killed. I'll forget about the %name5%.>
		Msg11 <You're right... I should have known this was a lost cause. The only thing to do now is to admit to the boss that I messed up.>
		Msg12 <I'll admit... this is a rather nice consolation prize. Thanks, \PC .>
		Msg13 <You do that.>
		Prompt1 <No, not quite yet...>
		Prompt2 <Yes. Here it is. [Give Item]>
		CPrompt2 <ifKeyItem %5% Accept>
		Prompt3 <Yes, and I'm going to keep it for myself.>
		CPrompt3 <ifKeyItem %5% Accept>
		Prompt4 <There's been a slight mishap...>
		CPrompt4 <ifItemDestroyed %5% Accept>
		Prompt5 <I think you should give up on it, myself.>
		CPrompt5 <if# P%id%02 0 Accept>
		Prompt6 <Maybe I could help you get it back.>
		Prompt7 <Your troubles do not interest me.>
		Prompt8 <The %name5%, huh? What's that?>
		Prompt9 <Bad things happen to people who cross %name4%.>
		CPrompt9 <ifIntimidation HardSkillTar %threat% Accept>
		Prompt10 <%name4% must have already sold it; it's gone.>
		CPrompt10 <ifConversation HardSkillTar %threat% Accept>
		Prompt11 <Here, I'll give you $ \VAL &BribeAmount to help you forget. [Give Money]>
		CPrompt11 <ifShopping SkillTar %threat% ifG PC$ &BribeAmount Accept>
		Prompt12 <I'll think about that for a bit.>
		Prompt13 <Alright, I'll do it.>
		Prompt14 <Nope, it sounds boring.>

		Persona 4
		% V1 = Have asked who E2 is
		% V2 = Have attempted to make a deal
		&BribeAmount <Threat %threat% 5>
		greeting <if= PlotStatus %plotid% %id% else GoChat ifChatNPCInPlay else GoBrushOff if= P%id%04 0 else GoChat if= P%id%02 0 else GoReport Goto GoGreet>
		GoBrushOff <EndChat Say 1>
		GoChat <NewChat SayAnything>
		*GoGreet <*WhatDoYouWantWithMe&YouHaveSomething GoBargain>
		GoBargain <NewChat Say 2 AddChat 1 AddChat 2 AddChat 3 AddCHat 4 AddCHat 6>
		GoReport <NewChat Say 15 AddChat 13 AddChat 14 AddChat 15>
		Result1 <NewChat Say 3 AddChat 5 V= 1 1>
		result2 <NewChat Say 4 AddLawful -1 PCEnemy %2% GiveItem %5% SetXXRAttitude %4% XXR_A_Antagonistic  if# P%id%03 0 AddLawful -5>
		result3 <NewChat Say 5 AddChat 7 AddChat 8 AddCHat 9 V= 2 1>
		result4 <NewChat Say 6 AddReact -d20 PCEnemy %2% GiveItem %5% SetXXRAttitude %4% XXR_A_Antagonistic  if# P%id%03 0 AddLawful -5>
		result5 <NewChat Say 7 AddChat 3 AddChat 10>
		result6 <NewChat Say 8 GiveItem %5% AddChat 11 AddChat 12>
		result7 <NewChat Say 9 QMemo %plotid% 10 P= %id%02 1>
		result8 <NewChat Say 11 Cash+ -&BribeAmount AddReact d20 GiveItem %5% SetXXRMotivation %4% XXR_M_Mercenary  if# P%id%03 0 AddLawful -5>
		result9 <NewChat Say 12>
		result10 <Goto result4>
		result11 <NewChat Say 13>
		result12 <PCAlly %4% AddReact d20 NewChat Say 14 Cash+ -&BribeAmount SetXXRAttitude %4% XXR_A_Thankful>
		result13 <NewChat Say 16>
		result14 <PCAlly %4% AddLawful -5 NewChat Say 17 History 18 WinSubPlot %plotid% AddReact d20 DeleteItem %5% SetXXRAttitude %4% XXR_A_Thankful CashPrize Reward %threat% 50>
		result15 <Goto GoBargain>
		Msg1 <...>
		Msg2 <Look, I didn't want to steal this %name5%, but %name2% ordered me to and I couldn't exactly say no.>
		Msg3 <You don't know %name2%? You don't want to know... I don't even want to know. %name2% is bad news.>
		Msg4 <Really? Wow, I was worried there for a bit... I thought %name3% sent a cavalier after me. Here, you can bring this to \OPR %2% .>
		Msg5 <What kind of deal are you talking about?>
		Msg6 <You make a compelling argument. Alright, here you go... but if anybody asks, you had to beat me up to get it, okay?>
		Msg7 <How should I know? \ITEM_USAGE %5% All I know is that I need to deliver the goods.>
		Msg8 <Really? Well that's an unexpected turn of events... I guess that's why no-one ever came to pick up the %name5%. I don't need this old thing anymore; You can have it if you want.>
		Msg9 <If you could do that, I'd share half the reward I'm getting from %name2% with you. Come back here when it's safe for me to go out in public again.>
		Msg10 <You told %name4% that you'd get %name3% off \PPR %4% back.>
		Msg11 <Hmm... That does seem to be a fair price for it, and it's more than %name2% offered. Here you go. It's been a pleasure doing business with you.>
		Msg12 <Yeah, thinking is good.>
		Msg13 <Yeah, whatever. I'm just glad that I can finally get out of here.>
		Msg14 <Hey, that's really nice of you. Y'know with %name2% out of the picture I'm going to need a new boss... if you meet anyone looking to hire a thief, send 'em my way.>
		Msg15 <So have you convinced %name3% to back off yet? I'm getting real tired of staring at these walls...>
		Msg16 <Working is good. Come back when the job is done.>
		Msg17 <Thanks. I can see you're pretty useful to have around... maybe we can work together again, someday.>
		Msg18 <You helped %name4% steal the %name5% from %name3%.>
		Prompt1 <Who is %name2%?>
		CPrompt1 <if= V1 0 Accept>
		Prompt2 <Relax. %name2% sent me to collect.>
		CPrompt2 <if= V1 0 if= V2 0 ifConversation SkillTar %threat% Accept>
		Prompt3 <How about we make a deal?>
		Prompt4 <Give it to me now or you won't live long enough to say no.>
		CPrompt4 <ifIntimidation HardSkillTar %threat% Accept>
		Prompt5 <Why does \SPR %2% want the %name5%?>
		Prompt6 <%name2% is dead.>
		CPrompt6 <ifNPCDead %2% Accept>
		Prompt7 <I can get %name3% off your back.>
		CPrompt7 <if= P%id%02 0 Accept>
		Prompt8 <I'll buy the %name5% for $ \VAL &BribeAmount .>
		CPrompt8 <ifG PC$ &BribeAmount ifShopping SkillTar %threat% Accept>
		Prompt9 <Good question. I'll think about that.>
		Prompt10 <If you want to live, you need to give it to me.>
		CPrompt10 <ifIntimidation HardSkillTar %threat% Accept>
		Prompt11 <Thanks.>
		Prompt12 <Here, you can have this for your trouble. [Give $ \VAL &BribeAmount ]>
		CPrompt12 <ifG PC$ &BribeAmount Accept>
		Prompt13 <I'm still working on it.>
		Prompt14 <%name3% won't be bothering you again.>
		CPrompt14 <if# P%id%03 0 Accept>
		Prompt15 <We need to talk about the %name5%...>
	end
	inv
		NPC Thief
		Combatant
	end

