% Component List

% STATE OF STORY DESCRIPTION
%  The state of the story is determined by both the "context" attribute held in
%  the story and by certain variables which are determined when it's time to
%  generate a new component. These variables could include:
%  - The existence and nature of the palette entries
%  - The alleigance of the current location with either the PC's faction
%    or the palette enemy faction

%%
%% #C Conclusion
%%
%%  All conclusions start the same: with a stub. This plot doesn't do anything by
%%  itself, but sets the mood and invokes the following subplots:
%%      *CS_END_Intro
%%      *:CS_END_RallyDefenses
%%
%%  It must have the following macros defined:
%%      &RallyDefenses
%%      &ifDefensesRallied
%%

Plot
	name <Conclusion Stub>
	desc <This stub just holds all the conclusion subplots and sets the mood.>
	requires <#C F:++>

	% Element1 is the mood for the conclusion
	Element1 <Prefab>

	% P%id%01 = Defense Counter

	% Everything starts when the PC enters the episode scene.
	start <if= PlotStatus %plotid% 0 if= RootSceneID &EpisodeScene  Alert %id%01 History %id%02  SetPlotStatus %plotid1% %id1% SetPlotStatus %plotid2% %id2% SetPlotStatus %plotid3% %id3% SetPlotStatus %plotid4% %id4%  SetMood %1% &EpisodeScene>

	&RallyDefenses <P= %id%01 1>
	&ifDefensesRallied <if= P%id%01 1>

	Msg%id%01 <As you enter \SCENE &EpisodeScene , you experience a distinct feeling of dread. Something big is about to happen here.>
	Msg%id%02 <You found \SCENE &EpisodeScene under the control of \FACTION &EnemyFac .>

	% SubPlot1 is the confrontation intro
	%     This will handle the arch-enemy and load the other subplots
	% SubPlot2 is the rally defenses subplot-
	%     This will be determined by the +T task.
	SubPlot1 <*CS_END_Intro 1>
	SubPlot2 <*:CS_END_RallyDefenses>

	inv
		Mood 5
		name <Conclusion Mood>
		plot_type <*FactionRampage>
		Element1 <Grab -2>
		Update <if= v1 0 V= 1 1   News 1>
		Msg1_1 <%city% under siege as %name3%'s personal forces take control.>
		Msg1_2 <Mecha from \FACTION &EnemyFac take control of %city% under the orders of %name3%.>
		Msg1_3 <%name3% has begun a purge of \PPR %3% enemies from %city%; authorities powerless to stop the destruction.>
		% Meme Messages
		Msg_1 <When will the trouble with %me_name1% end?>
		CMsg_1 <if# ChatNPCFac %me_1% Accept>
		Msg_2 <Someone really ought to do something about %me_name1%... They must be stopped!>
		CMsg_2 <if# ChatNPCFac %me_1% Accept>
		Msg_3 <What did %city% do to deserve this? Those jerks from %me_name1% are acting like they own the place.>
		CMsg_3 <if# ChatNPCFac %me_1% Accept>
	end

%%
%% #A Plots
%%

