Skip to content

Instantly share code, notes, and snippets.

@Celludriel
Created December 19, 2018 18:53
Show Gist options
  • Save Celludriel/8c01734479bea8f7f49bd5466cdf39e5 to your computer and use it in GitHub Desktop.
Save Celludriel/8c01734479bea8f7f49bd5466cdf39e5 to your computer and use it in GitHub Desktop.
Warsubscriptions with debug
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="/mdscript/cues">
<cues>
<cue name="Start" namespace="this">
<conditions>
<event_cue_completed cue="md.Setup.Start"/>
</conditions>
<actions>
<set_value name="$DebugChance" exact="100"/>
<set_value name="$DebugChance2" exact="100"/>
<set_value name="$MissionGroupCues" exact="table[]"/>
<set_value name="$Threads" exact="[]"/>
<set_value name="$ThreadDefinitions" exact="table[]"/>
<set_value name="$ActiveThreads" exact="[]" comment="List of instanced thread cues of md.MC_Management.Thread_Manager"/>
<set_value name="$WarFronts" exact="table[]"/>
<set_value name="$NonSubscriptionWars" exact="table[]"/>
<debug_text text="'War Subscriptions Starting'" />
</actions>
<cues>
<!--War text pages
Argon Vs Xenon
Text: 30210
Rep voice: 10110
Argon Vs Holy Order
Text: 30211
Rep voice: 10101
Paranid Vs Holy Order
Text: 30212
Rep voice: 10304
Holy Order Vs Argon
Text: 30213
Rep voice: 10305
Holy Order Vs Paranid
Text: 30214
Rep voice: 10307-->
<cue name="DefineNonSubscriptionWars">
<actions>
<set_value name="$NonSubscriptionWars.{faction.antigone}" exact="[faction.holyorder, faction.xenon]"/>
<set_value name="$NonSubscriptionWars.{faction.holyorder}" exact="[faction.antigone, faction.ministry, faction.teladi, faction.xenon]"/>
<set_value name="$NonSubscriptionWars.{faction.ministry}" exact="[faction.holyorder, faction.xenon]"/>
<set_value name="$NonSubscriptionWars.{faction.teladi}" exact="[faction.holyorder, faction.xenon]"/>
</actions>
</cue>
<!--
###################################
ARGON VS XENON
###################################-->
<cue name="ARG_VS_XENON" namespace="this">
<actions>
<!--Common values-->
<set_value name="$ManagerCue" exact="parent.namespace"/>
<set_value name="$Faction" exact="faction.argon"/>
<set_value name="$EnemyFaction" exact="faction.xenon"/>
<set_value name="$MissionGroup" exact="missiongroup.argon_war_xenon"/>
<set_value name="$Mission_Contact" exact="null"/>
<set_value name="$Page" exact="30210" comment="Argon-Xenon-War page"/>
<set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
<set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
<set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
<set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
<!--Status-->
<set_value name="$SubscriptionStatus" exact="null"/>
<set_value name="$IntroducedToContact" exact="false"/>
<set_value name="$JobsDescribed" exact="false"/>
<set_value name="$ConflictDescribed" exact="false"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<set_value name="$CooldownTime" exact="-1s"/>
<!--Stats-->
<set_value name="$ThreadsCompleted" exact="0"/>
<set_value name="$ThreadsFailed" exact="0"/>
<set_value name="$MissionsCompleted" exact="0"/>
<set_value name="$MissionsFailed" exact="0"/>
</actions>
<cues>
<cue name="ARG_VS_XENON_Init">
<actions>
<set_value name="$ContactCreatorCue" exact="ARG_VS_XENON_Create_Contact"/>
<set_value name="$IntroMissionCue" exact="ARG_VS_XENON_Introduction"/>
<!--$SubscriptionStatus:
- 'unsubscribed'
- 'probation'
- 'subscribed'
- 'cooldown'-->
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'unsubscribed'"/>
</actions>
</cue>
<!--
####################
DEBUG
####################-->
<cue name="ARG_VS_XENON_Debug_Reset">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
<signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
</do_if>
</do_all>
<set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
<do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
<remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
</do_if>
</do_all>
<do_if value="$Mission_Contact.isclass.npc">
<destroy_object object="$Mission_Contact"/>
</do_if>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="namespace"/>
<reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
</actions>
</cue>
<cue name="ARG_VS_XENON_Debug_Subscribe" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
SUBSCRIPTION
####################-->
<!--event.param == new status-->
<cue name="ARG_VS_XENON_Set_Subscription_Status" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_if value="
event.param == 'unsubscribed' or
event.param == 'probation' or
event.param == 'subscribed' or
event.param == 'cooldown'">
<debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
<set_value name="$SubscriptionStatus" exact="event.param"/>
<!--Be careful with state change handlers here if the requested state was the same as the previous one-->
<do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
<unlock_achievement name="JOIN_WAR" />
<signal_cue cue="CalculateThreads"/>
</do_if>
<do_elseif value="event.param == 'cooldown'">
<!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
<set_value name="$CooldownTime" exact="player.age + 5min"/>
</do_elseif>
</do_if>
<do_else>
<assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
</do_else>
</actions>
</cue>
<cue name="ARG_VS_XENON_Check_Cooldown" instantiate="true" checkinterval="5s">
<conditions>
<check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
</conditions>
<actions>
<debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
CONTACT
####################-->
<!--event.param == Cloned table of the host sectors for this war front in which to search for a placement object (or null to fallback to any owned space in the galaxy)-->
<cue name="ARG_VS_XENON_Create_Contact">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<set_value name="this.$SelectedSpace" exact="null"/>
<do_if value="event.param and typeof event.param == datatype.table">
<set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
<do_all exact="this.$HostSectorKeys.count" counter="$i">
<do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
<!--Select a sector with stations and a high security value-->
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_if>
</do_all>
<do_if value="not this.$SelectedSpace">
<!--Simply select the furthest sector with stations-->
<do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
<!--TODO @Owen - attempt to find major stations first-->
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_all>
</do_if>
</do_if>
<do_if value="not this.$SelectedSpace">
<find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
<debug_text text="'Fallback case for not finding suitable sector to place mission contact for ' + $MissionGroup + '. Placing on ' + this.$PotentialStation + ' ' + this.$PotentialStation.knownname + ' in ' + this.$SelectedSpace.knownname" filter="error"/>
</do_if>
</do_if>
<do_if value="this.$SelectedSpace">
<find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
<match_content class="class.walkablemodule"/>
</find_station>
<assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
<do_if value="$PlacementObject">
<create_cue_actor name="$Mission_Contact" cue="namespace" group="argon.factionrepresentative.female">
<page exact="10110"/>
<owner exact="$Faction"/>
</create_cue_actor>
<do_if value="$Mission_Contact">
<set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
<set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
<debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</do_if>
<assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
<do_if value="not $Mission_Contact">
<reset_cue cue="this"/>
</do_if>
</actions>
<cues>
<cue name="ARG_VS_XENON_Place_Contact_Init">
<actions>
<do_if value="$PlacementObject.attention ge attention.nearby">
<signal_cue cue="ARG_VS_XENON_Place_Contact_Create_Interior"/>
</do_if>
</actions>
</cue>
<cue name="ARG_VS_XENON_Place_Contact_Create_Interior">
<conditions>
<check_any>
<event_cue_signalled/>
<check_all>
<event_object_changed_attention object="$PlacementObject"/>
<check_value value="event.param ge attention.nearby"/>
</check_all>
</check_any>
</conditions>
<actions>
<debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
<get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
<do_if value="$StartCorridorMacro">
<get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" />
</do_if>
<get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
<do_if value="$StartRoomMacro">
<get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" />
</do_if>
<create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30210,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
<assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
<do_if value="$DynamicInterior">
<find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
<assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
<do_if value="$NPC_Slot">
<add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
<debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</actions>
<cues>
<cue name="ARG_VS_XENON_Place_Contact_WithinDynamicInterior_Destroy">
<conditions>
<event_object_interiors_despawning object="$PlacementObject"/>
</conditions>
<actions>
<debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
<remove_actor_from_room actor="$Mission_Contact"/>
<destroy_object object="$DynamicInterior"/>
<remove_value name="$DynamicInterior"/>
<remove_value name="$DynamicCorridor"/>
<remove_value name="$DynamicRoom"/>
<reset_cue cue="ARG_VS_XENON_Place_Contact_Create_Interior"/>
</actions>
</cue>
</cues>
</cue>
<cue name="ARG_VS_XENON_Contact_Killed">
<conditions>
<event_object_destroyed object="$Mission_Contact"/>
</conditions>
<actions>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="ARG_VS_XENON_Create_Contact"/>
</actions>
</cue>
<cue name="ARG_VS_XENON_Contact_Conversation_Started" instantiate="true">
<conditions>
<check_any>
<event_conversation_started actor="$Mission_Contact" />
<event_conversation_returned_to_section actor="$Mission_Contact" />
</check_any>
<check_value value="event.param == 'default'" />
</conditions>
<actions>
<do_if value="event.name == 'event_conversation_started'">
<do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
<do_if value="player.entity.isfemale">
<add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
</do_else>
</do_if>
<do_else>
<!--More familiar greeting-->
<add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
</do_else>
</do_if>
<include_actions ref="ARG_VS_XENON_Contact_Player_Lines"/>
</actions>
</cue>
<library name="ARG_VS_XENON_Contact_Player_Lines">
<actions>
<!--Specific sections-->
<do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_if>
</do_if>
<do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
<add_player_choice text="{1002,3021002}" section="war_subscribe_ask_conflict" comment="What can you tell me about them?"/>
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
<add_player_choice text="{1002,3021003}" section="war_subscribe_ask_conflict_2" comment="What can we do?"/>
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict_2'">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<!--Start or other sections-->
<do_else>
<do_if value="$SubscriptionStatus == 'unsubscribed'">
<do_if value="ARG_VS_XENON_Introduction.state == cuestate.waiting">
<!--Intro mission is not in a state where the player can take it.-->
<!--TODO @Owen - voice lines on rejecting the player?-->
<add_player_choice text="{1002,3021101}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
</do_if>
<do_elseif value="$IntroducedToContact">
<do_if value="$JobsDescribed">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
<add_player_choice text="{1002,3021102}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_else>
</do_elseif>
<do_else>
<add_player_choice text="{1002,3021001}" section="war_subscribe_request" comment="I'm here to help with the Xenon."/>
</do_else>
</do_if>
<do_elseif value="$SubscriptionStatus == 'probation'">
<do_if value="$IntroMissionSuccessful">
<add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
</do_else>
</do_elseif>
</do_else>
</actions>
</library>
<cue name="ARG_VS_XENON_Contact_NextSection" instantiate="true">
<conditions>
<event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
</conditions>
<actions>
<set_value name="$AddPlayerChoices" exact="true"/>
<set_value name="$IsXenonSlayer" exact="player.name == 'Xenon Slayer'"/>
<!--TODO @Owen statistic counting of how many Xenon have been killed. If >100, play this line-->
<!--Xenon Slayer easter egg-->
<do_if value="event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$IntroducedToContact" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30210001" hidechoices="true" comment="Ah, nice to meet you."/>
<add_npc_line speaker="$Mission_Contact" line="30210002" hidechoices="true" comment="My job here is to help coordinate our efforts against the Xenon..."/>
<do_if value="player.entity.race == race.argon">
<!--Argon citizen-->
<add_npc_line speaker="$Mission_Contact" line="30210004" hidechoices="true" comment="If you're here, it means you have been recognised as an outstanding citizen of the Argon Federation."/>
</do_if>
<do_else>
<!--Argon friend-->
<add_npc_line speaker="$Mission_Contact" line="30210003" hidechoices="true" comment="If you're here, it means you have been recognised as a true friend of the Argon Federation."/>
</do_else>
<add_npc_line speaker="$Mission_Contact" line="30210005" hidechoices="true" comment="There is a great need for pilots like you."/>
<add_npc_line speaker="$Mission_Contact" line="30210006" hidechoices="true" comment="Probation line 1"/>
<add_npc_line speaker="$Mission_Contact" line="30210007" hidechoices="true" comment="Probation line 2"/>
<do_if value="$IsXenonSlayer">
<add_npc_line speaker="$Mission_Contact" line="30210008" hidechoices="true" comment="Looking at your records, I see you consider yourself a 'Xenon Slayer'..."/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30210009" hidechoices="true" comment="Probation line 3"/>
<add_npc_line speaker="$Mission_Contact" line="30210010" hidechoices="true" comment="Any questions?"/>
</do_else>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30210026" comment="Sorry, but this is a high-risk situation. We require pilots who have proven themselves to the Argon Federation."/>
</do_else>
</do_if>
<do_elseif value="event.param == 'war_subscribe_ask_intro'">
<set_value name="$JobsDescribed" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30210011" hidechoices="true" comment="There will be a wide range of tasks, from combat deployments to construction work..."/>
<add_npc_line speaker="$Mission_Contact" line="30210012" hidechoices="true" comment="You will be paid as you complete your allotted tasks, with a potential bonus at the end."/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_ask_conflict'">
<set_value name="$ConflictDescribed" exact="true"/>
<do_if value="$IsXenonSlayer">
<add_npc_line speaker="$Mission_Contact" line="30210013" hidechoices="true" comment="As someone who's been toe to toe with the Xenon I'm sure you know what they are capable of."/>
</do_if>
<add_npc_line speaker="$Mission_Contact" line="30210014" hidechoices="true" comment="Conflict desc 1"/>
<add_npc_line speaker="$Mission_Contact" line="30210015" hidechoices="true" comment="Conflict desc 2"/>
<add_npc_line speaker="$Mission_Contact" line="30210016" hidechoices="true" comment="Conflict desc 3"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_ask_conflict_2'">
<add_npc_line speaker="$Mission_Contact" line="30210017" hidechoices="true" comment="Conflict desc 4"/>
<add_npc_line speaker="$Mission_Contact" line="30210018" hidechoices="true" comment="Conflict desc 5"/>
<add_npc_line speaker="$Mission_Contact" line="30210019" hidechoices="true" comment="Anything else?"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_request_2'">
<!--This section is for when the intro mission is not currently active for the player to accept it. Either reject the player or signal the intro mission to activate.-->
<include_actions ref="ARG_VS_XENON_Can_Activate_Introduction"/>
<do_if value="$CanActivateIntro">
<signal_cue cue="ARG_VS_XENON_Introduction"/>
<add_npc_line speaker="$Mission_Contact" line="30210001" hidechoices="true" comment="Ah, very good."/>
</do_if>
<do_else>
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30210027" hidechoices="true" comment="Sorry. We're still reviewing your performance from the last time."/>
</do_else>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_start_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="ARG_VS_XENON_Player_Requested_Subscription"/>
<add_npc_line speaker="$Mission_Contact" line="30210020" hidechoices="true" comment="Alright. I'll have a suitable task picked out for you momentarily."/>
<add_npc_line speaker="$Mission_Contact" line="30210021" hidechoices="true" comment="Stay safe out there, pilot."/>
</do_elseif>
<do_elseif value="event.param == 'war_intro_complete'">
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30210022" hidechoices="true" comment="Yes, I saw. Good work."/>
<add_npc_line speaker="$Mission_Contact" line="30210023" hidechoices="true" comment="You will now find tasks related to the Xenon in your mission interface."/>
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'subscribed'"/>
</do_elseif>
<do_elseif value="event.param == 'war_abort_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="ARG_VS_XENON_Player_Requests_Intro_Abort"/>
</do_elseif>
<do_if value="$AddPlayerChoices">
<include_actions ref="ARG_VS_XENON_Contact_Player_Lines"/>
</do_if>
</actions>
</cue>
</cues>
</cue>
<!--event.param = table[
$cue = thread cue namespace,
$completedmissions = number of completed missions,
$failedmissions = number of failed missions]-->
<cue name="ARG_VS_XENON_Thread_Finished" instantiate="true">
<conditions>
<event_cue_signalled cue="Cleanup_Thread"/>
<!--<debug_text text="event.param.$cue.$Definition.$MissionGroup"/>
<debug_text text="$MissionGroup"/>-->
<check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
<!--<debug_text text="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>-->
<check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
</conditions>
<actions>
<debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
<set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
<set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
<do_if value="$MissionsCompleted ge 20">
<unlock_achievement name="WAR_MISSIONS" />
</do_if>
<do_if value="event.param.$failed">
<set_value name="$ThreadsFailed" operation="add"/>
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'cooldown'"/>
</do_if>
<do_else>
<set_value name="$ThreadsCompleted" operation="add"/>
<signal_cue cue="CalculateThreads"/>
</do_else>
</actions>
</cue>
<!--
####################
INTRODUCTION
####################-->
<cue name="ARG_VS_XENON_Player_Requested_Subscription" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="ARG_VS_XENON_Player_Requests_Intro_Abort" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<library name="ARG_VS_XENON_Can_Activate_Introduction">
<actions>
<!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
<set_value name="$CanActivateIntro" exact="false"/>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$CanActivateIntro" exact="true"/>
</do_if>
</actions>
</library>
<cue name="ARG_VS_XENON_Introduction" version="2">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
<set_value name="$MissionIntroCue" exact="this"/>
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'unsubscribed'"/>
</actions>
<patch sinceversion="2" state="complete">
<do_if value="$SubscriptionStatus == 'cooldown'">
<debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'unsubscribed'"/>
</do_if>
</patch>
<cues>
<cue name="ARG_VS_XENON_Introduction_Init">
<actions>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<signal_cue cue="ARG_VS_XENON_Introduction_Create_Offer"/>
</do_if>
</actions>
</cue>
<cue name="ARG_VS_XENON_Introduction_Create_Offer">
<conditions>
<check_any>
<check_all>
<event_player_relation_changed faction="$Faction"/>
<check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
</check_all>
<event_cue_signalled/>
</check_any>
</conditions>
<actions>
<assert value="$Mission_Contact.isclass.npc" text="'Mission contact was not yet created for ' + $MissionGroup + '. Triggering creation now but location may not be near a war front. [Owen]'"/>
<do_if value="not $Mission_Contact.isclass.npc">
<signal_cue_instantly cue="$ContactCreatorCue"/>
</do_if>
<do_if value="$Mission_Contact">
<debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
<create_offer cue="$MissionIntroCue" actor="$Mission_Contact" type="missiontype.fight" name="readtext.{30210}.{1}" description="readtext.{30210}.{2}" difficulty="level.easy" faction="faction.argon" group="$MissionGroup">
<briefing>
<objective step="1" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</create_offer>
</do_if>
<do_else>
<debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
<reset_cue cue="$MissionIntroCue"/>
</do_else>
</actions>
<cues>
<cue name="ARG_VS_XENON_Introduction_Offer_Accepted">
<conditions>
<event_object_signalled object="$Mission_Contact" param="'accept'" />
</conditions>
<actions>
<create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
</briefing>
</update_mission>
<remove_offer cue="$MissionIntroCue"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = ARG_VS_XENON_Cancel_Intro_Talkto,
$objective = objective.talkto,
$debugchance = $DebugChance]"/>
</actions>
</cue>
</cues>
</cue>
<cue name="ARG_VS_XENON_Intro_Abort">
<conditions>
<check_any>
<event_mission_aborted cue="ARG_VS_XENON_Introduction"/>
<event_cue_signalled cue="ARG_VS_XENON_Player_Requests_Intro_Abort"/>
</check_any>
</conditions>
<actions>
<do_if value="$MissionIntroCue.hasmission">
<remove_mission cue="$MissionIntroCue" type="aborted"/>
</do_if>
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'unsubscribed'"/>
<reset_cue cue="ARG_VS_XENON_Introduction"/>
</actions>
</cue>
<cue name="ARG_VS_XENON_Cancel_Intro_Talkto" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="ARG_VS_XENON_Start_Intro_Mission">
<conditions>
<event_cue_signalled cue="ARG_VS_XENON_Player_Requested_Subscription"/>
</conditions>
<actions>
<signal_cue cue="ARG_VS_XENON_Cancel_Intro_Talkto"/>
<signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'probation'"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<do_if value="$MissionIntroCue.hasmissionoffer">
<remove_offer cue="$MissionIntroCue"/>
</do_if>
<do_if value="not $MissionIntroCue.hasmission">
<create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30210}.{10}" description="readtext.{30210}.{11}" difficulty="level.easy" faction="faction.argon" group="$MissionGroup"/>
</do_if>
<create_ship name="$TestShip" zone="player.zone">
<select faction="faction.xenon" size="class.ship_s"/>
<owner exact="faction.xenon"/>
<pilot actor="null"/>
<safepos object="player.entity" min="30km" max="40km"/>
</create_ship>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.destroy" object="$TestShip"/>
</briefing>
</update_mission>
<set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
</actions>
<cues>
<cue name="ARG_VS_XENON_Start_Intro_Mission_Successful">
<conditions>
<event_object_destroyed object="$TestShip"/>
</conditions>
<actions>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="2" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</update_mission>
<set_value name="$IntroMissionSuccessful" exact="true"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = ARG_VS_XENON_Start_Intro_Mission_Remove_Mission,
$objective = objective.talkto,
$step = 2,
$debugchance = $DebugChance]"/>
</actions>
</cue>
<cue name="ARG_VS_XENON_Start_Intro_Mission_Remove_Mission">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<remove_mission cue="$MissionIntroCue" type="completed"/>
<reset_cue cue="ARG_VS_XENON_Introduction"/>
</actions>
</cue>
<cue name="ARG_VS_XENON_Start_Intro_Mission_End">
<conditions>
<event_conversation_started actor="$Mission_Contact"/>
</conditions>
<actions>
<signal_cue cue="ARG_VS_XENON_Start_Intro_Mission_Remove_Mission"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--
####################
THREADS
####################-->
<cue name="ARG_VS_XENON_Reinforce_Defence">
<cues>
<cue name="ARG_VS_XENON_Reinforce_Defence_Register">
<actions>
<!--Argon Vs Xenon - Reinforce Defence-->
<set_value name="$ThreadID" exact="'$arg_vs_xenon_reinforce_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.protect,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_XENON_Reinforce_Defence_Get_Submissions,
$NameLib = ARG_VS_XENON_Reinforce_Defence_Construct_Name,
$DescriptionLib = ARG_VS_XENON_Reinforce_Defence_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Reinforce_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_lasertowers"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [101000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_mines"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__host_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [102000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$repair__damagedship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30210, $TextOffset = [103000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$taxi__specialist"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30210, $TextOffset = [104000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deliver__crew"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30210, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Reinforce_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30210, 3000}"/>
<set_value name="this.$Name" exact="{30210, 3001}"/>
<set_value name="this.$Name" exact="{30210, 3002}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Reinforce_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30210, 3101}"/>
<set_value name="this.$Description" exact="{30210, 3102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 3111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 3121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 3122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30210, 3201}"/>
<set_value name="this.$Description" exact="{30210, 3202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 3211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 3221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_XENON_Construct_Defence">
<cues>
<cue name="ARG_VS_XENON_Construct_Defence_Register" version="2">
<actions>
<!--Argon Vs Xenon - Construct Defence-->
<set_value name="$ThreadID" exact="'$arg_vs_xenon_construct_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
$ThreadType = 'sequential',
$MissionType = missiontype.build,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_XENON_Construct_Defence_Get_Submissions,
$NameLib = ARG_VS_XENON_Construct_Defence_Construct_Name,
$DescriptionLib = ARG_VS_XENON_Construct_Defence_Construct_Description,
$MinMissions = 1,
$MaxMissions = 2,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
<patch sinceversion="2">
<append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
</patch>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Construct_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$build__defencestation"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30210, $TextOffset = [105000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$build__fleet"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30210, $TextOffset = [120000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Construct_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30210, 4000}"/>
<set_value name="this.$Name" exact="{30210, 4001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Construct_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30210, 4101}"/>
<set_value name="this.$Description" exact="{30210, 4102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 4111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 4121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 4122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30210, 4201}"/>
<set_value name="this.$Description" exact="{30210, 4202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 4211}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 4221}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 4222}"/>
</do_any>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_XENON_Secure_Resources">
<cues>
<cue name="ARG_VS_XENON_Secure_Resources_Register">
<actions>
<!--Argon Vs Xenon - Secure Resources-->
<set_value name="$ThreadID" exact="'$arg_vs_xenon_secure_resources'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.trade,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_XENON_Secure_Resources_Get_Submissions,
$NameLib = ARG_VS_XENON_Secure_Resources_Construct_Name,
$DescriptionLib = ARG_VS_XENON_Secure_Resources_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Secure_Resources_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$large_supply__food"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30210, $TextOffset = [100000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$large_supply__shiptech"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30210, $TextOffset = [100100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_lasertowers_at_resources"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [101300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$find_resources__ores"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [106000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$supply_station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [130000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Secure_Resources_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30210, 5000}"/>
<set_value name="this.$Name" exact="{30210, 5001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Secure_Resources_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30210, 5101}"/>
<set_value name="this.$Description" exact="{30210, 5102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 5111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 5121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 5122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30210, 5201}"/>
<set_value name="this.$Description" exact="{30210, 5202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 5211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 5221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_XENON_Preemptive_Offensive">
<cues>
<cue name="ARG_VS_XENON_Preemptive_Offensive_Register">
<actions>
<!--Argon Vs Xenon - Preemptive Offensive-->
<set_value name="$ThreadID" exact="'$arg_vs_xenon_preemptive_offensive'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_XENON_Preemptive_Offensive_Get_Submissions,
$NameLib = ARG_VS_XENON_Preemptive_Offensive_Construct_Name,
$DescriptionLib = ARG_VS_XENON_Preemptive_Offensive_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Preemptive_Offensive_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$assassination"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30210, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$board_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30210, $TextOffset = [108000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$destroy_rare_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30210, $TextOffset = [140000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Preemptive_Offensive_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30210, 6000}"/>
<set_value name="this.$Name" exact="{30210, 6001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Preemptive_Offensive_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30210, 6101}"/>
<set_value name="this.$Description" exact="{30210, 6102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 6111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 6121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 6122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30210, 6201}"/>
<set_value name="this.$Description" exact="{30210, 6202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 6211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 6221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_XENON_Gather_Intel">
<cues>
<cue name="ARG_VS_XENON_Preemptive_Gather_Intel">
<actions>
<!--Argon Vs Xenon - Gather Intel-->
<set_value name="$ThreadID" exact="'$arg_vs_xenon_gather_intel'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.intelligence,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_XENON_Gather_Intel_Get_Submissions,
$NameLib = ARG_VS_XENON_Gather_Intel_Construct_Name,
$DescriptionLib = ARG_VS_XENON_Gather_Intel_Construct_Description,
$MinMissions = 2,
$MaxMissions = 3,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Gather_Intel_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_satellite"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [101400], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [102100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$find_resources__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [106100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__module"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_ware"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_idcode"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150600], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Gather_Intel_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30210, 7000}"/>
<set_value name="this.$Name" exact="{30210, 7001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Gather_Intel_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30210, 7101}"/>
<set_value name="this.$Description" exact="{30210, 7102}"/>
</do_any>
<do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 7111}"/>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 7112}"/>
</do_any>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 7121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 7122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30210, 7201}"/>
<set_value name="this.$Description" exact="{30210, 7202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 7211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 7221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_XENON_Support_Invasion">
<cues>
<cue name="ARG_VS_XENON_Preemptive_Support_Invasion">
<actions>
<!--Argon Vs Xenon - Support Invasion-->
<set_value name="$ThreadID" exact="'$arg_vs_xenon_support_invasion'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Invading],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.hard,
$SubMissionLib = ARG_VS_XENON_Support_Invasion_Get_Submissions,
$NameLib = ARG_VS_XENON_Support_Invasion_Construct_Name,
$DescriptionLib = ARG_VS_XENON_Support_Invasion_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Support_Invasion_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$support_invasion"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30210, $TextOffset = [109000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Support_Invasion_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30210, 8000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_XENON_Support_Invasion_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30210, 8101}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 8111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 8121}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30210, 8201}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30210, 8211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30210, 8221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
</cues>
</cue>
<!--
###################################
ARGON VS HOLY ORDER
###################################-->
<cue name="ARG_VS_HOL" namespace="this">
<actions>
<!--Common values-->
<set_value name="$ManagerCue" exact="parent.namespace"/>
<set_value name="$Faction" exact="faction.argon"/>
<set_value name="$EnemyFaction" exact="faction.holyorder"/>
<set_value name="$MissionGroup" exact="missiongroup.argon_war_holyorder"/>
<set_value name="$Mission_Contact" exact="null"/>
<set_value name="$Page" exact="30211" comment="Argon-HolyOrder-War page"/>
<set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
<set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
<set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
<set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
<!--Status-->
<set_value name="$SubscriptionStatus" exact="null"/>
<set_value name="$IntroducedToContact" exact="false"/>
<set_value name="$JobsDescribed" exact="false"/>
<set_value name="$ConflictDescribed" exact="false"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<set_value name="$CooldownTime" exact="-1s"/>
<!--Stats-->
<set_value name="$ThreadsCompleted" exact="0"/>
<set_value name="$ThreadsFailed" exact="0"/>
<set_value name="$MissionsCompleted" exact="0"/>
<set_value name="$MissionsFailed" exact="0"/>
</actions>
<cues>
<cue name="ARG_VS_HOL_Init">
<actions>
<set_value name="$ContactCreatorCue" exact="ARG_VS_HOL_Create_Contact"/>
<set_value name="$IntroMissionCue" exact="ARG_VS_HOL_Introduction"/>
<!--$SubscriptionStatus:
- 'unsubscribed'
- 'probation'
- 'subscribed'
- 'cooldown'-->
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'unsubscribed'" comment="TODO: @Owen, @Roger - temporary, change back to unsubscribed!"/>
</actions>
</cue>
<!--
####################
DEBUG
####################-->
<cue name="ARG_VS_HOL_Debug_Reset">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
<signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
</do_if>
</do_all>
<set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
<do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
<remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
</do_if>
</do_all>
<do_if value="$Mission_Contact.isclass.npc">
<destroy_object object="$Mission_Contact"/>
</do_if>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="namespace"/>
<reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
</actions>
</cue>
<cue name="ARG_VS_HOL_Debug_Subscribe" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
SUBSCRIPTION
####################-->
<!--event.param == new status-->
<cue name="ARG_VS_HOL_Set_Subscription_Status" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_if value="
event.param == 'unsubscribed' or
event.param == 'probation' or
event.param == 'subscribed' or
event.param == 'cooldown'">
<debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
<set_value name="$SubscriptionStatus" exact="event.param"/>
<!--Be careful with state change handlers here if the requested state was the same as the previous one-->
<do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
<unlock_achievement name="JOIN_WAR" />
<do_if value="HOL_VS_ARG.$SubscriptionStatus == 'subscribed'">
<unlock_achievement name="JOIN_DOUBLE_AGENT" />
</do_if>
<signal_cue cue="CalculateThreads"/>
</do_if>
<do_elseif value="event.param == 'cooldown'">
<!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
<set_value name="$CooldownTime" exact="player.age + 5min"/>
</do_elseif>
</do_if>
<do_else>
<assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
</do_else>
</actions>
</cue>
<cue name="ARG_VS_HOL_Check_Cooldown" instantiate="true" checkinterval="5s">
<conditions>
<check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
</conditions>
<actions>
<debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
CONTACT
####################-->
<!--event.param == Cloned table of the host sectors for this war front in which to search for a placement object (or null to fallback to any owned space in the galaxy)-->
<cue name="ARG_VS_HOL_Create_Contact">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<set_value name="this.$SelectedSpace" exact="null"/>
<do_if value="event.param and typeof event.param == datatype.table">
<set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
<do_all exact="this.$HostSectorKeys.count" counter="$i">
<do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
<!--Select a sector with stations and a high security value-->
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_if>
</do_all>
<do_if value="not this.$SelectedSpace">
<!--Simply select the furthest sector with stations-->
<do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_all>
</do_if>
</do_if>
<do_if value="not this.$SelectedSpace">
<find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
<debug_text text="'Fallback case for not finding suitable sector to place mission contact for ' + $MissionGroup + '. Placing on ' + this.$PotentialStation + ' ' + this.$PotentialStation.knownname + ' in ' + this.$SelectedSpace.knownname" filter="error"/>
</do_if>
</do_if>
<do_if value="this.$SelectedSpace">
<find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
<match_content class="class.walkablemodule"/>
</find_station>
<assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
<do_if value="$PlacementObject">
<create_cue_actor name="$Mission_Contact" cue="namespace" group="argon.factionrepresentative.male">
<page exact="10101"/>
<owner exact="$Faction"/>
</create_cue_actor>
<do_if value="$Mission_Contact">
<set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
<set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
<debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</do_if>
<assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
<do_if value="not $Mission_Contact">
<reset_cue cue="this"/>
</do_if>
</actions>
<cues>
<cue name="ARG_VS_HOL_Place_Contact_Init">
<actions>
<do_if value="$PlacementObject.attention ge attention.nearby">
<signal_cue cue="ARG_VS_HOL_Place_Contact_Create_Interior"/>
</do_if>
</actions>
</cue>
<cue name="ARG_VS_HOL_Place_Contact_Create_Interior">
<conditions>
<check_any>
<event_cue_signalled/>
<check_all>
<event_object_changed_attention object="$PlacementObject"/>
<check_value value="event.param ge attention.nearby"/>
</check_all>
</check_any>
</conditions>
<actions>
<debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
<get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
<get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
<create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30211,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
<assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
<do_if value="$DynamicInterior">
<find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
<assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
<do_if value="$NPC_Slot">
<add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
<debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</actions>
<cues>
<cue name="ARG_VS_HOL_Place_Contact_WithinDynamicInterior_Destroy">
<conditions>
<event_object_interiors_despawning object="$PlacementObject"/>
</conditions>
<actions>
<debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
<remove_actor_from_room actor="$Mission_Contact"/>
<destroy_object object="$DynamicInterior"/>
<remove_value name="$DynamicInterior"/>
<remove_value name="$DynamicCorridor"/>
<remove_value name="$DynamicRoom"/>
<reset_cue cue="ARG_VS_HOL_Place_Contact_Create_Interior"/>
</actions>
</cue>
</cues>
</cue>
<cue name="ARG_VS_HOL_Contact_Killed">
<conditions>
<event_object_destroyed object="$Mission_Contact"/>
</conditions>
<actions>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="ARG_VS_HOL_Create_Contact"/>
</actions>
</cue>
<cue name="ARG_VS_HOL_Contact_Conversation_Started" instantiate="true">
<conditions>
<check_any>
<event_conversation_started actor="$Mission_Contact" />
<event_conversation_returned_to_section actor="$Mission_Contact" />
</check_any>
<check_value value="event.param == 'default'" />
</conditions>
<actions>
<do_if value="event.name == 'event_conversation_started'">
<do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
<do_if value="player.entity.isfemale">
<add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
</do_else>
</do_if>
<do_else>
<!--More familiar greeting-->
<add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
</do_else>
</do_if>
<include_actions ref="ARG_VS_HOL_Contact_Player_Lines"/>
</actions>
</cue>
<library name="ARG_VS_HOL_Contact_Player_Lines">
<actions>
<!--Specific sections-->
<do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_if>
</do_if>
<do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
<add_player_choice text="{1002,3021102}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
<add_player_choice text="{1002,3021103}" section="war_subscribe_ask_conflict_2" comment="And the Argon?"/>
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict_2'">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<!--Start or other sections-->
<do_else>
<do_if value="$SubscriptionStatus == 'unsubscribed'">
<do_if value="ARG_VS_HOL_Introduction.state == cuestate.waiting">
<!--Intro mission is not in a state where the player can take it.-->
<!--TODO @Owen - voice lines on rejecting the player?-->
<add_player_choice text="{1002,3021101}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
</do_if>
<do_elseif value="$IntroducedToContact">
<do_if value="$JobsDescribed">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
<add_player_choice text="{1002,3021102}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_else>
</do_elseif>
<do_else>
<add_player_choice text="{1002,3021101}" section="war_subscribe_request" comment="I'm here about the Holy Order."/>
</do_else>
</do_if>
<do_elseif value="$SubscriptionStatus == 'probation'">
<do_if value="$IntroMissionSuccessful">
<add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
</do_else>
</do_elseif>
</do_else>
</actions>
</library>
<cue name="ARG_VS_HOL_Contact_NextSection" instantiate="true">
<conditions>
<event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
</conditions>
<actions>
<set_value name="$AddPlayerChoices" exact="true"/>
<do_if value="event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$IntroducedToContact" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211001" hidechoices="true" comment="Ah, very good."/>
<add_npc_line speaker="$Mission_Contact" line="30211002" hidechoices="true"/>
<do_if value="player.entity.race == race.argon">
<!--Argon citizen-->
<add_npc_line speaker="$Mission_Contact" line="30211004" hidechoices="true"/>
</do_if>
<do_else>
<!--Argon friend-->
<add_npc_line speaker="$Mission_Contact" line="30211003" hidechoices="true"/>
</do_else>
<add_npc_line speaker="$Mission_Contact" line="30211005" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211006" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211007" hidechoices="true"/>
<do_if value="player.entity.race == race.paranid">
<!--Paranid player line-->
<add_npc_line speaker="$Mission_Contact" line="30211008" hidechoices="true"/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30211009" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211010" hidechoices="true"/>
</do_else>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30211026" comment="Sorry, but that is a very sensitive situation. We require pilots who have proven themselves to the Argon Federation."/>
</do_else>
</do_if>
<do_elseif value="event.param == 'war_subscribe_ask_intro'">
<set_value name="$JobsDescribed" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211011" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211012" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_ask_conflict'">
<set_value name="$ConflictDescribed" exact="true"/>
<do_if value="player.entity.race == race.paranid">
<!--Paranid player line-->
<add_npc_line speaker="$Mission_Contact" line="30211013" hidechoices="true"/>
</do_if>
<add_npc_line speaker="$Mission_Contact" line="30211014" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211015" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_ask_conflict_2'">
<add_npc_line speaker="$Mission_Contact" line="30211016" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211017" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211018" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211019" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_request_2'">
<!--This section is for when the intro mission is not currently active for the player to accept it. Either reject the player or signal the intro mission to activate.-->
<include_actions ref="ARG_VS_HOL_Can_Activate_Introduction"/>
<do_if value="$CanActivateIntro">
<signal_cue cue="ARG_VS_HOL_Introduction"/>
<add_npc_line speaker="$Mission_Contact" line="30211001" hidechoices="true" comment="Ah, very good."/>
</do_if>
<do_else>
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30211027" hidechoices="true"/>
</do_else>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_start_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="ARG_VS_HOL_Player_Requested_Subscription"/>
<add_npc_line speaker="$Mission_Contact" line="30211020" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30211021" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_intro_complete'">
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30211022" hidechoices="true" comment="Yes, I saw. Very good."/>
<add_npc_line speaker="$Mission_Contact" line="30211023" hidechoices="true" comment="You will now find tasks related to the Holy Order conflict in your mission interface."/>
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
</do_elseif>
<do_elseif value="event.param == 'war_abort_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="ARG_VS_HOL_Player_Requests_Intro_Abort"/>
</do_elseif>
<do_if value="$AddPlayerChoices">
<include_actions ref="ARG_VS_HOL_Contact_Player_Lines"/>
</do_if>
</actions>
</cue>
</cues>
</cue>
<!--event.param = table[
$cue = thread cue namespace,
$completedmissions = number of completed missions,
$failedmissions = number of failed missions]-->
<cue name="ARG_VS_HOL_Thread_Finished" instantiate="true">
<conditions>
<event_cue_signalled cue="Cleanup_Thread"/>
<check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
<check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
</conditions>
<actions>
<!--TODO @Owen spoken feedback?-->
<debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
<set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
<set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
<do_if value="$MissionsCompleted ge 20">
<unlock_achievement name="WAR_MISSIONS" />
</do_if>
<do_if value="event.param.$failed">
<set_value name="$ThreadsFailed" operation="add"/>
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'cooldown'"/>
</do_if>
<do_else>
<set_value name="$ThreadsCompleted" operation="add"/>
<signal_cue cue="CalculateThreads"/>
</do_else>
</actions>
</cue>
<!--
####################
INTRODUCTION
####################-->
<cue name="ARG_VS_HOL_Player_Requested_Subscription" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="ARG_VS_HOL_Player_Requests_Intro_Abort" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<library name="ARG_VS_HOL_Can_Activate_Introduction">
<actions>
<!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
<set_value name="$CanActivateIntro" exact="false"/>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$CanActivateIntro" exact="true"/>
</do_if>
</actions>
</library>
<cue name="ARG_VS_HOL_Introduction" version="2">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
<set_value name="$MissionIntroCue" exact="this"/>
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
</actions>
<patch sinceversion="2" state="complete">
<do_if value="$SubscriptionStatus == 'cooldown'">
<debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
</do_if>
</patch>
<cues>
<cue name="ARG_VS_HOL_Introduction_Init">
<actions>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<signal_cue cue="ARG_VS_HOL_Introduction_Create_Offer"/>
</do_if>
</actions>
</cue>
<cue name="ARG_VS_HOL_Introduction_Create_Offer">
<conditions>
<check_any>
<check_all>
<event_player_relation_changed faction="$Faction"/>
<check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
</check_all>
<event_cue_signalled/>
</check_any>
</conditions>
<actions>
<assert value="$Mission_Contact.isclass.npc" text="'Mission contact was not yet created for ' + $MissionGroup + '. Triggering creation now but location may not be near a war front. [Owen]'"/>
<do_if value="not $Mission_Contact.isclass.npc">
<signal_cue_instantly cue="$ContactCreatorCue"/>
</do_if>
<do_if value="$Mission_Contact">
<debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
<create_offer cue="$MissionIntroCue" actor="$Mission_Contact" type="missiontype.fight" name="{30211,1}" description="{30211,2}" difficulty="level.easy" faction="faction.argon" group="$MissionGroup">
<briefing>
<objective step="1" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</create_offer>
</do_if>
<do_else>
<debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
<reset_cue cue="$MissionIntroCue"/>
</do_else>
</actions>
<cues>
<cue name="ARG_VS_HOL_Introduction_Offer_Accepted">
<conditions>
<event_object_signalled object="$Mission_Contact" param="'accept'" />
</conditions>
<actions>
<create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
</briefing>
</update_mission>
<remove_offer cue="$MissionIntroCue"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = ARG_VS_HOL_Cancel_Intro_Talkto,
$objective = objective.talkto,
$debugchance = $DebugChance]"/>
</actions>
</cue>
</cues>
</cue>
<cue name="ARG_VS_HOL_Intro_Abort">
<conditions>
<check_any>
<event_mission_aborted cue="ARG_VS_HOL_Introduction"/>
<event_cue_signalled cue="ARG_VS_HOL_Player_Requests_Intro_Abort"/>
</check_any>
</conditions>
<actions>
<do_if value="$MissionIntroCue.hasmission">
<remove_mission cue="$MissionIntroCue" type="aborted"/>
</do_if>
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
<reset_cue cue="ARG_VS_HOL_Introduction"/>
</actions>
</cue>
<cue name="ARG_VS_HOL_Cancel_Intro_Talkto" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="ARG_VS_HOL_Start_Intro_Mission">
<conditions>
<event_cue_signalled cue="ARG_VS_HOL_Player_Requested_Subscription"/>
</conditions>
<actions>
<signal_cue cue="ARG_VS_HOL_Cancel_Intro_Talkto"/>
<signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'probation'"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<do_if value="$MissionIntroCue.hasmissionoffer">
<remove_offer cue="$MissionIntroCue"/>
</do_if>
<do_if value="not $MissionIntroCue.hasmission">
<create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30211}.{1}" description="readtext.{30211}.{2}" difficulty="level.easy" faction="faction.argon" group="$MissionGroup"/>
</do_if>
<create_ship name="$TestShip" zone="player.zone">
<select faction="faction.holyorder" size="class.ship_s"/>
<owner exact="faction.holyorder"/>
<pilot actor="null"/>
<safepos object="player.entity" min="30km" max="40km"/>
</create_ship>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.destroy" object="$TestShip"/>
</briefing>
</update_mission>
<set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
</actions>
<cues>
<cue name="ARG_VS_HOL_Start_Intro_Mission_Successful">
<conditions>
<event_object_destroyed object="$TestShip"/>
</conditions>
<actions>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="2" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</update_mission>
<set_value name="$IntroMissionSuccessful" exact="true"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = ARG_VS_HOL_Start_Intro_Mission_Remove_Mission,
$objective = objective.talkto,
$step = 2,
$debugchance = $DebugChance]"/>
</actions>
</cue>
<cue name="ARG_VS_HOL_Start_Intro_Mission_Remove_Mission">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<remove_mission cue="$MissionIntroCue" type="completed"/>
<reset_cue cue="ARG_VS_HOL_Introduction"/>
</actions>
</cue>
<cue name="ARG_VS_HOL_Start_Intro_Mission_End">
<conditions>
<event_conversation_started actor="$Mission_Contact"/>
</conditions>
<actions>
<signal_cue cue="ARG_VS_HOL_Start_Intro_Mission_Remove_Mission"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--
####################
THREADS
####################-->
<cue name="ARG_VS_HOL_Reinforce_Defence">
<cues>
<cue name="ARG_VS_HOL_Reinforce_Defence_Register">
<actions>
<!--Argon Vs Holy Order - Reinforce Defence-->
<set_value name="$ThreadID" exact="'$arg_vs_hol_reinforce_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.protect,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_HOL_Reinforce_Defence_Get_Submissions,
$NameLib = ARG_VS_HOL_Reinforce_Defence_Construct_Name,
$DescriptionLib = ARG_VS_HOL_Reinforce_Defence_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Reinforce_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_lasertowers"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [101000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_mines"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__host_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [102000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$repair__damagedship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30211, $TextOffset = [103000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$taxi__specialist"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30211, $TextOffset = [104000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deliver__crew"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30211, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Reinforce_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30211, 3000}"/>
<set_value name="this.$Name" exact="{30211, 3001}"/>
<set_value name="this.$Name" exact="{30211, 3002}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Reinforce_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30211, 3101}"/>
<set_value name="this.$Description" exact="{30211, 3102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 3111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 3121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 3122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30211, 3201}"/>
<set_value name="this.$Description" exact="{30211, 3202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 3211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 3221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_HOL_Construct_Defence">
<cues>
<cue name="ARG_VS_HOL_Construct_Defence_Register" version="2">
<actions>
<!--Argon Vs Holy Order - Construct Defence-->
<set_value name="$ThreadID" exact="'$arg_vs_hol_construct_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
$ThreadType = 'sequential',
$MissionType = missiontype.build,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_HOL_Construct_Defence_Get_Submissions,
$NameLib = ARG_VS_HOL_Construct_Defence_Construct_Name,
$DescriptionLib = ARG_VS_HOL_Construct_Defence_Construct_Description,
$MinMissions = 1,
$MaxMissions = 2,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
<patch sinceversion="2">
<append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
</patch>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Construct_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$build__defencestation"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30211, $TextOffset = [105000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$build__fleet"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30211, $TextOffset = [120000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Construct_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30211, 4000}"/>
<set_value name="this.$Name" exact="{30211, 4001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Construct_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30211, 4101}"/>
<set_value name="this.$Description" exact="{30211, 4102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 4111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 4121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 4122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30211, 4201}"/>
<set_value name="this.$Description" exact="{30211, 4202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 4211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 4221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_HOL_Secure_Resources">
<cues>
<cue name="ARG_VS_HOL_Secure_Resources_Register">
<actions>
<!--Argon Vs Holy Order - Secure Resources-->
<set_value name="$ThreadID" exact="'$arg_vs_hol_secure_resources'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.trade,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_HOL_Secure_Resources_Get_Submissions,
$NameLib = ARG_VS_HOL_Secure_Resources_Construct_Name,
$DescriptionLib = ARG_VS_HOL_Secure_Resources_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Secure_Resources_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$large_supply__food"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30211, $TextOffset = [100000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$large_supply__shiptech"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30211, $TextOffset = [100100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_lasertowers_at_resources"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [101300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$find_resources__ores"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [106000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$supply_station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [130000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Secure_Resources_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30211, 5000}"/>
<set_value name="this.$Name" exact="{30211, 5001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Secure_Resources_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30211, 5101}"/>
<set_value name="this.$Description" exact="{30211, 5102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 5111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 5121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 5122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30211, 5201}"/>
<set_value name="this.$Description" exact="{30211, 5202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 5211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 5221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_HOL_Preemptive_Offensive">
<cues>
<cue name="ARG_VS_HOL_Preemptive_Offensive_Register">
<actions>
<!--Argon Vs Holy Order - Preemptive Offensive-->
<set_value name="$ThreadID" exact="'$arg_vs_hol_preemptive_offensive'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_HOL_Preemptive_Offensive_Get_Submissions,
$NameLib = ARG_VS_HOL_Preemptive_Offensive_Construct_Name,
$DescriptionLib = ARG_VS_HOL_Preemptive_Offensive_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Preemptive_Offensive_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$assassination__informant"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30211, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$board_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30211, $TextOffset = [108000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$destroy_rare_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30211, $TextOffset = [140000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Preemptive_Offensive_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30211, 6000}"/>
<set_value name="this.$Name" exact="{30211, 6001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Preemptive_Offensive_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30211, 6101}"/>
<set_value name="this.$Description" exact="{30211, 6102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 6111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 6121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 6122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30211, 6201}"/>
<set_value name="this.$Description" exact="{30211, 6202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 6211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 6221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_HOL_Gather_Intel">
<cues>
<cue name="ARG_VS_HOL_Preemptive_Gather_Intel">
<actions>
<!--Argon Vs Holy Order - Gather Intel-->
<set_value name="$ThreadID" exact="'$arg_vs_hol_gather_intel'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.intelligence,
$Difficulty = level.medium,
$SubMissionLib = ARG_VS_HOL_Gather_Intel_Get_Submissions,
$NameLib = ARG_VS_HOL_Gather_Intel_Construct_Name,
$DescriptionLib = ARG_VS_HOL_Gather_Intel_Construct_Description,
$MinMissions = 2,
$MaxMissions = 3,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Gather_Intel_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_satellite"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [101400], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [102100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$find_resources__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [106100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__module"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_ware"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_inventory"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150400], $Sequence = -1 ]"/>
<!--$scan__for_entity currently disabled as it's quite a chore-->
<!--<set_value name="$Submissions.$scan__for_entity"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150500], $Sequence = -1 ]"/>-->
<set_value name="$Submissions.$scan__for_idcode"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150600], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Gather_Intel_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30211, 7000}"/>
<set_value name="this.$Name" exact="{30211, 7001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Gather_Intel_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30211, 7101}"/>
<set_value name="this.$Description" exact="{30211, 7102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 7111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 7121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 7122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30211, 7201}"/>
<set_value name="this.$Description" exact="{30211, 7202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 7211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 7221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="ARG_VS_HOL_Support_Invasion">
<cues>
<cue name="ARG_VS_HOL_Preemptive_Support_Invasion">
<actions>
<!--Argon Vs Holy Order - Support Invasion-->
<set_value name="$ThreadID" exact="'$arg_vs_hol_support_invasion'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Invading],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.hard,
$SubMissionLib = ARG_VS_HOL_Support_Invasion_Get_Submissions,
$NameLib = ARG_VS_HOL_Support_Invasion_Construct_Name,
$DescriptionLib = ARG_VS_HOL_Support_Invasion_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Support_Invasion_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$support_invasion"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30211, $TextOffset = [109000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Support_Invasion_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30211, 8000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="ARG_VS_HOL_Support_Invasion_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30211, 8101}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 8111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 8121}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30211, 8201}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30211, 8211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30211, 8221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
</cues>
</cue>
<!--
###################################
PARANID VS HOLY ORDER
###################################-->
<cue name="PAR_VS_HOL" namespace="this">
<actions>
<!--Common values-->
<set_value name="$ManagerCue" exact="parent.namespace"/>
<set_value name="$Faction" exact="faction.paranid"/>
<set_value name="$EnemyFaction" exact="faction.holyorder"/>
<set_value name="$MissionGroup" exact="missiongroup.paranid_war_holyorder"/>
<set_value name="$Mission_Contact" exact="null"/>
<set_value name="$Page" exact="30212" comment="Paranid-HolyOrder-War page"/>
<set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
<set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
<set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
<set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
<!--Status-->
<set_value name="$SubscriptionStatus" exact="null"/>
<set_value name="$IntroducedToContact" exact="false"/>
<set_value name="$JobsDescribed" exact="false"/>
<set_value name="$ConflictDescribed" exact="false"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<set_value name="$CooldownTime" exact="-1s"/>
<!--Stats-->
<set_value name="$ThreadsCompleted" exact="0"/>
<set_value name="$ThreadsFailed" exact="0"/>
<set_value name="$MissionsCompleted" exact="0"/>
<set_value name="$MissionsFailed" exact="0"/>
</actions>
<cues>
<cue name="PAR_VS_HOL_Init">
<actions>
<set_value name="$ContactCreatorCue" exact="PAR_VS_HOL_Create_Contact"/>
<set_value name="$IntroMissionCue" exact="PAR_VS_HOL_Introduction"/>
<!--$SubscriptionStatus:
- 'unsubscribed'
- 'probation'
- 'subscribed'
- 'cooldown'-->
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'unsubscribed'" comment="TODO: @Owen, @Roger - temporary, change back to unsubscribed!"/>
</actions>
</cue>
<!--
####################
DEBUG
####################-->
<cue name="PAR_VS_HOL_Debug_Reset">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
<signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
</do_if>
</do_all>
<set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
<do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
<remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
</do_if>
</do_all>
<do_if value="$Mission_Contact.isclass.npc">
<destroy_object object="$Mission_Contact"/>
</do_if>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="namespace"/>
<reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
</actions>
</cue>
<cue name="PAR_VS_HOL_Debug_Subscribe" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
SUBSCRIPTION
####################-->
<!--event.param == new status-->
<cue name="PAR_VS_HOL_Set_Subscription_Status" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_if value="
event.param == 'unsubscribed' or
event.param == 'probation' or
event.param == 'subscribed' or
event.param == 'cooldown'">
<debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
<set_value name="$SubscriptionStatus" exact="event.param"/>
<!--Be careful with state change handlers here if the requested state was the same as the previous one-->
<do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
<unlock_achievement name="JOIN_WAR" />
<do_if value="HOL_VS_PAR.$SubscriptionStatus == 'subscribed'">
<unlock_achievement name="JOIN_DOUBLE_AGENT" />
</do_if>
<signal_cue cue="CalculateThreads"/>
</do_if>
<do_elseif value="event.param == 'cooldown'">
<!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
<set_value name="$CooldownTime" exact="player.age + 5min"/>
</do_elseif>
</do_if>
<do_else>
<assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
</do_else>
</actions>
</cue>
<cue name="PAR_VS_HOL_Check_Cooldown" instantiate="true" checkinterval="5s">
<conditions>
<check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
</conditions>
<actions>
<debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
CONTACT
####################-->
<!--event.param == Cloned table of the host sectors for this war front in which to search for a placement object (or null to fallback to any owned space in the galaxy)-->
<cue name="PAR_VS_HOL_Create_Contact">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<set_value name="this.$SelectedSpace" exact="null"/>
<do_if value="event.param and typeof event.param == datatype.table">
<set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
<do_all exact="this.$HostSectorKeys.count" counter="$i">
<do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
<!--Select a sector with stations and a high security value-->
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_if>
</do_all>
<do_if value="not this.$SelectedSpace">
<!--Simply select the furthest sector with stations-->
<do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_all>
</do_if>
</do_if>
<do_if value="not this.$SelectedSpace">
<find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
<debug_text text="'Fallback case for not finding suitable sector to place mission contact for ' + $MissionGroup + '. Placing on ' + this.$PotentialStation + ' ' + this.$PotentialStation.knownname + ' in ' + this.$SelectedSpace.knownname" filter="error"/>
</do_if>
</do_if>
<do_if value="this.$SelectedSpace">
<find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
<match_content class="class.walkablemodule"/>
</find_station>
<assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
<do_if value="$PlacementObject">
<create_cue_actor name="$Mission_Contact" cue="namespace" group="paranid.factionrepresentative">
<page exact="10304"/>
<owner exact="$Faction"/>
</create_cue_actor>
<do_if value="$Mission_Contact">
<set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
<set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
<debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</do_if>
<assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
<do_if value="not $Mission_Contact">
<reset_cue cue="this"/>
</do_if>
</actions>
<cues>
<cue name="PAR_VS_HOL_Place_Contact_Init">
<actions>
<do_if value="$PlacementObject.attention ge attention.nearby">
<signal_cue cue="PAR_VS_HOL_Place_Contact_Create_Interior"/>
</do_if>
</actions>
</cue>
<cue name="PAR_VS_HOL_Place_Contact_Create_Interior">
<conditions>
<check_any>
<event_cue_signalled/>
<check_all>
<event_object_changed_attention object="$PlacementObject"/>
<check_value value="event.param ge attention.nearby"/>
</check_all>
</check_any>
</conditions>
<actions>
<debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
<get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
<get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
<create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30212,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
<assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
<do_if value="$DynamicInterior">
<find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
<assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
<do_if value="$NPC_Slot">
<add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
<debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</actions>
<cues>
<cue name="PAR_VS_HOL_Place_Contact_WithinDynamicInterior_Destroy">
<conditions>
<event_object_interiors_despawning object="$PlacementObject"/>
</conditions>
<actions>
<debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
<remove_actor_from_room actor="$Mission_Contact"/>
<destroy_object object="$DynamicInterior"/>
<remove_value name="$DynamicInterior"/>
<remove_value name="$DynamicCorridor"/>
<remove_value name="$DynamicRoom"/>
<reset_cue cue="PAR_VS_HOL_Place_Contact_Create_Interior"/>
</actions>
</cue>
</cues>
</cue>
<cue name="PAR_VS_HOL_Contact_Killed">
<conditions>
<event_object_destroyed object="$Mission_Contact"/>
</conditions>
<actions>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="PAR_VS_HOL_Create_Contact"/>
</actions>
</cue>
<cue name="PAR_VS_HOL_Contact_Conversation_Started" instantiate="true">
<conditions>
<check_any>
<event_conversation_started actor="$Mission_Contact" />
<event_conversation_returned_to_section actor="$Mission_Contact" />
</check_any>
<check_value value="event.param == 'default'" />
</conditions>
<actions>
<do_if value="event.name == 'event_conversation_started'">
<do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
<do_if value="player.entity.isfemale">
<add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
</do_else>
</do_if>
<do_else>
<!--More familiar greeting-->
<add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
</do_else>
</do_if>
<include_actions ref="PAR_VS_HOL_Contact_Player_Lines"/>
</actions>
</cue>
<library name="PAR_VS_HOL_Contact_Player_Lines">
<actions>
<!--Specific sections-->
<do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_if>
</do_if>
<do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
<add_player_choice text="{1002,3021202}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<!--Start or other sections-->
<do_else>
<do_if value="$SubscriptionStatus == 'unsubscribed'">
<do_if value="PAR_VS_HOL_Introduction.state == cuestate.waiting">
<!--Intro mission is not in a state where the player can take it.-->
<!--TODO @Owen - voice lines on rejecting the player?-->
<add_player_choice text="{1002,3021201}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
</do_if>
<do_elseif value="$IntroducedToContact">
<do_if value="$JobsDescribed">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
<add_player_choice text="{1002,3021202}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict?"/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_else>
</do_elseif>
<do_else>
<add_player_choice text="{1002,3021201}" section="war_subscribe_request" comment="I'm here about The Order."/>
</do_else>
</do_if>
<do_elseif value="$SubscriptionStatus == 'probation'">
<do_if value="$IntroMissionSuccessful">
<add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
</do_else>
</do_elseif>
</do_else>
</actions>
</library>
<cue name="PAR_VS_HOL_Contact_NextSection" instantiate="true">
<conditions>
<event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
</conditions>
<actions>
<set_value name="$AddPlayerChoices" exact="true"/>
<do_if value="event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$IntroducedToContact" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30212001" hidechoices="true" comment="Ah, very good."/>
<add_npc_line speaker="$Mission_Contact" line="30212002" hidechoices="true" comment="My responsibility is to coordinate our forces in our campaign against the heretics of the so-called 'Holy Order'..."/>
<do_if value="player.entity.race == race.paranid">
<!--Paranid citizen-->
<add_npc_line speaker="$Mission_Contact" line="30212004" hidechoices="true" comment="Your being here means that you have gained recognition as a true champion of the Paranid Empire."/>
</do_if>
<do_else>
<!--Paranid friend-->
<add_npc_line speaker="$Mission_Contact" line="30212003" hidechoices="true" comment="Your being here means that you have gained recognition as a worthy friend of the Paranid Empire."/>
</do_else>
<add_npc_line speaker="$Mission_Contact" line="30212005" hidechoices="true" comment="There will always be place for pilots who share our ideals."/>
<add_npc_line speaker="$Mission_Contact" line="30212006" hidechoices="true" comment="Probation line 1"/>
<add_npc_line speaker="$Mission_Contact" line="30212007" hidechoices="true" comment="Probation line 2"/>
<do_if value="player.entity.race != race.paranid">
<!--non-Paranid player line-->
<add_npc_line speaker="$Mission_Contact" line="30212008" hidechoices="true" comment="I am curious to see how you fare compared to my Paranid brethren."/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30212009" hidechoices="true" comment="Probation line 3"/>
<add_npc_line speaker="$Mission_Contact" line="30212010" hidechoices="true" comment="Do you have questions?"/>
</do_else>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30212026" comment="Sorry, but that is a very sensitive situation. We require pilots who have proven themselves to the Argon Federation."/>
</do_else>
</do_if>
<do_elseif value="event.param == 'war_subscribe_ask_intro'">
<set_value name="$JobsDescribed" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30212011" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30212012" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_ask_conflict'">
<set_value name="$ConflictDescribed" exact="true"/>
<do_if value="player.entity.race == race.paranid">
<!--Paranid player line-->
<add_npc_line speaker="$Mission_Contact" line="30212013" hidechoices="true" comment="We will not simply have anyone interfere in our matters. Do not bother us unless you have proven yourself worth our time."/>
</do_if>
<add_npc_line speaker="$Mission_Contact" line="30212014" hidechoices="true" comment="Conflict desc 1"/>
<add_npc_line speaker="$Mission_Contact" line="30212015" hidechoices="true" comment="Conflict desc 2"/>
<add_npc_line speaker="$Mission_Contact" line="30212016" hidechoices="true" comment="Conflict desc 3"/>
<add_npc_line speaker="$Mission_Contact" line="30212017" hidechoices="true" comment="Conflict desc 4"/>
<add_npc_line speaker="$Mission_Contact" line="30212018" hidechoices="true" comment="Conflict desc 5"/>
<add_npc_line speaker="$Mission_Contact" line="30212019" hidechoices="true" comment="Shall we begin?"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_request_2'">
<!--This section is for when the intro mission is not currently active for the player to accept it. Either reject the player or signal the intro mission to activate.-->
<include_actions ref="PAR_VS_HOL_Can_Activate_Introduction"/>
<do_if value="$CanActivateIntro">
<signal_cue cue="PAR_VS_HOL_Introduction"/>
<add_npc_line speaker="$Mission_Contact" line="30212001" hidechoices="true" comment="Ah, very good."/>
</do_if>
<do_else>
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30212027" hidechoices="true" comment="We are still passing judgement on your previous performance. Leave us."/>
</do_else>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_start_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="PAR_VS_HOL_Player_Requested_Subscription"/>
<add_npc_line speaker="$Mission_Contact" line="30212020" hidechoices="true" comment="I will select a suitable task for you momentarily."/>
<add_npc_line speaker="$Mission_Contact" line="30212021" hidechoices="true" comment="I look forward to your return."/>
</do_elseif>
<do_elseif value="event.param == 'war_intro_complete'">
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30212022" hidechoices="true" comment="Yes, I saw. Very good."/>
<add_npc_line speaker="$Mission_Contact" line="30212023" hidechoices="true" comment="You will now find tasks related to the Holy Order conflict in your mission interface."/>
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
</do_elseif>
<do_elseif value="event.param == 'war_abort_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="PAR_VS_HOL_Player_Requests_Intro_Abort"/>
</do_elseif>
<do_if value="$AddPlayerChoices">
<include_actions ref="PAR_VS_HOL_Contact_Player_Lines"/>
</do_if>
</actions>
</cue>
</cues>
</cue>
<!--event.param = table[
$cue = thread cue namespace,
$completedmissions = number of completed missions,
$failedmissions = number of failed missions]-->
<cue name="PAR_VS_HOL_Thread_Finished" instantiate="true">
<conditions>
<event_cue_signalled cue="Cleanup_Thread"/>
<check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
<check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
</conditions>
<actions>
<!--TODO @Owen spoken feedback?-->
<debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
<set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
<set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
<do_if value="$MissionsCompleted ge 20">
<unlock_achievement name="WAR_MISSIONS" />
</do_if>
<do_if value="event.param.$failed">
<set_value name="$ThreadsFailed" operation="add"/>
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'cooldown'"/>
</do_if>
<do_else>
<set_value name="$ThreadsCompleted" operation="add"/>
<signal_cue cue="CalculateThreads"/>
</do_else>
</actions>
</cue>
<!--
####################
INTRODUCTION
####################-->
<cue name="PAR_VS_HOL_Player_Requested_Subscription" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="PAR_VS_HOL_Player_Requests_Intro_Abort" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<library name="PAR_VS_HOL_Can_Activate_Introduction">
<actions>
<!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
<set_value name="$CanActivateIntro" exact="false"/>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$CanActivateIntro" exact="true"/>
</do_if>
</actions>
</library>
<cue name="PAR_VS_HOL_Introduction" version="2">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
<set_value name="$MissionIntroCue" exact="this"/>
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
</actions>
<patch sinceversion="2" state="complete">
<do_if value="$SubscriptionStatus == 'cooldown'">
<debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
</do_if>
</patch>
<cues>
<cue name="PAR_VS_HOL_Introduction_Init">
<actions>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<signal_cue cue="PAR_VS_HOL_Introduction_Create_Offer"/>
</do_if>
</actions>
</cue>
<cue name="PAR_VS_HOL_Introduction_Create_Offer">
<conditions>
<check_any>
<check_all>
<event_player_relation_changed faction="$Faction"/>
<check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
</check_all>
<event_cue_signalled/>
</check_any>
</conditions>
<actions>
<assert value="$Mission_Contact.isclass.npc" text="'Mission contact was not yet created for ' + $MissionGroup + '. Triggering creation now but location may not be near a war front. [Owen]'"/>
<do_if value="not $Mission_Contact.isclass.npc">
<signal_cue_instantly cue="$ContactCreatorCue"/>
</do_if>
<do_if value="$Mission_Contact">
<debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
<create_offer cue="$MissionIntroCue" actor="$Mission_Contact" type="missiontype.fight" name="readtext.{30212}.{1}" description="readtext.{30212}.{2}" difficulty="level.easy" faction="faction.argon" group="$MissionGroup">
<briefing>
<objective step="1" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</create_offer>
</do_if>
<do_else>
<debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
<reset_cue cue="$MissionIntroCue"/>
</do_else>
</actions>
<cues>
<cue name="PAR_VS_HOL_Introduction_Offer_Accepted">
<conditions>
<event_object_signalled object="$Mission_Contact" param="'accept'" />
</conditions>
<actions>
<create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
</briefing>
</update_mission>
<remove_offer cue="$MissionIntroCue"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = PAR_VS_HOL_Cancel_Intro_Talkto,
$objective = objective.talkto,
$debugchance = $DebugChance]"/>
</actions>
</cue>
</cues>
</cue>
<cue name="PAR_VS_HOL_Intro_Abort">
<conditions>
<check_any>
<event_mission_aborted cue="PAR_VS_HOL_Introduction"/>
<event_cue_signalled cue="PAR_VS_HOL_Player_Requests_Intro_Abort"/>
</check_any>
</conditions>
<actions>
<do_if value="$MissionIntroCue.hasmission">
<remove_mission cue="$MissionIntroCue" type="aborted"/>
</do_if>
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
<reset_cue cue="PAR_VS_HOL_Introduction"/>
</actions>
</cue>
<cue name="PAR_VS_HOL_Cancel_Intro_Talkto" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="PAR_VS_HOL_Start_Intro_Mission">
<conditions>
<event_cue_signalled cue="PAR_VS_HOL_Player_Requested_Subscription"/>
</conditions>
<actions>
<signal_cue cue="PAR_VS_HOL_Cancel_Intro_Talkto"/>
<signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'probation'"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<do_if value="$MissionIntroCue.hasmissionoffer">
<remove_offer cue="$MissionIntroCue"/>
</do_if>
<do_if value="not $MissionIntroCue.hasmission">
<create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30212}.{1}" description="readtext.{30212}.{2}" difficulty="level.easy" faction="$Faction" group="$MissionGroup"/>
</do_if>
<create_ship name="$TestShip" zone="player.zone">
<select faction="faction.holyorder" size="class.ship_s"/>
<owner exact="faction.holyorder"/>
<pilot actor="null"/>
<safepos object="player.entity" min="30km" max="40km"/>
</create_ship>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.destroy" object="$TestShip"/>
</briefing>
</update_mission>
<set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
</actions>
<cues>
<cue name="PAR_VS_HOL_Start_Intro_Mission_Successful">
<conditions>
<event_object_destroyed object="$TestShip"/>
</conditions>
<actions>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="2" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</update_mission>
<set_value name="$IntroMissionSuccessful" exact="true"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = PAR_VS_HOL_Start_Intro_Mission_Remove_Mission,
$objective = objective.talkto,
$step = 2,
$debugchance = $DebugChance]"/>
</actions>
</cue>
<cue name="PAR_VS_HOL_Start_Intro_Mission_Remove_Mission">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<remove_mission cue="$MissionIntroCue" type="completed"/>
<reset_cue cue="PAR_VS_HOL_Introduction"/>
</actions>
</cue>
<cue name="PAR_VS_HOL_Start_Intro_Mission_End">
<conditions>
<event_conversation_started actor="$Mission_Contact"/>
</conditions>
<actions>
<signal_cue cue="PAR_VS_HOL_Start_Intro_Mission_Remove_Mission"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--
####################
THREADS
####################-->
<cue name="PAR_VS_HOL_Reinforce_Defence">
<cues>
<cue name="PAR_VS_HOL_Reinforce_Defence_Register">
<actions>
<!--Paranid Vs Holy Order - Reinforce Defence-->
<set_value name="$ThreadID" exact="'$par_vs_hol_reinforce_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.protect,
$Difficulty = level.medium,
$SubMissionLib = PAR_VS_HOL_Reinforce_Defence_Get_Submissions,
$NameLib = PAR_VS_HOL_Reinforce_Defence_Construct_Name,
$DescriptionLib = PAR_VS_HOL_Reinforce_Defence_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Reinforce_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_lasertowers"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [101000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_mines"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__host_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [102000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$repair__damagedship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30212, $TextOffset = [103000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$taxi__specialist"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30212, $TextOffset = [104000], $Sequence = 1 ]"/>
<set_value name="$Submissions.$deliver__crew"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30211, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Reinforce_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30212, 3000}"/>
<set_value name="this.$Name" exact="{30212, 3001}"/>
<set_value name="this.$Name" exact="{30212, 3002}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Reinforce_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30212, 3101}"/>
<set_value name="this.$Description" exact="{30212, 3102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 3111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 3121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 3122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30212, 3201}"/>
<set_value name="this.$Description" exact="{30212, 3202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 3211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 3221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="PAR_VS_HOL_Construct_Defence">
<cues>
<cue name="PAR_VS_HOL_Construct_Defence_Register" version="2">
<actions>
<!--Paranid Vs Holy Order - Construct Defence-->
<set_value name="$ThreadID" exact="'$par_vs_hol_construct_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
$ThreadType = 'sequential',
$MissionType = missiontype.build,
$Difficulty = level.medium,
$SubMissionLib = PAR_VS_HOL_Construct_Defence_Get_Submissions,
$NameLib = PAR_VS_HOL_Construct_Defence_Construct_Name,
$DescriptionLib = PAR_VS_HOL_Construct_Defence_Construct_Description,
$MinMissions = 1,
$MaxMissions = 2,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
<patch sinceversion="2">
<append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
</patch>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Construct_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$build__defencestation"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30212, $TextOffset = [105000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$build__fleet"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30212, $TextOffset = [120000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Construct_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30212, 4000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Construct_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30212, 4101}"/>
<set_value name="this.$Description" exact="{30212, 4102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 4111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 4121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 4122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30212, 4201}"/>
<set_value name="this.$Description" exact="{30212, 4202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 4211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 4221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="PAR_VS_HOL_Secure_Resources">
<cues>
<cue name="PAR_VS_HOL_Secure_Resources_Register">
<actions>
<!--Paranid Vs Holy Order - Secure Resources-->
<set_value name="$ThreadID" exact="'$par_vs_hol_secure_resources'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.trade,
$Difficulty = level.medium,
$SubMissionLib = PAR_VS_HOL_Secure_Resources_Get_Submissions,
$NameLib = PAR_VS_HOL_Secure_Resources_Construct_Name,
$DescriptionLib = PAR_VS_HOL_Secure_Resources_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Secure_Resources_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$large_supply__food"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30212, $TextOffset = [100000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$large_supply__shiptech"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30212, $TextOffset = [100100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_lasertowers_at_resources"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [101300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$find_resources__ores"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [106000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$supply_station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [130000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Secure_Resources_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30212, 5000}"/>
<set_value name="this.$Name" exact="{30212, 5001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Secure_Resources_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30212, 5101}"/>
<set_value name="this.$Description" exact="{30212, 5102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 5111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 5121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 5122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30212, 5201}"/>
<set_value name="this.$Description" exact="{30212, 5202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 5211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 5221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="PAR_VS_HOL_Preemptive_Offensive">
<cues>
<cue name="PAR_VS_HOL_Preemptive_Offensive_Register">
<actions>
<!--Paranid Vs Holy Order - Preemptive Offensive-->
<set_value name="$ThreadID" exact="'$par_vs_hol_preemptive_offensive'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.medium,
$SubMissionLib = PAR_VS_HOL_Preemptive_Offensive_Get_Submissions,
$NameLib = PAR_VS_HOL_Preemptive_Offensive_Construct_Name,
$DescriptionLib = PAR_VS_HOL_Preemptive_Offensive_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Preemptive_Offensive_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$assassination__informant"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30212, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$board_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30212, $TextOffset = [108000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$destroy_rare_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30212, $TextOffset = [140000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Preemptive_Offensive_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30212, 6000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Preemptive_Offensive_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30212, 6101}"/>
<set_value name="this.$Description" exact="{30212, 6102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 6111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 6121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 6122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30212, 6201}"/>
<set_value name="this.$Description" exact="{30212, 6202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 6211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 6221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="PAR_VS_HOL_Gather_Intel">
<cues>
<cue name="PAR_VS_HOL_Preemptive_Gather_Intel">
<actions>
<!--Paranid Vs Holy Order - Gather Intel-->
<set_value name="$ThreadID" exact="'$par_vs_hol_gather_intel'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.intelligence,
$Difficulty = level.medium,
$SubMissionLib = PAR_VS_HOL_Gather_Intel_Get_Submissions,
$NameLib = PAR_VS_HOL_Gather_Intel_Construct_Name,
$DescriptionLib = PAR_VS_HOL_Gather_Intel_Construct_Description,
$MinMissions = 2,
$MaxMissions = 3,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Gather_Intel_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_satellite"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [101400], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [102100], $Sequence = 1 ]"/>
<set_value name="$Submissions.$find_resources__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [106100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__module"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_ware"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_inventory"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150400], $Sequence = -1 ]"/>
<!--$scan__for_entity currently disabled as it's quite a chore-->
<!--<set_value name="$Submissions.$scan__for_entity"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150500], $Sequence = -1 ]"/>-->
<set_value name="$Submissions.$scan__for_idcode"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150600], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Gather_Intel_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30212, 7000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Gather_Intel_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30212, 7101}"/>
<set_value name="this.$Description" exact="{30212, 7102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 7111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 7121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 7122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30212, 7201}"/>
<set_value name="this.$Description" exact="{30212, 7202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 7211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 7221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="PAR_VS_HOL_Support_Invasion">
<cues>
<cue name="PAR_VS_HOL_Preemptive_Support_Invasion">
<actions>
<!--Paranid Vs Holy Order - Support Invasion-->
<set_value name="$ThreadID" exact="'$par_vs_hol_support_invasion'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Invading],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.hard,
$SubMissionLib = PAR_VS_HOL_Support_Invasion_Get_Submissions,
$NameLib = PAR_VS_HOL_Support_Invasion_Construct_Name,
$DescriptionLib = PAR_VS_HOL_Support_Invasion_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Support_Invasion_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$support_invasion"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30212, $TextOffset = [109000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Support_Invasion_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30212, 8000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="PAR_VS_HOL_Support_Invasion_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30212, 8101}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 8111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 8121}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30212, 8201}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30212, 8211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30212, 8221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
</cues>
</cue>
<!--
###################################
HOLY ORDER VS ARGON
###################################-->
<cue name="HOL_VS_ARG" namespace="this">
<actions>
<!--Common values-->
<set_value name="$ManagerCue" exact="parent.namespace"/>
<set_value name="$Faction" exact="faction.holyorder"/>
<set_value name="$EnemyFaction" exact="faction.argon"/>
<set_value name="$MissionGroup" exact="missiongroup.holyorder_war_argon"/>
<set_value name="$Mission_Contact" exact="null"/>
<set_value name="$Page" exact="30213" comment="HolyOrder-Argon-War page"/>
<set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
<set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
<set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
<set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
<!--Status-->
<set_value name="$SubscriptionStatus" exact="null"/>
<set_value name="$IntroducedToContact" exact="false"/>
<set_value name="$JobsDescribed" exact="false"/>
<set_value name="$ConflictDescribed" exact="false"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<set_value name="$CooldownTime" exact="-1s"/>
<!--Stats-->
<set_value name="$ThreadsCompleted" exact="0"/>
<set_value name="$ThreadsFailed" exact="0"/>
<set_value name="$MissionsCompleted" exact="0"/>
<set_value name="$MissionsFailed" exact="0"/>
</actions>
<cues>
<cue name="HOL_VS_ARG_Init">
<actions>
<set_value name="$ContactCreatorCue" exact="HOL_VS_ARG_Create_Contact"/>
<set_value name="$IntroMissionCue" exact="HOL_VS_ARG_Introduction"/>
<!--$SubscriptionStatus:
- 'unsubscribed'
- 'probation'
- 'subscribed'
- 'cooldown'-->
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'unsubscribed'" comment="TODO: @Owen, @Roger - temporary, change back to unsubscribed!"/>
</actions>
</cue>
<!--
####################
DEBUG
####################-->
<cue name="HOL_VS_ARG_Debug_Reset">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
<signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
</do_if>
</do_all>
<set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
<do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
<remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
</do_if>
</do_all>
<do_if value="$Mission_Contact.isclass.npc">
<destroy_object object="$Mission_Contact"/>
</do_if>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="namespace"/>
<reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
</actions>
</cue>
<cue name="HOL_VS_ARG_Debug_Subscribe" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
SUBSCRIPTION
####################-->
<!--event.param == new status-->
<cue name="HOL_VS_ARG_Set_Subscription_Status" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_if value="
event.param == 'unsubscribed' or
event.param == 'probation' or
event.param == 'subscribed' or
event.param == 'cooldown'">
<debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
<set_value name="$SubscriptionStatus" exact="event.param"/>
<!--Be careful with state change handlers here if the requested state was the same as the previous one-->
<do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
<unlock_achievement name="JOIN_WAR" />
<do_if value="ARG_VS_HOL.$SubscriptionStatus == 'subscribed'">
<unlock_achievement name="JOIN_DOUBLE_AGENT" />
</do_if>
<signal_cue cue="CalculateThreads"/>
</do_if>
<do_elseif value="event.param == 'cooldown'">
<!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
<set_value name="$CooldownTime" exact="player.age + 5min"/>
</do_elseif>
</do_if>
<do_else>
<assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
</do_else>
</actions>
</cue>
<cue name="HOL_VS_ARG_Check_Cooldown" instantiate="true" checkinterval="5s">
<conditions>
<check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
</conditions>
<actions>
<debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
CONTACT
####################-->
<!--event.param == Cloned table of the host sectors for this war front in which to search for a placement object (or null to fallback to any owned space in the galaxy)-->
<cue name="HOL_VS_ARG_Create_Contact">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<set_value name="this.$SelectedSpace" exact="null"/>
<do_if value="event.param and typeof event.param == datatype.table">
<set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
<do_all exact="this.$HostSectorKeys.count" counter="$i">
<do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
<!--Select a sector with stations and a high security value-->
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_if>
</do_all>
<do_if value="not this.$SelectedSpace">
<!--Simply select the furthest sector with stations-->
<do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_all>
</do_if>
</do_if>
<do_if value="not this.$SelectedSpace">
<find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
<debug_text text="'Fallback case for not finding suitable sector to place mission contact for ' + $MissionGroup + '. Placing on ' + this.$PotentialStation + ' ' + this.$PotentialStation.knownname + ' in ' + this.$SelectedSpace.knownname" filter="error"/>
</do_if>
</do_if>
<do_if value="this.$SelectedSpace">
<find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
<match_content class="class.walkablemodule"/>
</find_station>
<assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
<do_if value="$PlacementObject">
<create_cue_actor name="$Mission_Contact" cue="namespace" group="paranid.factionrepresentative">
<page exact="10305"/>
<owner exact="$Faction"/>
</create_cue_actor>
<do_if value="$Mission_Contact">
<set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
<set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
<debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</do_if>
<assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
<do_if value="not $Mission_Contact">
<reset_cue cue="this"/>
</do_if>
</actions>
<cues>
<cue name="HOL_VS_ARG_Place_Contact_Init">
<actions>
<do_if value="$PlacementObject.attention ge attention.nearby">
<signal_cue cue="HOL_VS_ARG_Place_Contact_Create_Interior"/>
</do_if>
</actions>
</cue>
<cue name="HOL_VS_ARG_Place_Contact_Create_Interior">
<conditions>
<check_any>
<event_cue_signalled/>
<check_all>
<event_object_changed_attention object="$PlacementObject"/>
<check_value value="event.param ge attention.nearby"/>
</check_all>
</check_any>
</conditions>
<actions>
<debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
<get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
<get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
<create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30213,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
<assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
<do_if value="$DynamicInterior">
<find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
<assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
<do_if value="$NPC_Slot">
<add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
<debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</actions>
<cues>
<cue name="HOL_VS_ARG_Place_Contact_WithinDynamicInterior_Destroy">
<conditions>
<event_object_interiors_despawning object="$PlacementObject"/>
</conditions>
<actions>
<debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
<remove_actor_from_room actor="$Mission_Contact"/>
<destroy_object object="$DynamicInterior"/>
<remove_value name="$DynamicInterior"/>
<remove_value name="$DynamicCorridor"/>
<remove_value name="$DynamicRoom"/>
<reset_cue cue="HOL_VS_ARG_Place_Contact_Create_Interior"/>
</actions>
</cue>
</cues>
</cue>
<cue name="HOL_VS_ARG_Contact_Killed">
<conditions>
<event_object_destroyed object="$Mission_Contact"/>
</conditions>
<actions>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="HOL_VS_ARG_Create_Contact"/>
</actions>
</cue>
<cue name="HOL_VS_ARG_Contact_Conversation_Started" instantiate="true">
<conditions>
<check_any>
<event_conversation_started actor="$Mission_Contact" />
<event_conversation_returned_to_section actor="$Mission_Contact" />
</check_any>
<check_value value="event.param == 'default'" />
</conditions>
<actions>
<do_if value="event.name == 'event_conversation_started'">
<do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
<do_if value="player.entity.isfemale">
<add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
</do_else>
</do_if>
<do_else>
<!--More familiar greeting-->
<add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
</do_else>
</do_if>
<include_actions ref="HOL_VS_ARG_Contact_Player_Lines"/>
</actions>
</cue>
<library name="HOL_VS_ARG_Contact_Player_Lines">
<actions>
<!--Specific sections-->
<do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_if>
</do_if>
<do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
<add_player_choice text="{1002,3021102}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<!--Start or other sections-->
<do_else>
<do_if value="$SubscriptionStatus == 'unsubscribed'">
<do_if value="HOL_VS_ARG_Introduction.state == cuestate.waiting">
<!--Intro mission is not in a state where the player can take it.-->
<!--TODO @Owen - voice lines on rejecting the player?-->
<add_player_choice text="{1002,3021301}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
</do_if>
<do_elseif value="$IntroducedToContact">
<do_if value="$JobsDescribed">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
<add_player_choice text="{1002,3021302}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict?"/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_else>
</do_elseif>
<do_else>
<add_player_choice text="{1002,3021301}" section="war_subscribe_request" comment="I'm here about the Argon."/>
</do_else>
</do_if>
<do_elseif value="$SubscriptionStatus == 'probation'">
<do_if value="$IntroMissionSuccessful">
<add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
</do_else>
</do_elseif>
</do_else>
</actions>
</library>
<cue name="HOL_VS_ARG_Contact_NextSection" instantiate="true">
<conditions>
<event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
</conditions>
<actions>
<set_value name="$AddPlayerChoices" exact="true"/>
<do_if value="event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$IntroducedToContact" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213001" hidechoices="true" comment="Ah, very good."/>
<add_npc_line speaker="$Mission_Contact" line="30213002" hidechoices="true"/>
<do_if value="player.entity.race == race.argon">
<!--Holy Order citizen-->
<add_npc_line speaker="$Mission_Contact" line="30213004" hidechoices="true"/>
</do_if>
<do_else>
<!--Holy Order friend-->
<add_npc_line speaker="$Mission_Contact" line="30213003" hidechoices="true"/>
</do_else>
<add_npc_line speaker="$Mission_Contact" line="30213005" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213006" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213007" hidechoices="true"/>
<do_if value="player.entity.race == race.argon">
<!--Argon player line-->
<add_npc_line speaker="$Mission_Contact" line="30213008" hidechoices="true"/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30213009" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213010" hidechoices="true"/>
</do_else>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30213026" comment="Sorry, but that is a very sensitive situation. We require pilots who have proven themselves to the Argon Federation."/>
</do_else>
</do_if>
<do_elseif value="event.param == 'war_subscribe_ask_intro'">
<set_value name="$JobsDescribed" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213011" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213012" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_ask_conflict'">
<set_value name="$ConflictDescribed" exact="true"/>
<do_if value="player.entity.race == race.argon">
<!--Argon player line-->
<add_npc_line speaker="$Mission_Contact" line="30213013" hidechoices="true"/>
</do_if>
<add_npc_line speaker="$Mission_Contact" line="30213014" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213015" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213016" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213017" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213018" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213019" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_request_2'">
<!--This section is for when the intro mission is not currently active for the player to accept it. Either reject the player or signal the intro mission to activate.-->
<include_actions ref="HOL_VS_ARG_Can_Activate_Introduction"/>
<do_if value="$CanActivateIntro">
<signal_cue cue="HOL_VS_ARG_Introduction"/>
<add_npc_line speaker="$Mission_Contact" line="30213001" hidechoices="true" comment="Ah, very good."/>
</do_if>
<do_else>
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30213027" hidechoices="true"/>
</do_else>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_start_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="HOL_VS_ARG_Player_Requested_Subscription"/>
<add_npc_line speaker="$Mission_Contact" line="30213020" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30213021" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_intro_complete'">
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30213022" hidechoices="true" comment="Yes, I saw. Very good."/>
<add_npc_line speaker="$Mission_Contact" line="30213023" hidechoices="true" comment="You will now find tasks related to the Holy Order conflict in your mission interface."/>
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'subscribed'"/>
</do_elseif>
<do_elseif value="event.param == 'war_abort_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="HOL_VS_ARG_Player_Requests_Intro_Abort"/>
</do_elseif>
<do_if value="$AddPlayerChoices">
<include_actions ref="HOL_VS_ARG_Contact_Player_Lines"/>
</do_if>
</actions>
</cue>
</cues>
</cue>
<!--event.param = table[
$cue = thread cue namespace,
$completedmissions = number of completed missions,
$failedmissions = number of failed missions]-->
<cue name="HOL_VS_ARG_Thread_Finished" instantiate="true">
<conditions>
<event_cue_signalled cue="Cleanup_Thread"/>
<check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
<check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
</conditions>
<actions>
<!--TODO @Owen spoken feedback?-->
<debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
<set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
<set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
<do_if value="$MissionsCompleted ge 20">
<unlock_achievement name="WAR_MISSIONS" />
</do_if>
<do_if value="event.param.$failed">
<set_value name="$ThreadsFailed" operation="add"/>
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'cooldown'"/>
</do_if>
<do_else>
<set_value name="$ThreadsCompleted" operation="add"/>
<signal_cue cue="CalculateThreads"/>
</do_else>
</actions>
</cue>
<!--
####################
INTRODUCTION
####################-->
<cue name="HOL_VS_ARG_Player_Requested_Subscription" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="HOL_VS_ARG_Player_Requests_Intro_Abort" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<library name="HOL_VS_ARG_Can_Activate_Introduction">
<actions>
<!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
<set_value name="$CanActivateIntro" exact="false"/>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$CanActivateIntro" exact="true"/>
</do_if>
</actions>
</library>
<cue name="HOL_VS_ARG_Introduction" version="2">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
<set_value name="$MissionIntroCue" exact="this"/>
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'unsubscribed'"/>
</actions>
<patch sinceversion="2" state="complete">
<do_if value="$SubscriptionStatus == 'cooldown'">
<debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'unsubscribed'"/>
</do_if>
</patch>
<cues>
<cue name="HOL_VS_ARG_Introduction_Init">
<actions>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<signal_cue cue="HOL_VS_ARG_Introduction_Create_Offer"/>
</do_if>
</actions>
</cue>
<cue name="HOL_VS_ARG_Introduction_Create_Offer">
<conditions>
<check_any>
<check_all>
<event_player_relation_changed faction="$Faction"/>
<check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
</check_all>
<event_cue_signalled/>
</check_any>
</conditions>
<actions>
<assert value="$Mission_Contact.isclass.npc" text="'Mission contact was not yet created for ' + $MissionGroup + '. Triggering creation now but location may not be near a war front. [Owen]'"/>
<do_if value="not $Mission_Contact.isclass.npc">
<signal_cue_instantly cue="$ContactCreatorCue"/>
</do_if>
<do_if value="$Mission_Contact">
<debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
<create_offer cue="$MissionIntroCue" actor="$Mission_Contact" type="missiontype.fight" name="readtext.{30213}.{1}" description="readtext.{30213}.{2}" difficulty="level.easy" faction="$Faction" group="$MissionGroup">
<briefing>
<objective step="1" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</create_offer>
</do_if>
<do_else>
<debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
<reset_cue cue="$MissionIntroCue"/>
</do_else>
</actions>
<cues>
<cue name="HOL_VS_ARG_Introduction_Offer_Accepted">
<conditions>
<event_object_signalled object="$Mission_Contact" param="'accept'" />
</conditions>
<actions>
<create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
</briefing>
</update_mission>
<remove_offer cue="$MissionIntroCue"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = HOL_VS_ARG_Cancel_Intro_Talkto,
$objective = objective.talkto,
$debugchance = $DebugChance]"/>
</actions>
</cue>
</cues>
</cue>
<cue name="HOL_VS_ARG_Intro_Abort">
<conditions>
<check_any>
<event_mission_aborted cue="HOL_VS_ARG_Introduction"/>
<event_cue_signalled cue="HOL_VS_ARG_Player_Requests_Intro_Abort"/>
</check_any>
</conditions>
<actions>
<do_if value="$MissionIntroCue.hasmission">
<remove_mission cue="$MissionIntroCue" type="aborted"/>
</do_if>
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'unsubscribed'"/>
<reset_cue cue="HOL_VS_ARG_Introduction"/>
</actions>
</cue>
<cue name="HOL_VS_ARG_Cancel_Intro_Talkto" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="HOL_VS_ARG_Start_Intro_Mission">
<conditions>
<event_cue_signalled cue="HOL_VS_ARG_Player_Requested_Subscription"/>
</conditions>
<actions>
<signal_cue cue="HOL_VS_ARG_Cancel_Intro_Talkto"/>
<signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'probation'"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<do_if value="$MissionIntroCue.hasmissionoffer">
<remove_offer cue="$MissionIntroCue"/>
</do_if>
<do_if value="not $MissionIntroCue.hasmission">
<create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30213}.{1}" description="readtext.{30213}.{2}" difficulty="level.easy" faction="$Faction" group="$MissionGroup"/>
</do_if>
<create_ship name="$TestShip" zone="player.zone">
<select faction="faction.holyorder" size="class.ship_s"/>
<owner exact="faction.holyorder"/>
<pilot actor="null"/>
<safepos object="player.entity" min="30km" max="40km"/>
</create_ship>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.destroy" object="$TestShip"/>
</briefing>
</update_mission>
<set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
</actions>
<cues>
<cue name="HOL_VS_ARG_Start_Intro_Mission_Successful">
<conditions>
<event_object_destroyed object="$TestShip"/>
</conditions>
<actions>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="2" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</update_mission>
<set_value name="$IntroMissionSuccessful" exact="true"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = HOL_VS_ARG_Start_Intro_Mission_Remove_Mission,
$objective = objective.talkto,
$step = 2,
$debugchance = $DebugChance]"/>
</actions>
</cue>
<cue name="HOL_VS_ARG_Start_Intro_Mission_Remove_Mission">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<remove_mission cue="$MissionIntroCue" type="completed"/>
<reset_cue cue="HOL_VS_ARG_Introduction"/>
</actions>
</cue>
<cue name="HOL_VS_ARG_Start_Intro_Mission_End">
<conditions>
<event_conversation_started actor="$Mission_Contact"/>
</conditions>
<actions>
<signal_cue cue="HOL_VS_ARG_Start_Intro_Mission_Remove_Mission"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--
####################
THREADS
####################-->
<cue name="HOL_VS_ARG_Reinforce_Defence">
<cues>
<cue name="HOL_VS_ARG_Reinforce_Defence_Register">
<actions>
<!--Holy Order Vs Argon - Reinforce Defence-->
<set_value name="$ThreadID" exact="'$hol_vs_arg_reinforce_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.protect,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_ARG_Reinforce_Defence_Get_Submissions,
$NameLib = HOL_VS_ARG_Reinforce_Defence_Construct_Name,
$DescriptionLib = HOL_VS_ARG_Reinforce_Defence_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Reinforce_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_lasertowers"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [101000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_mines"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__host_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [102000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$repair__damagedship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30213, $TextOffset = [103000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$taxi__specialist"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30213, $TextOffset = [104000], $Sequence = 1 ]"/>
<set_value name="$Submissions.$deliver__crew"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30211, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Reinforce_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30213, 3000}"/>
<set_value name="this.$Name" exact="{30213, 3001}"/>
<set_value name="this.$Name" exact="{30213, 3002}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Reinforce_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30213, 3101}"/>
<set_value name="this.$Description" exact="{30213, 3102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 3111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 3121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 3122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30213, 3201}"/>
<set_value name="this.$Description" exact="{30213, 3202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 3211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 3221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_ARG_Construct_Defence">
<cues>
<cue name="HOL_VS_ARG_Construct_Defence_Register" version="2">
<actions>
<!--Holy Order vs Argon - Construct Defence-->
<set_value name="$ThreadID" exact="'$hol_vs_arg_construct_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
$ThreadType = 'sequential',
$MissionType = missiontype.build,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_ARG_Construct_Defence_Get_Submissions,
$NameLib = HOL_VS_ARG_Construct_Defence_Construct_Name,
$DescriptionLib = HOL_VS_ARG_Construct_Defence_Construct_Description,
$MinMissions = 1,
$MaxMissions = 2,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
<patch sinceversion="2">
<append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
</patch>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Construct_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$build__defencestation"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30213, $TextOffset = [105000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$build__fleet"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30213, $TextOffset = [120000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Construct_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30213, 4000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Construct_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30213, 4101}"/>
<set_value name="this.$Description" exact="{30213, 4102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 4111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 4121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 4122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30213, 4201}"/>
<set_value name="this.$Description" exact="{30213, 4202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 4211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 4221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_ARG_Secure_Resources">
<cues>
<cue name="HOL_VS_ARG_Secure_Resources_Register">
<actions>
<!--Holy Order vs Argon - Secure Resources-->
<set_value name="$ThreadID" exact="'$hol_vs_arg_secure_resources'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.trade,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_ARG_Secure_Resources_Get_Submissions,
$NameLib = HOL_VS_ARG_Secure_Resources_Construct_Name,
$DescriptionLib = HOL_VS_ARG_Secure_Resources_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Secure_Resources_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$large_supply__food"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30213, $TextOffset = [100000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$large_supply__shiptech"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30213, $TextOffset = [100100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_lasertowers_at_resources"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [101300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$find_resources__ores"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [106000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$supply_station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [130000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Secure_Resources_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30213, 5000}"/>
<set_value name="this.$Name" exact="{30213, 5001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Secure_Resources_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30213, 5101}"/>
<set_value name="this.$Description" exact="{30213, 5102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 5111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 5121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 5122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30213, 5201}"/>
<set_value name="this.$Description" exact="{30213, 5202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 5211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 5221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_ARG_Preemptive_Offensive">
<cues>
<cue name="HOL_VS_ARG_Preemptive_Offensive_Register">
<actions>
<!--Holy Order Vs Argon- Preemptive Offensive-->
<set_value name="$ThreadID" exact="'$hol_vs_arg_preemptive_offensive'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_ARG_Preemptive_Offensive_Get_Submissions,
$NameLib = HOL_VS_ARG_Preemptive_Offensive_Construct_Name,
$DescriptionLib = HOL_VS_ARG_Preemptive_Offensive_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Preemptive_Offensive_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$assassination__informant"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30213, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$board_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30213, $TextOffset = [108000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$destroy_rare_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30213, $TextOffset = [140000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Preemptive_Offensive_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30213, 6000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Preemptive_Offensive_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30213, 6101}"/>
<set_value name="this.$Description" exact="{30213, 6102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 6111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 6121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 6122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30213, 6201}"/>
<set_value name="this.$Description" exact="{30213, 6202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 6211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 6221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_ARG_Gather_Intel">
<cues>
<cue name="HOL_VS_ARG_Preemptive_Gather_Intel">
<actions>
<!-- Holy Order Vs Argon - Gather Intel-->
<set_value name="$ThreadID" exact="'$hol_vs_arg_gather_intel'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.intelligence,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_ARG_Gather_Intel_Get_Submissions,
$NameLib = HOL_VS_ARG_Gather_Intel_Construct_Name,
$DescriptionLib = HOL_VS_ARG_Gather_Intel_Construct_Description,
$MinMissions = 2,
$MaxMissions = 3,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Gather_Intel_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_satellite"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [101400], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [102100], $Sequence = 1 ]"/>
<set_value name="$Submissions.$find_resources__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [106100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__module"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_ware"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_inventory"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150400], $Sequence = -1 ]"/>
<!--$scan__for_entity currently disabled as it's quite a chore-->
<!--<set_value name="$Submissions.$scan__for_entity"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150500], $Sequence = -1 ]"/>-->
<set_value name="$Submissions.$scan__for_idcode"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150600], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Gather_Intel_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30213, 7000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Gather_Intel_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30213, 7101}"/>
<set_value name="this.$Description" exact="{30213, 7102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 7111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 7121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 7122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30213, 7201}"/>
<set_value name="this.$Description" exact="{30213, 7202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 7211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 7221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_ARG_Support_Invasion">
<cues>
<cue name="HOL_VS_ARG_Preemptive_Support_Invasion">
<actions>
<!--Argon Vs Holy Order - Support Invasion-->
<set_value name="$ThreadID" exact="'$hol_vs_arg_support_invasion'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Invading],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.hard,
$SubMissionLib = HOL_VS_ARG_Support_Invasion_Get_Submissions,
$NameLib = HOL_VS_ARG_Support_Invasion_Construct_Name,
$DescriptionLib = HOL_VS_ARG_Support_Invasion_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Support_Invasion_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$support_invasion"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30213, $TextOffset = [109000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Support_Invasion_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30213, 8000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_ARG_Support_Invasion_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30213, 8101}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 8111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 8121}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30213, 8201}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30213, 8211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30213, 8221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
</cues>
</cue>
<!--
###################################
HOLY ORDER OF THE PARANID vs GODREALM OF THE PARANID
###################################-->
<cue name="HOL_VS_PAR" namespace="this">
<actions>
<!--Common values-->
<set_value name="$ManagerCue" exact="parent.namespace"/>
<set_value name="$Faction" exact="faction.holyorder"/>
<set_value name="$EnemyFaction" exact="faction.paranid"/>
<set_value name="$MissionGroup" exact="missiongroup.holyorder_war_paranid"/>
<set_value name="$Mission_Contact" exact="null"/>
<set_value name="$Page" exact="30214" comment="HolyOrder-Paranid-War page"/>
<set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
<set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
<set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
<set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
<!--Status-->
<set_value name="$SubscriptionStatus" exact="null"/>
<set_value name="$IntroducedToContact" exact="false"/>
<set_value name="$JobsDescribed" exact="false"/>
<set_value name="$ConflictDescribed" exact="false"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<set_value name="$CooldownTime" exact="-1s"/>
<!--Stats-->
<set_value name="$ThreadsCompleted" exact="0"/>
<set_value name="$ThreadsFailed" exact="0"/>
<set_value name="$MissionsCompleted" exact="0"/>
<set_value name="$MissionsFailed" exact="0"/>
</actions>
<cues>
<cue name="HOL_VS_PAR_Init">
<actions>
<set_value name="$ContactCreatorCue" exact="HOL_VS_PAR_Create_Contact"/>
<set_value name="$IntroMissionCue" exact="HOL_VS_PAR_Introduction"/>
<!--$SubscriptionStatus:
- 'unsubscribed'
- 'probation'
- 'subscribed'
- 'cooldown'-->
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'unsubscribed'" comment="TODO: @Owen, @Roger - temporary, change back to unsubscribed!"/>
</actions>
</cue>
<!--
####################
DEBUG
####################-->
<cue name="HOL_VS_PAR_Debug_Reset">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
<signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
</do_if>
</do_all>
<set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
<do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
<do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
<remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
</do_if>
</do_all>
<do_if value="$Mission_Contact.isclass.npc">
<destroy_object object="$Mission_Contact"/>
</do_if>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="namespace"/>
<reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
</actions>
</cue>
<cue name="HOL_VS_PAR_Debug_Subscribe" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
SUBSCRIPTION
####################-->
<!--event.param == new status-->
<cue name="HOL_VS_PAR_Set_Subscription_Status" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_if value="
event.param == 'unsubscribed' or
event.param == 'probation' or
event.param == 'subscribed' or
event.param == 'cooldown'">
<debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
<set_value name="$SubscriptionStatus" exact="event.param"/>
<!--Be careful with state change handlers here if the requested state was the same as the previous one-->
<do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
<unlock_achievement name="JOIN_WAR" />
<do_if value="PAR_VS_HOL.$SubscriptionStatus == 'subscribed'">
<unlock_achievement name="JOIN_DOUBLE_AGENT" />
</do_if>
<signal_cue cue="CalculateThreads"/>
</do_if>
<do_elseif value="event.param == 'cooldown'">
<!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
<set_value name="$CooldownTime" exact="player.age + 5min"/>
</do_elseif>
</do_if>
<do_else>
<assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
</do_else>
</actions>
</cue>
<cue name="HOL_VS_PAR_Check_Cooldown" instantiate="true" checkinterval="5s">
<conditions>
<check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
</conditions>
<actions>
<debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'subscribed'"/>
</actions>
</cue>
<!--
####################
CONTACT
####################-->
<!--event.param == Cloned table of the host sectors for this war front in which to search for a placement object (or null to fallback to any owned space in the galaxy)-->
<cue name="HOL_VS_PAR_Create_Contact">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<set_value name="this.$SelectedSpace" exact="null"/>
<do_if value="event.param and typeof event.param == datatype.table">
<set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
<do_all exact="this.$HostSectorKeys.count" counter="$i">
<do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
<!--Select a sector with stations and a high security value-->
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_if>
</do_all>
<do_if value="not this.$SelectedSpace">
<!--Simply select the furthest sector with stations-->
<do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
<find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
<break/>
</do_if>
</do_all>
</do_if>
</do_if>
<do_if value="not this.$SelectedSpace">
<find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
<match_content class="class.walkablemodule"/>
</find_station>
<do_if value="this.$PotentialStation">
<set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
<debug_text text="'Fallback case for not finding suitable sector to place mission contact for ' + $MissionGroup + '. Placing on ' + this.$PotentialStation + ' ' + this.$PotentialStation.knownname + ' in ' + this.$SelectedSpace.knownname" filter="error"/>
</do_if>
</do_if>
<do_if value="this.$SelectedSpace">
<find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
<match_content class="class.walkablemodule"/>
</find_station>
<assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
<do_if value="$PlacementObject">
<create_cue_actor name="$Mission_Contact" cue="namespace" group="paranid.factionrepresentative">
<page exact="10307"/>
<owner exact="$Faction"/>
</create_cue_actor>
<do_if value="$Mission_Contact">
<set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
<set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
<debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</do_if>
<assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
<do_if value="not $Mission_Contact">
<reset_cue cue="this"/>
</do_if>
</actions>
<cues>
<cue name="HOL_VS_PAR_Place_Contact_Init">
<actions>
<do_if value="$PlacementObject.attention ge attention.nearby">
<signal_cue cue="HOL_VS_PAR_Place_Contact_Create_Interior"/>
</do_if>
</actions>
</cue>
<cue name="HOL_VS_PAR_Place_Contact_Create_Interior">
<conditions>
<check_any>
<event_cue_signalled/>
<check_all>
<event_object_changed_attention object="$PlacementObject"/>
<check_value value="event.param ge attention.nearby"/>
</check_all>
</check_any>
</conditions>
<actions>
<debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
<get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
<get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
<create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30214,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
<assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
<do_if value="$DynamicInterior">
<find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
<assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
<do_if value="$NPC_Slot">
<add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
<debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
</do_if>
</do_if>
</actions>
<cues>
<cue name="HOL_VS_PAR_Place_Contact_WithinDynamicInterior_Destroy">
<conditions>
<event_object_interiors_despawning object="$PlacementObject"/>
</conditions>
<actions>
<debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
<remove_actor_from_room actor="$Mission_Contact"/>
<destroy_object object="$DynamicInterior"/>
<remove_value name="$DynamicInterior"/>
<remove_value name="$DynamicCorridor"/>
<remove_value name="$DynamicRoom"/>
<reset_cue cue="HOL_VS_PAR_Place_Contact_Create_Interior"/>
</actions>
</cue>
</cues>
</cue>
<cue name="HOL_VS_PAR_Contact_Killed">
<conditions>
<event_object_destroyed object="$Mission_Contact"/>
</conditions>
<actions>
<set_value name="$Mission_Contact" exact="null"/>
<reset_cue cue="HOL_VS_PAR_Create_Contact"/>
</actions>
</cue>
<cue name="HOL_VS_PAR_Contact_Conversation_Started" instantiate="true">
<conditions>
<check_any>
<event_conversation_started actor="$Mission_Contact" />
<event_conversation_returned_to_section actor="$Mission_Contact" />
</check_any>
<check_value value="event.param == 'default'" />
</conditions>
<actions>
<do_if value="event.name == 'event_conversation_started'">
<do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
<do_if value="player.entity.isfemale">
<add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
</do_else>
</do_if>
<do_else>
<!--More familiar greeting-->
<add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
</do_else>
</do_if>
<include_actions ref="HOL_VS_PAR_Contact_Player_Lines"/>
</actions>
</cue>
<library name="HOL_VS_PAR_Contact_Player_Lines">
<actions>
<!--Specific sections-->
<do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_if>
</do_if>
<do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
<add_player_choice text="{1002,3021402}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
<add_player_choice text="{1002,3021403}" section="war_subscribe_ask_conflict_2" comment="What will you do?"/>
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict_2'">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
</do_elseif>
<!--Start or other sections-->
<do_else>
<do_if value="$SubscriptionStatus == 'unsubscribed'">
<do_if value="HOL_VS_PAR_Introduction.state == cuestate.waiting">
<!--Intro mission is not in a state where the player can take it.-->
<!--TODO @Owen - voice lines on rejecting the player?-->
<add_player_choice text="{1002,3021401}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
</do_if>
<do_elseif value="$IntroducedToContact">
<do_if value="$JobsDescribed">
<add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
<add_player_choice text="{1002,3021402}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
</do_else>
</do_elseif>
<do_else>
<add_player_choice text="{1002,3021401}" section="war_subscribe_request" comment="I'm here about the Holy Order."/>
</do_else>
</do_if>
<do_elseif value="$SubscriptionStatus == 'probation'">
<do_if value="$IntroMissionSuccessful">
<add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
</do_if>
<do_else>
<add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
</do_else>
</do_elseif>
</do_else>
</actions>
</library>
<cue name="HOL_VS_PAR_Contact_NextSection" instantiate="true">
<conditions>
<event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
</conditions>
<actions>
<set_value name="$AddPlayerChoices" exact="true"/>
<do_if value="event.param == 'war_subscribe_request'">
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$IntroducedToContact" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214001" hidechoices="true" comment="Ah, very good."/>
<add_npc_line speaker="$Mission_Contact" line="30214002" hidechoices="true"/>
<do_if value="player.entity.race == race.argon">
<!--Holy Order citizen-->
<add_npc_line speaker="$Mission_Contact" line="30214004" hidechoices="true"/>
</do_if>
<do_else>
<!--Holy Order friend-->
<add_npc_line speaker="$Mission_Contact" line="30214003" hidechoices="true"/>
</do_else>
<add_npc_line speaker="$Mission_Contact" line="30214005" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214006" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214007" hidechoices="true"/>
<do_if value="player.entity.race != race.paranid">
<!--Non-Paranid player line-->
<add_npc_line speaker="$Mission_Contact" line="30214008" hidechoices="true"/>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30214009" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214010" hidechoices="true"/>
</do_else>
</do_if>
<do_else>
<add_npc_line speaker="$Mission_Contact" line="30214026" comment="Sorry, but that is a very sensitive situation. We require pilots who have proven themselves to the Argon Federation."/>
</do_else>
</do_if>
<do_elseif value="event.param == 'war_subscribe_ask_intro'">
<set_value name="$JobsDescribed" exact="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214011" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214012" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_ask_conflict'">
<set_value name="$ConflictDescribed" exact="true"/>
<do_if value="player.entity.race != race.paranid">
<!--Non-Paranid player line-->
<add_npc_line speaker="$Mission_Contact" line="30214013" hidechoices="true"/>
</do_if>
<add_npc_line speaker="$Mission_Contact" line="30214014" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214015" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_ask_conflict_2'">
<add_npc_line speaker="$Mission_Contact" line="30214016" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214017" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214018" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214019" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_request_2'">
<!--This section is for when the intro mission is not currently active for the player to accept it. Either reject the player or signal the intro mission to activate.-->
<include_actions ref="HOL_VS_PAR_Can_Activate_Introduction"/>
<do_if value="$CanActivateIntro">
<signal_cue cue="HOL_VS_PAR_Introduction"/>
<add_npc_line speaker="$Mission_Contact" line="30214001" hidechoices="true" comment="Ah, very good."/>
</do_if>
<do_else>
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30214027" hidechoices="true"/>
</do_else>
</do_elseif>
<do_elseif value="event.param == 'war_subscribe_start_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="HOL_VS_PAR_Player_Requested_Subscription"/>
<add_npc_line speaker="$Mission_Contact" line="30214020" hidechoices="true"/>
<add_npc_line speaker="$Mission_Contact" line="30214021" hidechoices="true"/>
</do_elseif>
<do_elseif value="event.param == 'war_intro_complete'">
<set_value name="$AddPlayerChoices" exact="false"/>
<add_npc_line speaker="$Mission_Contact" line="30214022" hidechoices="true" comment="Yes, I saw. Very good."/>
<add_npc_line speaker="$Mission_Contact" line="30214023" hidechoices="true" comment="You will now find tasks related to the Holy Order conflict in your mission interface."/>
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'subscribed'"/>
</do_elseif>
<do_elseif value="event.param == 'war_abort_intro'">
<set_value name="$AddPlayerChoices" exact="false"/>
<signal_cue cue="HOL_VS_PAR_Player_Requests_Intro_Abort"/>
</do_elseif>
<do_if value="$AddPlayerChoices">
<include_actions ref="HOL_VS_PAR_Contact_Player_Lines"/>
</do_if>
</actions>
</cue>
</cues>
</cue>
<!--event.param = table[
$cue = thread cue namespace,
$completedmissions = number of completed missions,
$failedmissions = number of failed missions]-->
<cue name="HOL_VS_PAR_Thread_Finished" instantiate="true">
<conditions>
<event_cue_signalled cue="Cleanup_Thread"/>
<check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
<check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
</conditions>
<actions>
<!--TODO @Owen spoken feedback?-->
<debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
<set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
<set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
<do_if value="$MissionsCompleted ge 20">
<unlock_achievement name="WAR_MISSIONS" />
</do_if>
<do_if value="event.param.$failed">
<set_value name="$ThreadsFailed" operation="add"/>
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'cooldown'"/>
</do_if>
<do_else>
<set_value name="$ThreadsCompleted" operation="add"/>
<signal_cue cue="CalculateThreads"/>
</do_else>
</actions>
</cue>
<!--
####################
INTRODUCTION
####################-->
<cue name="HOL_VS_PAR_Player_Requested_Subscription" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="HOL_VS_PAR_Player_Requests_Intro_Abort" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<library name="HOL_VS_PAR_Can_Activate_Introduction">
<actions>
<!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
<set_value name="$CanActivateIntro" exact="false"/>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<set_value name="$CanActivateIntro" exact="true"/>
</do_if>
</actions>
</library>
<cue name="HOL_VS_PAR_Introduction" version="2">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
<set_value name="$MissionIntroCue" exact="this"/>
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'unsubscribed'"/>
</actions>
<patch sinceversion="2" state="complete">
<do_if value="$SubscriptionStatus == 'cooldown'">
<debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'unsubscribed'"/>
</do_if>
</patch>
<cues>
<cue name="HOL_VS_PAR_Introduction_Init">
<actions>
<do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
<signal_cue cue="HOL_VS_PAR_Introduction_Create_Offer"/>
</do_if>
</actions>
</cue>
<cue name="HOL_VS_PAR_Introduction_Create_Offer">
<conditions>
<check_any>
<check_all>
<event_player_relation_changed faction="$Faction"/>
<check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
</check_all>
<event_cue_signalled/>
</check_any>
</conditions>
<actions>
<assert value="$Mission_Contact.isclass.npc" text="'Mission contact was not yet created for ' + $MissionGroup + '. Triggering creation now but location may not be near a war front. [Owen]'"/>
<do_if value="not $Mission_Contact.isclass.npc">
<signal_cue_instantly cue="$ContactCreatorCue"/>
</do_if>
<do_if value="$Mission_Contact">
<debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
<create_offer cue="$MissionIntroCue" actor="$Mission_Contact" type="missiontype.fight" name="readtext.{30214}.{1}" description="readtext.{30214}.{2}" difficulty="level.easy" faction="$Faction" group="$MissionGroup">
<briefing>
<objective step="1" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</create_offer>
</do_if>
<do_else>
<debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
<reset_cue cue="$MissionIntroCue"/>
</do_else>
</actions>
<cues>
<cue name="HOL_VS_PAR_Introduction_Offer_Accepted">
<conditions>
<event_object_signalled object="$Mission_Contact" param="'accept'" />
</conditions>
<actions>
<create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
</briefing>
</update_mission>
<remove_offer cue="$MissionIntroCue"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = HOL_VS_PAR_Cancel_Intro_Talkto,
$objective = objective.talkto,
$debugchance = $DebugChance]"/>
</actions>
</cue>
</cues>
</cue>
<cue name="HOL_VS_PAR_Intro_Abort">
<conditions>
<check_any>
<event_mission_aborted cue="HOL_VS_PAR_Introduction"/>
<event_cue_signalled cue="HOL_VS_PAR_Player_Requests_Intro_Abort"/>
</check_any>
</conditions>
<actions>
<do_if value="$MissionIntroCue.hasmission">
<remove_mission cue="$MissionIntroCue" type="aborted"/>
</do_if>
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'unsubscribed'"/>
<reset_cue cue="HOL_VS_PAR_Introduction"/>
</actions>
</cue>
<cue name="HOL_VS_PAR_Cancel_Intro_Talkto" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
</cue>
<cue name="HOL_VS_PAR_Start_Intro_Mission">
<conditions>
<event_cue_signalled cue="HOL_VS_PAR_Player_Requested_Subscription"/>
</conditions>
<actions>
<signal_cue cue="HOL_VS_PAR_Cancel_Intro_Talkto"/>
<signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'probation'"/>
<set_value name="$IntroMissionSuccessful" exact="false"/>
<do_if value="$MissionIntroCue.hasmissionoffer">
<remove_offer cue="$MissionIntroCue"/>
</do_if>
<do_if value="not $MissionIntroCue.hasmission">
<create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30214}.{1}" description="readtext.{30214}.{2}" difficulty="level.easy" faction="$Faction" group="$MissionGroup"/>
</do_if>
<create_ship name="$TestShip" zone="player.zone">
<select faction="faction.holyorder" size="class.ship_s"/>
<owner exact="faction.holyorder"/>
<pilot actor="null"/>
<safepos object="player.entity" min="30km" max="40km"/>
</create_ship>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="1" action="objective.destroy" object="$TestShip"/>
</briefing>
</update_mission>
<set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
</actions>
<cues>
<cue name="HOL_VS_PAR_Start_Intro_Mission_Successful">
<conditions>
<event_object_destroyed object="$TestShip"/>
</conditions>
<actions>
<update_mission cue="$MissionIntroCue">
<briefing>
<objective step="2" action="objective.talkto" object="$Mission_Contact"/>
</briefing>
</update_mission>
<set_value name="$IntroMissionSuccessful" exact="true"/>
<signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
$actor = $Mission_Contact,
$object = $PlacementObject,
$missioncue = $MissionIntroCue,
$cancelcue = HOL_VS_PAR_Start_Intro_Mission_Remove_Mission,
$objective = objective.talkto,
$step = 2,
$debugchance = $DebugChance]"/>
</actions>
</cue>
<cue name="HOL_VS_PAR_Start_Intro_Mission_Remove_Mission">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<remove_mission cue="$MissionIntroCue" type="completed"/>
<reset_cue cue="HOL_VS_PAR_Introduction"/>
</actions>
</cue>
<cue name="HOL_VS_PAR_Start_Intro_Mission_End">
<conditions>
<event_conversation_started actor="$Mission_Contact"/>
</conditions>
<actions>
<signal_cue cue="HOL_VS_PAR_Start_Intro_Mission_Remove_Mission"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--
####################
THREADS
####################-->
<cue name="HOL_VS_PAR_Reinforce_Defence">
<cues>
<cue name="HOL_VS_PAR_Reinforce_Defence_Register">
<actions>
<!--Holy Order vs Paranid - Reinforce Defence-->
<set_value name="$ThreadID" exact="'$hol_vs_par_reinforce_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.protect,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_PAR_Reinforce_Defence_Get_Submissions,
$NameLib = HOL_VS_PAR_Reinforce_Defence_Construct_Name,
$DescriptionLib = HOL_VS_PAR_Reinforce_Defence_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Reinforce_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_lasertowers"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [101000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_mines"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__host_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [102000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$repair__damagedship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30214, $TextOffset = [103000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$taxi__specialist"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30214, $TextOffset = [104000], $Sequence = 1 ]"/>
<set_value name="$Submissions.$deliver__crew"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30211, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Reinforce_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30214, 3000}"/>
<set_value name="this.$Name" exact="{30214, 3001}"/>
<set_value name="this.$Name" exact="{30214, 3002}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Reinforce_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30214, 3101}"/>
<set_value name="this.$Description" exact="{30214, 3102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 3111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 3121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 3122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30214, 3201}"/>
<set_value name="this.$Description" exact="{30214, 3202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 3211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 3221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_PAR_Construct_Defence">
<cues>
<cue name="HOL_VS_PAR_Construct_Defence_Register" version="2">
<actions>
<!--Holy Order vs Paranid - Construct Defence-->
<set_value name="$ThreadID" exact="'$hol_vs_par_construct_defence'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
$ThreadType = 'sequential',
$MissionType = missiontype.build,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_PAR_Construct_Defence_Get_Submissions,
$NameLib = HOL_VS_PAR_Construct_Defence_Construct_Name,
$DescriptionLib = HOL_VS_PAR_Construct_Defence_Construct_Description,
$MinMissions = 1,
$MaxMissions = 2,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
<patch sinceversion="2">
<append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
</patch>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Construct_Defence_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$build__defencestation"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30214, $TextOffset = [105000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$build__fleet"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30214, $TextOffset = [120000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Construct_Defence_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30214, 4000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Construct_Defence_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30214, 4101}"/>
<set_value name="this.$Description" exact="{30214, 4102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 4111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 4121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 4122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30214, 4201}"/>
<set_value name="this.$Description" exact="{30214, 4202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 4211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 4221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_PAR_Secure_Resources">
<cues>
<cue name="HOL_VS_PAR_Secure_Resources_Register">
<actions>
<!--Holy Order vs Paranid - Secure Resources-->
<set_value name="$ThreadID" exact="'$hol_vs_par_secure_resources'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.trade,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_PAR_Secure_Resources_Get_Submissions,
$NameLib = HOL_VS_PAR_Secure_Resources_Construct_Name,
$DescriptionLib = HOL_VS_PAR_Secure_Resources_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Secure_Resources_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$large_supply__food"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30214, $TextOffset = [100000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$large_supply__shiptech"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30214, $TextOffset = [100100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$deploy_lasertowers_at_resources"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [101300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$find_resources__ores"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [106000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$supply_station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [130000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Secure_Resources_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30214, 5000}"/>
<set_value name="this.$Name" exact="{30214, 5001}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Secure_Resources_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30214, 5101}"/>
<set_value name="this.$Description" exact="{30214, 5102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 5111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 5121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 5122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30214, 5201}"/>
<set_value name="this.$Description" exact="{30214, 5202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 5211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 5221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_PAR_Preemptive_Offensive">
<cues>
<cue name="HOL_VS_PAR_Preemptive_Offensive_Register">
<actions>
<!--Holy Order vs Paranid - Preemptive Offensive-->
<set_value name="$ThreadID" exact="'$hol_vs_par_preemptive_offensive'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_PAR_Preemptive_Offensive_Get_Submissions,
$NameLib = HOL_VS_PAR_Preemptive_Offensive_Construct_Name,
$DescriptionLib = HOL_VS_PAR_Preemptive_Offensive_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Preemptive_Offensive_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$assassination__informant"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30214, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$board_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30214, $TextOffset = [108000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$destroy_rare_ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30214, $TextOffset = [140000], $Sequence = -1 ]"/>
<!--TODO @Owen
- destroy mining ships / other vulnerable ships
- mine resource areas
- mass traffic destruction
- rescue an allied ship behind enemy lines?-->
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Preemptive_Offensive_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30214, 6000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Preemptive_Offensive_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30214, 6101}"/>
<set_value name="this.$Description" exact="{30214, 6102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 6111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 6121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 6122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30214, 6201}"/>
<set_value name="this.$Description" exact="{30214, 6202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 6211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 6221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_PAR_Gather_Intel">
<cues>
<cue name="HOL_VS_PAR_Preemptive_Gather_Intel">
<actions>
<!--Holy Order vs Paranid - Gather Intel-->
<set_value name="$ThreadID" exact="'$hol_vs_par_gather_intel'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
$ThreadType = 'sequential',
$MissionType = missiontype.intelligence,
$Difficulty = level.medium,
$SubMissionLib = HOL_VS_PAR_Gather_Intel_Get_Submissions,
$NameLib = HOL_VS_PAR_Gather_Intel_Construct_Name,
$DescriptionLib = HOL_VS_PAR_Gather_Intel_Construct_Description,
$MinMissions = 2,
$MaxMissions = 3,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Gather_Intel_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$deploy_satellite"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [101400], $Sequence = -1 ]"/>
<set_value name="$Submissions.$achieve_coverage__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [102100], $Sequence = 1 ]"/>
<set_value name="$Submissions.$find_resources__enemy_sector"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [106100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__ship"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150000], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__station"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150100], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__module"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150200], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_ware"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150300], $Sequence = -1 ]"/>
<set_value name="$Submissions.$scan__for_inventory"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150400], $Sequence = -1 ]"/>
<!--$scan__for_entity currently disabled as it's quite a chore-->
<!--<set_value name="$Submissions.$scan__for_entity"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150500], $Sequence = -1 ]"/>-->
<set_value name="$Submissions.$scan__for_idcode"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150600], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Gather_Intel_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30214, 7000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Gather_Intel_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30214, 7101}"/>
<set_value name="this.$Description" exact="{30214, 7102}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 7111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 7121}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 7122}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30214, 7201}"/>
<set_value name="this.$Description" exact="{30214, 7202}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 7211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 7221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
<cue name="HOL_VS_PAR_Support_Invasion">
<cues>
<cue name="HOL_VS_PAR_Preemptive_Support_Invasion">
<actions>
<!--Holy Order vs Paranid - Support Invasion-->
<set_value name="$ThreadID" exact="'$hol_vs_par_support_invasion'"/>
<set_value name="$Thread" exact="table[
$ID = $ThreadID,
$Faction = $Faction,
$EnemyFaction = $EnemyFaction,
$MissionGroup = $MissionGroup,
$ThreadConditionLibs = [Situation__Invading],
$ThreadType = 'sequential',
$MissionType = missiontype.fight,
$Difficulty = level.hard,
$SubMissionLib = HOL_VS_PAR_Support_Invasion_Get_Submissions,
$NameLib = HOL_VS_PAR_Support_Invasion_Construct_Name,
$DescriptionLib = HOL_VS_PAR_Support_Invasion_Construct_Description,
$MinMissions = 4,
$MaxMissions = 5,
$ThreadAbortRelation = -0.00064]"/>
<assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
<set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
</actions>
</cue>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Support_Invasion_Get_Submissions">
<actions>
<set_value name="$Submissions" exact="table[]"/>
<set_value name="$Submissions.$support_invasion"
exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30214, $TextOffset = [109000], $Sequence = -1 ]"/>
<set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
</actions>
</library>
<!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Support_Invasion_Construct_Name">
<actions>
<do_any>
<set_value name="this.$Name" exact="{30214, 8000}"/>
</do_any>
</actions>
</library>
<!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
<library name="HOL_VS_PAR_Support_Invasion_Construct_Description">
<actions>
<do_if value="$ThreadMood == 'negative'">
<do_any>
<set_value name="this.$Description" exact="{30214, 8101}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 8111}"/>
<do_any>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 8121}"/>
</do_any>
</do_if>
<do_elseif value="$ThreadMood == 'positive'">
<do_any>
<set_value name="this.$Description" exact="{30214, 8201}"/>
</do_any>
<set_value name="this.$Description" operation="add" exact="' ' + {30214, 8211}"/>
<set_value name="this.$Description" operation="add" exact="'\n' + {30214, 8221}"/>
</do_elseif>
</actions>
</library>
</cues>
</cue>
</cues>
</cue>
<!--
Required variables: $CentralSector = the sector to look for war fronts around (usually the player.sector)-->
<library name="GetWarFronts">
<actions>
<clear_table table="$WarFronts"/>
<do_all chance="$DebugChance">
<do_if value="$CentralSector">
<debug_text text="'Getting WarFronts around ' + $CentralSector.knownname"/>
</do_if>
<do_else>
<debug_text text="'Getting WarFronts in the whole galaxy'"/>
</do_else>
</do_all>
<!--
table[
{$HostFaction} =
table[
$HostEntryPoint = Jumpgate or Super Highway Entry Gate leading from host space to enemy space
$EnemyEntryPoint = Jumpgate or Super Highway Entry Gate leading from enemy space to host space
$EnemyFaction = $EnemyFaction,
$HostSectors = table[table of sectors that are exclusivly owned by $HostFaction within 1 jump of the enemy exitpoint or a related contested sector. Value is gate distance to the enemy ENTRY point or Enemy contested sector],
$EnemySectors = table[table of sectors that are exclusivly owned by $EnemyFaction within 1 jump of the enemy entrypoint or a related contested sector. Value is gate distance to the nearest Host owned or contested sector],
$OtherSectors = table[table of sectors that neither faction owns within either 1 jump of the enemy exitpoint or a related contested sector. Value is gate distance to the enemy ENTRY point or contested sector],
$ContestedSectors = [list of sectors which are contested by either {Host and Enemy} or {Ally Vs Enemy} ],
$ContestedSectorsIncludeHost = bool - whether $ContestedSectors is {Host Vs Enemy} or {Ally Vs Enemy (Host is not involved)}
$OfferSectors = [list of sectors where the thread offers are visible],
$HostInvasions = [list of FactionGoal_Invade_Space cues to query for invasion details of the host against the enemy],
$EnemyInvasions = [list of FactionGoal_Invade_Space cues to query for invasion details of the enemy against the host],
$AllyInvasions = [list of FactionGoal_Invade_Space cues to query for invasion details of an ally against the enemy],
$EnemyToAllyInvasions = [list of FactionGoal_Invade_Space cues to query for invasion details of the enemy against an ally],
$ActiveSituations = [list of situation libraries which currently pass for this warfront e.g. Situation__Invading. Populated when iterating over potential threads]
]
]-->
<set_value name="$ThreadWarFactionTable" exact="table[]"/>
<set_value name="$ThreadDefinitionIDs" exact="$ThreadDefinitions.keys.list"/>
<do_all exact="$ThreadDefinitionIDs.count" counter="$gwf_i">
<set_value name="$gwf_faction" exact="$ThreadDefinitions.{$ThreadDefinitionIDs.{$gwf_i}}.$Faction"/>
<set_value name="$gwf_enemyfaction" exact="$ThreadDefinitions.{$ThreadDefinitionIDs.{$gwf_i}}.$EnemyFaction"/>
<do_if value="not $ThreadWarFactionTable.{$gwf_faction}?">
<set_value name="$ThreadWarFactionTable.{$gwf_faction}" exact="[]"/>
</do_if>
<do_if value="not $ThreadWarFactionTable.{$gwf_faction}.indexof.{$gwf_enemyfaction}">
<append_to_list name="$ThreadWarFactionTable.{$gwf_faction}" exact="$gwf_enemyfaction"/>
</do_if>
</do_all>
<do_all exact="$NonSubscriptionWars.keys.count" counter="$gwf_i">
<set_value name="$gwf_faction" exact="$NonSubscriptionWars.keys.{$gwf_i}"/>
<do_if value="not $ThreadWarFactionTable.{$gwf_faction}?">
<set_value name="$ThreadWarFactionTable.{$gwf_faction}" exact="[]"/>
</do_if>
<do_all exact="$NonSubscriptionWars.{$gwf_faction}.count" counter="$gwf_k">
<set_value name="$gwf_enemyfaction" exact="$NonSubscriptionWars.{$gwf_faction}.{$gwf_k}"/>
<do_if value="not $ThreadWarFactionTable.{$gwf_faction}.indexof.{$gwf_enemyfaction}">
<append_to_list name="$ThreadWarFactionTable.{$gwf_faction}" exact="$gwf_enemyfaction"/>
</do_if>
</do_all>
</do_all>
<do_if value="$CentralSector">
<find_cluster_in_range name="$LocalCentralClusters" object="$CentralSector" maxdistance="2" multiple="true"/>
</do_if>
<do_else>
<find_cluster name="$LocalCentralClusters" multiple="true"/>
</do_else>
<set_value name="$RelevantFactions" exact="$ThreadWarFactionTable.keys.list"/>
<do_all exact="$RelevantFactions.count" counter="$gwf_i">
<set_value name="$HostFaction" exact="$RelevantFactions.{$gwf_i}"/>
<set_value name="$HostEnemyFactions" exact="$ThreadWarFactionTable.{$HostFaction}"/>
<set_value name="$HostSectors" exact="[]"/>
<do_all chance="$DebugChance">
<do_if value="$CentralSector">
<debug_text text="'Checking for Warfronts for ' + $HostFaction.knownname + ' around ' + $CentralSector + ' ' + $CentralSector.knownname"/>
</do_if>
<do_else>
<debug_text text="'Checking for Warfronts for ' + $HostFaction.knownname"/>
</do_else>
</do_all>
<do_all exact="$LocalCentralClusters.count" counter="$gwf_j">
<find_sector name="$HostSectors" owner="$HostFaction" multiple="true" space="$LocalCentralClusters.{$gwf_j}" append="true"/>
</do_all>
<set_value name="$EnemySectors" exact="[]"/>
<do_all exact="$HostSectors.count" counter="$gwf_j">
<set_value name="$HostSector" exact="$HostSectors.{$gwf_j}"/>
<debug_text text="'checking ' + $HostFaction.knownname + ' sector ' + $HostSector.knownname" chance="$DebugChance2"/>
<set_value name="$LocalSectors" exact="[]"/>
<find_cluster_in_range name="$SurroundingClusters" object="$HostSector" maxdistance="2" multiple="true"/>
<do_all exact="$SurroundingClusters.count" counter="$gwf_k">
<find_sector name="$LocalSectors" space="$SurroundingClusters.{$gwf_k}" multiple="true" append="true"/>
</do_all>
<do_all exact="$HostEnemyFactions.count" counter="$gwf_k">
<set_value name="$EnemyFaction" exact="$HostEnemyFactions.{$gwf_k}"/>
<debug_text text="'Checking if there are any local ' + $EnemyFaction.knownname + ' sectors'" chance="$DebugChance2"/>
<clear_list list="$EnemySectors"/>
<do_all exact="$LocalSectors.count" counter="$gwf_m">
<debug_text text="'has local sector ' + $LocalSectors.{$gwf_m}.knownname" chance="$DebugChance2"/>
<do_if value="$LocalSectors.{$gwf_m}.owner == $EnemyFaction or $LocalSectors.{$gwf_m}.iscontestedby.{$EnemyFaction}">
<debug_text text="'Sector ' + $HostSector.knownname + ' owned by ' + $HostSector.owner + ' has a local enemy sector ' + $LocalSectors.{$gwf_m}.knownname + ' owned by ' + $LocalSectors.{$gwf_m}.owner" chance="$DebugChance2"/>
<append_to_list name="$EnemySectors" exact="$LocalSectors.{$gwf_m}"/>
</do_if>
</do_all>
<!--Find all war fronts closest to $HostSector-->
<do_all exact="$EnemySectors.count" counter="$gwf_m">
<set_value name="$EnemySector" exact="$EnemySectors.{$gwf_m}"/>
<set_value name="$FrontFocus" exact="null"/>
<do_if value="$EnemySector.iscontestedby.{$HostFaction}">
<!--Host and enemy faction are both contesting this sector. $FrontFocus is the sector-->
<set_value name="$FrontFocus" exact="$EnemySector"/>
</do_if>
<do_else>
<!--TODO @Owen handle the case of there being a one way sector-highway front from enemy space to the host-->
<get_global_path component="$GlobalPathComps" uselocalhighways="false" multiple="true">
<start object="$HostSector"/>
<end object="$EnemySector"/>
</get_global_path>
<do_all exact="$GlobalPathComps.count" counter="$gwf_o">
<set_value name="$FrontEntryPoint" exact="null"/>
<do_if value="$GlobalPathComps.{$gwf_o}.isclass.gate and $EnemySectors.indexof.{$GlobalPathComps.{$gwf_o}.destination.sector}">
<set_value name="$FrontEntryPoint" exact="$GlobalPathComps.{$gwf_o}"/>
</do_if>
<do_elseif value="$GlobalPathComps.{$gwf_o}.isclass.highwayentrygate and $EnemySectors.indexof.{$GlobalPathComps.{$gwf_o}.destination.sector}">
<set_value name="$FrontEntryPoint" exact="$GlobalPathComps.{$gwf_o}"/>
</do_elseif>
<do_if value="$FrontEntryPoint">
<!--Check if the WarFront has already been checked-->
<set_value name="$HasFront" exact="false"/>
<do_if value="$WarFronts.{$HostFaction}?">
<set_value name="$HostFronts" exact="$WarFronts.{$HostFaction}"/>
<do_all exact="$HostFronts.count" counter="$gwf_o">
<do_if value="$HostFronts.{$gwf_o}.$EnemyFaction == $EnemyFaction">
<do_if value="$HostFronts.{$gwf_o}.$HostEntryPoint == $FrontEntryPoint">
<debug_text text="'Already has front for this sector ' + $HostFronts.{$gwf_o}" chance="$DebugChance2"/>
<set_value name="$HasFront" exact="true"/>
<break/>
</do_if>
<do_elseif value="$HostFronts.{$gwf_o}.$ContestedSectors.indexof.{$EnemySector}">
<debug_text text="'Already has front for this contested sector ' + $HostFronts.{$gwf_o}" chance="$DebugChance2"/>
<set_value name="$HasFront" exact="true"/>
<break/>
</do_elseif>
</do_if>
</do_all>
</do_if>
<do_if value="not $HasFront">
<set_value name="$FrontFocus" exact="$FrontEntryPoint"/>
</do_if>
<break/>
</do_if>
</do_all>
</do_else>
<do_if value="$FrontFocus">
<set_value name="$WarFrontTable" exact="table[
$HostEntryPoint = null,
$EnemyEntryPoint = null,
$EnemyFaction = $EnemyFaction,
$HostSectors = table[],
$EnemySectors = table[],
$OtherSectors = table[],
$ContestedSectors = [],
$ContestedSectorsIncludeHost = true,
$OfferSectors = [],
$HostInvasions = [],
$EnemyInvasions = [],
$AllyInvasions = [],
$EnemyToAllyInvasions = [],
$ActiveSituations = []]"/>
<do_if value="$FrontFocus.isclass.gate">
<set_value name="$WarFrontTable.$HostEntryPoint" exact="$FrontFocus"/>
<set_value name="$WarFrontTable.$EnemyEntryPoint" exact="$FrontFocus.exit"/>
</do_if>
<do_elseif value="$FrontFocus.isclass.highwayentrygate">
<set_value name="$WarFrontTable.$HostEntryPoint" exact="$FrontFocus"/>
<!--Find the returning highway from enemy space to the host's space-->
<get_global_path component="$GlobalPathComps" uselocalhighways="false" multiple="true">
<start object="$WarFrontTable.$HostEntryPoint.destination"/>
<end object="$WarFrontTable.$HostEntryPoint.sector"/>
</get_global_path>
<!--Iterate in reverse as we're interested in the last highway into host space (will keep the gate case here but should never happen)-->
<do_all exact="$GlobalPathComps.count" counter="$gwf_o" reverse="true">
<do_if value="$GlobalPathComps.{$gwf_o}.isclass.gate">
<set_value name="$WarFrontTable.$EnemyEntryPoint" exact="$GlobalPathComps.{$gwf_o}.exit"/>
<break/>
</do_if>
<do_elseif value="$GlobalPathComps.{$gwf_o}.isclass.highwayexitgate">
<set_value name="$WarFrontTable.$EnemyEntryPoint" exact="$GlobalPathComps.{$gwf_o}.entry"/>
<break/>
</do_elseif>
</do_all>
</do_elseif>
<do_elseif value="$FrontFocus.isclass.sector">
<add_to_group groupname="$WarFrontTable.$ContestedSectors" object="$FrontFocus"/>
</do_elseif>
<do_else>
<assert value="false" text="'Unknown class of $FrontFocus. Should be gate, highwayentrygate or sector. $FrontFocus: ' + $FrontFocus + ' ' + $FrontFocus.knownname + ' [Owen]'"/>
<continue/>
</do_else>
<do_if value="$WarFrontTable.$HostEntryPoint">
<!--If we're dealing with an entrypoint, we're not dealing with sectors contested by both the Host an Enemy factions. They will have their own front.
This bool helps identify what contents is in $ContestedSectors. In this case, Enemy sectors which are also contested by allies-->
<set_value name="$ContestedSectorsIncludeHost" exact="false"/>
<find_cluster_in_range distances="$HostLocalClusterDistances" object="$WarFrontTable.$HostEntryPoint" maxdistance="3" multiple="true"/>
<find_cluster_in_range distances="$EnemyLocalClusterDistances" object="$WarFrontTable.$HostEntryPoint.exit" maxdistance="3" multiple="true"/>
<set_value name="$HostLocalClusters" exact="$HostLocalClusterDistances.keys.sorted"/>
<set_value name="$EnemyLocalClusters" exact="$EnemyLocalClusterDistances.keys.sorted"/>
<!--Populate $OfferSectors: Find sectors within 1 jump of the entry point leading to enemy space-->
<do_all exact="$HostLocalClusters.count" counter="$gwf_o">
<do_if value="$HostLocalClusterDistances.{$HostLocalClusters.{$gwf_o}} le 1" comment="Is this cluster within 1 jump of the host entry point?">
<find_sector name="$WarFrontTable.$OfferSectors" multiple="true" space="$HostLocalClusters.{$gwf_o}" append="true"/>
</do_if>
<do_else>
<break/>
</do_else>
</do_all>
<!--Populate $HostSectors and $OtherSectors-->
<do_all exact="$WarFrontTable.$OfferSectors.count" counter="$gwf_o">
<set_value name="$OfferSector" exact="$WarFrontTable.$OfferSectors.{$gwf_o}"/>
<!--Check if owned by HostFaction or contested by HostFaction and not EnemyFaction (as that should be it's own front)-->
<do_if value="$OfferSector.owner == $HostFaction or $OfferSector.iscontestedby.{$HostFaction}">
<do_if value="not $OfferSector.iscontestedby.{$EnemyFaction}">
<do_if value="not $EnemyLocalClusterDistances.{$OfferSector.cluster}?">
<!--We already know the jump distances of this sector to the entry point. Use it.-->
<set_value name="$WarFrontTable.$HostSectors.{$OfferSector}" exact="$EnemyLocalClusterDistances.{$OfferSector.cluster}"/>
</do_if>
<do_else>
<!--The distance table doesn't have an entry for this sector. Manually get it.-->
<set_value name="$WarFrontTable.$HostSectors.{$OfferSector}" exact="$WarFrontTable.$HostEntryPoint.exit.gatedistance.{$OfferSector}"/>
</do_else>
</do_if>
</do_if>
<do_elseif value="$OfferSector.owner != $EnemyFaction and not $OfferSector.iscontestedby.{$EnemyFaction}">
<do_if value="$EnemyLocalClusterDistances.{$OfferSector.cluster}?">
<!--We already know the jump distances of this sector to the entry point. Use it.-->
<set_value name="$WarFrontTable.$OtherSectors.{$OfferSector}" exact="$EnemyLocalClusterDistances.{$OfferSector.cluster}"/>
</do_if>
<do_else>
<!--The distance table doesn't have an entry for this sector. Manually get it.-->
<set_value name="$WarFrontTable.$OtherSectors.{$OfferSector}" exact="$WarFrontTable.$HostEntryPoint.exit.gatedistance.{$OfferSector}"/>
</do_else>
</do_elseif>
</do_all>
<!--Populate $EnemySectors-->
<set_value name="$LocalEnemySectors" exact="[]"/>
<do_all exact="$EnemyLocalClusters.count" counter="$gwf_o">
<do_if value="$EnemyLocalClusterDistances.{$EnemyLocalClusters.{$gwf_o}} le 1" comment="Is this cluster within 1 jump of the entry point?">
<find_sector name="$LocalEnemySectors" multiple="true" space="$EnemyLocalClusters.{$gwf_o}" append="true">
<match_any>
<match owner="$EnemyFaction"/>
<match contestedby="$EnemyFaction"/>
</match_any>
</find_sector>
</do_if>
<do_else>
<break/>
</do_else>
</do_all>
<do_all exact="$LocalEnemySectors.count" counter="$gwf_o">
<set_value name="$LocalEnemySector" exact="$LocalEnemySectors.{$gwf_o}"/>
<!--TODO @Owen check if contested by ally here-->
<set_value name="$ContestedByAlly" exact="false"/>
<do_if value="$LocalEnemySector.iscontested">
<set_value name="$ContestingFactions" exact="$LocalEnemySector.contestingfactions"/>
<do_all exact="$ContestingFactions.count" counter="$gwf_p">
<do_if value="$HostFaction != $ContestingFactions.{$gwf_p} and $HostFaction.relationto.{$ContestingFactions.{$gwf_p}} ge $HostFaction.relation.neutral.min and $ContestingFactions.{$gwf_p}.hasrelation.enemy.{$EnemyFaction}">
<set_value name="$ContestedByAlly" exact="true"/>
<break/>
</do_if>
</do_all>
</do_if>
<do_if value="$ContestedByAlly">
<do_if value="$HostLocalClusterDistances.{$LocalEnemySector.cluster}?">
<!--We already know the jump distances of this sector to the exit point. Use it.-->
<set_value name="$WarFrontTable.$ContestedSectors.{$LocalEnemySector}" exact="$HostLocalClusterDistances.{$LocalEnemySector.cluster}"/>
</do_if>
<do_else>
<!--The distance table doesn't have an entry for this sector. Manually get it.-->
<set_value name="$WarFrontTable.$ContestedSectors.{$LocalEnemySector}" exact="$WarFrontTable.$HostEntryPoint.gatedistance.{$LocalEnemySector}"/>
</do_else>
</do_if>
<do_else>
<do_if value="$HostLocalClusterDistances.{$LocalEnemySector.cluster}?">
<!--We already know the jump distances of this sector to the exit point. Use it.-->
<set_value name="$WarFrontTable.$EnemySectors.{$LocalEnemySector}" exact="$HostLocalClusterDistances.{$LocalEnemySector.cluster}"/>
</do_if>
<do_else>
<!--The distance table doesn't have an entry for this sector. Manually get it.-->
<set_value name="$WarFrontTable.$EnemySectors.{$LocalEnemySector}" exact="$WarFrontTable.$HostEntryPoint.gatedistance.{$LocalEnemySector}"/>
</do_else>
</do_else>
</do_all>
</do_if>
<do_else>
<!--If we're not dealing with an entrypoint, we're dealing with sectors contested by both the Host an Enemy factions.
This bool helps identify what contents is in $ContestedSectors. In this case, sectors which are contested by both Host and Enemy factions-->
<set_value name="$ContestedSectorsIncludeHost" exact="true"/>
<assert value="$WarFrontTable.$ContestedSectors.count == 1" text="'There should only be one contested sector at the start of this section. Count: ' + $WarFrontTable.$ContestedSectors.count + ' [Owen]'"/>
<do_if value="$WarFrontTable.$ContestedSectors.count == 1">
<!--Populate $ContestedSectors: From the contested sector, find all linked contested sectors-->
<create_group groupname="$ContestedSectorGroup"/>
<add_to_group groupname="$ContestedSectorGroup" object="$WarFrontTable.$ContestedSectors.{1}"/>
<set_value name="$CheckedContestedSectors" exact="[]"/>
<do_while value="$CheckedContestedSectors.count != $ContestedSectorGroup.count">
<do_all exact="$ContestedSectorGroup.count" counter="$gwf_o">
<do_if value="not $CheckedContestedSectors.indexof.{$ContestedSectorGroup.{$gwf_o}}">
<append_to_list name="$CheckedContestedSectors" exact="$ContestedSectorGroup.{$gwf_o}"/>
<find_cluster_in_range name="$PotentiallyContestedClusters" object="$ContestedSectorGroup.{$gwf_o}" mindistance="1" maxdistance="1" multiple="true"/>
<do_all exact="$PotentiallyContestedClusters" counter="$gwf_p">
<find_sector groupname="$ContestedSectorGroup" space="$PotentiallyContestedClusters.{$gwf_p}" multiple="true">
<match>
<match contestedby="$HostFaction"/>
<match contestedby="$EnemyFaction"/>
</match>
</find_sector>
</do_all>
</do_if>
</do_all>
</do_while>
<set_value name="$WarFrontTable.$ContestedSectors" exact="$ContestedSectorGroup.list"/>
<remove_value name="$ContestedSectorGroup"/>
<!--Populate $OfferSectors-->
<create_group groupname="$OfferSectorsGroup"/>
<do_all exact="$ContestedSectorGroup.count" counter="$gwf_o">
<find_cluster_in_range name="$PotentialOtherClusters" object="$ContestedSectorGroup.{$gwf_o}" maxdistance="1" multiple="true"/>
<do_all exact="$PotentialOtherClusters" counter="$gwf_p">
<find_sector groupname="$OfferSectorsGroup" multiple="true" space="$PotentialOtherClusters.{$gwf_p}" append="true"/>
</do_all>
</do_all>
<set_value name="$WarFrontTable.$OfferSectors" exact="$OfferSectorsGroup.list"/>
<!--Populate $HostSectors, $EnemySectors or $OtherSectors
Go over all OfferSectors and add non-contested sectors to either the $HostSectors, $EnemySectors or $OtherSectors tables (at jump distance of 1 as that's as far as we've looked)-->
<do_all exact="$WarFrontTable.$OfferSectors.count" counter="$gwf_o">
<set_value name="$OfferSector" exact="$WarFrontTable.$OfferSectors.{$gwf_o}"/>
<do_if value="not $WarFrontTable.$ContestedSectors.indexof.{$OfferSector}">
<do_if value="$OfferSector.owner == $HostFaction or $OfferSector.iscontestedby.{$HostFaction}">
<!--Owned by host or contested by host but not by enemy-->
<set_value name="$WarFrontTable.$HostSectors.{$OfferSector}" exact="1"/>
</do_if>
<do_elseif value="$OfferSector.owner == $EnemyFaction or $OfferSector.iscontestedby.{$EnemyFaction}">
<!--Owned by enemy or contested by enemy but not by host-->
<set_value name="$WarFrontTable.$EnemySectors.{$OfferSector}" exact="1"/>
</do_elseif>
<do_else>
<!--Not owned or contested by either host or enemy-->
<set_value name="$WarFrontTable.$OtherSectors.{$OfferSector}" exact="1"/>
</do_else>
</do_if>
</do_all>
</do_if>
</do_else>
<set_value name="$HostGoals" exact="null"/>
<set_value name="$EnemyGoals" exact="null"/>
<do_if value="global.$FactionManagers.{$HostFaction}?">
<set_value name="$HostGoals" exact="global.$FactionManagers.{$HostFaction}.$Goals"/>
</do_if>
<do_if value="global.$FactionManagers.{$EnemyFaction}?">
<set_value name="$EnemyGoals" exact="global.$FactionManagers.{$EnemyFaction}.$Goals"/>
</do_if>
<do_if value="$HostGoals">
<!--Check for Invade_Space faction goals for the host faction-->
<do_all exact="$HostGoals.count" counter="$gwf_i">
<do_if value="$HostGoals.{$gwf_i}.static == md.FactionGoal_Invade_Space.Start">
<do_if value="$WarFrontTable.$EnemySectors.{$HostGoals.{$gwf_i}.$Target}? or $WarFrontTable.$ContestedSectors.indexof.{$HostGoals.{$gwf_i}.$Target}">
<append_to_list name="$WarFrontTable.$HostInvasions" exact="$HostGoals.{$gwf_i}"/>
</do_if>
</do_if>
</do_all>
</do_if>
<do_if value="$EnemyGoals">
<!--Check for Invade_Space faction goals for the enemy faction-->
<do_all exact="$EnemyGoals.count" counter="$gwf_i">
<do_if value="$EnemyGoals.{$gwf_i}.static == md.FactionGoal_Invade_Space.Start">
<!--Check if the enemy is invading a sector owned or contested by the host faction-->
<do_if value="$WarFrontTable.$HostSectors.{$EnemyGoals.{$gwf_i}.$Target}? or $WarFrontTable.$ContestedSectors.indexof.{$EnemyGoals.{$gwf_i}.$Target}">
<append_to_list name="$WarFrontTable.$EnemyInvasions" exact="$EnemyGoals.{$gwf_i}"/>
</do_if>
<!--Check if the enemy is invading a sector contested by an ally faction-->
<do_elseif value="$EnemyGoals.{$gwf_i}.$Target.iscontested">
<do_if value="$WarFrontTable.$ContestedSectors.indexof.{$EnemyGoals.{$gwf_i}.$Target}">
<set_value name="$ContestingFactions" exact="$WarFrontTable.$HostSectors.{$EnemyGoals.{$gwf_i}.$Target}.contestingfactions"/>
<do_all exact="$ContestingFactions.count" counter="$gwf_o">
<!--At least for now, treat all neutral (including -0.1) factions as allies against the common enemy-->
<do_if value="$HostFaction != $ContestingFactions.{$gwf_o} and $HostFaction.relationto.{$ContestingFactions.{$gwf_o}} ge $HostFaction.relation.neutral.min and $ContestingFactions.{$gwf_o}.hasrelation.enemy.{$EnemyFaction}">
<append_to_list name="$WarFrontTable.$EnemyToAllyInvasions" exact="$EnemyGoals.{$gwf_i}"/>
</do_if>
</do_all>
</do_if>
</do_elseif>
<!--Check if the enemy is invading a sector owned by an ally faction-->
<do_elseif value="$WarFrontTable.$OtherSectors.{$EnemyGoals.{$gwf_i}.$Target}?">
<set_value name="$EnemyTargetOwner" exact="$EnemyGoals.{$gwf_i}.$Target.owner"/>
<!--At least for now, treat all neutral (including -0.1) factions as allies against the common enemy-->
<do_if value="$HostFaction != $EnemyTargetOwner and $HostFaction.relationto.{$EnemyTargetOwner} ge $HostFaction.relation.neutral.min and $EnemyTargetOwner.hasrelation.enemy.{$EnemyFaction}">
<append_to_list name="$WarFrontTable.$EnemyToAllyInvasions" exact="$EnemyGoals.{$gwf_i}"/>
</do_if>
</do_elseif>
</do_if>
</do_all>
</do_if>
<!--Check if any allies are set to invade the enemy-->
<do_all exact="$WarFrontTable.$OtherSectors.keys.count" counter="$gwf_i">
<set_value name="$OtherSector" exact="$WarFrontTable.$OtherSectors.keys.{$gwf_i}"/>
<do_if value="$OtherSector.iscontested">
<set_value name="$ContestingFactions" exact="$OtherSector.contestingfactions"/>
<do_all exact="$ContestingFactions.count" counter="$gwf_o">
<do_if value="$HostFaction.relationto.{$ContestingFactions.{$gwf_o}} ge $HostFaction.relation.neutral.min and $ContestingFactions.{$gwf_o}.hasrelation.enemy.{$EnemyFaction}">
<do_if value="global.$FactionManagers.{$ContestingFactions.{$gwf_o}}?">
<set_value name="$AllyGoals" exact="global.$FactionManagers.{$ContestingFactions.{$gwf_o}}.$Goals"/>
<!--Check for Invade_Space faction goals for the ally faction-->
<do_all exact="$AllyGoals.count" counter="$gwf_k">
<do_if value="$AllyGoals.{$gwf_k}.static == md.FactionGoal_Invade_Space.Start">
<!--Check if the ally is invading a sector owned or contested by the enemy faction (but is also related to this exact war front)-->
<do_if value="$WarFrontTable.$EnemySectors.{$AllyGoals.{$gwf_k}.$Target}? or $WarFrontTable.$ContestedSectors.indexof.{$AllyGoals.{$gwf_k}.$Target}">
<append_to_list name="$AllyInvasions" exact="$AllyGoals.{$gwf_k}"/>
</do_if>
<!--Check if the ally is invading a sector contested by an ally faction-->
<do_elseif value="$EnemyGoals.{$gwf_k}.$Target.iscontested">
<do_if value="$WarFrontTable.$ContestedSectors.indexof.{$EnemyGoals.{$gwf_k}.$Target}">
<set_value name="$ContestingFactions" exact="$WarFrontTable.$HostSectors.{$EnemyGoals.{$gwf_k}.$Target}.contestingfactions"/>
<do_all exact="$ContestingFactions.count" counter="$gwf_o">
<!--At least for now, treat all neutral (including -0.1) factions as allies against the common enemy-->
<do_if value="$HostFaction != $ContestingFactions.{$gwf_o} and $HostFaction.relationto.{$ContestingFactions.{$gwf_o}} ge $HostFaction.relation.neutral.min and $ContestingFactions.{$gwf_o}.hasrelation.enemy.{$EnemyFaction}">
<append_to_list name="$EnemyToAllyInvasions" exact="$EnemyGoals.{$gwf_k}"/>
</do_if>
</do_all>
</do_if>
</do_elseif>
<!--Check if the enemy is invading a sector owned by an ally faction-->
<do_elseif value="$WarFrontTable.$OtherSectors.indexof.{$EnemyGoals.{$gwf_k}.$Target}">
<set_value name="$EnemyTargetOwner" exact="$EnemyGoals.{$gwf_k}.$Target.owner"/>
<!--At least for now, treat all neutral (including -0.1) factions as allies against the common enemy-->
<do_if value="$HostFaction != $EnemyTargetOwner and $HostFaction.relationto.{$EnemyTargetOwner} ge $HostFaction.relation.neutral.min and $EnemyTargetOwner.hasrelation.enemy.{$EnemyFaction}">
<append_to_list name="$EnemyToAllyInvasions" exact="$EnemyGoals.{$gwf_k}"/>
</do_if>
</do_elseif>
</do_if>
</do_all>
</do_if>
</do_if>
</do_all>
</do_if>
</do_all>
<do_if value="$WarFrontTable.$HostEntryPoint">
<debug_text text="'Registered front for ' + $HostFaction.knownname + ' against ' + $EnemyFaction.knownname + ' from entrypoint ' + $WarFrontTable.$HostEntryPoint + ' in ' + $WarFrontTable.$HostEntryPoint.sector.knownname" chance="$DebugChance"/>
</do_if>
<do_else>
<debug_text text="'Registered front for ' + $HostFaction.knownname + ' against ' + $EnemyFaction.knownname + ' in contested sectors ' + $WarFrontTable.$ContestedSectors + ' which includes ' + $WarFrontTable.$ContestedSectors.knownname" chance="$DebugChance"/>
</do_else>
<do_all chance="$DebugChance2">
<debug_text text="'Host Sectors:'"/>
<do_all exact="$WarFrontTable.$HostSectors.keys.count" counter="$gwf_o">
<debug_text text="$WarFrontTable.$HostSectors.keys.{$gwf_o} + ' ' + $WarFrontTable.$HostSectors.keys.{$gwf_o}.knownname + ' - jumps to enemy sector: ' + $WarFrontTable.$HostSectors.{$WarFrontTable.$HostSectors.keys.{$gwf_o}}"/>
</do_all>
<debug_text text="'Enemy Sectors:'"/>
<do_all exact="$WarFrontTable.$EnemySectors.keys.count" counter="$gwf_o">
<debug_text text="$WarFrontTable.$EnemySectors.keys.{$gwf_o} + ' ' + $WarFrontTable.$EnemySectors.keys.{$gwf_o}.knownname + ' - jumps to host sector: ' + $WarFrontTable.$EnemySectors.{$WarFrontTable.$EnemySectors.keys.{$gwf_o}}"/>
</do_all>
<debug_text text="'Other Sectors:'"/>
<do_all exact="$WarFrontTable.$OtherSectors.keys.count" counter="$gwf_o">
<debug_text text="$WarFrontTable.$OtherSectors.keys.{$gwf_o} + ' ' + $WarFrontTable.$OtherSectors.keys.{$gwf_o}.knownname + ' - jumps to enemy sector: ' + $WarFrontTable.$OtherSectors.{$WarFrontTable.$OtherSectors.keys.{$gwf_o}}"/>
</do_all>
<do_if value="$ContestedSectorsIncludeHost">
<debug_text text="'Sectors contested by Host and Enemy:'"/>
</do_if>
<do_else>
<debug_text text="'Sectors contested by Enemy and Ally:'"/>
</do_else>
<do_all exact="$WarFrontTable.$ContestedSectors.count" counter="$gwf_o">
<debug_text text="$WarFrontTable.$ContestedSectors.{$gwf_o} + ' ' + $WarFrontTable.$ContestedSectors.{$gwf_o}.knownname"/>
</do_all>
<debug_text text="'Offer Sectors:'"/>
<do_all exact="$WarFrontTable.$OfferSectors.count" counter="$gwf_o">
<debug_text text="$WarFrontTable.$OfferSectors.{$gwf_o} + ' ' + $WarFrontTable.$OfferSectors.{$gwf_o}.knownname"/>
</do_all>
<debug_text text="'Host invasions against enemy:'"/>
<do_all exact="$WarFrontTable.$HostInvasions.count" counter="$gwf_o">
<debug_text text="'Invading: ' + $WarFrontTable.$HostInvasions.{$gwf_o}.$Target.knownname"/>
</do_all>
<debug_text text="'Enemy invasions against host:'"/>
<do_all exact="$WarFrontTable.$EnemyInvasions.count" counter="$gwf_o">
<debug_text text="'Invading: ' + $WarFrontTable.$EnemyInvasions.{$gwf_o}.$Target.knownname"/>
</do_all>
<debug_text text="'Ally invasions against enemy:'"/>
<do_all exact="$WarFrontTable.$AllyInvasions.count" counter="$gwf_o">
<debug_text text="'Invading: ' + $WarFrontTable.$AllyInvasions.{$gwf_o}.$Target.knownname"/>
</do_all>
<debug_text text="'Enemy invasions against ally:'"/>
<do_all exact="$WarFrontTable.$EnemyToAllyInvasions.count" counter="$gwf_o">
<debug_text text="'Invading: ' + $WarFrontTable.$EnemyToAllyInvasions.{$gwf_o}.$Target.knownname"/>
</do_all>
</do_all>
<do_if value="not $WarFronts.{$HostFaction}?">
<set_value name="$WarFronts.{$HostFaction}" exact="[]"/>
</do_if>
<append_to_list name="$WarFronts.{$HostFaction}" exact="$WarFrontTable"/>
</do_if>
</do_all>
</do_all>
</do_all>
</do_all>
</actions>
</library>
<cue name="Gamestart">
<delay exact="2s"/>
<actions>
<signal_cue cue="CalculateThreads"/>
</actions>
</cue>
<cue name="CalculateThreads" instantiate="true">
<conditions>
<check_any>
<event_object_changed_sector object="player.entity"/>
<event_cue_signalled/>
</check_any>
<check_value value="player.sector"/>
</conditions>
<actions>
<do_if value="not $ThreadList?">
<set_value name="$ThreadList" exact="[]"/>
</do_if>
<debug_text text="'Player is now in ' + player.sector + ' ' + player.sector.knownname" chance="$DebugChance"/>
<!--TODO @Owen set $CentralSector to null for cases where we want to find all war fronts in the galaxy e.g player is subscribed and we want to show them threads for at least one front-->
<set_value name="$CentralSector" exact="player.sector"/>
<include_actions ref="GetWarFronts"/>
<set_value name="$ThreadDefinitionIDs" exact="$ThreadDefinitions.keys.list"/>
<set_value name="$WarFrontFactions" exact="$WarFronts.keys.list"/>
<set_value name="$SignalledIntroMissions" exact="[]"/>
<do_all exact="$WarFrontFactions.count" counter="$i">
<debug_text text="'Checkin war fronts for faction: ' + $WarFrontFactions.{$i}" chance="$DebugChance2"/>
<set_value name="$FactionWarFronts" exact="$WarFronts.{$WarFrontFactions.{$i}}"/>
<do_all exact="$FactionWarFronts.count" counter="$j">
<set_value name="$WarFront" exact="$FactionWarFronts.{$j}"/>
<do_all exact="$ThreadDefinitionIDs.count" counter="$d">
<set_value name="$Potential_Thread" exact="$ThreadDefinitions.{$ThreadDefinitionIDs.{$d}}"/>
<debug_text text="'Checking if mission thread ' + $ThreadDefinitionIDs.{$d} + ' should be spawned around sector ' + @$CentralSector.knownname + ' for faction ' + $WarFrontFactions.{$i} + ' against ' + $WarFront.$EnemyFaction" chance="$DebugChance2"/>
<debug_text text="'$WarFrontFactions.{$i}: ' + $WarFrontFactions.{$i}" chance="$DebugChance2"/>
<debug_text text="'$Potential_Thread.$Faction: ' + $Potential_Thread.$Faction" chance="$DebugChance2"/>
<debug_text text="'$WarFront.$EnemyFaction: ' + $WarFront.$EnemyFaction" chance="$DebugChance2"/>
<debug_text text="'$Potential_Thread.$EnemyFaction: ' + $Potential_Thread.$EnemyFaction" chance="$DebugChance2"/>
<debug_text text="'$WarFrontFactions.{$i} == $Potential_Thread.$Faction and $WarFront.$EnemyFaction == $Potential_Thread.$EnemyFaction: ' + $WarFrontFactions.{$i} == $Potential_Thread.$Faction and $WarFront.$EnemyFaction == $Potential_Thread.$EnemyFaction" chance="$DebugChance2"/>
<do_if value="$WarFrontFactions.{$i} == $Potential_Thread.$Faction and $WarFront.$EnemyFaction == $Potential_Thread.$EnemyFaction">
<set_value name="$ThreadValid" exact="true"/>
<!--First, check that there isn't already the same thread already running for this WarFront-->
<do_all exact="$Threads.count" counter="$tc_k">
<do_if value="$Threads.{$tc_k}.$ThreadCue.$Definition.$ID == $Potential_Thread.$ID">
<set_value name="$ThreadInstanceDefinition" exact="$Threads.{$tc_k}.$ThreadCue.$Definition"/>
<do_if value="$WarFront.$EnemyFaction == $ThreadInstanceDefinition.$WarFront.$EnemyFaction">
<do_if value="$WarFront.$HostEntryPoint and $WarFront.$HostEntryPoint == $ThreadInstanceDefinition.$WarFront.$HostEntryPoint">
<set_value name="$ThreadValid" exact="false"/>
<debug_text text="'$ThreadValid 1: ' + $ThreadValid" chance="$DebugChance2"/>
<break/>
</do_if>
<do_elseif value="$WarFront.$ContestedSectors.count and $ThreadInstanceDefinition.$WarFront.$ContestedSectors.count">
<do_all exact="$WarFront.$ContestedSectors.count" counter="$tc_o">
<do_if value="$ThreadInstanceDefinition.$WarFront.$ContestedSectors.indexof.{$WarFront.$ContestedSectors.{$tc_o}}">
<set_value name="$ThreadValid" exact="false"/>
<debug_text text="'$ThreadValid 2: ' + $ThreadValid" chance="$DebugChance2"/>
<break/>
</do_if>
</do_all>
</do_elseif>
</do_if>
</do_if>
</do_all>
<!--TODO @Owen take $ThreadAbortRelation into account-->
<do_if value="$ThreadValid">
<set_value name="$ThreadValid" exact="false"/>
<debug_text text="'$ThreadValid 3: ' + $ThreadValid" chance="$DebugChance2"/>
<do_if value="@$Potential_Thread.$ThreadConditionLibs.count">
<do_all exact="$Potential_Thread.$ThreadConditionLibs.count" counter="$o">
<do_if value="$WarFront.$ActiveSituations.indexof.{$Potential_Thread.$ThreadConditionLibs.{$o}}">
<set_value name="$ThreadValid" exact="true"/>
<debug_text text="'$ThreadValid 4: ' + $ThreadValid" chance="$DebugChance2"/>
</do_if>
<do_else>
<include_actions ref="$Potential_Thread.$ThreadConditionLibs.{$o}"/>
<do_if value="$SituationValid">
<append_to_list name="$WarFront.$ActiveSituations" exact="$Potential_Thread.$ThreadConditionLibs.{$o}"/>
<set_value name="$ThreadValid" exact="true"/>
<debug_text text="'$ThreadValid 5: ' + $ThreadValid" chance="$DebugChance2"/>
</do_if>
</do_else>
</do_all>
</do_if>
<do_else>
<set_value name="$ThreadValid" exact="true"/>
<debug_text text="'$ThreadValid 6: ' + $ThreadValid" chance="$DebugChance2"/>
</do_else>
</do_if>
<do_if value="$ThreadValid">
<debug_text text="'$ThreadValid 7: ' + $ThreadValid" chance="$DebugChance2"/>
<set_value name="$MissionGroupCue" exact="$MissionGroupCues.{$Potential_Thread.$MissionGroup}"/>
<debug_text text="'$MissionGroupCue: ' + $MissionGroupCue" chance="$DebugChance2"/>
<debug_text text="'$MissionGroupCue.$SubscriptionStatus: ' + $MissionGroupCue.$SubscriptionStatus" chance="$DebugChance2"/>
<do_if value="$MissionGroupCue.$SubscriptionStatus == 'unsubscribed'">
<do_if value="$MissionGroupCue.$IntroMissionCue.state == cuestate.waiting and not $SignalledIntroMissions.indexof.{$MissionGroupCue.$IntroMissionCue}">
<debug_text text="'Signalling intro mission cue ' + $MissionGroupCue.$IntroMissionCue + ' for mission group ' + $Potential_Thread.$MissionGroup" chance="$DebugChance"/>
<append_to_list name="$SignalledIntroMissions" exact="$MissionGroupCue.$IntroMissionCue"/>
<do_if value="not $MissionGroupCue.$Mission_Contact.isclass.npc" comment="class check incase of disconnected (should we allow disconnected contacts?)">
<signal_cue_instantly cue="$MissionGroupCue.$ContactCreatorCue" param="$WarFront.$HostSectors.clone"/>
</do_if>
<signal_cue cue="$MissionGroupCue.$IntroMissionCue"/>
</do_if>
</do_if>
<do_elseif value="$MissionGroupCue.$SubscriptionStatus == 'subscribed'">
<set_value name="$New_Thread" exact="$Potential_Thread.clone"/>
<!--TODO @Owen sanity checks-->
<do_if value="not $MissionGroupCue.$Mission_Contact.isclass.npc" comment="class check incase of disconnected (should we allow disconnected contacts?)">
<signal_cue_instantly cue="$MissionGroupCues.{$New_Thread.$MissionGroup}.$ContactCreatorCue" param="$WarFront.$HostSectors.clone"/>
</do_if>
<set_value name="$New_Thread.$Contact" exact="$MissionGroupCue.$Mission_Contact"/>
<set_value name="$New_Thread.$HQ" exact="$New_Thread.$Faction.headquarters"/>
<!--WarFront should essentially be read-only, so we're not going to clone it-->
<set_value name="$New_Thread.$WarFront" exact="$WarFront"/>
<set_value name="$New_Thread.$OfferSectors" exact="$WarFront.$OfferSectors"/>
<set_value name="$New_Thread.$DebugChance" exact="$DebugChance"/>
<!--TODO @Guage the current mood of this faction on this war front-->
<do_any>
<set_value name="$ThreadMood" exact="'negative'"/>
<set_value name="$ThreadMood" exact="'positive'"/>
</do_any>
<do_if value="$New_Thread.$NameLib?" comment="Support for older mission threads without text construction libs">
<!--Get sub-missions-->
<include_actions ref="$New_Thread.$SubMissionLib"/>
<!--Get thread name-->
<include_actions ref="$New_Thread.$NameLib"/>
<set_value name="$New_Thread.$ThreadName" exact="this.$Name"/>
<!--Construct a suitable description-->
<include_actions ref="$New_Thread.$DescriptionLib"/>
<set_value name="$New_Thread.$ThreadDescription" exact="this.$Description"/>
</do_if>
<set_value name="$ThreadManagerParams" exact="table[
$ThreadDefinition = $New_Thread,
$RegisterThreadCue = Register_Thread,
$ThreadAcceptedCue = Thread_Accepted,
$CleanupThreadCue = Cleanup_Thread]"/>
<signal_cue_instantly cue="md.MC_Management.Thread_Manager" param="$ThreadManagerParams"/>
</do_elseif>
</do_if>
</do_if>
</do_all>
</do_all>
</do_all>
</actions>
</cue>
<!--event.param = thread table: table[$ThreadCue, $CleanupCue]-->
<cue name="Register_Thread" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<append_to_list name="$Threads" exact="event.param"/>
</actions>
</cue>
<!-- Store the selected mission-thread in $ActiveThreads, and disable all other mission-thread cues of that mission group-->
<cue name="Thread_Accepted" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<debug_text text="'Accepted mission thread: ' + event.param.$Definition.$ID" chance="$DebugChance"/>
<append_to_list name="$ActiveThreads" exact="event.param"/>
<do_all exact="$Threads.count" counter="$i" reverse="true">
<do_if value="$Threads.{$i}.$ThreadCue != event.param and $Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == event.param.$Definition.$MissionGroup">
<signal_cue_instantly cue="$Threads.{$i}.$CleanupCue"/>
</do_if>
</do_all>
</actions>
</cue>
<!--event.param = table[
$cue = thread cue namespace,
$completedmissions = number of completed missions,
$failedmissions = number of failed missions]-->
<cue name="Cleanup_Thread" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<debug_text text="'Attempting to clean up mission thread: ' + event.param.$cue.$Definition.$ID" chance="$DebugChance"/>
<set_value name="this.$ActiveThreadIdx" exact="$ActiveThreads.indexof.{event.param.$cue}"/>
<do_if value="this.$ActiveThreadIdx">
<remove_value name="$ActiveThreads.{this.$ActiveThreadIdx}"/>
</do_if>
<set_value name="this.$Removed" exact="false"/>
<do_all exact="$Threads.count" counter="$Cleanup_Thread_i" reverse="true">
<do_if value="$Threads.{$Cleanup_Thread_i}.$ThreadCue == event.param.$cue">
<assert value="not this.$Removed" text="'Matching thread was already removed. Should not happen again. Thread: ' + event.param.$cue.$Definition.$ID + ' [Owen]'"/>
<set_value name="this.$Removed" exact="true"/>
<remove_value name="$Threads.{$Cleanup_Thread_i}"/>
</do_if>
</do_all>
<assert value="this.$Removed" text="'No matching thread was found to be removed. Thread: ' + event.param.$cue.$Definition.$ID + ' [Owen]'"/>
</actions>
</cue>
</cues>
</cue>
<!--Generic Event-handling code -->
<library name="MM__Standard_GM_Event">
<actions>
<do_if value="@static.$EndFeedbackValue" comment="Evaluate return-value of GM (success/failure)">
<debug_text text="'Mission ended. feedback' + static.$EndFeedbackValue" chance="$DebugChance"/>
<do_if value="$SuccessfullyGenerated">
<signal_cue_instantly cue="$Definition.$EndedCue" param="table[$wrappercue = namespace, $feedback = static.$EndFeedbackValue]"/>
</do_if>
<do_else>
<signal_cue_instantly cue="$Definition.$SpawnFailedCue"/>
</do_else>
<do_if value="static.$EndFeedbackValue.$type" exact="'success'" comment="see the $FeedbackValues table in the Generic Mission">
<do_if value="@$MissionDataTable.$NextMission">
<do_if value="false" comment="Forced failure as there are no valid NextMission cases defined for this mission. Replace with valid case if needed.">
</do_if>
<do_else>
<!--If there is a followup mission, signal it with whatever parameters it needs-->
<assert value="false" text="'Next mission ' + $MissionDataTable.$NextMission + ' is missing handling in ' + namespace + '. It should be explicitly signalled with whatever parameters it requires. [Owen]'"/>
</do_else>
</do_if>
</do_if>
<do_elseif value="static.$EndFeedbackValue.$ID" exact="'$MISSION_TIMEOUT'">
</do_elseif>
<cancel_cue cue="namespace"/>
</do_if>
<do_elseif value="@static.$FeedbackValue">
<debug_text text="'Mission signalled with feedback' + static.$FeedbackValue" chance="$DebugChance"/>
<do_if value="static.$FeedbackValue.$ID == '$MISSION_GENERATED'">
<!--If a followup mission, no need to inform the Mission Thread Manager of the mission successfully being generated as $Definition.$SpawnSuccessCue was already called for this mission-->
<do_if value="not $FollowUp">
<set_value name="$MissionDataTable" exact="event.param.clone"/>
<set_value name="$MissionDataTable.$WrapperCue" exact="namespace"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</do_if>
<set_value name="$SuccessfullyGenerated" exact="true"/>
</do_if>
</do_elseif>
</actions>
</library>
<!--
############################
Mission Thread Condition Libraries
############################-->
<!-- For debugging, to always enable a specific subscription -->
<library name="Situation__Always">
<actions>
<set_value name="$SituationValid" exact="true"/>
</actions>
</library>
<!--
Required variables:
- $WarFront = Current war front being checked (already checked that the Host and Enemy factions match this thread)
- $Potential_Thread = Thread definition to check if it's possible with the war front and active faction logic behaviours
Values to set for conditions:
- $HostInvasionPhase: string or null. either the ID of the phase e.g. 'beachhead' or 'none' for No Invasion. If null, it neither matter if there is an invasion or not.
- $EnemyInvasionPhase: string or null. either the ID of the phase e.g. 'beachhead' or 'none' for No Invasion. If null, it neither matter if there is an invasion or not.
- $ContestedSectors: -1 = No filter. 0 = No contested sectors. 1 = At least 1 contested sector-->
<!--Cold War / Cleanup
Host: No invasions
Enemy: No invasion
Ally: N/A
Enemy Vs. Ally: N/A
Contested sectors: None-->
<library name="Situation__Cold_War">
<actions>
<set_value name="$HostInvasionPhase" exact="'none'"/>
<set_value name="$EnemyInvasionPhase" exact="'none'"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="0"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Contention
Host: No invasions
Enemy: No invasions
Ally: N/A
Enemy Vs. Ally: N/A
Contested sectors: ge 1-->
<library name="Situation__Contention">
<actions>
<set_value name="$HostInvasionPhase" exact="'none'"/>
<set_value name="$EnemyInvasionPhase" exact="'none'"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Invasion preparation
Host: At least 1 invasion in 'prepare_for_invasion' phase
Enemy: N/A
Ally: N/A
Enemy Vs. Ally: N/A
Contested sectors: N/A-->
<library name="Situation__Invasion_Prep">
<actions>
<set_value name="$HostInvasionPhase" exact="'prepare_for_invasion'"/>
<set_value name="$EnemyInvasionPhase" exact="null"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="-1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Defence preparation
Host: N/A
Enemy: At least 1 invasion in 'prepare_for_invasion' phase
Ally: N/A
Enemy Vs. Ally: N/A
Contested sectors: N/A-->
<library name="Situation__Defence_Prep">
<actions>
<set_value name="$HostInvasionPhase" exact="null"/>
<set_value name="$EnemyInvasionPhase" exact="'prepare_for_invasion'"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="-1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Invading
Host: At least 1 invasion in 'beachhead' phase
Enemy: N/A
Ally: N/A
Enemy Vs. Ally: N/A
Contested sectors: N/A-->
<library name="Situation__Invading">
<actions>
<set_value name="$HostInvasionPhase" exact="'beachhead'"/>
<set_value name="$EnemyInvasionPhase" exact="null"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="-1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Defending
Host: N/A
Enemy: At least 1 invasion in 'beachhead' phase
Ally: N/A
Enemy Vs. Ally: N/A
Contested sectors: N/A-->
<library name="Situation__Defending">
<actions>
<set_value name="$HostInvasionPhase" exact="null"/>
<set_value name="$EnemyInvasionPhase" exact="'beachhead'"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="-1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Support invading ally
Host: No invasions
Enemy: No invasions
Ally: At least 1 invasion in 'beachhead' phase
Enemy Vs. Ally: N/A
Contested sectors: N/A-->
<library name="Situation__Invading_Ally">
<actions>
<set_value name="$HostInvasionPhase" exact="'none'"/>
<set_value name="$EnemyInvasionPhase" exact="'none'"/>
<set_value name="$AllyInvasionPhase" exact="'beachhead'"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="-1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Support defending ally
Host: No invasions
Enemy: No invasions
Ally: N/A
Enemy Vs. Ally: At least 1 invasion in 'beachhead' phase
Contested sectors: N/A-->
<library name="Situation__Defending_Ally">
<actions>
<set_value name="$HostInvasionPhase" exact="'none'"/>
<set_value name="$EnemyInvasionPhase" exact="'none'"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="['prepare_for_invasion', 'beachhead']"/>
<set_value name="$ContestedSectors" exact="-1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Retreat
Host: At least 1 invasion in 'retreat' phase
Enemy: N/A
Ally: N/A
Enemy Vs. Ally: N/A
Contested sectors: N/A-->
<library name="Situation__Retreat">
<actions>
<set_value name="$HostInvasionPhase" exact="'retreat'"/>
<set_value name="$EnemyInvasionPhase" exact="null"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="-1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--Push back
Host: N/A
Enemy: At least 1 invasion in 'retreat' phase
Ally: N/A
Enemy Vs. Ally: N/A
Contested sectors: N/A-->
<library name="Situation__Pushback">
<actions>
<set_value name="$HostInvasionPhase" exact="null"/>
<set_value name="$EnemyInvasionPhase" exact="'retreat'"/>
<set_value name="$AllyInvasionPhase" exact="null"/>
<set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
<set_value name="$ContestedSectors" exact="-1"/>
<include_actions ref="Thread_Conditions__Common"/>
</actions>
</library>
<!--For internal use by the above libraries
Library requires the same parameters stated above.
Values to set for conditions:
- $HostInvasionPhase: string or null. either the ID of the phase e.g. 'beachhead' or 'none' for No Invasion. If null, it neither matter if there is an invasion or not.
- $EnemyInvasionPhase: string or null. either the ID of the phase e.g. 'beachhead' or 'none' for No Invasion. If null, it neither matter if there is an invasion or not.
- $ContestedSectors: -1 = No filter. 0 = No contested sectors. 1 = At least 1 contested sector-->
<library name="Thread_Conditions__Common">
<actions>
<set_value name="$SituationValid" exact="true"/>
<do_if value="$SituationValid and $HostInvasionPhase">
<set_value name="$SituationValid" exact="false"/>
<do_if value="$HostInvasionPhase == 'none'">
<do_if value="$WarFront.$HostInvasions.count == 0">
<set_value name="$SituationValid" exact="true"/>
</do_if>
</do_if>
<do_elseif value="typeof $HostInvasionPhase == datatype.list">
<do_all exact="$WarFront.$HostInvasions.count" counter="$tc_i">
<do_if value="$WarFront.$HostInvasions.{$tc_i}.exists and $HostInvasionPhase.indexof.{$WarFront.$HostInvasions.{$tc_i}.$Phase}">
<set_value name="$SituationValid" exact="true"/>
<break/>
</do_if>
</do_all>
</do_elseif>
<do_else>
<do_all exact="$WarFront.$HostInvasions.count" counter="$tc_i">
<do_if value="$WarFront.$HostInvasions.{$tc_i}.exists and $HostInvasionPhase == $WarFront.$HostInvasions.{$tc_i}.$Phase">
<set_value name="$SituationValid" exact="true"/>
<break/>
</do_if>
</do_all>
</do_else>
</do_if>
<do_if value="$SituationValid and $EnemyInvasionPhase">
<set_value name="$SituationValid" exact="false"/>
<do_if value="$EnemyInvasionPhase == 'none'">
<do_if value="$WarFront.$EnemyInvasions.count == 0">
<set_value name="$SituationValid" exact="true"/>
</do_if>
</do_if>
<do_elseif value="typeof $EnemyInvasionPhase == datatype.list">
<do_all exact="$WarFront.$EnemyInvasions.count" counter="$tc_i">
<do_if value="$WarFront.$EnemyInvasions.{$tc_i}.exists and $EnemyInvasionPhase.indexof.{$WarFront.$EnemyInvasions.{$tc_i}.$Phase}">
<set_value name="$SituationValid" exact="true"/>
<break/>
</do_if>
</do_all>
</do_elseif>
<do_else>
<do_all exact="$WarFront.$EnemyInvasions.count" counter="$tc_i">
<do_if value="$WarFront.$EnemyInvasions.{$tc_i}.exists and $EnemyInvasionPhase == $WarFront.$EnemyInvasions.{$tc_i}.$Phase">
<set_value name="$SituationValid" exact="true"/>
<break/>
</do_if>
</do_all>
</do_else>
</do_if>
<do_if value="$SituationValid and $AllyInvasionPhase">
<set_value name="$SituationValid" exact="false"/>
<do_if value="$AllyInvasionPhase == 'none'">
<do_if value="$WarFront.$AllyInvasions.count == 0">
<set_value name="$SituationValid" exact="true"/>
</do_if>
</do_if>
<do_elseif value="typeof $AllyInvasionPhase == datatype.list">
<do_all exact="$WarFront.$AllyInvasions.count" counter="$tc_i">
<do_if value="$WarFront.$AllyInvasions.{$tc_i}.exists and $AllyInvasionPhase.indexof.{$WarFront.$AllyInvasions.{$tc_i}.$Phase}">
<set_value name="$SituationValid" exact="true"/>
<break/>
</do_if>
</do_all>
</do_elseif>
<do_else>
<do_all exact="$WarFront.$AllyInvasions.count" counter="$tc_i">
<do_if value="$WarFront.$AllyInvasions.{$tc_i}.exists and $AllyInvasionPhase == $WarFront.$AllyInvasions.{$tc_i}.$Phase">
<set_value name="$SituationValid" exact="true"/>
<break/>
</do_if>
</do_all>
</do_else>
</do_if>
<do_if value="$SituationValid and $EnemyVsAllyInvasionPhase">
<set_value name="$SituationValid" exact="false"/>
<do_if value="$EnemyVsAllyInvasionPhase == 'none'">
<do_if value="$WarFront.$EnemyToAllyInvasions.count == 0">
<set_value name="$SituationValid" exact="true"/>
</do_if>
</do_if>
<do_elseif value="typeof $EnemyVsAllyInvasionPhase == datatype.list">
<do_all exact="$WarFront.$EnemyToAllyInvasions.count" counter="$tc_i">
<do_if value="$WarFront.$EnemyToAllyInvasions.{$tc_i}.exists and $EnemyVsAllyInvasionPhase.indexof.{$WarFront.$EnemyToAllyInvasions.{$tc_i}.$Phase}">
<set_value name="$SituationValid" exact="true"/>
<break/>
</do_if>
</do_all>
</do_elseif>
<do_else>
<do_all exact="$WarFront.$EnemyToAllyInvasions.count" counter="$tc_i">
<do_if value="$WarFront.$EnemyToAllyInvasions.{$tc_i}.exists and $EnemyVsAllyInvasionPhase == $WarFront.$EnemyToAllyInvasions.{$tc_i}.$Phase">
<set_value name="$SituationValid" exact="true"/>
<break/>
</do_if>
</do_all>
</do_else>
</do_if>
<do_if value="$SituationValid">
<set_value name="$SituationValid" exact="false"/>
<do_if value="$ContestedSectors == -1">
<!--No filter-->
<set_value name="$SituationValid" exact="true"/>
</do_if>
<do_elseif value="$ContestedSectors == 0">
<do_if value="$WarFront.$ContestedSectors.count == 0">
<set_value name="$SituationValid" exact="true"/>
</do_if>
</do_elseif>
<do_elseif value="$ContestedSectors == 1">
<do_if value="$WarFront.$ContestedSectors.count gt 0">
<set_value name="$SituationValid" exact="true"/>
</do_if>
</do_elseif>
</do_if>
</actions>
</library>
<!--
######################
Submission Libraries
######################-->
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<library name="Large_Supply__Food">
<actions>
<set_value name="$StationSpace" exact="null"/>
<do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
<do_any>
<set_value name="$StationSpace" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted.{1}"/>
<set_value name="$StationSpace" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.random"/>
</do_any>
</do_if>
<do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
<set_value name="$StationSpace" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.random"/>
</do_elseif>
<do_if value="$StationSpace">
<set_value name="$WorkforceResources" exact="$Definition.$ThreadData.$Faction.primaryrace.workforce.resources.list"/>
<set_value name="$StationSupply" exact="[]"/>
<set_value name="$ResourceFactor" min="4" max="6"/>
<do_all exact="$WorkforceResources.count" counter="$i">
<append_to_list name="$StationSupply" exact="table[
$amount = $Definition.$ThreadData.$Faction.primaryrace.workforce.resources.{$WorkforceResources.{$i}}.count * $ResourceFactor,
$delivered = 0,
$ware = $WorkforceResources.{$i}]"/>
</do_all>
<do_if value="$StationSupply.count">
<!--Check that there are enough stations to deliver to-->
<set_value name="$SupplyWares" exact="[]"/>
<do_all exact="$StationSupply.count" counter="$supply_i">
<append_to_list name="$SupplyWares" exact="$StationSupply.{$supply_i}.$ware"/>
</do_all>
<find_station name="$MatchingStations" owner="$Definition.$ThreadData.$Faction" space="$StationSpace" multiple="true">
<match_resources wares="$SupplyWares"/>
</find_station>
<do_if value="$MatchingStations.count gt 2">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</do_if>
</actions>
</library>
<library name="Large_Supply__Ship_Construction_Tech">
<actions>
<!--Grab the list of shiptech goods from their waregroup-->
<set_value name="$ShipTechWares" exact="waregroup.shiptech.list"/>
<!--Get all host sectors sorted by distance to enemy space-->
<set_value name="$SortedHostSectors" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted"/>
<set_value name="$NeededWaresTable" exact="table[]"/>
<set_value name="$StationSupply" exact="[]"/>
<do_all exact="$SortedHostSectors.count" counter="$i">
<!--Find shipyards or equipmentdocks for this faction in this sector-->
<find_station name="$ShipyardOrEQDocks" space="$SortedHostSectors.{$i}" owner="$Definition.$ThreadData.$Faction" multiple="true">
<match_any>
<match shipyard="true"/>
<match equipmentdock="true"/>
</match_any>
</find_station>
<!--Build a table of needed wares-->
<clear_table table="$NeededWaresTable"/>
<do_all exact="$ShipyardOrEQDocks.count" counter="$k">
<find_buy_offer result="$BuyOffers" buyer="$ShipyardOrEQDocks.{$k}" wares="$ShipTechWares" multiple="true"/>
<do_all exact="$BuyOffers.count" counter="$m">
<set_value name="$NeededWaresTable.{$BuyOffers.{$m}.ware}" exact="$BuyOffers.{$m}.amount" operation="add"/>
</do_all>
</do_all>
<debug_text text="'Needed shiptech wares: ' + $NeededWaresTable" chance="$DebugChance"/>
<do_if value="$NeededWaresTable.keys.count">
<set_value name="$SortedWares" exact="$NeededWaresTable.keys.sorted"/>
<do_all exact="[$SortedWares.count, 3].min" counter="$k" reverse="true">
<append_to_list name="$StationSupply" exact="table[
$amount = [$NeededWaresTable.{$SortedWares.{$k}} / 2, 1].max,
$ware = $SortedWares.{$k},
$delivered = 0]"/>
</do_all>
<set_value name="$StationSpace" exact="$SortedHostSectors.{$i}"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
<break/>
</do_if>
</do_all>
</actions>
</library>
<cue name="Large_Supply__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 100000">
<!--Food supplies for workforce-->
<!--TODO @Owen check if there are enough stations in need of these resources-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Food"/>
</do_if>
<do_elseif value="$TextOffset == 100100">
<!--Construction supplies for ship construction-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Ship_Construction_Tech"/>
</do_elseif>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 100000">
<!--Food supplies for workforce-->
<!--TODO @Owen check if there are enough stations in need of these resources-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Food"/>
</do_if>
<do_elseif value="$TextOffset == 100100">
<!--Construction supplies for ship construction-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Ship_Construction_Tech"/>
</do_elseif>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 100000">
<!--Food supplies for workforce-->
<!--TODO @Owen check if there are enough stations in need of these resources-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Food"/>
</do_if>
<do_elseif value="$TextOffset == 100100">
<!--Construction supplies for ship construction-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Ship_Construction_Tech"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 100000">
<!--Food supplies for workforce-->
<!--TODO @Owen check if there are enough stations in need of these resources-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Food"/>
</do_if>
<do_elseif value="$TextOffset == 100100">
<!--Construction supplies for ship construction-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Ship_Construction_Tech"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 100000">
<!--Food supplies for workforce-->
<!--TODO @Owen check if there are enough stations in need of these resources-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Food"/>
</do_if>
<do_elseif value="$TextOffset == 100100">
<!--Construction supplies for ship construction-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Large_Supply__Ship_Construction_Tech"/>
</do_elseif>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Large_Supply__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Large_Supply__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.deliver"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Large_Supply__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Large_Supply__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Large_Supply__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Large_Supply__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Large_Supply__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Large_Supply__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Large_Supply__Standard_Ref" ref="md.GM_LargeSupply.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Large_Supply__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Definition.$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="Faction" value="$Definition.$ThreadData.$Faction"/>
<param name="StationSpace" value="$StationSpace" comment="todo: narrow down the space"/>
<param name="StationSupply" value="$StationSupply" comment="wants these stations supplied with the specified resources"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Large_Supply__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<cue name="Get_Exact_Crew__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<set_value name="$Destination" exact="player.ship"/>
<set_value name="$Faction" exact="$Definition.$ThreadData.$Faction"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<include_actions ref="md.GM_GetExactCrew.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $NpcCount"/>
<include_actions ref="md.GM_GetExactCrew.DetermineDestinationStation" comment="Input: $Faction-, output: $Destination"/>
<!--### ARGON VS XENON ###-->
<do_if value="not $Destination">
<!-- intentional fallthrough -->
<debug_text text="'No suitable destination-station found!'"/>
<set_value name="$Valid" exact="1" comment="No suitable variation found"/>
</do_if>
<do_elseif value="$Page == 30210">
<do_if value="$TextOffset == 110000" comment="pilot variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
</do_if>
<do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
</do_elseif>
</do_elseif>
<!-- ### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 110000" comment="pilot variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
</do_if>
<do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
</do_elseif>
</do_elseif>
<!-- ### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 110000" comment="pilot variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
</do_if>
<do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
</do_elseif>
</do_elseif>
<!-- ### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 110000" comment="pilot variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
</do_if>
<do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
</do_elseif>
</do_elseif>
<!-- ### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 110000" comment="pilot variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
</do_if>
<do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
</do_elseif>
</do_elseif>
<do_if value="@$Skills.keys.count">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Get_Exact_Crew__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Get_Exact_Crew__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.acquire_crew"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Get_Exact_Crew__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Get_Exact_Crew__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Get_Exact_Crew__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Get_Exact_Crew__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Get_Exact_Crew__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Get_Exact_Crew__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Get_Exact_Crew__Standard_Ref" ref="md.GM_GetExactCrew.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Get_Exact_Crew__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="$Difficulty"/>
<param name="Faction" value="$Faction"/>
<param name="NpcCount" value="$NpcCount"/>
<param name="Skills" value="$Skills"/>
<param name="Destination" value="$Destination"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Get_Exact_Crew__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<cue name="Get_Exact_Fleet__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<set_value name="$Fleet" exact="null"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 120000" comment="build a fleet">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<do_any>
<set_value name="$Fleet" exact="[
table[
$macro = macro.ship_arg_xl_carrier_01_a_macro,
$amount = 1,
$equipment = [macro.engine_arg_xl_allround_01_mk1_macro, macro.shield_arg_xl_standard_01_mk1_macro, macro.thruster_gen_xl_allround_01_mk2_macro],
$wares = table[{ware.countermeasure_flares_01} = 10, {ware.satellite_mk1} = 1],
],
table[
$macro = macro.ship_arg_l_destroyer_01_a_macro,
$amount = 1,
$equipment = [macro.engine_arg_l_travel_01_mk1_macro, macro.thruster_gen_l_allround_01_mk2_macro],
],
table[
$macro = macro.ship_arg_m_frigate_01_a_macro,
$amount = 3,
$mods = [ware.mod_weapon_damage_01_mk1],
]
]"/>
</do_any>
</do_if>
</do_if>
<!-- ### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 120000" comment="build a fleet">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<do_any>
<set_value name="$Fleet" exact="[
table[
$macro = macro.ship_arg_xl_carrier_01_a_macro,
$amount = 1,
$equipment = [macro.engine_arg_xl_travel_01_mk1_macro, macro.shield_arg_xl_standard_01_mk1_macro, macro.thruster_gen_xl_allround_01_mk2_macro],
$wares = table[{ware.countermeasure_flares_01} = 10, {ware.satellite_mk1} = 1],
],
table[
$macro = macro.ship_arg_l_destroyer_01_a_macro,
$amount = 1,
$equipment = [macro.engine_par_l_travel_01_mk1_macro, macro.thruster_gen_l_allround_01_mk3_macro],
],
table[
$macro = macro.ship_arg_m_frigate_01_a_macro,
$amount = 3,
]
]"/>
</do_any>
</do_if>
</do_elseif>
<!-- ### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 120000" comment="build a fleet">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<do_any>
<set_value name="$Fleet" exact="[
table[
$macro = macro.ship_par_xl_carrier_01_a_macro,
$amount = 1,
$equipment = [macro.engine_par_xl_travel_01_mk1_macro, macro.shield_par_xl_standard_01_mk1_macro],
$wares = table[{ware.countermeasure_flares_01} = 10],
],
table[
$macro = macro.ship_par_l_destroyer_01_a_macro,
$amount = 1,
$equipment = [macro.engine_par_l_travel_01_mk1_macro],
],
table[
$macro = macro.ship_par_m_frigate_01_a_macro,
$amount = 2,
]
]"/>
</do_any>
</do_if>
</do_elseif>
<!-- ### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 120000" comment="build a fleet">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<do_any>
<set_value name="$Fleet" exact="[
table[
$macro = macro.ship_par_l_destroyer_01_b_macro,
$amount = 1,
$equipment = [macro.engine_par_l_travel_01_mk1_macro],
],
table[
$macro = macro.ship_par_m_frigate_01_b_macro,
$amount = 3,
]
]"/>
</do_any>
</do_if>
</do_elseif>
<!-- ### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 120000" comment="build a fleet">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<do_any>
<set_value name="$Fleet" exact="[
table[
$macro = macro.ship_par_l_destroyer_01_b_macro,
$amount = 1,
$equipment = [macro.engine_par_l_travel_01_mk1_macro],
],
table[
$macro = macro.ship_par_m_frigate_01_b_macro,
$amount = 3,
]
]"/>
</do_any>
</do_if>
</do_elseif>
<do_if value="$Fleet">
<set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.list"/>
<do_if value="$Definition.$ThreadData.$WarFront.$ContestedSectorsIncludeHost">
<do_all exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.count" counter="$i">
<append_to_list name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.{$i}"/>
</do_all>
</do_if>
<do_if value="$PotentialLocations.count">
<set_value name="$Sector" exact="$PotentialLocations.random"/>
<find_station name="$PositionObject" space="$Sector" owner="$Definition.$ThreadData.$Faction"/>
<do_if value="$PositionObject">
<get_safe_pos result="$Offset" object="$PositionObject" sector="$Sector" allowyaxis="false" min="5km" max="10km"/>
</do_if>
<do_else>
<create_position name="$Offset" space="$Sector" min="5km" max="250km" />
<set_value name="$Offset" exact="position.[$Offset.x, 0, $Offset.z]" comment="Engine limitation, keep it on ecliptic (y=0)"/>
</do_else>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Get_Exact_Fleet__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Get_Exact_Fleet__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.build_ship"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Get_Exact_Fleet__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Get_Exact_Fleet__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Get_Exact_Fleet__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Get_Exact_Fleet__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Get_Exact_Fleet__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Get_Exact_Fleet__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Get_Exact_Fleet__Standard_Ref" ref="md.GM_GetExactFleet.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Get_Exact_Fleet__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="Faction" value="$Definition.$ThreadData.$Faction"/>
<param name="Fleet" value="$Fleet" comment="is looking for these ships with the specified upgrades"/>
<param name="TargetSector" value="$Sector"/>
<param name="TargetOffset" value="$Offset"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Get_Exact_Fleet__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<library name="Achieve_Coverage__Host_Space">
<actions>
<set_value name="$Location" exact="null"/>
<do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
<set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted"/>
</do_if>
<do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
<set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.clone"/>
</do_elseif>
<shuffle_list list="$PotentialLocations"/>
<do_while value="$PotentialLocations.count or not $Location">
<do_any>
<set_value name="$PotentialLocation" exact="$PotentialLocations.{1}" weight="50"/>
<set_value name="$PotentialLocation" exact="$PotentialLocations.random" weight="20"/>
</do_any>
<!--Check that there are not already a huge amount of satellites already in this location-->
<find_object name="$ExistingSatellites" class="class.satellite" owner="[faction.player, $Definition.$ThreadData.$Faction]" space="$PotentialLocation" multiple="true"/>
<do_if value="$ExistingSatellites.count lt 100">
<set_value name="$Location" exact="$PotentialLocation"/>
<break/>
</do_if>
<do_else>
<remove_value name="$PotentialLocations.{$PotentialLocations.indexof.{$PotentialLocation}}"/>
</do_else>
</do_while>
<do_if value="$Location">
<create_position name="$Offset" space="$Location" max="150km" />
<set_value name="$Y" min="-2km" max="2km" comment="Keep Y close to the ecliptic"/>
<set_value name="$Offset" exact="position.[$Offset.x, $Y, $Offset.z]"/>
<get_safe_pos result="$Offset" sector="$Location" allowyaxis="false" radius="5km"/>
<set_value name="$DifficultyVsRadius" exact="table[
{level.trivial } = [ macro.eq_arg_satellite_01_macro.maxradarrange * 0.80 ],
{level.easy } = [ macro.eq_arg_satellite_01_macro.maxradarrange * 1.20 ],
{level.medium } = [ macro.eq_arg_satellite_02_macro.maxradarrange * 0.80 ],
{level.hard } = [ macro.eq_arg_satellite_02_macro.maxradarrange * 1.20 ],
]"/>
<set_value name="$Difficulty" exact="$DifficultyVsRadius.keys.random"/>
<do_if value="$DifficultyVsRadius.{$Difficulty}">
<set_value name="$Radius" exact="$DifficultyVsRadius.{$Difficulty}.{1}"/>
</do_if>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</actions>
</library>
<library name="Achieve_Coverage__Enemy_Space">
<actions>
<set_value name="$Location" exact="null"/>
<do_if value="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.count">
<set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.sorted"/>
<do_while value="$PotentialLocations.count or not $Location">
<do_any>
<set_value name="$PotentialLocation" exact="$PotentialLocations.{1}" weight="50"/>
<set_value name="$PotentialLocation" exact="$PotentialLocations.random" weight="20"/>
</do_any>
<!--Check that there are not already a huge amount of satellites already in this location-->
<find_object name="$ExistingSatellites" class="class.satellite" owner="[faction.player, $Definition.$ThreadData.$Faction]" space="$PotentialLocation" multiple="true"/>
<do_if value="$ExistingSatellites.count lt 100">
<set_value name="$Location" exact="$PotentialLocation"/>
<break/>
</do_if>
<do_else>
<remove_value name="$PotentialLocations.{$PotentialLocations.indexof.{$PotentialLocation}}"/>
</do_else>
</do_while>
</do_if>
<do_if value="$Location">
<create_position name="$Offset" space="$Location" max="150km" />
<set_value name="$Y" min="-2km" max="2km" comment="Keep Y close to the ecliptic"/>
<set_value name="$Offset" exact="position.[$Offset.x, $Y, $Offset.z]"/>
<get_safe_pos result="$Offset" sector="$Location" allowyaxis="false" radius="5km"/>
<set_value name="$DifficultyVsRadius" exact="table[
{level.trivial } = [ macro.eq_arg_satellite_01_macro.maxradarrange * 0.80 ],
{level.easy } = [ macro.eq_arg_satellite_01_macro.maxradarrange * 1.20 ],
{level.medium } = [ macro.eq_arg_satellite_02_macro.maxradarrange * 0.80 ],
{level.hard } = [ macro.eq_arg_satellite_02_macro.maxradarrange * 1.20 ],
]"/>
<set_value name="$Difficulty" exact="$DifficultyVsRadius.keys.random"/>
<do_if value="$DifficultyVsRadius.{$Difficulty}">
<set_value name="$Radius" exact="$DifficultyVsRadius.{$Difficulty}.{1}"/>
</do_if>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</actions>
</library>
<cue name="Achieve_Coverage__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<set_value name="$Difficulty" exact="level.medium"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 102000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Host_Space"/>
</do_if>
<do_elseif value="$TextOffset == 102100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Enemy_Space"/>
</do_elseif>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 102000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Host_Space"/>
</do_if>
<do_elseif value="$TextOffset == 102100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Enemy_Space"/>
</do_elseif>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 102000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Host_Space"/>
</do_if>
<do_elseif value="$TextOffset == 102100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Enemy_Space"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 102000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Host_Space"/>
</do_if>
<do_elseif value="$TextOffset == 102100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Enemy_Space"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 102000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Host_Space"/>
</do_if>
<do_elseif value="$TextOffset == 102100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Achieve_Coverage__Enemy_Space"/>
</do_elseif>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Achieve_Coverage__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Achieve_Coverage__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective-->
<objective step="1" action="objective.custom" customaction="'TEMP: Achieve coverage'"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Achieve_Coverage__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Achieve_Coverage__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Achieve_Coverage__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Achieve_Coverage__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Achieve_Coverage__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Achieve_Coverage__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<cue name="Achieve_Coverage__Standard_Ref" ref="md.GM_AchieveCoverage.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Achieve_Coverage__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="$Difficulty"/>
<param name="Faction" value="$Definition.$ThreadData.$Faction"/>
<param name="CoverageSector" value="$Location"/>
<param name="CoverageOffset" value="$Offset"/>
<param name="CoverageRadius" value="$Radius"/>
<param name="CoveragePercent" value="75"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Achieve_Coverage__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<library name="Build_Station__Allied_Space">
<actions>
<do_any>
<set_value name="$PlotSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted.{1}"/>
<set_value name="$PlotSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.random"/>
</do_any>
<do_if value="$PlotSector">
<do_if value="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint and $Definition.$ThreadData.$WarFront.$EnemyEntryPoint.destination.sector == $PlotSector">
<set_value name="$X_Offset" min="-30km" max="30km"/>
<set_value name="$Z_Offset" min="8km" max="30km"/>
<create_position name="$PlotOffset" object="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint.exit" space="$PlotSector" x="$X_Offset" z="$Z_Offset"/>
</do_if>
<do_else>
<!--TODO @Owen expose the 'sector core boxes'?-->
<create_position name="$TargetOffset" space="$PlotSector" max="300km"/>
<set_value name="$PlotOffset" exact="position.[$TargetOffset.x, 0m, $TargetOffset.z]" comment="Engine limitation, can only build station on ecliptic (y=0)"/>
</do_else>
<set_value name="$PlotRange" exact="10km"/>
<set_value name="$PlotSize" exact="vector.[4km,3km,2km]"/>
<set_value name="$StationSpecs" exact="table[
$containedclasses = [[10, class.turret, 'Turret', 'Turrets']],
$containerstorage = 40000,
]"/>
<debug_text text="'Selected ' + $PlotSector + ' ' + $PlotSector.knownname + ' to be the sector to build the station in'" chance="$DebugChance"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</actions>
</library>
<cue name="Build_Station__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 105000" comment="Build defence outpost">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Build_Station__Allied_Space"/>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 105000" comment="Build defence outpost">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Build_Station__Allied_Space"/>
</do_if>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 105000" comment="Build defence outpost">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Build_Station__Allied_Space"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 105000" comment="Build defence outpost">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Build_Station__Allied_Space"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 105000" comment="Build defence outpost">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Build_Station__Allied_Space"/>
</do_if>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Build_Station__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Build_Station__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.build_station"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Build_Station__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Build_Station__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Build_Station__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Build_Station__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Build_Station__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Build_Station__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<set_value name="$ResultTable" exact="table[]"/>
</actions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Build_Station__Standard_Ref" ref="md.GM_BuildStation.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Build_Station__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="Faction" value="$Definition.$ThreadData.$Faction"/>
<param name="PlotSector" value="$PlotSector"/>
<param name="PlotOffset" value="$PlotOffset"/>
<param name="PlotRange" value="$PlotRange"/>
<param name="PlotSize" value="$PlotSize"/>
<param name="StationSpecs" value="$StationSpecs"/>
<param name="ResultTable" value="$ResultTable"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Build_Station__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<cue name="Supply_Factory__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<set_value name="$Faction" exact="$Definition.$ThreadData.$Faction"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 130000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
<do_if value="not $FollowUp">
<include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
<do_if value="$TargetStation">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<do_else>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_else>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_if value="$Page == 30211">
<do_if value="$TextOffset == 130000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
<do_if value="not $FollowUp">
<include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
<do_if value="$TargetStation">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<do_else>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_else>
</do_if>
</do_if>
<!--### PARANID VS HOLY ORDER ###-->
<do_if value="$Page == 30212">
<do_if value="$TextOffset == 130000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
<do_if value="not $FollowUp">
<include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
<do_if value="$TargetStation">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<do_else>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_else>
</do_if>
</do_if>
<!--### HOLY ORDER VS ARGON ###-->
<do_if value="$Page == 30213">
<do_if value="$TextOffset == 130000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
<do_if value="not $FollowUp">
<include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
<do_if value="$TargetStation">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<do_else>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_else>
</do_if>
</do_if>
<!--### HOLY ORDER VS PARANID ###-->
<do_if value="$Page == 30214">
<do_if value="$TextOffset == 130000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
<do_if value="not $FollowUp">
<include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
<do_if value="$TargetStation">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<do_else>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_else>
</do_if>
</do_if>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Supply_Factory__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Supply_Factory__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<objective step="1" action="objective.deliver" text="{30147,2}" comment="Production resources"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Supply_Factory__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Supply_Factory__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="event.param.isclass.station">
<set_value name="$TargetStation" exact="event.param"/>
<signal_cue cue="Supply_Factory__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Supply_Factory__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Supply_Factory__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Supply_Factory__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Supply_Factory__Standard_Ref" ref="md.GM_SupplyFactory.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Supply_Factory__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="MissionDuration" value="1h"/>
<param name="TargetStation" value="$TargetStation"/>
<param name="SupplyStorageMinPercent" value="$SupplyStorageMinPercent"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Supply_Factory__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<library name="DeployInPlace__LaserTowers_Around_Allied_Object">
<actions>
<do_any>
<set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted.{1}"/>
<set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.random"/>
</do_any>
<do_if value="$TargetSector">
<!--TODO @Owen find entry points towards enemy space-->
<find_station name="$AnchorObject" space="$TargetSector">
<match_relation_of faction="$Definition.$ThreadData.$Faction" relation="friend" comparison="ge"/>
</find_station>
<do_if value="$AnchorObject">
<create_position name="$TargetOffset" object="$AnchorObject" space="$TargetSector" />
<!--TODO @Owen @Roger This is a test to see if a sphere being around an object is fine even if it's away from the y axis -->
<!--<set_value name="$TargetOffset" exact="position.[$TargetOffset.x, 0, $TargetOffset.z]" comment="Keep guidance sphere on ecliptic (y=0)"/>-->
<set_value name="$TargetRadius" exact="$AnchorObject.size + 5km"/>
<set_value name="$DeployableCategory" exact="deployablecategory.lasertower"/>
<set_value name="$DropAmount" exact="3"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</actions>
</library>
<!--Additional params:
- $OwnEntryPointID - Text ID for the mission variant where the entry point is in host faction space
- $AlliedEntryPointID - Text ID for the mission variant where the entry point is in allied space-->
<library name="DeployInPlace__Mine_Entry_Point">
<actions>
<do_if value="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint">
<!--Clear $TextOffset as it will be set below based on the situation-->
<set_value name="$TextOffset" exact="null"/>
<set_value name="$ExitPointSector" exact="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint.destination.sector"/>
<do_if value="$ExitPointSector.owner == $Definition.$ThreadData.$Faction or $ExitPointSector.iscontestedby.{$Definition.$ThreadData.$Faction}">
<do_if value="$Definition.$TextOffset.indexof.{$OwnEntryPointID}">
<!--Set $TextOffset to $OwnEntryPointID which is the one for the exit point being in Faction owned space, but only if a possible selection in $Definition.$TextOffset-->
<set_value name="$TextOffset" exact="$OwnEntryPointID"/>
<debug_text text="'Setting text offset to ' + $TextOffset + ' as exit point is in space owned or contested by ' + $Definition.$ThreadData.$Faction" chance="$DebugChance"/>
</do_if>
</do_if>
<do_else>
<do_if value="$Definition.$TextOffset.indexof.{$AlliedEntryPointID}">
<!--Set $TextOffset to $AlliedEntryPointID which is the one for the exit point being in space owned by another faction, but only if a possible selection in $Definition.$TextOffset-->
<set_value name="$TextOffset" exact="$AlliedEntryPointID"/>
<debug_text text="'Setting text offset to ' + $TextOffset + ' as exit point is not in space owned or contested by ' + $Definition.$ThreadData.$Faction" chance="$DebugChance"/>
</do_if>
</do_else>
<do_if value="$TextOffset">
<create_position name="$TargetOffset" object="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint.exit" space="$ExitPointSector" z="5km" max="500m"/>
<!--TODO @Owen @Roger This is a test to see if a sphere being around an object is fine even if it's away from the y axis -->
<!--<set_value name="$TargetOffset" exact="position.[$TargetOffset.x, 0, $TargetOffset.z]" comment="Keep guidance sphere on ecliptic (y=0)"/>-->
<set_value name="$TargetSector" exact="$ExitPointSector"/>
<set_value name="$TargetRadius" exact="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint.exit.size"/>
<set_value name="$DeployableCategory" exact="deployablecategory.mine"/>
<set_value name="$DropAmount" exact="5"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</actions>
</library>
<library name="DeployInPlace__LaserTowers_In_Resource_Regions">
<actions>
<do_any>
<set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted.{1}"/>
<set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.random"/>
</do_any>
<do_if value="$TargetSector">
<set_value name="$Resources" exact="[ware.ice, ware.ore, ware.silicon]"/>
<shuffle_list list="$Resources"/>
<set_value name="$ResultSector" exact="null"/>
<do_all exact="$Resources.count" counter="$i">
<find_resource ware="$Resources.{$i}" refobject="$TargetSector" sector="$ResultSector" position="$TargetOffset" snap="false"/>
<do_if value="$ResultSector">
<break/>
</do_if>
</do_all>
<do_if value="$ResultSector">
<set_value name="$TargetRadius" exact="10km"/>
<set_value name="$DeployableCategory" exact="deployablecategory.lasertower"/>
<set_value name="$DropAmount" exact="3"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</actions>
</library>
<library name="DeployInPlace__Satellite_In_Enemy_Space">
<actions>
<do_any>
<set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.sorted.{1}" weight="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.count gt 0"/>
<set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.random" weight="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.count gt 0"/>
<set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.keys.random" weight="$Definition.$ThreadData.$WarFront.$ContestedSectors.count gt 0"/>
</do_any>
<do_if value="$TargetSector">
<create_position name="$TargetOffset" max="150km"/>
<set_value name="$Y" min="-5km" max="5km"/>
<set_value name="$TargetOffset" exact="position.[$TargetOffset.x, $Y, $TargetOffset.z]"/>
<get_safe_pos result="$TargetOffset" sector="$TargetSector" allowyaxis="false" radius="5km" value="$TargetOffset"/>
<set_value name="$TargetRadius" exact="1000m"/>
<set_value name="$DeployableCategory" exact="deployablecategory.satellite"/>
<set_value name="$DropAmount" exact="1"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</actions>
</library>
<cue name="DeployInPlace__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 101000">
<!--Deploy laser towers around an allied object-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
</do_if>
<do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
<!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$OwnEntryPointID" exact="101200"/>
<set_value name="$AlliedEntryPointID" exact="101100"/>
<include_actions ref="DeployInPlace__Mine_Entry_Point"/>
</do_elseif>
<do_elseif value="$TextOffset == 101300">
<!--Deploy laser towers in resource regions-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
</do_elseif>
<do_elseif value="$TextOffset == 101400">
<!--Deploy satellite in enemy territory-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
</do_elseif>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 101000">
<!--Deploy laser towers around an allied object-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
</do_if>
<do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
<!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$OwnEntryPointID" exact="101200"/>
<set_value name="$AlliedEntryPointID" exact="101100"/>
<include_actions ref="DeployInPlace__Mine_Entry_Point"/>
</do_elseif>
<do_elseif value="$TextOffset == 101300">
<!--Deploy laser towers in resource regions-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
</do_elseif>
<do_elseif value="$TextOffset == 101400">
<!--Deploy satellite in enemy territory-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
</do_elseif>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 101000">
<!--Deploy laser towers around an allied object-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
</do_if>
<do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
<!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$OwnEntryPointID" exact="101200"/>
<set_value name="$AlliedEntryPointID" exact="101100"/>
<include_actions ref="DeployInPlace__Mine_Entry_Point"/>
</do_elseif>
<do_elseif value="$TextOffset == 101300">
<!--Deploy laser towers in resource regions-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
</do_elseif>
<do_elseif value="$TextOffset == 101400">
<!--Deploy satellite in enemy territory-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 101000">
<!--Deploy laser towers around an allied object-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
</do_if>
<do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
<!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$OwnEntryPointID" exact="101200"/>
<set_value name="$AlliedEntryPointID" exact="101100"/>
<include_actions ref="DeployInPlace__Mine_Entry_Point"/>
</do_elseif>
<do_elseif value="$TextOffset == 101300">
<!--Deploy laser towers in resource regions-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
</do_elseif>
<do_elseif value="$TextOffset == 101400">
<!--Deploy satellite in enemy territory-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 101000">
<!--Deploy laser towers around an allied object-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
</do_if>
<do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
<!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$OwnEntryPointID" exact="101200"/>
<set_value name="$AlliedEntryPointID" exact="101100"/>
<include_actions ref="DeployInPlace__Mine_Entry_Point"/>
</do_elseif>
<do_elseif value="$TextOffset == 101300">
<!--Deploy laser towers in resource regions-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
</do_elseif>
<do_elseif value="$TextOffset == 101400">
<!--Deploy satellite in enemy territory-->
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
</do_elseif>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="DeployInPlace__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="DeployInPlace__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.deploy"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="DeployInPlace__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="DeployInPlace__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="DeployInPlace__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="DeployInPlace__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="DeployInPlace__Standard_Create_GM"/>
</actions>
</cue>
<cue name="DeployInPlace__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="DeployInPlace__Standard_Ref" ref="md.GM_DeployInPlace.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="DeployInPlace__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.easy"/>
<param name="Faction" value="$Definition.$ThreadData.$Faction"/>
<param name="TargetSector" value="$TargetSector"/>
<param name="TargetOffset" value="$TargetOffset"/>
<param name="TargetRadius" value="$TargetRadius"/>
<param name="TargetCount" value="$DropAmount"/>
<param name="DeployableCategory" value="$DeployableCategory"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="DeployInPlace__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<cue name="DestroyRarelyOnSight__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 140000" comment="undermine enemy variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<!-- set_value name="$TargetSpec" exact="[macro.ship_arg_xl_carrier_01_a_macro, [macro.engine_arg_xl_allround_01_mk1_macro], [ware.countermeasure_flares_01], [ware.mod_weapon_damage_01_mk1]]"/-->
<set_value name="$TargetSpec" exact="[macro.ship_xen_m_fighter_01_a_macro, [], [], []]"/>
<set_value name="$TargetCount" exact="1"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER-->
<do_if value="$Page == 30211">
<do_if value="$TextOffset == 140000" comment="undermine enemy variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetSpec" exact="[macro.ship_par_l_destroyer_01_b_macro, [], [], []]"/>
<set_value name="$TargetCount" exact="1"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<!--### PARANID VS HOLY ORDER ###-->
<do_if value="$Page == 30212">
<do_if value="$TextOffset == 140000" comment="undermine enemy variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetSpec" exact="[macro.ship_par_m_frigate_01_b_macro, [], [], []]"/>
<set_value name="$TargetCount" exact="[1,2].random"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<!--### HOLY ORDER VS ARGON ###-->
<do_if value="$Page == 30213">
<do_if value="$TextOffset == 140000" comment="undermine enemy variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetSpec" exact="[macro.ship_arg_m_frigate_01_a_macro, [], [], []]"/>
<set_value name="$TargetCount" exact="[1,2].random"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<!--### HOLY ORDER VS PARANID ###-->
<do_if value="$Page == 30214">
<do_if value="$TextOffset == 140000" comment="undermine enemy variation">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetSpec" exact="[macro.ship_par_m_frigate_01_a_macro, [], [], []]"/>
<set_value name="$TargetCount" exact="[1,2].random"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="DestroyRarelyOnSight__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="DestroyRarelyOnSight__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.destroy"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="DestroyRarelyOnSight__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="DestroyRarelyOnSight__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="DestroyRarelyOnSight__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="DestroyRarelyOnSight__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="DestroyRarelyOnSight__Standard_Create_GM"/>
</actions>
</cue>
<cue name="DestroyRarelyOnSight__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="DestroyRarelyOnSight__Standard_Ref" ref="md.GM_Destroy_RarelyOnSight.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="DestroyRarelyOnSight__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.veryhard"/>
<param name="Faction" value="$Definition.$ThreadData.$Faction"/>
<param name="TargetSpec" value="$TargetSpec"/>
<param name="TargetCount" value="$TargetCount"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="DestroyRarelyOnSight__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!-- Input: $EnemyFaction
Returns: $TargetShip, and on success also $Difficulty -->
<library name="BoardShip__Standard_FindMilitaryTarget">
<actions>
<set_value name="$Spaces" exact="null"/>
<do_if value="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.count">
<set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.list"/>
</do_if>
<do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
<set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.clone"/>
</do_elseif>
<do_if value="$Spaces">
<shuffle_list list="$Spaces"/>
<!--TODO @Owen further balancing to find easy enough boarding targets-->
<!--TODO @Owen a variant to help NPCs board targets?-->
<set_value name="$TargetShip" exact="null"/>
<do_all exact="$Spaces.count" counter="$i">
<find_ship name="$TargetShip" class="class.ship_l" primarypurpose="purpose.fight" space="$Spaces.{$i}" owner="$EnemyFaction" hascommander="false" capturable="true" docked="false"/>
<do_if value="$TargetShip">
<break/>
</do_if>
</do_all>
<do_if value="$TargetShip">
<set_value name="$Difficulty" exact="level.hard"/>
</do_if>
</do_if>
</actions>
</library>
<cue name="BoardShip__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<set_value name="$EnemyFaction" exact="$Definition.$ThreadData.$EnemyFaction"/>
<set_value name="$TargetSpec" exact="null"/>
<set_value name="$TargetShip" exact="null"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 108000" comment="GM_Board (specified ship)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<!-- TODO @Owen - Boarding variant to not board a Xenon ship but some other. Rogue scientists heading into Xenon space -->
<!-- TODO: Bulletproof find_ship not returning anything -->
<set_value name="$EnemyFaction" exact="faction.argon"/>
<include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
</do_if>
<do_elseif value="$TextOffset == 5600" comment="HL_BoardRare (ship matching specifications)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetSpec" exact="[macro.ship_arg_xl_carrier_01_a_macro, [macro.engine_arg_xl_allround_01_mk1_macro, macro.turret_arg_m_gatling_02_mk1_macro], [ware.countermeasure_flares_01], [ware.mod_weapon_damage_01_mk1]]"/>
<set_value name="$Difficulty" exact="level.veryhard"/>
</do_elseif>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 108000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
</do_if>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 108000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 108000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 108000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
</do_if>
</do_elseif>
<do_if value="$TargetShip or $TargetSpec">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
<do_if value="$Valid == 2">
<do_any>
<set_value name="$MissionDuration" exact="2h"/>
<set_value name="$MissionDuration" exact="3h"/>
</do_any>
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="BoardShip__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="BoardShip__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.board"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="BoardShip__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="BoardShip__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="BoardShip__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="BoardShip__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="BoardShip__Standard_Create_GM"/>
</actions>
</cue>
<cue name="BoardShip__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="BoardShip__Standard_Ref" ref="md.GM_BoardShip.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="BoardShip__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="$Difficulty"/>
<param name="MissionDuration" value="$MissionDuration"/>
<param name="Faction" value="$Definition.$ThreadData.$Faction"/>
<param name="TargetShip" value="$TargetShip" comment="pass either TargetShip or TargetSpecs!"/>
<param name="TargetSpec" value="$TargetSpec"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="BoardShip__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<cue name="Scan__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<set_value name="$Difficulty" exact="level.medium"/>
<set_value name="$EnemyFaction" exact="$Definition.$ThreadData.$EnemyFaction"/>
<set_value name="$TargetShip" exact="null"/>
<set_value name="$TargetStation" exact="null"/>
<set_value name="$TargetModule" exact="null"/>
<set_value name="$TargetWare" exact="null"/>
<set_value name="$TargetItem" exact="null"/>
<set_value name="$TargetPerson" exact="null"/>
<set_value name="$TargetPersonName" exact="null"/>
<set_value name="$TargetIDCode" exact="null"/>
<set_value name="$ScanPercentage" exact="null"/>
<set_value name="$ScanShip" exact="null"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
</do_if>
<do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
</do_elseif>
<do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
</do_elseif>
<do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetWare" exact="ware.spaceweed"/>
<set_value name="$Difficulty" exact="level.impossible"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
</do_elseif>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
</do_if>
<do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
</do_elseif>
<do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
</do_elseif>
<do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetWare" exact="ware.spaceweed"/>
<set_value name="$Difficulty" exact="level.hard"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150400" comment="GM_Scan5 (deepscan ships for specified item)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetItem" exact="ware.inv_decryptionmodule"/>
<set_value name="$Difficulty" exact="level.hard"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150500" comment="GM_Scan6 (deepscan ships for specified person)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Random_NPC"/>
</do_elseif>
<do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
</do_elseif>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
</do_if>
<do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
</do_elseif>
<do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
</do_elseif>
<do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetWare" exact="ware.spaceweed"/>
<set_value name="$Difficulty" exact="level.hard"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150400" comment="GM_Scan5 (deepscan ships for specified item)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetItem" exact="ware.inv_decryptionmodule"/>
<set_value name="$Difficulty" exact="level.hard"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150500" comment="GM_Scan6 (deepscan ships for specified person)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Random_NPC"/>
</do_elseif>
<do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
</do_if>
<do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
</do_elseif>
<do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
</do_elseif>
<do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetWare" exact="ware.spaceweed"/>
<set_value name="$Difficulty" exact="level.hard"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150400" comment="GM_Scan5 (deepscan ships for specified item)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetItem" exact="ware.inv_decryptionmodule"/>
<set_value name="$Difficulty" exact="level.hard"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150500" comment="GM_Scan6 (deepscan ships for specified person)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Random_NPC"/>
</do_elseif>
<do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
</do_if>
<do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
</do_elseif>
<do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
</do_elseif>
<do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetWare" exact="ware.spaceweed"/>
<set_value name="$Difficulty" exact="level.hard"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150400" comment="GM_Scan5 (deepscan ships for specified item)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetItem" exact="ware.inv_decryptionmodule"/>
<set_value name="$Difficulty" exact="level.hard"/>
<set_value name="$ScanType" exact="1"/>
</do_elseif>
<do_elseif value="$TextOffset == 150500" comment="GM_Scan6 (deepscan ships for specified person)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Random_NPC"/>
</do_elseif>
<do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
</do_elseif>
</do_elseif>
<do_if value="$TargetShip or $TargetStation or $TargetModule or $TargetPerson or $ScanShip or $TargetItem or $TargetWare">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Scan__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Scan__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.scan"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Scan__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Scan__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Scan__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Scan__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Scan__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Scan__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Scan__Standard_Ref" ref="md.GM_Scan.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Scan__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="$Difficulty"/>
<param name="TargetShip" value="$TargetShip"/>
<param name="TargetStation" value="$TargetStation"/>
<param name="TargetModule" value="$TargetModule"/>
<param name="TargetWare" value="$TargetWare"/>
<param name="TargetItem" value="$TargetItem"/>
<param name="TargetPersonName" value="$TargetPersonName"/>
<param name="TargetIDCode" value="$TargetIDCode"/>
<param name="ScanType" value="$ScanType"/>
<param name="ScanPercentage" value="$ScanPercentage"/>
<param name="ScanShip" value="$ScanShip"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Scan__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<library name="Passenger_Transport__To_Frontline">
<actions>
<set_value name="$TargetStation" exact="null"/>
<set_value name="$PotentialTargetSpaces" exact="null"/>
<do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
<set_value name="$PotentialTargetSpaces" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.list"/>
</do_if>
<do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
<set_value name="$PotentialTargetSpaces" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors"/>
</do_elseif>
<do_while value="$PotentialTargetSpaces.count and not $TargetStation">
<!-- TODO: Would be nice if the target could be a ship, instead of a station -->
<find_station name="$TargetStation" space="$PotentialTargetSpaces.{$PotentialTargetSpaces.count}" owner="$Definition.$ThreadData.$Faction" multiple="false" comment="Station to deliver the passenger"/>
<remove_value name="$PotentialTargetSpaces.{$PotentialTargetSpaces.count}"/>
</do_while>
<do_if value="$TargetStation">
<find_cluster_in_range name="$SourceStationClusters" object="$TargetStation" mindistance="3" maxdistance="4" multiple="true"/>
<do_all exact="$SourceStationClusters.count" counter="$i">
<find_sector name="$SourceStationSectors" space="$SourceStationClusters.{$i}" multiple="true" append="true">
<match_any>
<match owner="$Definition.$ThreadData.$Faction"/>
<match contestedby="$Definition.$ThreadData.$Faction"/>
</match_any>
</find_sector>
</do_all>
<shuffle_list list="$SourceStationClusters"/>
<do_all exact="$SourceStationSectors.count" counter="$i">
<find_station name="$SourceStation" space="$SourceStationSectors.{$i}" owner="$Definition.$ThreadData.$Faction" multiple="false" comment="Station to fetch the passenger"/>
<do_if value="$SourceStation">
<!-- TODO: Make sure we aren't claiming some super-important npc -->
<!--TODO @Owen - this doesn't look right. Improve passenger generation and cleanup-->
<find_object_component name="$TargetPassenger" class="class.npc" object="$SourceStation" multiple="false"/>
<create_cue_actor cue="Passenger_Transport__Standard" name="$TargetPassenger">
<select faction="$SourceStation.owner"/>
<owner exact="$SourceStation.owner"/>
</create_cue_actor>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_all>
</do_if>
</actions>
</library>
<cue name="Passenger_Transport__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<set_value name="$Difficulty" exact="level.medium"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 104000" comment="Transport specialist on Xenon to front">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Passenger_Transport__To_Frontline"/>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 104000" comment="Transport specialist on Holy Order to front">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Passenger_Transport__To_Frontline"/>
</do_if>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 104000" comment="Transport specialist on Holy Order to front">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Passenger_Transport__To_Frontline"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 104000" comment="Transport specialist on Holy Order to front">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Passenger_Transport__To_Frontline"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 104000" comment="Transport specialist on Holy Order to front">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Passenger_Transport__To_Frontline"/>
</do_if>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Passenger_Transport__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Passenger_Transport__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.transport"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Passenger_Transport__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Passenger_Transport__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Passenger_Transport__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Passenger_Transport__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Passenger_Transport__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Passenger_Transport__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Passenger_Transport__Standard_Ref" ref="md.GM_Transport_Passengers.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Passenger_Transport__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="$Difficulty"/>
<param name="ExistingActors" value="[$TargetPassenger]"/>
<param name="UseClient" value="false"/>
<param name="StartContainer" value="$SourceStation"/>
<param name="TargetContainer" value="$TargetStation"/>
<param name="TargetDockArea" value="null"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Passenger_Transport__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<cue name="Sabotage__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<set_value name="$EnemyFaction" exact="$Definition.$ThreadData.$EnemyFaction"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 14000" comment="sabotage station">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.turret]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
</do_if>
<do_elseif value="$TextOffset == 14100" comment="sabotage ship">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
</do_elseif>
</do_if>
<!--### ARGON VS HOLY ORDER -->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 14000" comment="sabotage station">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.turret]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
</do_if>
<do_elseif value="$TextOffset == 14100" comment="sabotage ship">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
</do_elseif>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 14000" comment="sabotage station">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.turret]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
</do_if>
<do_elseif value="$TextOffset == 14100" comment="sabotage ship">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 14000" comment="sabotage station">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.turret]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
</do_if>
<do_elseif value="$TextOffset == 14100" comment="sabotage ship">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 14000" comment="sabotage station">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.turret]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
</do_if>
<do_elseif value="$TextOffset == 14100" comment="sabotage ship">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
<include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
</do_elseif>
</do_elseif>
<do_if value="$TargetObject.exists and $TargetComponents.count">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Sabotage__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Sabotage__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.destroy"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Sabotage__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Sabotage__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Sabotage__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Sabotage__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Sabotage__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Sabotage__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
</actions>
<cues>
<cue name="Sabotage__Standard_ChangeOwner" comment="TODO: @Owen, Roger - For demo-purpose">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
</conditions>
<actions>
<set_owner object="$TargetObject" faction="faction.player"/>
</actions>
</cue>
<cue name="Sabotage__Standard_Ref" ref="md.GM_Sabotage.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Sabotage__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="EnemyFaction" value="$EnemyFaction"/>
<param name="PrimaryTarget" value="$TargetObject"/>
<param name="TargetComponents" value="$TargetComponents"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Sabotage__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--TODO @Owen unused!-->
<cue name="Destroy_Objects__Clear_Explosives" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This is an example of using a library to create a group of targets. If the targets are invalid by the time the sub-mission runs, the library could be run again.
Could also be done for finding an existing object as a target-->
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 9000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$ExplosiveOwner" exact="[faction.scaleplate, faction.hatikvah]" comment="Pirates"/>
<include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
<do_if value="$Explosives.count">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 9000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$ExplosiveOwner" exact="[faction.holyorder]" comment="Pirates"/>
<include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
<do_if value="$Explosives.count">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</do_elseif>
<!--### PARANID VS HOLY ORDER###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 9000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$ExplosiveOwner" exact="[faction.holyorder]" comment=""/>
<include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
<do_if value="$Explosives.count">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 9000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$Sector" exact="player.sector"/>
<set_value name="$ExplosiveOwner" exact="[faction.scaleplate, faction.hatikvah]" comment="Pirates"/>
<include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
<do_if value="$Explosives.count">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 9000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<set_value name="$Sector" exact="player.sector"/>
<set_value name="$ExplosiveOwner" exact="[faction.scaleplate, faction.hatikvah]" comment="Pirates"/>
<include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
<do_if value="$Explosives.count">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Destroy_Objects__Clear_Explosives_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Destroy_Objects__Clear_Explosives_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.destroy"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Destroy_Objects__Clear_Explosives_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Destroy_Objects__Clear_Explosives_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Destroy_Objects__Clear_Explosives_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Destroy_Objects__Clear_Explosives_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Destroy_Objects__Clear_Explosives_Create_GM"/>
</actions>
</cue>
<cue name="Destroy_Objects__Clear_Explosives_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!--event.param == result cue, result saved to event.param.$Targets-->
<cue name="Destroy_Objects__Clear_Explosives__New_Targets" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
<add_to_group groupname="event.param.$Targets" group="$Explosives"/>
<debug_text text="'Finding new targets as the previous group was invalid. Found: ' + $Explosives.count" chance="$DebugChance"/>
</actions>
</cue>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Destroy_Objects__Clear_Explosives_Ref" ref="md.GM_Destroy_Objects.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Destroy_Objects__Clear_Explosives_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="DebugChance" value="$DebugChance"/>
<param name="TargetSector" value="$Explosives.{1}.sector.knownname"/>
<param name="Targets" value="$Explosives"/>
<param name="TargetRequestCue" value="Destroy_Objects__Clear_Explosives__New_Targets"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Destroy_Objects__Clear_Explosives_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<library name="KillShip__Standard_Lib">
<actions>
<set_value name="$EnemyFaction" exact="$Definition.$ThreadData.$Faction"/>
<!--get_ship_definition reference="$ShipReference" faction="$EnemyFaction" size="class.ship_s" tags="[tag.mission, tag.military]"/-->
<find_ship name="$TargetShip" space="player.galaxy" masstraffic="false" class="[class.ship_s, class.ship_m]" owner="$EnemyFaction"/>
<do_if value="$TargetShip">
<add_to_group groupname="$Targets" object="$TargetShip"/>
<!-- TODO: Set the ship behaviour, see <create_order> -->
<set_value name="$Valid" exact="2" comment="all fine"/>
</do_if>
<do_else>
</do_else>
</actions>
</library>
<cue name="KillShip__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<set_value name="$Valid" exact="0"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<create_group groupname="$Targets"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 11000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="KillShip__Standard_Lib"/>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_if value="$Page == 30211">
<do_if value="$TextOffset == 11000">
<include_actions ref="KillShip__Standard_Lib"/>
</do_if>
</do_if>
<!--### PARANID VS HOLY ORDER ###-->
<do_if value="$Page == 30212">
<do_if value="$TextOffset == 11000">
<include_actions ref="KillShip__Standard_Lib"/>
</do_if>
</do_if>
<!--### HOLY ORDER VS ARGON ###-->
<do_if value="$Page == 30213">
<do_if value="$TextOffset == 11000">
<include_actions ref="KillShip__Standard_Lib"/>
</do_if>
</do_if>
<!--### HOLY ORDER VS PARANID ###-->
<do_if value="$Page == 30214">
<do_if value="$TextOffset == 11000">
<include_actions ref="KillShip__Standard_Lib"/>
</do_if>
</do_if>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="KillShip__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="KillShip__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.destroy">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.destroy"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="KillShip__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="KillShip__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="KillShip__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="KillShip__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="KillShip__Standard_Create_GM"/>
</actions>
</cue>
<cue name="KillShip__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="KillShip__Standard_Ref" ref="md.GM_Destroy_Objects.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="KillShip__Standard_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="TargetSector" value="$Explosives.{1}.sector.knownname"/>
<param name="Targets" value="$Targets"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="KillShip__Standard_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<library name="Find_Resources__Allied_Space_1">
<!--TODO @Owen @Roger - better list of resources?-->
<!--Ore, Silicon, Hydrogen-->
<actions>
<set_value name="$Spaces" exact="[]"/>
<do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
<set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted"/>
<shuffle_list list="$Spaces" chance="40"/>
</do_if>
<do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
<set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors"/>
</do_elseif>
<do_if value="$Spaces.count">
<set_value name="$ResourceTryList" exact="[ware.ore, ware.silicon, ware.hydrogen]"/>
<do_all exact="$Spaces.count" counter="$i">
<set_value name="$Space" exact="$Spaces.{$i}"/>
<include_actions ref="md.GM_Find_Resources.Check_Space"/>
<!-- Check that at least something was found - abort otherwise-->
<do_if value="$ResourceList.count == 0">
<debug_text text="'No matching resources found, aborting'" chance="$DebugChance"/>
</do_if>
<do_else>
<set_value name="$Valid" exact="2"/>
<break/>
</do_else>
</do_all>
</do_if>
</actions>
</library>
<library name="Find_Resources__Enemy_Space_1">
<!--TODO @Owen @Roger - better list of resources?-->
<!--Ore, Silicon, Hydrogen-->
<actions>
<set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.sorted"/>
<shuffle_list list="$Spaces" chance="40"/>
<set_value name="$ResourceTryList" exact="[ware.ore, ware.silicon, ware.hydrogen]"/>
<do_all exact="$Spaces.count" counter="$i">
<set_value name="$Space" exact="$Spaces.{$i}"/>
<include_actions ref="md.GM_Find_Resources.Check_Space"/>
<!-- Check that at least something was found - abort otherwise-->
<do_if value="$ResourceList.count == 0">
<debug_text text="'No matching resources found, aborting'" chance="$DebugChance"/>
</do_if>
<do_else>
<set_value name="$Valid" exact="2"/>
<break/>
</do_else>
</do_all>
</actions>
</library>
<cue name="Find_Resources__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<!-- Setup what resources we suggest to look for depending on the mission-variation/text -->
<do_if value="$TextOffset == 106000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Allied_Space_1"/>
</do_if>
<do_elseif value="$TextOffset == 106100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Enemy_Space_1"/>
</do_elseif>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 106000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Allied_Space_1"/>
</do_if>
<do_elseif value="$TextOffset == 106100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Enemy_Space_1"/>
</do_elseif>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 106000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Allied_Space_1"/>
</do_if>
<do_elseif value="$TextOffset == 106100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Enemy_Space_1"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 106000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Allied_Space_1"/>
</do_if>
<do_elseif value="$TextOffset == 106100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Enemy_Space_1"/>
</do_elseif>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 106000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Allied_Space_1"/>
</do_if>
<do_elseif value="$TextOffset == 106100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Find_Resources__Enemy_Space_1"/>
</do_elseif>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Find_Resources__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Find_Resources__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.find"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Find_Resources__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Find_Resources__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Find_Resources__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Find_Resources__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Find_Resources__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Find_Resources__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Find_Resources__Standard_Ref" ref="md.GM_Find_Resources.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Find_Resources__Standard_GM_Event" comment="tell GM to call this cue when done"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="$Difficulty"/>
<param name="FindArea" value="$Space"/>
<param name="ResourceList" value="$ResourceList"/>
<param name="ResourceYieldList" value="$ResourceYieldList"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Find_Resources__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<library name="RepairObject__Allied_Job_Ship">
<actions>
<create_group groupname="$TargetObjects"/>
<set_value name="$DamagedShips" exact="[]"/>
<do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
<set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted"/>
<do_while value="$PotentialLocations.count and not $DamagedShips.count">
<do_any>
<set_value name="$PotentialLocation" exact="$PotentialLocations.{1}" weight="50"/>
<set_value name="$PotentialLocation" exact="$PotentialLocations.random" weight="20"/>
</do_any>
<!--<find_ship name="$TestDamageShips" commandeerable="true" primarypurpose="purpose.fight" owner="$Definition.$ThreadData.$Faction" space="$PotentialLocation" multiple="true"/>
<do_all exact="$TestDamageShips.count" counter="$i">
<set_object_hull object="$TestDamageShips.{$i}" min="87" max="88"/>
</do_all>-->
<!--Find a damaged ship which could be commandeered-->
<find_ship name="$PotentialDamagedShips" commandeerable="true" primarypurpose="purpose.fight" owner="$Definition.$ThreadData.$Faction" space="$PotentialLocation" multiple="true">
<match_hull max="89"/>
</find_ship>
<do_if value="$PotentialDamagedShips.count">
<set_value name="$DamagedShips" exact="$PotentialDamagedShips"/>
<break/>
</do_if>
<do_else>
<remove_value name="$PotentialLocations.{$PotentialLocations.indexof.{$PotentialLocation}}"/>
</do_else>
</do_while>
</do_if>
<do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
<set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.clone"/>
<do_while value="$PotentialLocations.count and not $DamagedShips.count">
<set_value name="$PotentialLocation" exact="$PotentialLocations.random"/>
<!--<find_ship name="$TestDamageShips" commandeerable="true" primarypurpose="purpose.fight" owner="$Definition.$ThreadData.$Faction" space="$PotentialLocation" multiple="true"/>
<do_all exact="$TestDamageShips.count" counter="$i">
<set_object_hull object="$TestDamageShips.{$i}" min="87" max="88"/>
</do_all>-->
<!--Find a damaged ship which could be commandeered-->
<find_ship name="$PotentialDamagedShips" commandeerable="true" primarypurpose="purpose.fight" owner="$Definition.$ThreadData.$Faction" space="$PotentialLocation" multiple="true">
<match_hull max="89"/>
</find_ship>
<do_if value="$PotentialDamagedShips.count">
<set_value name="$DamagedShips" exact="$PotentialDamagedShips"/>
<break/>
</do_if>
<do_else>
<remove_value name="$PotentialLocations.{$PotentialLocations.indexof.{$PotentialLocation}}"/>
</do_else>
</do_while>
</do_elseif>
<do_if value="$DamagedShips.count">
<add_to_group groupname="$TargetObjects" object="$DamagedShips.random"/>
<set_value name="$RepairPercentage" exact="90"/>
<!--TODO @Owen select sub-components-->
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</actions>
</library>
<cue name="RepairObject__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 103000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="RepairObject__Allied_Job_Ship"/>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 103000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="RepairObject__Allied_Job_Ship"/>
</do_if>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 103000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="RepairObject__Allied_Job_Ship"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 103000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="RepairObject__Allied_Job_Ship"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 103000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="RepairObject__Allied_Job_Ship"/>
</do_if>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="RepairObject__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="RepairObject__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.repair">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.repair"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="RepairObject__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="RepairObject__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="RepairObject__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="RepairObject__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="RepairObject__Standard_Create_GM"/>
</actions>
</cue>
<cue name="RepairObject__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<cue name="RepairObject__Standard_Ref" ref="md.GM_RepairObject.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="RepairObject__Standard_GM_Event"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="Targets" value="$TargetObjects"/>
<param name="RepairPercentage" value="$RepairPercentage"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="RepairObject__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<do_if value="@static.$EndFeedbackValue" comment="Evaluate return-value of GM (success/failure)">
<debug_text text="'Mission ended. feedback' + static.$EndFeedbackValue" chance="$DebugChance"/>
<do_if value="$SuccessfullyGenerated">
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
</do_if>
<do_else>
<signal_cue_instantly cue="$Definition.$SpawnFailedCue"/>
</do_else>
<!-- handle EndFeedbackValue of the GM -->
<do_if value="static.$EndFeedbackValue.$ID" exact="'$MISSION_SUCCEEDED'" comment="see the $FeedbackValues table in the Generic Mission">
<do_if value="@$MissionDataTable.$NextMission">
<do_if value="false" comment="Forced failure as there are no valid NextMission cases defined for this mission. Replace with valid case if needed.">
</do_if>
<do_else>
<!--If there is a followup mission, signal it with whatever parameters it needs-->
<assert value="false" text="'Next mission ' + $MissionDataTable.$NextMission + ' is missing handling in ' + namespace + '. It should be explicitly signalled with whatever parameters it requires. [Owen]'"/>
</do_else>
</do_if>
</do_if>
<do_elseif value="static.$EndFeedbackValue.$ID" exact="'$MISSION_TIMEOUT'">
</do_elseif>
</do_if>
<do_elseif value="@static.$FeedbackValue">
<debug_text text="'Mission signalled with feedback' + static.$FeedbackValue" chance="$DebugChance"/>
<do_if value="static.$FeedbackValue.$ID == '$MISSION_GENERATED'">
<!--If a followup mission, no need to inform the Mission Thread Manager of the mission successfully being generated as $Definition.$SpawnSuccessCue was already called for this mission-->
<do_if value="not $FollowUp">
<set_value name="$MissionDataTable" exact="event.param.clone"/>
<set_value name="$MissionDataTable.$WrapperCue" exact="namespace"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</do_if>
<set_value name="$SuccessfullyGenerated" exact="true"/>
</do_if>
</do_elseif>
</actions>
<cues>
<cue name="RepairObject__Standard_GM_Event_Cleanup" onfail="cancel">
<conditions>
<check_value value="@static.$EndFeedbackValue"/>
</conditions>
<actions>
<!--Delayed cleanup to allow other sections to perform their actions-->
<cancel_cue cue="namespace"/>
</actions>
</cue>
</cues>
</cue>
<!--Specialised cue to handle the variant of damaged ships. Outside of the GM to reduce bloat.
Ships will be commandeered, given an order to wait in a certain location. On the mission ending, it will be released.-->
<cue name="RepairObject__Standard_Manage_Damaged_Ships">
<conditions>
<event_cue_signalled cue="RepairObject__Standard_GM_Event"/>
<check_value value="$Page == 30211 and $TextOffset == 103000"/>
<check_value value="not @RepairObject__Standard_GM_Event.$EndFeedbackValue" comment="GM has not ended"/>
<check_value value="@RepairObject__Standard_GM_Event.$FeedbackValue and RepairObject__Standard_GM_Event.$FeedbackValue.$ID == '$mission_generated'" comment="GM has been successfully generated"/>
</conditions>
<actions>
<create_group groupname="this.$Commandeered"/>
<do_all exact="$TargetObjects.count" counter="$i">
<do_if value="$TargetObjects.{$i}.isclass.ship">
<assert value="$TargetObjects.{$i}.iscommandeerable" text="'Ship ' + $TargetObjects.{$i} + ' ' + $TargetObjects.{$i}.knownname + ' is not commandeerable and may wander off during the mission [Owen]'"/>
<do_if value="$TargetObjects.{$i}.iscommandeerable">
<debug_text text="'Commandeering ship ' + $TargetObjects.{$i} + ' ' + $TargetObjects.{$i}.knownname" chance="$DebugChance"/>
<commandeer_object object="$TargetObjects.{$i}"/>
<add_to_group groupname="this.$Commandeered" object="$TargetObjects.{$i}"/>
<cancel_all_orders object="$TargetObjects.{$i}"/>
<create_order id="'Wait'" object="$TargetObjects.{$i}" default="true">
<param name="debugchance" value="$DebugChance"/>
</create_order>
</do_if>
</do_if>
</do_all>
</actions>
<cues>
<cue name="RepairObject__Standard_Manage_Damaged_Ships_GM_Ended">
<conditions>
<event_cue_signalled cue="RepairObject__Standard_GM_Event"/>
<check_value value="@RepairObject__Standard_GM_Event.$EndFeedbackValue" comment="GM has ended"/>
</conditions>
<actions>
<debug_text text="'meh ' + RepairObject__Standard_GM_Event.$EndFeedbackValue"/>
<do_all exact="parent.$Commandeered.count" counter="$i">
<debug_text text="'Releasing commandeered ship ' + parent.$Commandeered.{$i} + ' ' + parent.$Commandeered.{$i}.knownname" chance="$DebugChance"/>
<release_commandeered_object object="parent.$Commandeered.{$i}"/>
</do_all>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
</cues>
</cue>
<!--Variant Helper Libraries
Helper libraries to be call from different threads but want to have the same basic variant rules
If you want to have something custom for a faction e.g. if Vs Xenon, have twice as many enemies, either write your own variant within the cue itself, or modify variables after calling the library-->
<library name="Assassinate__Enemy_S_M_Ship">
<actions>
<do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
<do_any>
<set_value name="$Space" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.sorted.{1}"/>
<set_value name="$Space" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.random"/>
</do_any>
</do_if>
<do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
<set_value name="$Space" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.random"/>
</do_elseif>
<do_if value="$Space">
<find_ship name="$TargetShip" owner="$Definition.$ThreadData.$EnemyFaction" class="[class.ship_s, class.ship_m]" hascommander="false" space="$Space"/>
<do_if value="$TargetShip">
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
</do_if>
</do_if>
</actions>
</library>
<cue name="Assassinate__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 107000 or $TextOffset == 107100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Assassinate__Enemy_S_M_Ship"/>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 107000 or $TextOffset == 107100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Assassinate__Enemy_S_M_Ship"/>
</do_if>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 107000 or $TextOffset == 107100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Assassinate__Enemy_S_M_Ship"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 107000 or $TextOffset == 107100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Assassinate__Enemy_S_M_Ship"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 107000 or $TextOffset == 107100">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Assassinate__Enemy_S_M_Ship"/>
</do_if>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Assassinate__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Assassinate__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.find"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Assassinate__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Assassinate__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Assassinate__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Assassinate__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Assassinate__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Assassinate__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Assassinate__Standard_Ref" ref="md.GM_Assassinate.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Assassinate__Standard_GM_Event" comment="tell GM to call this cue when done"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="3"/>
<param name="Difficulty" value="level.medium"/>
<param name="AssassinationTarget" value="$TargetShip.pilot"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Assassinate__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
<library name="Support_Invasion__Get_Invasion">
<actions>
<do_if value="$Definition.$ThreadData.$WarFront.$HostInvasions.count">
<shuffle_list list="$Definition.$ThreadData.$WarFront.$HostInvasions"/>
<do_all exact="$Definition.$ThreadData.$WarFront.$HostInvasions.count" counter="$i">
<do_if value="$Definition.$ThreadData.$WarFront.$HostInvasions.{$i}.exists">
<set_value name="$InvasionCue" exact="$Definition.$ThreadData.$WarFront.$HostInvasions.{$i}"/>
<set_value name="$Valid" exact="2" comment="Valid mission variables"/>
<break/>
</do_if>
</do_all>
</do_if>
</actions>
</library>
<cue name="Support_Invasion__Standard" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
<!--Signal the static cue to trigger a new instance of this mission.
Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
</conditions>
<actions>
<set_value name="$Definition" exact="event.param"/>
<set_value name="$Page" exact="$Definition.$Page"/>
<set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
<set_value name="$FollowUp" exact="@$Definition.$FollowUp == true" comment="Does this mission follow directly after another, with parameters potentially passing between them. This changes how this mission is spawned and managed."/>
<set_value name="$SuccessfullyGenerated" exact="false"/>
<set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
<assert value="not $FollowUp" text="'This mission does not currently have any parameters where it makes sense as a follow up mission. If there is, adjust the _Activate_FollowUp cue and remove this assert [Owen]'"/>
<!--This mission is specific enough that it will only run if a matching text offset is found. If not, the offer will abort with an error.
$Valid:
0: Page/TextOffset not handled
1: Correct Page/TextOffset but unable to setup mission
2: Mission can attempt to be spawned -->
<set_value name="$Valid" exact="0"/>
<!--### ARGON VS XENON ###-->
<do_if value="$Page == 30210">
<do_if value="$TextOffset == 109000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Support_Invasion__Get_Invasion"/>
</do_if>
</do_if>
<!--### ARGON VS HOLY ORDER ###-->
<do_elseif value="$Page == 30211">
<do_if value="$TextOffset == 109000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Support_Invasion__Get_Invasion"/>
</do_if>
</do_elseif>
<!--### PARANID VS HOLY ORDER ###-->
<do_elseif value="$Page == 30212">
<do_if value="$TextOffset == 109000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Support_Invasion__Get_Invasion"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS ARGON ###-->
<do_elseif value="$Page == 30213">
<do_if value="$TextOffset == 109000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Support_Invasion__Get_Invasion"/>
</do_if>
</do_elseif>
<!--### HOLY ORDER VS PARANID ###-->
<do_elseif value="$Page == 30214">
<do_if value="$TextOffset == 109000">
<set_value name="$Valid" exact="1" comment="Valid text offset"/>
<include_actions ref="Support_Invasion__Get_Invasion"/>
</do_if>
</do_elseif>
<do_if value="$Valid == 2">
<do_if value="$FollowUp">
<!--Followup missions use the namespace as the mission cue-->
<set_value name="$MissionCue" exact="namespace"/>
</do_if>
<do_else>
<set_value name="$MissionCue" exact="null"/>
</do_else>
</do_if>
<do_else>
<do_if value="$Valid == 1">
<debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
</do_if>
<do_else>
<assert value="false" text="'Attempting to spawn a mission on ' + this + ' but the combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + ' do not match any definitions [Owen]'"/>
</do_else>
<signal_cue cue="$Definition.$SpawnFailedCue"/>
<cancel_cue cue="this"/>
</do_else>
</actions>
<cues>
<cue name="Support_Invasion__Standard_FollowUp_Manager" onfail="cancel">
<conditions>
<check_value value="$FollowUp"/>
</conditions>
<actions>
<!--If this is going to be a followup mission, first, inform the mission thread manager of this submission so it can be displayed in the offer.-->
<!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
<set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
<set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
<debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
<set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
<signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
</actions>
<cues>
<cue name="Support_Invasion__Standard_FollowUp_Offer_Accepted">
<conditions>
<event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
<check_value value="event.param == $MissionCue"/>
</conditions>
<actions>
<!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
TODO @Owen Move this to a library in the GM file?-->
<create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.fight">
<briefing>
<!--TODO @Owen Better objective?-->
<objective step="1" action="objective.secure" object="$InvasionCue.$Target"/>
</briefing>
</create_mission>
</actions>
</cue>
<cue name="Support_Invasion__Standard_Aborted">
<conditions>
<event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
</conditions>
<actions>
<cancel_cue cue="namespace"/>
</actions>
</cue>
<!--namespace signalled to activate followup mission
event.param = Station to supply-->
<cue name="Support_Invasion__Standard_Activate_FollowUp">
<conditions>
<event_cue_signalled cue="namespace"/>
</conditions>
<actions>
<!--Check that the correct parameters have been passed-->
<do_if value="false">
<!--Currently no followup case for this type of mission-->
<signal_cue cue="Support_Invasion__Standard_Create_GM"/>
<cancel_cue cue="parent"/>
</do_if>
<do_else>
<assert value="false" text="namespace + ' was signalled to start a followup mission, but the passed parameter ' + event.param + ' was not what this mission was expecting. Ending mission.'"/>
<!--TODO @Owen what if there is another followup mission?-->
<signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
<cancel_cue cue="namespace"/>
</do_else>
</actions>
</cue>
</cues>
</cue>
<cue name="Support_Invasion__Standard_Not_FollowUp" onfail="cancel">
<conditions>
<check_value value="not $FollowUp"/>
</conditions>
<actions>
<signal_cue cue="Support_Invasion__Standard_Create_GM"/>
</actions>
</cue>
<cue name="Support_Invasion__Standard_Create_GM">
<conditions>
<event_cue_signalled/>
</conditions>
<cues>
<!-- Trigger actual GM, passing the specified parameters -->
<cue name="Support_Invasion__Standard_Ref" ref="md.GM_Support_Invasion.Start">
<param name="Client" value="$Definition.$ThreadData.$Contact"/>
<param name="MissionCue" value="$MissionCue"/>
<param name="MissionThread" value="$Definition.$ThreadCue"/>
<param name="ReportSignalCue" value="Support_Invasion__Standard_GM_Event" comment="tell GM to call this cue when done"/>
<param name="WithoutOffer" value="true"/>
<param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
<param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
<param name="Page" value="$Page"/>
<param name="TextOffset" value="$TextOffset"/>
<param name="MissionLevel" value="4"/>
<param name="Difficulty" value="level.hard"/>
<param name="InvasionCue" value="$InvasionCue"/>
<param name="DebugChance" value="$DebugChance"/>
</cue>
<!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
<cue name="Support_Invasion__Standard_GM_Event" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<include_actions ref="MM__Standard_GM_Event"/>
</actions>
</cue>
</cues>
</cue>
</cues>
</cue>
</cues>
</replace>
</diff>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment