%%
%% MegaPlot Components
%%

%% Similar to quests, but work for plots.

%% *ThiefHideout Content
%%
%%  A thief is hiding out somewhere. Add a hideout, and a way to access it.
%%  Most of these fragments should result in a personal scale fight.
%%
%%  The parent plot should set the plot status to this layer's ID when ready
%%  for the player to go looking. Forcing a capture will freeze the NPC.
%%  Causing the subplot to become unwinnable will also likely freeze the NPC.
%%
%%    PARAM1: Thief
%%    PARAM2: Person looking for thief; plot wiil take place in his city
%%  Returns:
%%    P%id%01 = Capture Value
%%		-1: Plot has become impossible
%%		0: Plot in progress
%%		1: NPC has been captured

Content
	name <Space Hideout>
	requires <*ThiefHideout>

	% E1 is the thief being sought; set PLACE here.
	% E2 is the bounty hunter looking for him.
	% E3 is an urban scene, for placing the encounter
	% E4 is the encounter/metascene itself
	% E5 is a character who can tell the PC where the hideout is.

	% P%id%01 = Capture Value
	% P%id%11 = Have discovered location of target

	Place1 <4 (Citizens) pass>
	Element3 <Scene Outdoors Space !Near 2>
	Element4 <Prefab>
	Place4 <3>
	Element5 <Character !Near 2>

	% If this subplot has been activated, check to make sure the informant is OK.
	Start <if= PlotStatus %plotid% %id% else %pop% if= P%id%11 0 else %pop% ifNPCDead %5% else %pop% P= %id%01 -1 Goto %pop%>

sub
	Persona 1
	Special <UNLISTED>
	greeting <ifChatNPCSurrendered else GoFirstTime Goto GoWillSurrender>
	*GoFirstTime <*IntruderGreeting&Arrest GoBargain>
	*GoBargain <*YoureUnderArrest %threat% GoWillSurrender GoWillResist na>
	*GoWillSurrender <*ISurrender&Arrest GoSurrender>
	*GoWillResist <*IDisagreeYouDie&Arrest GoAttack>
	GoAttack <SoloAttack %1% L= 2 1>
	GoSurrender <P= %id%01 1  FreezeNPC %1%>

	Persona 5
	rumor%id% <%name5% might know where %name1% is.>
	greeting <if= PlotStatus %plotid% %id% else GoChat if= P%id%11 0 else GoChat Goto GoGetInfo>
	GoChat <RevertPersona>
	*GoGetInfo <*LookingForNPC %1% GoSuccess GoFailure>
	GoSuccess <NewChat Say 1 P= %id%11 1 Memo 2>
	*GoFailure <*BrushOff&Questioning>
	Msg1 <%name1% has a microstation in %name3%. I used to do supply runs to \OPR %1% . If you're looking for \OPR %1% , that's the first place I'd check.>
	Msg2 <%name5% told you that %name1%'s microstation can be found in %name3%.>

	MetaScene 4
	special <NOEXIT>
	% L1 = Initialization Counter
	% L2 = Fight has started
	BoxMap
	MapWidth 12
	MapHeight 17
	content <Fill Sub *HIDEOUT_X na>
	Start <Print 1 if= L1 0 L= 1 1 ForceChat %1%>
	nu1 <if= T1 0 Return if= L2 1 ifNPCOK %1% FreezeNPC %1% P= %id%01 -1>
	Surrender%1% <ForceChat %1%>
	Msg1 <You enter the hideout.>
	sub
		Team 1

		Team 2
		name <Citizens>

		Room
		special <STARTHERE>
		minimap <......###..#1#...........>
		sub
			Elevator
			Destination -1
			MiniMapComponent 1
			use <Print 1 Return>
		end
	end
end
inv
	STC ENCOUNTER-DUEL
	name <%name1%'s Station>
	update <if= P%id%11 1 else GoHide  SetStat STAT_MetaVisibility 0  ShowEncounter  Goto GoSetOrders>
	ENCOUNTER_Hostile
end

Content
	name <Basic Hideout>
	requires <*ThiefHideout>

	% E1 is the thief being sought; set PLACE here.
	% E2 is the bounty hunter looking for him.
	% E3 is an urban scene, for placing the encounter
	% E4 is the encounter/metascene itself
	% E5 is a character who can tell the PC where the hideout is.

	% P%id%01 = Capture Value
	% P%id%11 = Have discovered location of target

	Place1 <4 (Citizens) pass>
	Element3 <Scene Urban !Near 2>
	Element4 <Prefab>
	Place4 <3>
	Element5 <Character !Near 2 Criminal>

	% If this subplot has been activated, check to make sure the informant is OK.
	Start <if= PlotStatus %plotid% %id% else %pop% if= P%id%11 0 else %pop% ifNPCDead %5% else %pop% P= %id%01 -1 Goto %pop%>

sub
	Persona 1
	Special <UNLISTED>
	greeting <ifChatNPCSurrendered else GoFirstTime Goto GoWillSurrender>
	*GoFirstTime <*IntruderGreeting&Arrest GoBargain>
	*GoBargain <*YoureUnderArrest %threat% GoWillSurrender GoWillResist na>
	*GoWillSurrender <*ISurrender&Arrest GoSurrender>
	*GoWillResist <*IDisagreeYouDie&Arrest GoAttack>
	GoAttack <SoloAttack %1% L= 2 1>
	GoSurrender <P= %id%01 1  FreezeNPC %1%>

	Persona 5
	rumor%id% <%name5% has had dealings with %name1% in the past.>
	greeting <if= PlotStatus %plotid% %id% else GoChat if= P%id%11 0 else GoChat Goto GoGetInfo>
	GoChat <RevertPersona>
	*GoGetInfo <*LookingForNPC %1% GoSuccess GoFailure>
	GoSuccess <NewChat Say 1 P= %id%11 1 Memo 2>
	*GoFailure <*BrushOff&Questioning>
	Msg1 <I'll tell you- %name1% used to have a hideout in %name3%. If you're looking for \OPR %1% , that's the first place I'd check.>
	Msg2 <%name5% told you that %name1%'s hideout can be found in %name3%.>

	MetaScene 4
	special <NOEXIT>
	% L1 = Initialization Counter
	% L2 = Fight has started
	BoxMap
	MapWidth 12
	MapHeight 17
	content <Fill Sub *HIDEOUT_X na>
	Start <Print 1 if= L1 0 L= 1 1 ForceChat %1%>
	nu1 <if= T1 0 Return if= L2 1 ifNPCOK %1% FreezeNPC %1% P= %id%01 -1>
	Surrender%1% <ForceChat %1%>
	Msg1 <You enter the hideout.>
	sub
		Team 1

		Team 2
		name <Citizens>

		Room
		special <STARTHERE>
		minimap <......###..#1#...........>
		sub
			Elevator
			Destination -1
			MiniMapComponent 1
			use <Print 1 Return>
		end
	end
end
inv
	STC ENCOUNTER-DUEL
	name <%name1%'s Hideout>
	update <if= P%id%11 1 else GoHide  SetStat STAT_MetaVisibility 0  ShowEncounter  Goto GoSetOrders>
	ENCOUNTER_Hostile
end

Content
	name <Hiding in Mecha>
	% The NPC is in his mecha outside of town. In order to capture him, the
	% PC will have to fight in a mecha.
	requires <*ThiefHideout>

	% E1 is the thief being sought; set PLACE here.
	% E2 is the bounty hunter looking for him.
	% E3 is an environs scene, for placing the encounter
	% E4 is the encounter/metascene itself

	Place1 <4 (Enemies) SD Enemy>
	Element3 <Scene Environs !Near 2>
	Element4 <Prefab>
	Place4 <3>

	% P%id%01 = Capture Counter
	% P%id%11 = Entered Fight Once Counter

sub
	Persona 1
	Special <UNLISTED>
	rumor%id% <%name1% is out driving around in %name3%.>
	*Greeting <*BattleIntroduction&SentToFight GoThemeExpo>
	*GoThemeExpo <*THEME_EXPO&Enemy na>

	MetaScene 4 2
	% L1 = Initialization Counter
	MapWidth 30
	MapHeight 30
	content <Fill Sub *HIDEOUT_X na>
	Start <if= L1 0 L= 1 1 P= %id%11 1 ForceChat %1%>
	nu1 <if= T1 0 Return if= L1 1  L= 1 2 ifNPCOk %1% P= %id%01 -1  ifNPCOK %1% FreezeNPC %1%>
	nu2 <if= T2 0        if= L1 1  L= 1 2 Salvage  ifNPCOk %1% P= %id%01 1   Print 2  FreezeNPC %1%>
	Msg2 <%name1% has been captured.>
	sub
		team 1
		SetEnemy 2
		ParaX 5
		ParaY 5

		team 2
		name <Enemies>
		SetEnemy 1
		update <SetSelfFaction NPCFac %1%   WMecha 2 %threat% 100>
		ParaX 25
		ParaY 25
	end
end
inv
	STC ENCOUNTER-WANDER
	name <%name1%'s Mecha>
	update <if= PlotStatus %plotid% %id% else GoHide  if= P%id%11 0 else GoHide SetStat STAT_MetaVisibility 0  Goto GoSetOrders>
	ENCOUNTER_Hostile
end