Plot
	name <Information Trade>
	desc <A person here has information for you, if you do them a favor first.>
	requires <#A +Tgs (+Fcc|+Fin) ~+Gkn>
	Size 1

	% E1 is a scene for the conference
	% E2 is the presenter
	Element1 <Grab 6>
	Element2 <Character (ACADE|TRADE|CORPO) !Near -7 -ArchEnemy !XClude -2>
	Place2 <1 (Citizens) pass>

	% P1 = Spot E2 counter

	%% FAIL CONDITIONS:
	%% - E2 dies before subplot 2 is activated
	end <if= PlotStatus %plotid2% 0 ifNPCDead %2% LoseComp 0 .%id%_next>
	.%id%_next <+T-- +F-->

	start <if= P1 0 if= SceneID %1%  P= 1 1 ifNPCInPlay &PartnerNPC else GoSoloSpot Monologue &PartnerNPC %id%01>
	GoSoloSpot <ifUAwareness 5 Alert %id%02>

	.%id2%_%plotid2%_GoWin <WinComp 0 .%id%_next>
	.%id2%_%plotid2%_GoLoss <LoseComp 0 .%id%_next>

	Msg%id%01 <Hey, look, it's %name2%; I heard that \SPR %2% 's got some kind of mission that needs doing.>
	Msg%id%02 <You notice that %name2% seems to be thinking about something.>

	% SubPlot1 is the favor for E2
	% SubPlot2 is the Gather Information task
	SubPlot1 <*:CS_MinorMission 2>
	SubPlot2 <*:CS_GatherInformation 2>

	sub
		Persona 2
		rumor0 <%name2% knows a secret.>
		% V1 = Have offered mission (1), Have completed mission (2)
		% V2 = Reputation Counter
		&BribeAmount <Threat %threat% 1>
		greeting <if= V1 2 else GoCheckProgress RevertPersona>
		GoCheckProgress <if= V1 1 else GoCheckFirst ifSubPlotWon %plotid1% else GoCheckLoss Goto GoReveal>
		*GoReveal <*RevealSecret GoInitSP2>
		GoInitSP2 <V= 1 2 SetPlotStatus %plotid% %id% SetPlotStatus %plotid2% %id2% Goto .%id2%_GoInform>
		GoCheckLoss <ifSubPlotLost %plotid1% else GoRemind LoseComp 0 .next SMemo 0 History 4 Goto GoLose>
		.next <+T-- +F-->
		*GoLose <*MissionWasFailure na na na>
		*GoRemind <*GenericMissionReminder>
		*GoCheckFirst <*IHaveInformation GoInform na>
		GoInform <NewChat Say 1 SMemo 2 AddChat 1 AddChat 2 AddChat 3 AddChat 4 AddChat 5>
		result1 <V= 1 1 History 3 Goto .%id1%_GoInit>
		*result2 <*RejectMission .%id%_GoR2Exit>
		.%id%_GoR2Exit <SMemo 0 LoseComp 0 .next>
		result3 <EndChat Say 5 AddChat 6>
		result4 <EndChat Say 6 AddChat 7 if= V2 0 V= 2 1 AddCheerful -d10>
		result5 <EndChat Say 7 AddChat 7 if= V2 0 V= 2 1 AddEasygoing d6>
		result6 <Cash+ -&BribeAmount Goto GoInitSP2>
		result7 <Goto GoInitSP2>
		Msg1 <Before I tell you what I know, I need you to do something for me. It's a fair exchange, don't you think?>
		Msg2 <%name2% offered to tell you some information, if you complete a mission for \OPR %2% first.>
		Msg3 <%name2% offered to tell you some information if you completed a mission first.>
		Msg4 <You lost %name2%'s mission.>
		Msg5 <You're right, that would save us both a whole lot of trouble. Here's what I know...>
		Msg6 <Um... I guess this is what we call one of those offers I can't refuse, right? Here's what I know...>
		Msg7 <Alright, I guess I can't hold out on you like this... just stop making those puppy dog eyes and I'll tell you what I know.>
		Prompt1 <Alright. What do you need done?>
		Prompt2 <No deal.>
		Prompt3 <Why don't I just pay you for the info? [Offer $ \VAL &BribeAmount ]>
		CPrompt3 <ifShopping HardSkillTar %threat% ifG PC$ &BribeAmount Accept>
		Prompt4 <Why don't you tell me what you know, and I let you live?>
		CPrompt4 <ifIntimidation HardSkillTar %threat% Accept>
		Prompt5 <Come on, %name2%, why make me jump through hoops?>
		CPrompt5 <ifG React %threat% Accept>
		Prompt6 <[Continue]>
		Prompt7 <[Continue]>

		STC MS_SOCIAL
		SetID 1
	end

