Plot 0
	name <ARC: Invasion Defense>
	% v1.1 :  Added memo

	% E1 is the faction behind the story
	Element1 <Grab 1>

	% E2 is the NPC who will give the PC the mission.
	% Right now it will just be a member of E1.
	Element2 <Character !Comrade 1 HasMecha>

	% ********************
	% *** SCRIPT BLOCK ***
	% ********************
	% V1 = Time Limit
	% V2 = Combat Indicator, if V2=1 combat has been entered
	% V3 = Email sent indicator.
	% V4 = Original NPC location

	% On a cleanup request, delete this plot unless combat has been
	% entered.
	cleanup <if= V2 0 MoveChar E2 V4 AdvancePlot 0>

	% Time limit. This plot will conclude in one day, or immediately
	% if NPC E2 is killed.
	start <ifPersona E2 else GoDelete if= V1 0 else GoCheckTime V= 1 ComTime V+ 1 86400 V= 4 EScene 2 MoveChar E2 N3>
	GoCheckTime <if= V2 0 ifG ComTime V1 MoveChar E2 V4 if= d2 1 else GoDelete V+ 101 1 AdvancePlot 0>
	GoDelete <AdvancePlot 0>

	% Combat check. If combat has been entered, V2=1.
	% Combat ends in victory if the number of active masters on
	% team two drops to zero, or ends in defeat is the number of
	% active masters on team one drops to zero. After combat, V2=3
	% if the player was victorious or V2=2 is the player lost.
	% Finally, if the player won, the calling story's faction victory
	% count (by default now story variable 101) will be increased.
	nu1 <if= T1 0 if= V2 1  V= 2 2  Reputation 6 -7>
	nu2 <if= T2 0 if= V2 1  V= 2 3  Reputation 6  1  XPV 50  S+ 101 1>

	% Email check. If the PC belongs to the same faction as the NPC,
	% he may recieve an email about the mission. Make a check every
	% 5 minutes.
	5Min <if= d30 23 if= V3 0 if= PCFac E1 V= 3 1 Email d5>

	% *********************
	% *** MESSAGE BLOCK ***
	% *********************

	% 01 - 05 :  Email Messages.
	%  The NPC is offering the PC a mission via email.
	Msg1 <\PERSONA E2 @ \SCENE EScene 2 :// \NARRATIVE 3 is under attack from \NARRATIVE 2 . Report here to aid in the defense.>
	Msg2 <\PERSONA E2 @ \SCENE EScene 2 :// We're being attacked by \NARRATIVE 2 . Get over here right away!>
	Msg3 <\PERSONA E2 @ \SCENE EScene 2 :// \NARRATIVE 3 is being attacked and \NARRATIVE 1 is defending. Please come quickly!>
	Msg4 <\PERSONA E2 @ \SCENE EScene 2 :// Turns out \NARRATIVE 2 wants to take \NARRATIVE 3 , so we're going to stop them.>
	Msg5 <\PERSONA E2 @ \SCENE EScene 2 :// I could use some help. \NARRATIVE 3 is under attack; report here as quickly as possible.>


sub
	% This next bit is the conversation which will happen when the
	% PC speaks to E2.
	Persona 2

	rumor <!2 is one of the city's defenders.>


	% SPECIAL FEATURE: If the PC did a lot of work during this story,
	%  and is pretty renowned, and has no faction at the moment, make
	%  an offer to join E1.
	Greeting <NewChat if= P2 3 else GoCheckLoss Say d5 CashPrize V4 AdvancePlot 0>
	GoCheckLoss <if= P2 2 else GoCheckJob V= 2 5 V+ 2 d5 Say V2 AdvancePlot 0>
	GoCheckJob <if= V1 1 else GoInitialize Say 101 Goto GoAddComOps>

	% The first time the PC meets the NPC, the PC will be given the
	% mission automatically if he's part of the same faction, or if
	% he is a friend of the NPC, or if he's already been sent email.
	GoInitialize <V= 3 FacVar E1 1000 V+ 3 d6 V+ 3 -d6 V= 3 Threat V3 100 V= 4 Reward V3 85 Goto GoCheckFirst>
	GoCheckFirst <if= V1 0 else GoDenied V= 1 -1 if= PCFac E1 else GoCheckEmail V= 2 10 V+ 2 d5 Say V2 Goto GoAddComOps>
	GoCheckEmail <if= P3 1 else GoCheckFriend V= 2 10 V+ 2 d5 Say V2 Goto GoAddComOps>
	% If the reaction score is greater than 40, PC will automatically
	% be offered the job, but unlike above will not be automatically
	% expected to accept it,
	GoCheckFriend <if# PCFac N2 else GoDenied ifG S5 -1 else GoDenied ifG React 20 else GoNoAutomatic ifG PCRep 1 0 else GoNoAutomatic V= 2 15 V+ 2 d5 Say V2 Goto GoAddFriendOps>
	GoAddFriendOps <V= 2 6 V+ 2 d2 AddChat V2 V= 2 8 V+ 2 d2 AddChat V2>
	% If the PC is not automatically offered the job, there's still
	% a chance to get the job... as long as the NPC doesn't hate him.
	GoNoAutomatic <ifG React -d20 else GoDenied V= 2 20 V+ 2 d5 Say V2 V= 2 10 V+ 2 d3 AddChat V2 V= 2 13 V+ 2 d3 AddChat V2 V= 2 16 V+ 2 d3 AddChat V2>
	GoDenied <V= 1 -1 SayAnything>

	GoAddComOps <V= 1 1 AddChat d2 V= 2 2 V+ 2 d2 AddChat V2 V= 2 4 V+ 2 d2 AddChat V2 Memo 107>

	% The PC will enter combat here.
	result1 <EndChat V= 2 35 V+ 2 d5 Say V2 SavePos P= 2 1 Dynamic 2 V3 .nu1 .nu2 S+ 5 1 Encounter 25 25 .edesc>
	.nu1 <if= T1 0 Return>
	.nu2 <if= T2 0 Salvage Return>
	.edesc <!M \VAL N2>
	result2 <Goto Result1>

	% The PC needs some time to get ready.
	result3 <NewChat Say 103>
	result4 <Goto Result3>

	% The PC will be told the enemy's point value.
	result5 <NewChat V= 2 25 V+ 2 d5 Say V2 AddChat 1 AddChat 3>
	result6 <Goto result5>

	% The PC accepts the job offer.
	result7 <NewChat V= 2 10 V+ 2 d5 Say V2 Goto GoAddComOps>
	result8 <Goto result7>

	% The PC refuses the job offer.
	result9 <NewChat Say 102 V= 1 -1>
	result10 <Goto result9>

	% The PC tries to get the job via "PLAN A"- be forceful and
	% convincing. This plan uses Intimidation skill in order to
	% succeed. If you want to change it, some alternate "PLAN A"
	% types are presented... uncomment the one you like.
	result11 <NewChat ifG Intimidation 10 else GoR11Lose V= 2 30 V+ 2 d5 Say V2 V= 2 6 V+ 2 d2 AddChat V2 V= 2 8 V+ 2 d2 AddChat V2>
	result12 <Goto result11>
	result13 <Goto result11>
	GoR11Lose <NewChat Say 104 V= 1 -1>


	% The PC tries to get the job via "PLAN B".
	% The PC will impress the NPC with HEROIC reputation...
	result14 <NewChat ifG PCRep 1 -d30 else GoR14Lose V= 2 30 V+ 2 d5 Say V2 V= 2 6 V+ 2 d2 AddChat V2 V= 2 8 V+ 2 d2 AddChat V2>
	result15 <Goto result14>
	result16 <Goto result14>
	% PLAN "B", whatever it was, has failed...
	GoR14Lose <NewChat Say 105 V= 1 -1>

	% The player doesn't want this stinkin' job.
	result17 <NewChat Say 106 V= 1 -1>
	result18 <Goto result17>
	result19 <Goto result17>

	result20 <NewChat Say 42 AddReact d12 SetPlayerFaction E1 XPV 500 mechaprize .facmek>
	.facmek <BuruBuru.txt>
	result21 <NewChat Say 43>

	% *********************
	% *** MESSAGE BLOCK ***
	% *********************

	% 01 - 05 :  Player has won the battle and is being paid.
	Msg1 <Good job out there! The invaders have been driven back, but I have the feeling that more will be coming...>
	Msg2 <You did it. Here's your reward.>
	Msg3 <That wave has been driven off, but we can't let down our guard because there'll definitely be more coming. Here's your pay.>
	Msg4 <You beat \NARRATIVE 2 this time, but something tells me they won't give up so easily. Here's your pay.>
	Msg5 <That was a great battle. Here's the pay you earned.>

	% 06 - 10 :  Player has lost the battle.
	Msg6 <This is horrible... if we can't turn them back, our city will be captured.>
	Msg7 <The mission was a failure... \NARRATIVE 2 is one step closer to victory.>
	Msg8 <You lost.>
	Msg9 <They defeated you.>
	Msg10 <The forces of \NARRATIVE 2 won that last battle... I fear we may be doomed.>

	% 11 - 15 :  Description of mission.
	%  use "$ \VAL V4 " to insert the pay for the mission,
	%  and don't forget to mention that the PC also gets salvage.
	Msg11 <Our enemies in \NARRATIVE 2 are attacking the north garrison. We need you to stop them. Pay is $ \VAL V4 plus salvage.>
	Msg12 <The enemy is moving its forces into position for a major assault against our city. You'll get $ \VAL V4 and first salvage rights if you can stop \NARRATIVE 2 before they get here.>
	Msg13 <The forces of \NARRATIVE 2 are attacking our south garrison. Pay for the job is $ \VAL V4 and salvage.>
	Msg14 <Our perimiter defense line is under attack; we need to drive back \NARRATIVE 2 before they break through. I can give you $ \VAL V4 plus salvage rights for the job.>
	Msg15 <The enemy has established a firebase outside of town. It's your job to destroy it. If you succeed it'll be worth $ \VAL V4 to you, plus any leftover enemy meks.>

	% 16 - 20 :  Player is asked if he is looking for a job.
	Msg16 <Our town is under attack by \NARRATIVE 2 mecha! Will you help defend us against these invaders?>
	Msg17 <\NARRATIVE 3 is under attack! Mecha from \NARRATIVE 2 have surrounded our city. Will you help us in the defense?>
	Msg18 <This city is under siege from \NARRATIVE 2 forces. I could really use your help to drive them off.>
	Msg19 <I've been placed in command of a defense squad. As you may know \NARRATIVE 2 is staging an invasion of our city. How'd you like to help us?>
	Msg20 <Why don't you join up with the civic defense squad? We're being attacked by \NARRATIVE 2 and could use all the help we can get.>

	% 21 - 25 :  NPC implies job, PC might have chance to get it.
	Msg21 <This town is under attack by \NARRATIVE 2 . I would advise that you leave this area as quickly as possible.>
	Msg22 <We are currently under attack from \NARRATIVE 2 . This town is no longer a safe place to be.>
	Msg23 <If you have no urgent business here, I would advise you to leave town as quickly as possible. We are under attack from \NARRATIVE 2 .>
	Msg24 <This town is under attack. Citizens should evacuate to safer areas.>
	Msg25 <It isn't safe here; \NARRATIVE 2 has been attacking this city.>

	% 26 - 30 :  PC will be told exact enemy point value.
	%  use "\VAL V3 " to insert the value.
	Msg26 <Our reports indicate that you'll be up against \VAL V3 threat points worth of enemy hardware. Do you feel up to the challenge?>
	Msg27 <They'll be sending around \VAL V3 tactical threat points worth of mecha our way.>
	Msg28 <Reports indicate that you will be facing \VAL V3 TTP worth of enemy mecha. Do you think you can deal with all of that by yourself?>
	Msg29 <According to our scouts, \NARRATIVE 2 has \VAL V3 worth of mecha in the area.>
	Msg30 <They have \VAL V3 threat points worth of mecha in the engagement zone. You'll be responsible for disabling all of that yourself.>

	% 31 - 35 :  "PLAN A" or "PLAN B" worked... the PC is offered
	%  a job and may choose either prompt7/8 to accept or prompt9/10
	%  to reject it.
	Msg31 <I could use you on our side. How'd you like to join the civic defense force?>
	Msg32 <\NARRATIVE 3 needs all the defenders it can get. How about running a defense mission for us?>
	Msg33 <There are defense missions avaliable, if you'd like to do one.>
	Msg34 <Would you really like to help defend \NARRATIVE 3 ? It's a dangerous job, you know.>
	Msg35 <How about signing on for a defense mission? I have a few sorties coming up which I could use a pilot for.>

	% 36 - 40 :  Combat is starting.
	Msg36 <Good luck out there. Report back to me once you've completed the mission.>
	Msg37 <Here are the navigation coordinates. Report back to me once you've completed the mission.>
	Msg38 <Here are the operation coordinates. Destroy all enemy mecha you encounter, then return back here and I'll give you your reward.>
	Msg39 <Travel to these coordinates, and eliminate all the enemy units you find.>
	Msg40 <Give 'em hell!>


	% Recruitment offer messages
	Msg41 <Here's your pay. You handled things pretty well out there... How'd you like to join \ELEMENT 1 ?>
	Msg42 <Great! Welcome to our ranks. You will receive a standard issue battroid mecha, and all the other perks of membership.>
	Msg43 <That's too bad. Keep my offer in mind, though. There are a lot of benefits to serving in the military.>

	% 101 :  Player accepted job, then left to get ready.
	Msg101 <Are you ready to start the mission?>
	% 102 :  Player has refused to take job; answer to prompts 9-10.
	Msg102 <That's too bad.>
	% 103 :  Player has asked for some time to get ready.
	Msg103 <Okay. Hurry back once your equipment is in shape and we can start the mission then.>
	% 104 :  "PLAN A" has failed, and the PC is not offered a job.
	Msg104 <I can handle this fine by myself.>
	% 105 :  "PLAN B" has failed, and the PC is not offered a job.
	Msg105 <Given your track record I don't really think we want you on our side.>
	% 106 :  Player doesn't want job; answer to prompts 17-19.
	msg106 <If you'll excuse me, I have work to do.>
	% 107 :  Memo
	msg107 <\ELEMENT 2 in \SCENE EScene 2 asked you to help defend the city against \NARRATIVE 2 .>

	% 01 - 02 :  Ready to start the mission
	Prompt1 <I'm ready to go.>
	Prompt2 <All ready to start.>

	% 03 - 04 :  Need time to get ready first.
	Prompt3 <Give me some time to get ready.>
	Prompt4 <My mecha needs repairs.>

	% 05 - 06 :  What is the enemy point value?
	Prompt5 <What am I up against out there?>
	Prompt6 <How many tac points do they have?>

	% 07 - 08 :  After being asked if he wants a job, PC says yes.
	Prompt7 <I'd like to.>
	Prompt8 <I'll do that.>

	% 09 - 10 :  After being asked if he wants a job, PC says no.
	Prompt9 <No, not really.>
	Prompt10 <Sorry, I don't want to die.>

	% 11 - 13 : Player tries to get job using PLAN "A".
	%   By default, PLAN "A" is to sound tough and experienced.
	Prompt11 <You could use a good pilot on your side.>
	Prompt12 <I could take \NARRATIVE 2 no sweat.>
	Prompt13 <Sounds like you need some help.>

	% 14 - 16 : Player tries to get job using PLAN "B".
	%   By default, PLAN "B" is to be friendly and personable.
	Prompt14 <Let me help you fight them.>
	Prompt15 <I will defend \NARRATIVE 3 as well.>
	Prompt16 <I want to help you.>

	% 17 - 19 : Player doesn't much care for the job.
	Prompt17 <Guess I should get out of town, then.>
	Prompt18 <Thanks for the tip. Goodbye.>
	Prompt19 <Your battle doesn't concern me.>

	Prompt20 <I'd like to.>
	Prompt21 <No thanks.>

end