Plot
	name <Missing Prototype>
	desc <A prototype sprocket has gone missing from the trade show. Go find it!>
	requires <#A +Tgs +Fcc>
	Size 1

	% E1 is a scene for the conference
	% E2 is the presenter
	% E3 is the stolen item
	Element1 <Grab 6>
	Element2 <Character (ACADE|TRADE|CORPO) !Near -7 -ArchEnemy>
	Place2 <1 (Citizens) pass>
	Element3 <Prefab>

	% Fail Conditions:
	% - Mission giver dies before encounter is activated
	% - Fetch subplot fails

	% P%id%01 = Initialization Counter
	% P%id%02 = Partner Monologue

	update <if= P%id%01 0 P= %id%01 1 SetPlotStatus %plotid% %id%>
	start <if= SceneID %1% if= P%id%02 0 P= %id%02 1 ifNPCOK &PartnerNPC Monologue &PartnerNPC %id%03>
	end <if= PlotStatus %plotid1% 0 else .%id%_GoCheckReveal ifNPCDead %2%  LoseComp 0 .%id%_loss>
	.%id%_GoCheckReveal <ifSubPlotLost %plotid1% SMemo %id%01 SetPlotStatus %plotid3% %id3%>
	.%id%_loss <+T-->

	% Upon getting the item, set the win subplot.
	Get%3% <SMemo %id%02  SetPlotStatus %plotid2% %id2%>

	Msg%id%01 <You failed to recover the sprocket. You should go report to %name2% at %name1%.>
	Msg%id%02 <You should return the sprocket to %name2% at %name1%.>
	Msg%id%03 <Look over there- %name2% seems to be really nervous about something.>

	%% SubPlot1 is Fetch Item
	%% SubPlot2 is the winning condition
	%% SubPlot3 is the loss condition
	SubPlot1 <*:CS_FetchItem&Stolen 3>
	SubPlot2 <*CS_WinFetchItem 2 3>
	SubPlot3 <*CS_CALoseMission 2>

	sub
		Persona 2
		rumor%id% <%name2% lost something really important.>
		greeting <if= PlotStatus %plotid1% 0 else .%id%_GoRemind Goto .%id%_GoGreet>
		.%id%_GoOfferMission <ifChatNPCUnknown else .%id%_GoKnownGreeting ifChatNPCAlly else .%id%_GoUnknownGreeting Goto .%id%_GoKnownGreeting>
		*.%id%_GoRemind <*GenericMissionReminder>
		*.%id%_GoGreet <*INeedYourHelp .%id%_GoBriefing .%id%_GoRefuse>
		.%id%_GoBriefing <NewChat Say %id%01 AddChat %id%01 AddChat %id%02>
		.%id%_GoRefuse <NewChat Say %id%03 AddChat %id%01 AddChat %id%02>
		*result%id%01 <*GoodLuckOnMission .%id%_GoR1Exit ChatNPCFac na>
		.%id%_GoR1Exit <StoryNote %id%02 SetPlotStatus %plotid1% %id1%>
		*Result%id%02 <*RejectMission .%id%_GoR2Exit>
		.%id%_GoR2Exit <LoseComp 0 .%id%_changes>
		.%id%_changes <+T-- +F-->
		Msg%id%01 <This is terrible- I've been working on a prototype sprocket which I was going to debut at this conference, but it's gone missing! Someone must have stolen it... Can you help me find it?>
		Msg%id%02 <%name2% hired you to recover \PPR %2% prototype sprocket.>
		Msg%id%03 <Just listen for a moment! I've been working on a prototype sprocket which I plan to debut at this conference, but it's gone missing. Someone must have stolen it! Won't you help me find it?>
		Prompt%id%01 <No problem, as long as the pay is good.>
		Prompt%id%02 <You'll have to find someone else, I'm afraid.>
		CPrompt%id%02 <if# PCFac ChatNPCFac Accept>

		STC MS_PRESENTATION
		SetID 1
	end
	inv
		Treasure
		name <Sprocket>
		desc <A prototype sprocket.>
	end

Plot
	name <What are you going to do about all the pirates?>
	desc <The corps are waiting for the government to act.>
	requires <#A +Tgs (+Fcc|+Fmi) (P:POLIT|P:MILIT|P:POLIC) F:-->
	changes <F:++>

	% E1 is the scene where this component will take place.
	% E2 is a government faction allied with the ally fac
	% E3 is a police faction allied with the government
	% E4 is a crime faction which is an enemy of the police
	% E5 is a corporate faction which is an enemy of the criminals
	% E6 is a member of said corporate faction
	% E7 is an outdoors scene for a combat encounter
	% E8 is the encounter itself
	element1 <Grab 6>
	element2 <Faction Government !Ally -3 !Okay -7>
	element3 <Faction Police !Ally 2 !Okay -3>
	Element4 <Faction Crime !Enemy 3 !Xclude -3>
	Element5 <Faction Corporate !Enemy 4 !Okay -3 !Okay 2>
	Element6 <Character !Comrade 5 !Global>
	Place6 <1 (Citizens) pass ally>
	Element7 <Scene Outdoors !Near -7>
	Element8 <Prefab>
	Place8 <7>

	% Fail Conditions:
	% - Mission giver dies before encounter is activated
	% - Revalation subplot fails

	update <if= PlotStatus %plotid% 0 SetPlotStatus %plotid% %id%>
	end <if= PlotStatus %plotid1% 0 else .%id%_GoCheckReveal ifNPCDead %6% LoseComp 0 .%id%_loss>
	.%id%_GoCheckReveal <ifSubPlotLost %plotid2% SMemo %id%02 SetPlotStatus %plotid5% %id5%>
	.%id%_loss <+T-- +F-->

	.%id1%_%plotid1%_GoWin <SetPlotStatus %plotid3% %id3%     SMemo %id%01>
	.%id1%_%plotid1%_GoLoss <SetPlotStatus %plotid4% %id4%    SMemo %id%02>

	Msg%id%01 <You won the mission. You should go see %name6% at %name1% about the reward.>
	Msg%id%02 <You lost the mission. You should go report to %name6% at %name1% .>

	%% SubPlot1 is the combat encounter itself
	%% SubPlot2 is the encounter revealation
	%% SubPlot3 is the winning condition
	%% SubPlot4 is the loss condition
	%% SubPlot5 is the unwinnable condition
	SubPlot1 <*:CS_MechaEncounter&Raiders&Secondary 7 8>
	SubPlot2 <*:CS_RevealEncounter_Raiders 7 8>
	SubPlot3 <*CS_CAWinMission 6>
	SubPlot4 <*CS_CALoseMission 6>
	SubPlot5 <*CS_MootMission 6>

	sub
		Persona 6
		rumor%id% <%name6% is hoping to speak with someone from the government.>
		greeting <if= PlotStatus %plotid1% 0 else .%id%_GoRemind if# PlotStatus %plotid% %id% else .%id%_GoGreet NewChat SayAnything>
		*.%id%_GoRemind <*GenericMissionReminder>
		*.%id%_GoGreet <*GreetThenDiscuss .%id%_GoOfferMission>
		.%id%_GoOfferMission <NewChat Say %id%01 AddCHat %id%01 AddCHat %id%02>
		result%id%01 <NewChat Say %id%02 AddChat %id%03>
		result%id%02 <NewChat Say %id%03 AddChat %id%03>
		result%id%03 <NewChat Say %id%04 SMemo %id%05 History %id%06 &SetEnemyFac %4% SetPlotStatus %plotid1% %id1% SetPlotStatus %plotid2% %id2%>
		Msg%id%01 <What do the people at \FACTION &AllyFac plan to do about %name4%? This isn't just a problem for %name5%, but for everyone. Something must be done immediately!>
		Msg%id%02 <The problem is that they're disrupting our shipping lanes, stealing millions of dollars worth of product, and the government is just standing by! Why, right now they've got a lance of raiders in town.>
		Msg%id%03 <Oh really? Then how can you explain the fact that they've got a lance of raiders in town at this very minute? The government needs to put more money into law enforcement.>
		Msg%id%04 <It's about time that somebody did. \HINT %plotid2%>
		Msg%id%05 <You agreed to take care of some raiders from %name4% for %name6%.>
		Msg%id%06 <%name6% told you that raiders from %name4% were in town.>
		Prompt%id%01 <I don't know... what exactly is the problem?>
		Prompt%id%02 <Rest assured that we're doing everything we can.>
		Prompt%id%03 <Raiders, you say? I'll look into that for you.>

		STC MS_SOCIAL
		SetID 1
	end
	inv
		stc CORE-ACTIVATABLE
		name <%name6%'s Mission>
	end

Plot
	name <Bounty Hunter Mission>
	desc <A bounty hunter is hiring.>
	requires <#A +Tgs (+Fmi|+F--) E:++ (E:THIEF|F:CRIME)>

	% E1 is the scene where this component will take place
	% E2 is a local public scene
	% E3 is the NPC that the PC will speak with
	% E4 is your enemy
	element1 <Grab 6>
	element2 <Scene Public !Near -7>
	element3 <Character Bounty Hunter -ENEMY !Near 2 NeverFail>
	NeverFail3 <Bounty Hunter>
	Place3 <1 (Guards) SD>
	element4 <Grab 1>

	% Fail Conditions:
	% - Mission giver dies before encounter is activated
	end <if= PlotStatus %plotid1% 0 ifNPCDead %3% LoseComp 0 .%id%_loss>
	.%id%_loss <+T-->

	.%id1%_%plotid1%_GoWin <SetPlotStatus %plotid2% %id2%     SMemo %id%01>
	.%id1%_%plotid1%_GoLoss <SetPlotStatus %plotid3% %id3%    SMemo %id%02>

	Msg%id%01 <You defeated %name4%. You should go tell %name3% at %name1%.>
	Msg%id%02 <You lost to %name4%. You should go tell %name3% at %name1%.>

	%% SubPlot1 is the Stop Mission task
	%% SubPlot2 is the winning condition
	%% SubPlot3 is the loss condition
	SubPlot1 <*:CS_StopNPCMission&IsEnemyNPC 4>
	SubPlot2 <*CS_CAWinMission 3>
	SubPlot3 <*CS_CALoseMission 3>

	sub
		Persona 3
		greeting <if= PlotStatus %plotid1% 0 else .%id%_GoRemind if# PlotStatus %plotid% 0 else .%id%_GoGreet NewChat SayAnything>
		*.%id%_GoGreet <*IHearYouAreFightingNPC %2% .%id%_GoOfferMission>
		*.%id%_GoRemind <*GenericMissionReminder>
		.%id%_GoOfferMission <NewChat Say %id%01 AddCHat %id%01 AddChat %id%02>
		result%id%01 <NewChat Say %id%02 History %id%03 SMemo %id%04 SetPlotStatus %plotid1% %id1%>
		*result%id%02 <*RejectMission .%id%_GoR2Exit>
		.%id%_GoR2Exit <AddReact -10   AddRenown -10   NTBLoseComp 0 .%id%_changes>
		.%id%_changes <+T-- +F-->
		Msg%id%01 <I need a cavalier for an upcoming mission against \OPR %4% . We don't know what \SPR %4% 's up to, but whatever it is it can't be good. If you want, I can let you have the job.>
		Msg%id%02 <Thanks. Come back and let me know when you've beaten \OPR %4% .>
		Msg%id%03 <%name3% hired you to discover %name4%'s plan and put a stop to it.>
		Msg%id%04 <You agreed to stop %name4%'s mission for %name3%.>
		Prompt%id%01 <Alright, I can do that.>
		Prompt%id%02 <Forget it. I'm done with %name4%.>

		STC MS_SOCIAL
		SetID 1
	end

Plot
	name <Good Thing You Showed Up>
	desc <An ally faction is hiring.>
	requires <#A +Tgs (+Fmi|+Fin|+F--) P:++ S:++>

	% E1 is the scene where this component will take place
	% E2 is the NPC that the PC will speak with
	element1 <Grab 6>
	element2 <Character !Near -7 !Ally -3 !XClude -2>
	Place2 <1 (Citizens) pass>

	% All this plot does is move the NPC and activate the mission subplot
	update <if= PlotStatus %plotid% 0   SetPlotStatus %plotid% %id1%>

	%% SubPlot1 is the mission to be offered
	SubPlot1 <*CS_GiveMission 2>

	sub
		Persona 2
		rumor%id1% <you should really speak to %name2% at %name1%.>
		Greeting <NewChat SayAnything>

		STC MS_SOCIAL
		SetID 1
	end

Plot
	name <Right Place For a Mission>
	desc <The city government is hiring.>
	requires <#A +Tgs (+Fmi|+Fin|+F--) S:PERM -L:ENEMY ~C:ADVEN>

	% E1 is the scene where this component will take place
	% E2 is the government faction, or a faction allied with it
	% E3 is the NPC that the PC will speak with
	element1 <Grab 6>
	element2 <Faction !Ally -7 !Okay 1 -ENEMY>
	element3 <Character !Near 1 !Comrade 2 NeverFail>
	NeverFail3 <Bureaucrat>
	Place3 <1 (Citizens) pass>

	% All this plot does is move the NPC, post some news,
	% and activate the mission subplot
	update <if= PlotStatus %plotid% 0   SetPlotStatus %plotid% %id1%>

	%% SubPlot1 is the mission to be offered
	SubPlot1 <*CS_GiveMission 3>

	sub
		Persona 3
		rumor%id1% <%name3% is at %name1% looking for a cavalier. It seems pretty important.>
		Greeting <NewChat SayAnything>

		STC MS_SOCIAL
		SetID 1
	end

Plot
	name <I have information for trade>
	Size 1
	desc <An NPC has information for you, but you have to do something first...>
	requires <#A +Tgs (+Fin|+F--) S:++ ~+Gkn>

	% E1 is the scene where the meeting will take place.
	% E2 is a public scene
	% E3 is the pilot being met.
	Element1 <Grab 6>
	Element2 <Scene Public (Building|Meeting) !Near -7>
	Element3 <Character ADVEN -ENEMY !Near 2 NeverFail>
	Place3 <1 sd ally (Guards)>

	% P%id%01 = Initialization Counter

	%% FAIL CONDITIONS:
	%% - E3 dies before the Gather Information started

	update <if= P%id%01 0 P= %id%01 1 SetPlotStatus %plotid% %id%>
	end <if= PlotStatus %plotid2% 0 ifNPCDead %3% LoseComp 0 .next>

	.%id2%_%plotid2%_GoWin <WinComp 0 .next>
	.%id2%_%plotid2%_GoLoss <LoseComp 0 .next>
	.next <+T-- +F-->

	% SubPlot1 is the Minor Mission
	% SubPlot2 is the Gather Information
	SubPlot1 <*:CS_MinorMission 3>
	SubPlot2 <*:CS_GatherInformation 3>

	sub
		Persona 3
		rumor%id% <%name3% at %name1% knows something. I just know it.>
		greeting <if= PlotStatus %plotid% %id% else GoChat ifSubPlotWon %plotid1% else GoCheckLoss Goto GoReveal>
		*GoReveal <*RevealSecret GoStartGI>
		GoStartGI <History 3 WinSubPlot %plotid% PMemo %plotid1% 0 SetPlotStatus %plotid2% %id2% Goto .%id2%_GoInform>
		GoCheckLoss <ifSubPlotLost %plotid1% else GoCheckProgress History 4 SMemo 0 NTBLoseComp 0 .next Goto GoLoss>
		*GoLoss <*MissionWasFailure na na na>
		GoChat <NewChat SayAnything>
		GoCheckProgress <if# PlotStatus %plotid1% 0 else GoFirstTime Goto GoRemind>
		*GoRemind <*GenericMissionReminder>
		*GoFirstTime <*IHaveInformation GoMakeOffer na>
		GoMakeOffer <NewChat Say 1 AddChat 1 AddChat 2>
		result1 <History 2 Goto .%id1%_GoInit>
		*result2 <*RejectMission .%id%_GoR2Exit>
		.%id%_GoR2Exit <SMemo 0 NTBLoseComp 0 .next>
		.next <+T-- +F-->
		Msg1 <Before I let you in on the secret, I need you to do a little something for me.>
		Msg2 <%name3% offered to tell you a secret, in exchange for a favor.>
		Msg3 <You completed %name3%'s task and learned the secret.>
		Msg4 <You failed at %name3%'s task.>
		Prompt1 <No problem. What do you need?>
		Prompt2 <Sorry, but I don't think it's worth it.>

		STC MS_CAFE
		SetID 1
	end

Plot
	name <Conference Corporate Mission: Enemy of my Enemy>
	desc <Go to a conference, find someone who's hiring.>
	requires <#A +Tgs (+Fcc|+Fmi|+F--) -P:CORPO F:++>
	Size 1

	% E1 is the scene where this component will take place
	% E2 is the corporate faction that's hiring
	% E3 is a local public scene for generating a new NPC
	% E4 is the NPC who will give the mission
	% E5 is the enemy faction - needed for the rumor
	element1 <Grab 6>
	Element2 <Faction Corporate -ArchEnemy !Okay -3 !Enemy -2>
	element3 <Scene Building Public !Near -7 !Okay 2>
	element4 <Character !Comrade 2 !Near 3 NeverFail>
	NeverFail4 <Corporate Executive>
	Place4 <1 (Citizens) pass>
	Element5 <Grab 2>

	% This plot updates when the PC enters the location
	start <if= PlotStatus %plotid% 0 ifNPCOK %4% else GoNPCDied if= SceneID %1%  SetPlotStatus %plotid% %id1%>
	GoNPCDied <LoseComp 0 .next>
	.next <>

	%% SubPlot1 is the mission to be offered
	SubPlot1 <*CS_GiveMission 4>

	sub
		Persona 4
		rumor%id1% <%name4% has been having problems with %name5%.>
		greeting <NewChat SayAnything>

		STC MS_OFFICE
		SetID 1
	end

Plot
	name <Conference Corporate Mission: L5 Region>
	desc <Go to a conference, find someone who's hiring.>
	requires <#A +Tgs (+Fcc|+Fmi|+F--) (P:--|P:CORPO) (L:MAQUI|L:FCOMS|L:RISHI)>
	Size 1

	% E1 is the scene where this component will take place
	% E2 is the corporate faction that's hiring
	% E3 is a local public scene for generating a new NPC
	% E4 is the NPC who will give the mission
	element1 <Grab 6>
	Element2 <Faction (COMET|HOELL|MUGLE) !Okay -3 !XClude -2 -Enemy>
	element3 <Scene Building Public !Near -7 !Okay 2>
	element4 <Character !Comrade 2 !Near 3 NeverFail>
	NeverFail4 <Corporate Executive>
	Place4 <1 (Citizens) pass>

	% This plot updates when the PC enters the location
	start <if= PlotStatus %plotid% 0 ifNPCOK %4% else GoNPCDied if= SceneID %1%  SetPlotStatus %plotid% %id1%>
	GoNPCDied <LoseComp 0 .next>
	.next <>

	%% SubPlot1 is the mission to be offered
	SubPlot1 <*CS_GiveMission 4>

	sub
		Persona 4
		rumor%id1% <%name4% is looking to hire someone for %name2%.>
		greeting <NewChat SayAnything>

		STC MS_OFFICE
		SetID 1
	end

Plot
	name <Party Contact>
	desc <At the party, the PC can get a job from someone.>
	requires <#A +Tgs (+Fpa|+Fcc) (P:--|P:PDASS|P:CORPO) ~+Gmo>
	Size 1

	% Element1 is the scene where this will take place
	% Element2 is a local public scene
	% Element3 is the NPC who will offer the mission
	% Element4 is the bodyguard
	% Element5 is an environs scene for the duel
	Element1 <Grab 6>
	Element2 <Scene Public Meeting !Near -7>
	Element3 <Prefab>
	Place3 <1 pass ally>
	Element4 <Prefab>
	Place4 <1 SD Ally>
	Element5 <Scene Environs !Near -7>

	% P%id%01 = Duel victory counter; 1=Win,-1=Loss
	% P%id%02 = Loss Timer
	start <if# P%id%02 0 ifG ComTime P%id%02 SMemo 0 LoseComp 0 .loss>
	end <ifNPCDead %3% LoseComp 0 .loss>
	.loss <+T-- +F-->

	.%id1%_%plotid1%_GoWin  <SMemo %id%01  p= %id%01  1  FreezeNPC %4%>
	.%id1%_%plotid1%_GoLose <SMemo %id%01  p= %id%01 -1  FreezeNPC %4%   P= %id%02 ComTime P+ %id%02 86400 P+ %id%02 d7200>

	Msg%id%01 <You should go tell %name3% at %name1% about your duel with %name4%.>

	% SubPlot1 is the duel with the bodyguard
	SubPlot1 <*CS_Duel&NoDerailment 4 1 5>

	sub
		Persona 3
		greeting <if= p%id%01 1 else GoCheckLoss NewChat Say %id%01 SMemo %id%02 History %id%03 Goto GoGetMission>
		GoGetMission <&SetTargetNPC %3% MoveNPC %4% %2% WinComp %2% .%id%_next>
		.%id%_next <+Tgt +Fmi>
		GoCheckLoss <if= p%id%01 -1 else GoCheckStatus NewChat Say %id%04 SMemo %id%02 History %id%03 AddChat %id%01 &SetTargetNPC %3% MoveNPC %4% %2% LoseComp %2% .%id%_next>
		GoCheckStatus <if# PlotStatus %plotid% 0 else GoIntro NewChat Say %id%05>
		*GoIntro <*NiceToMeetYou GoOffer>
		GoOffer <NewChat Say %id%06 AddChat %id%02 AddChat %id%03>

		result%id%01 <NewChat Say %id%07>
		result%id%02 <ifNPCOK %4% else .%id%_GoNoTest NewChat Say %id%08 AddChat %id%04 AddChat %id%05>
		.%id%_GoNoTest <NewChat Say %id%09 SMemo %id%02 History %id%03 &SetTargetNPC %3% NegateComp %2% .%id%_next>
		result%id%03 <NewChat Say %id%10 SMemo 0 NegateComp 0 .%id%_refuse>
		.%id%_refuse <+T-- +F-->
		result%id%04 <NewChat Say %id%11 SMemo %id%12 History %id%13 SetPlotStatus %plotid% %id1%>
		result%id%05 <Goto result%id%03>

		Msg%id%01 <I knew you looked like a winner. Come see me at %name2% later on and I'll have that mission for you.>
		Msg%id%02 <You should go meet %name3% at %name2% for a mission.>
		Msg%id%03 <After impressing \OPR %3% , %name3% offered you a job.>
		Msg%id%04 <Very good. I wasn't sure I was going to see you again. Come see me at %name2% later on and I'll try to find a mission for you.>
		Msg%id%05 <Come back to see me after you've fought %name4% in %name5%.>
		Msg%id%06 <You're not a cavalier are you? I've been looking for someone to run a couple of missions for me. Of course, I'd have to test your abilities before offering you the job...>
		Msg%id%07 <I know... but you came back to report after a humiliating defeat. That kind of diligence can be very useful. I'll see you at %name2%.>
		Msg%id%08 <See my bodyguard %name4% over there? I want you to go with \OPR %4% to %name5%; there, you'll be tested on your mecha combat skills. If I am impressed with your performance then the job is yours.>
		Msg%id%09 <I suppose a test isn't strictly necessary... Come see me in %name2% and I'll give you a mission.>
		Msg%id%10 <That's too bad.>
		Msg%id%11 <Wonderful. Come back here when you've finished the duel.>
		Msg%id%12 <%name3% sent you to duel %name4% in %name5%. If you win, \SPR %3% will give you a job.>
		Msg%id%13 <You agreed to duel %name4% to prove your abilities to %name3%.>

		Prompt%id%01 <But... I lost the duel!>
		Prompt%id%02 <What kind of test are you talking about?>
		Prompt%id%03 <Sorry, I'm not interested.>
		Prompt%id%04 <It's a deal.>
		Prompt%id%05 <No way. %name4% scares me.>

		Persona 4
		greeting <NewChat Say 1>
		msg1 <Go see %name3% if you've got any business.>

		STC MS_SOCIAL
		SetID 1
	end
	inv
		NPC Shopkeeper
		statline 10 9 12 13 14 16 15 16
		chardesc renowned
		job <Investor>

		NPC Soldier
		job <Bodyguard>
		job_desig <ADVEN>
		chardesc shy
	end

Plot
	name <Bad Party>
	desc <We're going to a bad party. Actually, meet a bored arena pilot and go duel.>
	requires <#A +Tgs (+Fpa|+Ffi) ~+Gpo>
	Size 1

	% Element1 is the scene where this will take place
	% Element2 is a local public scene
	% Element3 is the bored arena pilot
	% Element4 is an environs scene for the duel
	Element1 <Grab 6>
	Element2 <Scene Building Public !Near -7>
	Element3 <Character HasMecha PDAss !Near 2 Neverfail>
	NeverFail3 <Arena Pilot>
	Place3 <1 (Citizens) pass>
	Element4 <Scene Environs !Near -7>

	% V1 = Initialization Counter
	% V2 = Partner Observation
	% As long as we're still at the first phase, the NPC's death will end the plot.
	start <if= PlotStatus %plotid% 0 ifNPCDead %3% else GoCheckScene LoseComp 0 .changes>
	GoCheckScene <if= SceneID %1% ifNPCOK &PartnerNPC if= V2 0  Monologue &PartnerNPC 3 V= 2 1>
	.changes <+T-- +F-->

	% V1 = Initialization Counter
	update <if= v1 0 V= 1 1 NPCLevel %3% StoryDL>

	% Branch activators
	.%id1%_%plotid%_GoWin <ifNPCOK %3% else GoE3Died SMemo 1 SetPlotStatus %plotid% %id2%>
	.%id1%_%plotid%_GoLose <SMemo 2 SetPlotStatus %plotid% %id3%>
	GoE3Died <SMemo 0 WinComp 0 .changes>

	Msg1 <You bested %name3% in a duel; \SPR %3% is waiting for you at %name1%.>
	Msg2 <You were defeated by %name3% in a duel; \SPR %3% is waiting for you at %name1%.>
	Msg3 <Look over there... %name3% doesn't look like \SPR %3% 's enjoying the party.>
	Msg3_1 <Say, isn't that %name3% the famous arena pilot? I wonder if we can get an autograph... or a duel.>

	% SubPlot1 is the duel itself
	% SubPlot2 is the path if the PC wins the duel
	% SubPlot3 is the path if the PC loses the duel
	% SubPlot4 is the negation/advice from E3
	SubPlot1 <*CS_Duel 3 1 4>
	SubPlot2 <*CS_WinDuelVs 3>
	SubPlot3 <*CS_LoseDuelVs 3>
	SubPlot4 <*CS_AdvisePC 3>

	sub
		Persona 3
		% V1 = Reputation Counter
		greeting <if= PlotStatus %plotid% 0 else GoChat Goto GoFirstTime>
		*GoChat <*MISC_CHATTER>
		GoFirstTime <NewChat Say 1 AddChat 1 AddChat 2 AddChat 3>
		result1 <StoryNote 2 SetPlotStatus %plotid% %id1% Goto GoAcceptChallenge>
		*GoAcceptChallenge <*IAcceptYourChallenge %4%>
		result2 <Goto .%id4%_GoAdvise_N>
		result3 <EndChat Say 3 AddChat 4 if= V1 0 V= 1 1 AddSociable d10>
		result4 <Goto .%id4%_GoAdvise_N>
		Msg1 <Are you as bored with this party as I am? There's just no action here... this entire place is dead and dull.>
		Msg1_1 <This party is dead. If only there were something interesting to do...>
		Msg1_2 <>
		Msg2 <At the party, you challenged %name3% to a duel in %name4%.>
		Msg3 <Well, if you're looking for something exciting to do today, I might be able to help...>
		Prompt1 <Why don't we step outside and test our mecha?>
		Prompt1_1 <Here's an idea. Let's blow this place and do a practice duel.>
		Prompt1_2 <If you're looking for action, how about a duel?>
		Prompt2 <Any idea where I could find something better to do?>
		Prompt2_1 <Yeah, I wouldn't be here if I had anything better to do.>
		Prompt2_2 <>
		Prompt3 <If I'd arrived earlier, maybe I could've saved it.>
		Prompt3_1 <Half the people are gone already... this party's over.>
		Prompt3_2 <Man, I can't believe it's over already...>
		Prompt4 <[Continue]>

		STC MS_CAFE
		SetID 1
	end

Plot
	name <Convention Press Conference>
	desc <This convention is about to feature a press conference.>
	requires <#A +Tgs (+Fcc|+Fin) S:META>

	% E1 is the scene where the conference will take place
	% E2 is a local scene; natural home to E4
	% E3 is the character doing the talking
	Element1 <Grab 6>
	Element2 <Scene !Near -7 !Okay -3 Public>
	Element3 <NewNPC 2 2>
	Place3 <2>

	% V1 = Initialization Counter
	update <if= V1 0 MoveNPC %3% %1% V= 1 1>
	start <if= PlotStatus %plotid% 0 if= SceneID %1% Alert 1 SMemo 2 SetPlotStatus %plotid% %id1%>

	Msg1 <At the convention hall, %name3% appears to be just finishing up a speech.>
	Msg2 <At %name1%, %name3% just gave a speech about something.>

	%% SubPlot1 is the press conference
	SubPlot1 <*CS_PressConference 1 3>

	sub
		STC MS_PRESENTATION
		SetID 1
	end


%%
%%  ERROR CORRECTORS
%%

Content
	requires <+Hra A:-->
	update <NegateComp &CompScene .next>
	.next <+H-->


