· 7 years ago · Dec 19, 2018, 10:58 PM
1<?xml version="1.0" encoding="utf-8"?>
2<diff>
3 <replace sel="/mdscript/cues">
4 <cues>
5 <cue name="Start" namespace="this">
6 <conditions>
7 <event_cue_completed cue="md.Setup.Start"/>
8 </conditions>
9 <actions>
10 <set_value name="$DebugChance" exact="100"/>
11 <set_value name="$DebugChance2" exact="100"/>
12
13 <set_value name="$MissionGroupCues" exact="table[]"/>
14 <set_value name="$Threads" exact="[]"/>
15 <set_value name="$ThreadDefinitions" exact="table[]"/>
16 <set_value name="$ActiveThreads" exact="[]" comment="List of instanced thread cues of md.MC_Management.Thread_Manager"/>
17 <set_value name="$WarFronts" exact="table[]"/>
18 <set_value name="$NonSubscriptionWars" exact="table[]"/>
19
20 <debug_text text="'War Subscriptions Starting'" />
21 </actions>
22 <cues>
23 <!--War text pages
24 Argon Vs Xenon
25 Text: 30210
26 Rep voice: 10110
27
28 Argon Vs Holy Order
29 Text: 30211
30 Rep voice: 10101
31
32 Paranid Vs Holy Order
33 Text: 30212
34 Rep voice: 10304
35
36 Holy Order Vs Argon
37 Text: 30213
38 Rep voice: 10305
39
40 Holy Order Vs Paranid
41 Text: 30214
42 Rep voice: 10307-->
43
44 <cue name="DefineNonSubscriptionWars">
45 <actions>
46 <set_value name="$NonSubscriptionWars.{faction.antigone}" exact="[faction.holyorder, faction.xenon]"/>
47 <set_value name="$NonSubscriptionWars.{faction.holyorder}" exact="[faction.antigone, faction.ministry, faction.teladi, faction.xenon]"/>
48 <set_value name="$NonSubscriptionWars.{faction.ministry}" exact="[faction.holyorder, faction.xenon]"/>
49 <set_value name="$NonSubscriptionWars.{faction.teladi}" exact="[faction.holyorder, faction.xenon]"/>
50 </actions>
51 </cue>
52
53 <!--
54 ###################################
55 ARGON VS XENON
56 ###################################-->
57 <cue name="ARG_VS_XENON" namespace="this">
58 <actions>
59 <!--Common values-->
60 <set_value name="$ManagerCue" exact="parent.namespace"/>
61 <set_value name="$Faction" exact="faction.argon"/>
62 <set_value name="$EnemyFaction" exact="faction.xenon"/>
63 <set_value name="$MissionGroup" exact="missiongroup.argon_war_xenon"/>
64 <set_value name="$Mission_Contact" exact="null"/>
65 <set_value name="$Page" exact="30210" comment="Argon-Xenon-War page"/>
66 <set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
67 <set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
68 <set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
69 <set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
70
71 <!--Status-->
72 <set_value name="$SubscriptionStatus" exact="null"/>
73 <set_value name="$IntroducedToContact" exact="false"/>
74 <set_value name="$JobsDescribed" exact="false"/>
75 <set_value name="$ConflictDescribed" exact="false"/>
76 <set_value name="$IntroMissionSuccessful" exact="false"/>
77 <set_value name="$CooldownTime" exact="-1s"/>
78
79 <!--Stats-->
80 <set_value name="$ThreadsCompleted" exact="0"/>
81 <set_value name="$ThreadsFailed" exact="0"/>
82
83 <set_value name="$MissionsCompleted" exact="0"/>
84 <set_value name="$MissionsFailed" exact="0"/>
85 </actions>
86 <cues>
87 <cue name="ARG_VS_XENON_Init">
88 <actions>
89 <set_value name="$ContactCreatorCue" exact="ARG_VS_XENON_Create_Contact"/>
90 <set_value name="$IntroMissionCue" exact="ARG_VS_XENON_Introduction"/>
91
92 <!--$SubscriptionStatus:
93 - 'unsubscribed'
94 - 'probation'
95 - 'subscribed'
96 - 'cooldown'-->
97 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'unsubscribed'"/>
98 </actions>
99 </cue>
100
101 <!--
102 ####################
103 DEBUG
104 ####################-->
105 <cue name="ARG_VS_XENON_Debug_Reset">
106 <conditions>
107 <event_cue_signalled/>
108 </conditions>
109 <actions>
110 <do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
111 <do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
112 <signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
113 </do_if>
114 </do_all>
115 <set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
116 <do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
117 <do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
118 <remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
119 </do_if>
120 </do_all>
121 <do_if value="$Mission_Contact.isclass.npc">
122 <destroy_object object="$Mission_Contact"/>
123 </do_if>
124 <set_value name="$Mission_Contact" exact="null"/>
125 <reset_cue cue="namespace"/>
126 <reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
127 </actions>
128 </cue>
129
130 <cue name="ARG_VS_XENON_Debug_Subscribe" instantiate="true">
131 <conditions>
132 <event_cue_signalled/>
133 </conditions>
134 <actions>
135 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'subscribed'"/>
136 </actions>
137 </cue>
138
139 <!--
140 ####################
141 SUBSCRIPTION
142 ####################-->
143
144 <!--event.param == new status-->
145 <cue name="ARG_VS_XENON_Set_Subscription_Status" instantiate="true">
146 <conditions>
147 <event_cue_signalled/>
148 </conditions>
149 <actions>
150 <do_if value="
151 event.param == 'unsubscribed' or
152 event.param == 'probation' or
153 event.param == 'subscribed' or
154 event.param == 'cooldown'">
155
156 <debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
157 <set_value name="$SubscriptionStatus" exact="event.param"/>
158
159 <!--Be careful with state change handlers here if the requested state was the same as the previous one-->
160 <do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
161 <unlock_achievement name="JOIN_WAR" />
162 <signal_cue cue="CalculateThreads"/>
163 </do_if>
164 <do_elseif value="event.param == 'cooldown'">
165 <!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
166 <set_value name="$CooldownTime" exact="player.age + 5min"/>
167 </do_elseif>
168 </do_if>
169 <do_else>
170 <assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
171 </do_else>
172 </actions>
173 </cue>
174
175 <cue name="ARG_VS_XENON_Check_Cooldown" instantiate="true" checkinterval="5s">
176 <conditions>
177 <check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
178 </conditions>
179 <actions>
180 <debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
181 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'subscribed'"/>
182 </actions>
183 </cue>
184
185 <!--
186 ####################
187 CONTACT
188 ####################-->
189
190 <!--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)-->
191 <cue name="ARG_VS_XENON_Create_Contact">
192 <conditions>
193 <event_cue_signalled/>
194 </conditions>
195 <actions>
196 <set_value name="this.$SelectedSpace" exact="null"/>
197 <do_if value="event.param and typeof event.param == datatype.table">
198 <set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
199 <do_all exact="this.$HostSectorKeys.count" counter="$i">
200 <do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
201 <!--Select a sector with stations and a high security value-->
202 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
203 <match_content class="class.walkablemodule"/>
204 </find_station>
205 <do_if value="this.$PotentialStation">
206 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
207 <break/>
208 </do_if>
209 </do_if>
210 </do_all>
211 <do_if value="not this.$SelectedSpace">
212 <!--Simply select the furthest sector with stations-->
213 <do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
214 <!--TODO @Owen - attempt to find major stations first-->
215 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
216 <match_content class="class.walkablemodule"/>
217 </find_station>
218 <do_if value="this.$PotentialStation">
219 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
220 <break/>
221 </do_if>
222 </do_all>
223 </do_if>
224 </do_if>
225
226 <do_if value="not this.$SelectedSpace">
227 <find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
228 <match_content class="class.walkablemodule"/>
229 </find_station>
230 <do_if value="this.$PotentialStation">
231 <set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
232 <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"/>
233 </do_if>
234 </do_if>
235 <do_if value="this.$SelectedSpace">
236 <find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
237 <match_content class="class.walkablemodule"/>
238 </find_station>
239 <assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
240 <do_if value="$PlacementObject">
241 <create_cue_actor name="$Mission_Contact" cue="namespace" group="argon.factionrepresentative.female">
242 <page exact="10110"/>
243 <owner exact="$Faction"/>
244 </create_cue_actor>
245 <do_if value="$Mission_Contact">
246 <set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
247 <set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
248 <debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
249 </do_if>
250 </do_if>
251 </do_if>
252
253 <assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
254 <do_if value="not $Mission_Contact">
255 <reset_cue cue="this"/>
256 </do_if>
257 </actions>
258 <cues>
259 <cue name="ARG_VS_XENON_Place_Contact_Init">
260 <actions>
261 <do_if value="$PlacementObject.attention ge attention.nearby">
262 <signal_cue cue="ARG_VS_XENON_Place_Contact_Create_Interior"/>
263 </do_if>
264 </actions>
265 </cue>
266
267 <cue name="ARG_VS_XENON_Place_Contact_Create_Interior">
268 <conditions>
269 <check_any>
270 <event_cue_signalled/>
271 <check_all>
272 <event_object_changed_attention object="$PlacementObject"/>
273 <check_value value="event.param ge attention.nearby"/>
274 </check_all>
275 </check_any>
276 </conditions>
277 <actions>
278 <debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
279 <get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
280 <do_if value="$StartCorridorMacro">
281 <get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" />
282 </do_if>
283
284 <get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
285 <do_if value="$StartRoomMacro">
286 <get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" />
287 </do_if>
288
289 <create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30210,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
290 <assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
291 <do_if value="$DynamicInterior">
292 <find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
293 <assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
294 <do_if value="$NPC_Slot">
295 <add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
296 <debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
297 </do_if>
298 </do_if>
299 </actions>
300 <cues>
301 <cue name="ARG_VS_XENON_Place_Contact_WithinDynamicInterior_Destroy">
302 <conditions>
303 <event_object_interiors_despawning object="$PlacementObject"/>
304 </conditions>
305 <actions>
306 <debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
307 <remove_actor_from_room actor="$Mission_Contact"/>
308
309 <destroy_object object="$DynamicInterior"/>
310 <remove_value name="$DynamicInterior"/>
311 <remove_value name="$DynamicCorridor"/>
312 <remove_value name="$DynamicRoom"/>
313 <reset_cue cue="ARG_VS_XENON_Place_Contact_Create_Interior"/>
314 </actions>
315 </cue>
316 </cues>
317 </cue>
318
319 <cue name="ARG_VS_XENON_Contact_Killed">
320 <conditions>
321 <event_object_destroyed object="$Mission_Contact"/>
322 </conditions>
323 <actions>
324 <set_value name="$Mission_Contact" exact="null"/>
325 <reset_cue cue="ARG_VS_XENON_Create_Contact"/>
326 </actions>
327 </cue>
328
329 <cue name="ARG_VS_XENON_Contact_Conversation_Started" instantiate="true">
330 <conditions>
331 <check_any>
332 <event_conversation_started actor="$Mission_Contact" />
333 <event_conversation_returned_to_section actor="$Mission_Contact" />
334 </check_any>
335 <check_value value="event.param == 'default'" />
336 </conditions>
337 <actions>
338 <do_if value="event.name == 'event_conversation_started'">
339 <do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
340 <do_if value="player.entity.isfemale">
341 <add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
342 </do_if>
343 <do_else>
344 <add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
345 </do_else>
346 </do_if>
347 <do_else>
348 <!--More familiar greeting-->
349 <add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
350 </do_else>
351 </do_if>
352
353 <include_actions ref="ARG_VS_XENON_Contact_Player_Lines"/>
354 </actions>
355 </cue>
356
357 <library name="ARG_VS_XENON_Contact_Player_Lines">
358 <actions>
359 <!--Specific sections-->
360 <do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
361 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
362 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
363 </do_if>
364 </do_if>
365 <do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
366 <add_player_choice text="{1002,3021002}" section="war_subscribe_ask_conflict" comment="What can you tell me about them?"/>
367 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
368 </do_elseif>
369 <do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
370 <add_player_choice text="{1002,3021003}" section="war_subscribe_ask_conflict_2" comment="What can we do?"/>
371 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
372 </do_elseif>
373 <do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict_2'">
374 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
375 </do_elseif>
376
377 <!--Start or other sections-->
378 <do_else>
379 <do_if value="$SubscriptionStatus == 'unsubscribed'">
380 <do_if value="ARG_VS_XENON_Introduction.state == cuestate.waiting">
381 <!--Intro mission is not in a state where the player can take it.-->
382 <!--TODO @Owen - voice lines on rejecting the player?-->
383 <add_player_choice text="{1002,3021101}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
384 </do_if>
385 <do_elseif value="$IntroducedToContact">
386 <do_if value="$JobsDescribed">
387 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
388 <add_player_choice text="{1002,3021102}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
389 </do_if>
390 <do_else>
391 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
392 </do_else>
393 </do_elseif>
394 <do_else>
395 <add_player_choice text="{1002,3021001}" section="war_subscribe_request" comment="I'm here to help with the Xenon."/>
396 </do_else>
397 </do_if>
398 <do_elseif value="$SubscriptionStatus == 'probation'">
399 <do_if value="$IntroMissionSuccessful">
400 <add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
401 </do_if>
402 <do_else>
403 <add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
404 </do_else>
405 </do_elseif>
406 </do_else>
407 </actions>
408 </library>
409
410 <cue name="ARG_VS_XENON_Contact_NextSection" instantiate="true">
411 <conditions>
412 <event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
413 </conditions>
414 <actions>
415 <set_value name="$AddPlayerChoices" exact="true"/>
416 <set_value name="$IsXenonSlayer" exact="player.name == 'Xenon Slayer'"/>
417 <!--TODO @Owen statistic counting of how many Xenon have been killed. If >100, play this line-->
418 <!--Xenon Slayer easter egg-->
419 <do_if value="event.param == 'war_subscribe_request'">
420 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
421 <set_value name="$IntroducedToContact" exact="true"/>
422 <add_npc_line speaker="$Mission_Contact" line="30210001" hidechoices="true" comment="Ah, nice to meet you."/>
423 <add_npc_line speaker="$Mission_Contact" line="30210002" hidechoices="true" comment="My job here is to help coordinate our efforts against the Xenon..."/>
424 <do_if value="player.entity.race == race.argon">
425 <!--Argon citizen-->
426 <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."/>
427 </do_if>
428 <do_else>
429 <!--Argon friend-->
430 <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."/>
431 </do_else>
432
433 <add_npc_line speaker="$Mission_Contact" line="30210005" hidechoices="true" comment="There is a great need for pilots like you."/>
434 <add_npc_line speaker="$Mission_Contact" line="30210006" hidechoices="true" comment="Probation line 1"/>
435 <add_npc_line speaker="$Mission_Contact" line="30210007" hidechoices="true" comment="Probation line 2"/>
436 <do_if value="$IsXenonSlayer">
437 <add_npc_line speaker="$Mission_Contact" line="30210008" hidechoices="true" comment="Looking at your records, I see you consider yourself a 'Xenon Slayer'..."/>
438 </do_if>
439 <do_else>
440 <add_npc_line speaker="$Mission_Contact" line="30210009" hidechoices="true" comment="Probation line 3"/>
441 <add_npc_line speaker="$Mission_Contact" line="30210010" hidechoices="true" comment="Any questions?"/>
442 </do_else>
443 </do_if>
444 <do_else>
445 <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."/>
446 </do_else>
447 </do_if>
448 <do_elseif value="event.param == 'war_subscribe_ask_intro'">
449 <set_value name="$JobsDescribed" exact="true"/>
450 <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..."/>
451 <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."/>
452 </do_elseif>
453 <do_elseif value="event.param == 'war_subscribe_ask_conflict'">
454 <set_value name="$ConflictDescribed" exact="true"/>
455 <do_if value="$IsXenonSlayer">
456 <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."/>
457 </do_if>
458 <add_npc_line speaker="$Mission_Contact" line="30210014" hidechoices="true" comment="Conflict desc 1"/>
459 <add_npc_line speaker="$Mission_Contact" line="30210015" hidechoices="true" comment="Conflict desc 2"/>
460 <add_npc_line speaker="$Mission_Contact" line="30210016" hidechoices="true" comment="Conflict desc 3"/>
461 </do_elseif>
462 <do_elseif value="event.param == 'war_subscribe_ask_conflict_2'">
463 <add_npc_line speaker="$Mission_Contact" line="30210017" hidechoices="true" comment="Conflict desc 4"/>
464 <add_npc_line speaker="$Mission_Contact" line="30210018" hidechoices="true" comment="Conflict desc 5"/>
465 <add_npc_line speaker="$Mission_Contact" line="30210019" hidechoices="true" comment="Anything else?"/>
466 </do_elseif>
467 <do_elseif value="event.param == 'war_subscribe_request_2'">
468 <!--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.-->
469 <include_actions ref="ARG_VS_XENON_Can_Activate_Introduction"/>
470 <do_if value="$CanActivateIntro">
471 <signal_cue cue="ARG_VS_XENON_Introduction"/>
472 <add_npc_line speaker="$Mission_Contact" line="30210001" hidechoices="true" comment="Ah, very good."/>
473 </do_if>
474 <do_else>
475 <set_value name="$AddPlayerChoices" exact="false"/>
476 <add_npc_line speaker="$Mission_Contact" line="30210027" hidechoices="true" comment="Sorry. We're still reviewing your performance from the last time."/>
477 </do_else>
478 </do_elseif>
479 <do_elseif value="event.param == 'war_subscribe_start_intro'">
480 <set_value name="$AddPlayerChoices" exact="false"/>
481 <signal_cue cue="ARG_VS_XENON_Player_Requested_Subscription"/>
482 <add_npc_line speaker="$Mission_Contact" line="30210020" hidechoices="true" comment="Alright. I'll have a suitable task picked out for you momentarily."/>
483 <add_npc_line speaker="$Mission_Contact" line="30210021" hidechoices="true" comment="Stay safe out there, pilot."/>
484 </do_elseif>
485 <do_elseif value="event.param == 'war_intro_complete'">
486 <set_value name="$AddPlayerChoices" exact="false"/>
487 <add_npc_line speaker="$Mission_Contact" line="30210022" hidechoices="true" comment="Yes, I saw. Good work."/>
488 <add_npc_line speaker="$Mission_Contact" line="30210023" hidechoices="true" comment="You will now find tasks related to the Xenon in your mission interface."/>
489 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'subscribed'"/>
490 </do_elseif>
491 <do_elseif value="event.param == 'war_abort_intro'">
492 <set_value name="$AddPlayerChoices" exact="false"/>
493 <signal_cue cue="ARG_VS_XENON_Player_Requests_Intro_Abort"/>
494 </do_elseif>
495
496 <do_if value="$AddPlayerChoices">
497 <include_actions ref="ARG_VS_XENON_Contact_Player_Lines"/>
498 </do_if>
499 </actions>
500 </cue>
501 </cues>
502 </cue>
503
504
505 <!--event.param = table[
506 $cue = thread cue namespace,
507 $completedmissions = number of completed missions,
508 $failedmissions = number of failed missions]-->
509 <cue name="ARG_VS_XENON_Thread_Finished" instantiate="true">
510 <conditions>
511 <event_cue_signalled cue="Cleanup_Thread"/>
512 <!--<debug_text text="event.param.$cue.$Definition.$MissionGroup"/>
513 <debug_text text="$MissionGroup"/>-->
514 <check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
515 <!--<debug_text text="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>-->
516 <check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
517 </conditions>
518 <actions>
519 <debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
520
521 <set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
522 <set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
523
524 <do_if value="$MissionsCompleted ge 20">
525 <unlock_achievement name="WAR_MISSIONS" />
526 </do_if>
527
528 <do_if value="event.param.$failed">
529 <set_value name="$ThreadsFailed" operation="add"/>
530 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'cooldown'"/>
531 </do_if>
532 <do_else>
533 <set_value name="$ThreadsCompleted" operation="add"/>
534 <signal_cue cue="CalculateThreads"/>
535 </do_else>
536
537 </actions>
538 </cue>
539
540 <!--
541 ####################
542 INTRODUCTION
543 ####################-->
544
545 <cue name="ARG_VS_XENON_Player_Requested_Subscription" instantiate="true">
546 <conditions>
547 <event_cue_signalled/>
548 </conditions>
549 </cue>
550
551 <cue name="ARG_VS_XENON_Player_Requests_Intro_Abort" instantiate="true">
552 <conditions>
553 <event_cue_signalled/>
554 </conditions>
555 </cue>
556
557 <library name="ARG_VS_XENON_Can_Activate_Introduction">
558 <actions>
559 <!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
560 <set_value name="$CanActivateIntro" exact="false"/>
561 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
562 <set_value name="$CanActivateIntro" exact="true"/>
563 </do_if>
564 </actions>
565 </library>
566
567 <cue name="ARG_VS_XENON_Introduction" version="2">
568 <conditions>
569 <event_cue_signalled/>
570 </conditions>
571 <actions>
572 <debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
573 <set_value name="$MissionIntroCue" exact="this"/>
574 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'unsubscribed'"/>
575 </actions>
576 <patch sinceversion="2" state="complete">
577 <do_if value="$SubscriptionStatus == 'cooldown'">
578 <debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
579 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'unsubscribed'"/>
580 </do_if>
581 </patch>
582 <cues>
583 <cue name="ARG_VS_XENON_Introduction_Init">
584 <actions>
585 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
586 <signal_cue cue="ARG_VS_XENON_Introduction_Create_Offer"/>
587 </do_if>
588 </actions>
589 </cue>
590
591 <cue name="ARG_VS_XENON_Introduction_Create_Offer">
592 <conditions>
593 <check_any>
594 <check_all>
595 <event_player_relation_changed faction="$Faction"/>
596 <check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
597 </check_all>
598 <event_cue_signalled/>
599 </check_any>
600 </conditions>
601 <actions>
602 <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]'"/>
603 <do_if value="not $Mission_Contact.isclass.npc">
604 <signal_cue_instantly cue="$ContactCreatorCue"/>
605 </do_if>
606
607 <do_if value="$Mission_Contact">
608 <debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
609 <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">
610 <briefing>
611 <objective step="1" action="objective.talkto" object="$Mission_Contact"/>
612 </briefing>
613 </create_offer>
614 </do_if>
615 <do_else>
616 <debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
617 <reset_cue cue="$MissionIntroCue"/>
618 </do_else>
619 </actions>
620 <cues>
621 <cue name="ARG_VS_XENON_Introduction_Offer_Accepted">
622 <conditions>
623 <event_object_signalled object="$Mission_Contact" param="'accept'" />
624 </conditions>
625 <actions>
626 <create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
627 <update_mission cue="$MissionIntroCue">
628 <briefing>
629 <objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
630 </briefing>
631 </update_mission>
632 <remove_offer cue="$MissionIntroCue"/>
633 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
634 $actor = $Mission_Contact,
635 $object = $PlacementObject,
636 $missioncue = $MissionIntroCue,
637 $cancelcue = ARG_VS_XENON_Cancel_Intro_Talkto,
638 $objective = objective.talkto,
639 $debugchance = $DebugChance]"/>
640 </actions>
641 </cue>
642 </cues>
643 </cue>
644
645 <cue name="ARG_VS_XENON_Intro_Abort">
646 <conditions>
647 <check_any>
648 <event_mission_aborted cue="ARG_VS_XENON_Introduction"/>
649 <event_cue_signalled cue="ARG_VS_XENON_Player_Requests_Intro_Abort"/>
650 </check_any>
651 </conditions>
652 <actions>
653 <do_if value="$MissionIntroCue.hasmission">
654 <remove_mission cue="$MissionIntroCue" type="aborted"/>
655 </do_if>
656 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'unsubscribed'"/>
657 <reset_cue cue="ARG_VS_XENON_Introduction"/>
658 </actions>
659 </cue>
660
661 <cue name="ARG_VS_XENON_Cancel_Intro_Talkto" instantiate="true">
662 <conditions>
663 <event_cue_signalled/>
664 </conditions>
665 </cue>
666
667 <cue name="ARG_VS_XENON_Start_Intro_Mission">
668 <conditions>
669 <event_cue_signalled cue="ARG_VS_XENON_Player_Requested_Subscription"/>
670 </conditions>
671 <actions>
672 <signal_cue cue="ARG_VS_XENON_Cancel_Intro_Talkto"/>
673 <signal_cue_instantly cue="ARG_VS_XENON_Set_Subscription_Status" param="'probation'"/>
674 <set_value name="$IntroMissionSuccessful" exact="false"/>
675
676 <do_if value="$MissionIntroCue.hasmissionoffer">
677 <remove_offer cue="$MissionIntroCue"/>
678 </do_if>
679
680 <do_if value="not $MissionIntroCue.hasmission">
681 <create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30210}.{10}" description="readtext.{30210}.{11}" difficulty="level.easy" faction="faction.argon" group="$MissionGroup"/>
682 </do_if>
683
684 <create_ship name="$TestShip" zone="player.zone">
685 <select faction="faction.xenon" size="class.ship_s"/>
686 <owner exact="faction.xenon"/>
687 <pilot actor="null"/>
688 <safepos object="player.entity" min="30km" max="40km"/>
689 </create_ship>
690
691 <update_mission cue="$MissionIntroCue">
692 <briefing>
693 <objective step="1" action="objective.destroy" object="$TestShip"/>
694 </briefing>
695 </update_mission>
696 <set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
697 </actions>
698 <cues>
699 <cue name="ARG_VS_XENON_Start_Intro_Mission_Successful">
700 <conditions>
701 <event_object_destroyed object="$TestShip"/>
702 </conditions>
703 <actions>
704 <update_mission cue="$MissionIntroCue">
705 <briefing>
706 <objective step="2" action="objective.talkto" object="$Mission_Contact"/>
707 </briefing>
708 </update_mission>
709 <set_value name="$IntroMissionSuccessful" exact="true"/>
710 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
711 $actor = $Mission_Contact,
712 $object = $PlacementObject,
713 $missioncue = $MissionIntroCue,
714 $cancelcue = ARG_VS_XENON_Start_Intro_Mission_Remove_Mission,
715 $objective = objective.talkto,
716 $step = 2,
717 $debugchance = $DebugChance]"/>
718 </actions>
719 </cue>
720
721 <cue name="ARG_VS_XENON_Start_Intro_Mission_Remove_Mission">
722 <conditions>
723 <event_cue_signalled/>
724 </conditions>
725 <actions>
726 <remove_mission cue="$MissionIntroCue" type="completed"/>
727 <reset_cue cue="ARG_VS_XENON_Introduction"/>
728 </actions>
729 </cue>
730
731 <cue name="ARG_VS_XENON_Start_Intro_Mission_End">
732 <conditions>
733 <event_conversation_started actor="$Mission_Contact"/>
734 </conditions>
735 <actions>
736 <signal_cue cue="ARG_VS_XENON_Start_Intro_Mission_Remove_Mission"/>
737 </actions>
738 </cue>
739 </cues>
740 </cue>
741 </cues>
742 </cue>
743
744 <!--
745 ####################
746 THREADS
747 ####################-->
748 <cue name="ARG_VS_XENON_Reinforce_Defence">
749 <cues>
750 <cue name="ARG_VS_XENON_Reinforce_Defence_Register">
751 <actions>
752 <!--Argon Vs Xenon - Reinforce Defence-->
753 <set_value name="$ThreadID" exact="'$arg_vs_xenon_reinforce_defence'"/>
754 <set_value name="$Thread" exact="table[
755 $ID = $ThreadID,
756 $Faction = $Faction,
757 $EnemyFaction = $EnemyFaction,
758 $MissionGroup = $MissionGroup,
759 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
760 $ThreadType = 'sequential',
761 $MissionType = missiontype.protect,
762 $Difficulty = level.medium,
763 $SubMissionLib = ARG_VS_XENON_Reinforce_Defence_Get_Submissions,
764 $NameLib = ARG_VS_XENON_Reinforce_Defence_Construct_Name,
765 $DescriptionLib = ARG_VS_XENON_Reinforce_Defence_Construct_Description,
766 $MinMissions = 4,
767 $MaxMissions = 5,
768 $ThreadAbortRelation = -0.00064]"/>
769
770 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
771 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
772 </actions>
773 </cue>
774
775 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
776 <library name="ARG_VS_XENON_Reinforce_Defence_Get_Submissions">
777 <actions>
778 <set_value name="$Submissions" exact="table[]"/>
779 <set_value name="$Submissions.$deploy_lasertowers"
780 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [101000], $Sequence = -1 ]"/>
781 <set_value name="$Submissions.$deploy_mines"
782 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
783 <set_value name="$Submissions.$achieve_coverage__host_sector"
784 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [102000], $Sequence = -1 ]"/>
785 <set_value name="$Submissions.$repair__damagedship"
786 exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30210, $TextOffset = [103000], $Sequence = -1 ]"/>
787 <set_value name="$Submissions.$taxi__specialist"
788 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30210, $TextOffset = [104000], $Sequence = -1 ]"/>
789 <set_value name="$Submissions.$deliver__crew"
790 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30210, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
791
792 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
793 </actions>
794 </library>
795
796 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
797 <library name="ARG_VS_XENON_Reinforce_Defence_Construct_Name">
798 <actions>
799 <do_any>
800 <set_value name="this.$Name" exact="{30210, 3000}"/>
801 <set_value name="this.$Name" exact="{30210, 3001}"/>
802 <set_value name="this.$Name" exact="{30210, 3002}"/>
803 </do_any>
804 </actions>
805 </library>
806
807 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
808 <library name="ARG_VS_XENON_Reinforce_Defence_Construct_Description">
809 <actions>
810 <do_if value="$ThreadMood == 'negative'">
811 <do_any>
812 <set_value name="this.$Description" exact="{30210, 3101}"/>
813 <set_value name="this.$Description" exact="{30210, 3102}"/>
814 </do_any>
815
816 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 3111}"/>
817
818 <do_any>
819 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 3121}"/>
820 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 3122}"/>
821 </do_any>
822 </do_if>
823 <do_elseif value="$ThreadMood == 'positive'">
824 <do_any>
825 <set_value name="this.$Description" exact="{30210, 3201}"/>
826 <set_value name="this.$Description" exact="{30210, 3202}"/>
827 </do_any>
828
829 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 3211}"/>
830 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 3221}"/>
831 </do_elseif>
832 </actions>
833 </library>
834 </cues>
835 </cue>
836
837 <cue name="ARG_VS_XENON_Construct_Defence">
838 <cues>
839 <cue name="ARG_VS_XENON_Construct_Defence_Register" version="2">
840 <actions>
841 <!--Argon Vs Xenon - Construct Defence-->
842 <set_value name="$ThreadID" exact="'$arg_vs_xenon_construct_defence'"/>
843 <set_value name="$Thread" exact="table[
844 $ID = $ThreadID,
845 $Faction = $Faction,
846 $EnemyFaction = $EnemyFaction,
847 $MissionGroup = $MissionGroup,
848 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
849 $ThreadType = 'sequential',
850 $MissionType = missiontype.build,
851 $Difficulty = level.medium,
852 $SubMissionLib = ARG_VS_XENON_Construct_Defence_Get_Submissions,
853 $NameLib = ARG_VS_XENON_Construct_Defence_Construct_Name,
854 $DescriptionLib = ARG_VS_XENON_Construct_Defence_Construct_Description,
855 $MinMissions = 1,
856 $MaxMissions = 2,
857 $ThreadAbortRelation = -0.00064]"/>
858
859 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
860 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
861 </actions>
862 <patch sinceversion="2">
863 <append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
864 </patch>
865 </cue>
866
867 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
868 <library name="ARG_VS_XENON_Construct_Defence_Get_Submissions">
869 <actions>
870 <set_value name="$Submissions" exact="table[]"/>
871 <set_value name="$Submissions.$build__defencestation"
872 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30210, $TextOffset = [105000], $Sequence = -1 ]"/>
873 <set_value name="$Submissions.$build__fleet"
874 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30210, $TextOffset = [120000], $Sequence = -1 ]"/>
875
876 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
877 </actions>
878 </library>
879
880 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
881 <library name="ARG_VS_XENON_Construct_Defence_Construct_Name">
882 <actions>
883 <do_any>
884 <set_value name="this.$Name" exact="{30210, 4000}"/>
885 <set_value name="this.$Name" exact="{30210, 4001}"/>
886 </do_any>
887 </actions>
888 </library>
889
890 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
891 <library name="ARG_VS_XENON_Construct_Defence_Construct_Description">
892 <actions>
893 <do_if value="$ThreadMood == 'negative'">
894 <do_any>
895 <set_value name="this.$Description" exact="{30210, 4101}"/>
896 <set_value name="this.$Description" exact="{30210, 4102}"/>
897 </do_any>
898
899 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 4111}"/>
900
901 <do_any>
902 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 4121}"/>
903 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 4122}"/>
904 </do_any>
905 </do_if>
906 <do_elseif value="$ThreadMood == 'positive'">
907 <do_any>
908 <set_value name="this.$Description" exact="{30210, 4201}"/>
909 <set_value name="this.$Description" exact="{30210, 4202}"/>
910 </do_any>
911
912 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 4211}"/>
913 <do_any>
914 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 4221}"/>
915 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 4222}"/>
916 </do_any>
917 </do_elseif>
918 </actions>
919 </library>
920 </cues>
921 </cue>
922
923 <cue name="ARG_VS_XENON_Secure_Resources">
924 <cues>
925 <cue name="ARG_VS_XENON_Secure_Resources_Register">
926 <actions>
927 <!--Argon Vs Xenon - Secure Resources-->
928 <set_value name="$ThreadID" exact="'$arg_vs_xenon_secure_resources'"/>
929 <set_value name="$Thread" exact="table[
930 $ID = $ThreadID,
931 $Faction = $Faction,
932 $EnemyFaction = $EnemyFaction,
933 $MissionGroup = $MissionGroup,
934 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
935 $ThreadType = 'sequential',
936 $MissionType = missiontype.trade,
937 $Difficulty = level.medium,
938 $SubMissionLib = ARG_VS_XENON_Secure_Resources_Get_Submissions,
939 $NameLib = ARG_VS_XENON_Secure_Resources_Construct_Name,
940 $DescriptionLib = ARG_VS_XENON_Secure_Resources_Construct_Description,
941 $MinMissions = 4,
942 $MaxMissions = 5,
943 $ThreadAbortRelation = -0.00064]"/>
944
945 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
946 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
947 </actions>
948 </cue>
949
950 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
951 <library name="ARG_VS_XENON_Secure_Resources_Get_Submissions">
952 <actions>
953 <set_value name="$Submissions" exact="table[]"/>
954 <set_value name="$Submissions.$large_supply__food"
955 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30210, $TextOffset = [100000], $Sequence = -1 ]"/>
956 <set_value name="$Submissions.$large_supply__shiptech"
957 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30210, $TextOffset = [100100], $Sequence = -1 ]"/>
958 <set_value name="$Submissions.$deploy_lasertowers_at_resources"
959 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [101300], $Sequence = -1 ]"/>
960 <set_value name="$Submissions.$find_resources__ores"
961 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [106000], $Sequence = -1 ]"/>
962 <set_value name="$Submissions.$supply_station"
963 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [130000], $Sequence = -1 ]"/>
964
965 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
966 </actions>
967 </library>
968
969 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
970 <library name="ARG_VS_XENON_Secure_Resources_Construct_Name">
971 <actions>
972 <do_any>
973 <set_value name="this.$Name" exact="{30210, 5000}"/>
974 <set_value name="this.$Name" exact="{30210, 5001}"/>
975 </do_any>
976 </actions>
977 </library>
978
979 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
980 <library name="ARG_VS_XENON_Secure_Resources_Construct_Description">
981 <actions>
982 <do_if value="$ThreadMood == 'negative'">
983 <do_any>
984 <set_value name="this.$Description" exact="{30210, 5101}"/>
985 <set_value name="this.$Description" exact="{30210, 5102}"/>
986 </do_any>
987
988 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 5111}"/>
989
990 <do_any>
991 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 5121}"/>
992 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 5122}"/>
993 </do_any>
994 </do_if>
995 <do_elseif value="$ThreadMood == 'positive'">
996 <do_any>
997 <set_value name="this.$Description" exact="{30210, 5201}"/>
998 <set_value name="this.$Description" exact="{30210, 5202}"/>
999 </do_any>
1000
1001 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 5211}"/>
1002 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 5221}"/>
1003 </do_elseif>
1004 </actions>
1005 </library>
1006 </cues>
1007 </cue>
1008
1009 <cue name="ARG_VS_XENON_Preemptive_Offensive">
1010 <cues>
1011 <cue name="ARG_VS_XENON_Preemptive_Offensive_Register">
1012 <actions>
1013 <!--Argon Vs Xenon - Preemptive Offensive-->
1014 <set_value name="$ThreadID" exact="'$arg_vs_xenon_preemptive_offensive'"/>
1015 <set_value name="$Thread" exact="table[
1016 $ID = $ThreadID,
1017 $Faction = $Faction,
1018 $EnemyFaction = $EnemyFaction,
1019 $MissionGroup = $MissionGroup,
1020 $ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
1021 $ThreadType = 'sequential',
1022 $MissionType = missiontype.fight,
1023 $Difficulty = level.medium,
1024 $SubMissionLib = ARG_VS_XENON_Preemptive_Offensive_Get_Submissions,
1025 $NameLib = ARG_VS_XENON_Preemptive_Offensive_Construct_Name,
1026 $DescriptionLib = ARG_VS_XENON_Preemptive_Offensive_Construct_Description,
1027 $MinMissions = 4,
1028 $MaxMissions = 5,
1029 $ThreadAbortRelation = -0.00064]"/>
1030
1031 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
1032 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
1033 </actions>
1034 </cue>
1035
1036 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
1037 <library name="ARG_VS_XENON_Preemptive_Offensive_Get_Submissions">
1038 <actions>
1039 <set_value name="$Submissions" exact="table[]"/>
1040 <set_value name="$Submissions.$assassination"
1041 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30210, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
1042 <set_value name="$Submissions.$board_ship"
1043 exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30210, $TextOffset = [108000], $Sequence = -1 ]"/>
1044 <set_value name="$Submissions.$destroy_rare_ship"
1045 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30210, $TextOffset = [140000], $Sequence = -1 ]"/>
1046
1047 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
1048 </actions>
1049 </library>
1050
1051 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
1052 <library name="ARG_VS_XENON_Preemptive_Offensive_Construct_Name">
1053 <actions>
1054 <do_any>
1055 <set_value name="this.$Name" exact="{30210, 6000}"/>
1056 <set_value name="this.$Name" exact="{30210, 6001}"/>
1057 </do_any>
1058 </actions>
1059 </library>
1060
1061 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
1062 <library name="ARG_VS_XENON_Preemptive_Offensive_Construct_Description">
1063 <actions>
1064 <do_if value="$ThreadMood == 'negative'">
1065 <do_any>
1066 <set_value name="this.$Description" exact="{30210, 6101}"/>
1067 <set_value name="this.$Description" exact="{30210, 6102}"/>
1068 </do_any>
1069
1070 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 6111}"/>
1071
1072 <do_any>
1073 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 6121}"/>
1074 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 6122}"/>
1075 </do_any>
1076 </do_if>
1077 <do_elseif value="$ThreadMood == 'positive'">
1078 <do_any>
1079 <set_value name="this.$Description" exact="{30210, 6201}"/>
1080 <set_value name="this.$Description" exact="{30210, 6202}"/>
1081 </do_any>
1082
1083 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 6211}"/>
1084 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 6221}"/>
1085 </do_elseif>
1086 </actions>
1087 </library>
1088 </cues>
1089 </cue>
1090
1091 <cue name="ARG_VS_XENON_Gather_Intel">
1092 <cues>
1093 <cue name="ARG_VS_XENON_Preemptive_Gather_Intel">
1094 <actions>
1095 <!--Argon Vs Xenon - Gather Intel-->
1096 <set_value name="$ThreadID" exact="'$arg_vs_xenon_gather_intel'"/>
1097 <set_value name="$Thread" exact="table[
1098 $ID = $ThreadID,
1099 $Faction = $Faction,
1100 $EnemyFaction = $EnemyFaction,
1101 $MissionGroup = $MissionGroup,
1102 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
1103 $ThreadType = 'sequential',
1104 $MissionType = missiontype.intelligence,
1105 $Difficulty = level.medium,
1106 $SubMissionLib = ARG_VS_XENON_Gather_Intel_Get_Submissions,
1107 $NameLib = ARG_VS_XENON_Gather_Intel_Construct_Name,
1108 $DescriptionLib = ARG_VS_XENON_Gather_Intel_Construct_Description,
1109 $MinMissions = 2,
1110 $MaxMissions = 3,
1111 $ThreadAbortRelation = -0.00064]"/>
1112
1113 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
1114 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
1115 </actions>
1116 </cue>
1117
1118 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
1119 <library name="ARG_VS_XENON_Gather_Intel_Get_Submissions">
1120 <actions>
1121 <set_value name="$Submissions" exact="table[]"/>
1122 <set_value name="$Submissions.$deploy_satellite"
1123 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [101400], $Sequence = -1 ]"/>
1124 <set_value name="$Submissions.$achieve_coverage__enemy_sector"
1125 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30210, $TextOffset = [102100], $Sequence = -1 ]"/>
1126 <set_value name="$Submissions.$find_resources__enemy_sector"
1127 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [106100], $Sequence = -1 ]"/>
1128 <set_value name="$Submissions.$scan__ship"
1129 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150000], $Sequence = -1 ]"/>
1130 <set_value name="$Submissions.$scan__station"
1131 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150100], $Sequence = -1 ]"/>
1132 <set_value name="$Submissions.$scan__module"
1133 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150200], $Sequence = -1 ]"/>
1134 <set_value name="$Submissions.$scan__for_ware"
1135 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150300], $Sequence = -1 ]"/>
1136 <set_value name="$Submissions.$scan__for_idcode"
1137 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30210, $TextOffset = [150600], $Sequence = -1 ]"/>
1138
1139 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
1140 </actions>
1141 </library>
1142
1143 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
1144 <library name="ARG_VS_XENON_Gather_Intel_Construct_Name">
1145 <actions>
1146 <do_any>
1147 <set_value name="this.$Name" exact="{30210, 7000}"/>
1148 <set_value name="this.$Name" exact="{30210, 7001}"/>
1149 </do_any>
1150 </actions>
1151 </library>
1152
1153 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
1154 <library name="ARG_VS_XENON_Gather_Intel_Construct_Description">
1155 <actions>
1156 <do_if value="$ThreadMood == 'negative'">
1157 <do_any>
1158 <set_value name="this.$Description" exact="{30210, 7101}"/>
1159 <set_value name="this.$Description" exact="{30210, 7102}"/>
1160 </do_any>
1161
1162 <do_any>
1163 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 7111}"/>
1164 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 7112}"/>
1165 </do_any>
1166
1167 <do_any>
1168 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 7121}"/>
1169 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 7122}"/>
1170 </do_any>
1171 </do_if>
1172 <do_elseif value="$ThreadMood == 'positive'">
1173 <do_any>
1174 <set_value name="this.$Description" exact="{30210, 7201}"/>
1175 <set_value name="this.$Description" exact="{30210, 7202}"/>
1176 </do_any>
1177
1178 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 7211}"/>
1179 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 7221}"/>
1180 </do_elseif>
1181 </actions>
1182 </library>
1183 </cues>
1184 </cue>
1185
1186 <cue name="ARG_VS_XENON_Support_Invasion">
1187 <cues>
1188 <cue name="ARG_VS_XENON_Preemptive_Support_Invasion">
1189 <actions>
1190 <!--Argon Vs Xenon - Support Invasion-->
1191 <set_value name="$ThreadID" exact="'$arg_vs_xenon_support_invasion'"/>
1192 <set_value name="$Thread" exact="table[
1193 $ID = $ThreadID,
1194 $Faction = $Faction,
1195 $EnemyFaction = $EnemyFaction,
1196 $MissionGroup = $MissionGroup,
1197 $ThreadConditionLibs = [Situation__Invading],
1198 $ThreadType = 'sequential',
1199 $MissionType = missiontype.fight,
1200 $Difficulty = level.hard,
1201 $SubMissionLib = ARG_VS_XENON_Support_Invasion_Get_Submissions,
1202 $NameLib = ARG_VS_XENON_Support_Invasion_Construct_Name,
1203 $DescriptionLib = ARG_VS_XENON_Support_Invasion_Construct_Description,
1204 $MinMissions = 4,
1205 $MaxMissions = 5,
1206 $ThreadAbortRelation = -0.00064]"/>
1207
1208 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
1209 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
1210 </actions>
1211 </cue>
1212
1213 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
1214 <library name="ARG_VS_XENON_Support_Invasion_Get_Submissions">
1215 <actions>
1216 <set_value name="$Submissions" exact="table[]"/>
1217 <set_value name="$Submissions.$support_invasion"
1218 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30210, $TextOffset = [109000], $Sequence = -1 ]"/>
1219
1220 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
1221 </actions>
1222 </library>
1223
1224 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
1225 <library name="ARG_VS_XENON_Support_Invasion_Construct_Name">
1226 <actions>
1227 <do_any>
1228 <set_value name="this.$Name" exact="{30210, 8000}"/>
1229 </do_any>
1230 </actions>
1231 </library>
1232
1233 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
1234 <library name="ARG_VS_XENON_Support_Invasion_Construct_Description">
1235 <actions>
1236 <do_if value="$ThreadMood == 'negative'">
1237 <do_any>
1238 <set_value name="this.$Description" exact="{30210, 8101}"/>
1239 </do_any>
1240
1241 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 8111}"/>
1242
1243 <do_any>
1244 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 8121}"/>
1245 </do_any>
1246 </do_if>
1247 <do_elseif value="$ThreadMood == 'positive'">
1248 <do_any>
1249 <set_value name="this.$Description" exact="{30210, 8201}"/>
1250 </do_any>
1251
1252 <set_value name="this.$Description" operation="add" exact="' ' + {30210, 8211}"/>
1253 <set_value name="this.$Description" operation="add" exact="'\n' + {30210, 8221}"/>
1254 </do_elseif>
1255 </actions>
1256 </library>
1257 </cues>
1258 </cue>
1259
1260
1261 </cues>
1262 </cue>
1263
1264 <!--
1265 ###################################
1266 ARGON VS HOLY ORDER
1267 ###################################-->
1268 <cue name="ARG_VS_HOL" namespace="this">
1269 <actions>
1270 <!--Common values-->
1271 <set_value name="$ManagerCue" exact="parent.namespace"/>
1272 <set_value name="$Faction" exact="faction.argon"/>
1273 <set_value name="$EnemyFaction" exact="faction.holyorder"/>
1274 <set_value name="$MissionGroup" exact="missiongroup.argon_war_holyorder"/>
1275 <set_value name="$Mission_Contact" exact="null"/>
1276 <set_value name="$Page" exact="30211" comment="Argon-HolyOrder-War page"/>
1277 <set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
1278 <set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
1279 <set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
1280 <set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
1281
1282 <!--Status-->
1283 <set_value name="$SubscriptionStatus" exact="null"/>
1284 <set_value name="$IntroducedToContact" exact="false"/>
1285 <set_value name="$JobsDescribed" exact="false"/>
1286 <set_value name="$ConflictDescribed" exact="false"/>
1287 <set_value name="$IntroMissionSuccessful" exact="false"/>
1288 <set_value name="$CooldownTime" exact="-1s"/>
1289
1290 <!--Stats-->
1291 <set_value name="$ThreadsCompleted" exact="0"/>
1292 <set_value name="$ThreadsFailed" exact="0"/>
1293
1294 <set_value name="$MissionsCompleted" exact="0"/>
1295 <set_value name="$MissionsFailed" exact="0"/>
1296 </actions>
1297 <cues>
1298 <cue name="ARG_VS_HOL_Init">
1299 <actions>
1300 <set_value name="$ContactCreatorCue" exact="ARG_VS_HOL_Create_Contact"/>
1301 <set_value name="$IntroMissionCue" exact="ARG_VS_HOL_Introduction"/>
1302
1303 <!--$SubscriptionStatus:
1304 - 'unsubscribed'
1305 - 'probation'
1306 - 'subscribed'
1307 - 'cooldown'-->
1308 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'unsubscribed'" comment="TODO: @Owen, @Roger - temporary, change back to unsubscribed!"/>
1309 </actions>
1310 </cue>
1311
1312 <!--
1313 ####################
1314 DEBUG
1315 ####################-->
1316 <cue name="ARG_VS_HOL_Debug_Reset">
1317 <conditions>
1318 <event_cue_signalled/>
1319 </conditions>
1320 <actions>
1321 <do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
1322 <do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
1323 <signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
1324 </do_if>
1325 </do_all>
1326 <set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
1327 <do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
1328 <do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
1329 <remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
1330 </do_if>
1331 </do_all>
1332 <do_if value="$Mission_Contact.isclass.npc">
1333 <destroy_object object="$Mission_Contact"/>
1334 </do_if>
1335 <set_value name="$Mission_Contact" exact="null"/>
1336 <reset_cue cue="namespace"/>
1337 <reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
1338 </actions>
1339 </cue>
1340
1341 <cue name="ARG_VS_HOL_Debug_Subscribe" instantiate="true">
1342 <conditions>
1343 <event_cue_signalled/>
1344 </conditions>
1345 <actions>
1346 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
1347 </actions>
1348 </cue>
1349
1350 <!--
1351 ####################
1352 SUBSCRIPTION
1353 ####################-->
1354
1355 <!--event.param == new status-->
1356 <cue name="ARG_VS_HOL_Set_Subscription_Status" instantiate="true">
1357 <conditions>
1358 <event_cue_signalled/>
1359 </conditions>
1360 <actions>
1361 <do_if value="
1362 event.param == 'unsubscribed' or
1363 event.param == 'probation' or
1364 event.param == 'subscribed' or
1365 event.param == 'cooldown'">
1366
1367 <debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
1368 <set_value name="$SubscriptionStatus" exact="event.param"/>
1369
1370 <!--Be careful with state change handlers here if the requested state was the same as the previous one-->
1371 <do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
1372 <unlock_achievement name="JOIN_WAR" />
1373 <do_if value="HOL_VS_ARG.$SubscriptionStatus == 'subscribed'">
1374 <unlock_achievement name="JOIN_DOUBLE_AGENT" />
1375 </do_if>
1376 <signal_cue cue="CalculateThreads"/>
1377 </do_if>
1378 <do_elseif value="event.param == 'cooldown'">
1379 <!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
1380 <set_value name="$CooldownTime" exact="player.age + 5min"/>
1381 </do_elseif>
1382 </do_if>
1383 <do_else>
1384 <assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
1385 </do_else>
1386 </actions>
1387 </cue>
1388
1389 <cue name="ARG_VS_HOL_Check_Cooldown" instantiate="true" checkinterval="5s">
1390 <conditions>
1391 <check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
1392 </conditions>
1393 <actions>
1394 <debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
1395 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
1396 </actions>
1397 </cue>
1398
1399 <!--
1400 ####################
1401 CONTACT
1402 ####################-->
1403
1404 <!--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)-->
1405 <cue name="ARG_VS_HOL_Create_Contact">
1406 <conditions>
1407 <event_cue_signalled/>
1408 </conditions>
1409 <actions>
1410 <set_value name="this.$SelectedSpace" exact="null"/>
1411 <do_if value="event.param and typeof event.param == datatype.table">
1412 <set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
1413 <do_all exact="this.$HostSectorKeys.count" counter="$i">
1414 <do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
1415 <!--Select a sector with stations and a high security value-->
1416 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
1417 <match_content class="class.walkablemodule"/>
1418 </find_station>
1419 <do_if value="this.$PotentialStation">
1420 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
1421 <break/>
1422 </do_if>
1423 </do_if>
1424 </do_all>
1425 <do_if value="not this.$SelectedSpace">
1426 <!--Simply select the furthest sector with stations-->
1427 <do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
1428 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
1429 <match_content class="class.walkablemodule"/>
1430 </find_station>
1431 <do_if value="this.$PotentialStation">
1432 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
1433 <break/>
1434 </do_if>
1435 </do_all>
1436 </do_if>
1437 </do_if>
1438
1439 <do_if value="not this.$SelectedSpace">
1440 <find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
1441 <match_content class="class.walkablemodule"/>
1442 </find_station>
1443 <do_if value="this.$PotentialStation">
1444 <set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
1445 <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"/>
1446 </do_if>
1447 </do_if>
1448 <do_if value="this.$SelectedSpace">
1449 <find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
1450 <match_content class="class.walkablemodule"/>
1451 </find_station>
1452 <assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
1453 <do_if value="$PlacementObject">
1454 <create_cue_actor name="$Mission_Contact" cue="namespace" group="argon.factionrepresentative.male">
1455 <page exact="10101"/>
1456 <owner exact="$Faction"/>
1457 </create_cue_actor>
1458 <do_if value="$Mission_Contact">
1459 <set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
1460 <set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
1461 <debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
1462 </do_if>
1463 </do_if>
1464 </do_if>
1465
1466 <assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
1467 <do_if value="not $Mission_Contact">
1468 <reset_cue cue="this"/>
1469 </do_if>
1470 </actions>
1471 <cues>
1472 <cue name="ARG_VS_HOL_Place_Contact_Init">
1473 <actions>
1474 <do_if value="$PlacementObject.attention ge attention.nearby">
1475 <signal_cue cue="ARG_VS_HOL_Place_Contact_Create_Interior"/>
1476 </do_if>
1477 </actions>
1478 </cue>
1479
1480 <cue name="ARG_VS_HOL_Place_Contact_Create_Interior">
1481 <conditions>
1482 <check_any>
1483 <event_cue_signalled/>
1484 <check_all>
1485 <event_object_changed_attention object="$PlacementObject"/>
1486 <check_value value="event.param ge attention.nearby"/>
1487 </check_all>
1488 </check_any>
1489 </conditions>
1490 <actions>
1491 <debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
1492 <get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
1493 <get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
1494
1495 <create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30211,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
1496 <assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
1497 <do_if value="$DynamicInterior">
1498 <find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
1499 <assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
1500 <do_if value="$NPC_Slot">
1501 <add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
1502 <debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
1503 </do_if>
1504 </do_if>
1505 </actions>
1506 <cues>
1507 <cue name="ARG_VS_HOL_Place_Contact_WithinDynamicInterior_Destroy">
1508 <conditions>
1509 <event_object_interiors_despawning object="$PlacementObject"/>
1510 </conditions>
1511 <actions>
1512 <debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
1513 <remove_actor_from_room actor="$Mission_Contact"/>
1514
1515 <destroy_object object="$DynamicInterior"/>
1516 <remove_value name="$DynamicInterior"/>
1517 <remove_value name="$DynamicCorridor"/>
1518 <remove_value name="$DynamicRoom"/>
1519 <reset_cue cue="ARG_VS_HOL_Place_Contact_Create_Interior"/>
1520 </actions>
1521 </cue>
1522 </cues>
1523 </cue>
1524
1525 <cue name="ARG_VS_HOL_Contact_Killed">
1526 <conditions>
1527 <event_object_destroyed object="$Mission_Contact"/>
1528 </conditions>
1529 <actions>
1530 <set_value name="$Mission_Contact" exact="null"/>
1531 <reset_cue cue="ARG_VS_HOL_Create_Contact"/>
1532 </actions>
1533 </cue>
1534
1535 <cue name="ARG_VS_HOL_Contact_Conversation_Started" instantiate="true">
1536 <conditions>
1537 <check_any>
1538 <event_conversation_started actor="$Mission_Contact" />
1539 <event_conversation_returned_to_section actor="$Mission_Contact" />
1540 </check_any>
1541 <check_value value="event.param == 'default'" />
1542 </conditions>
1543 <actions>
1544 <do_if value="event.name == 'event_conversation_started'">
1545 <do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
1546 <do_if value="player.entity.isfemale">
1547 <add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
1548 </do_if>
1549 <do_else>
1550 <add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
1551 </do_else>
1552 </do_if>
1553 <do_else>
1554 <!--More familiar greeting-->
1555 <add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
1556 </do_else>
1557 </do_if>
1558
1559 <include_actions ref="ARG_VS_HOL_Contact_Player_Lines"/>
1560 </actions>
1561 </cue>
1562
1563 <library name="ARG_VS_HOL_Contact_Player_Lines">
1564 <actions>
1565 <!--Specific sections-->
1566 <do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
1567 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
1568 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
1569 </do_if>
1570 </do_if>
1571 <do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
1572 <add_player_choice text="{1002,3021102}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
1573 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
1574 </do_elseif>
1575 <do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
1576 <add_player_choice text="{1002,3021103}" section="war_subscribe_ask_conflict_2" comment="And the Argon?"/>
1577 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
1578 </do_elseif>
1579 <do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict_2'">
1580 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
1581 </do_elseif>
1582
1583 <!--Start or other sections-->
1584 <do_else>
1585 <do_if value="$SubscriptionStatus == 'unsubscribed'">
1586 <do_if value="ARG_VS_HOL_Introduction.state == cuestate.waiting">
1587 <!--Intro mission is not in a state where the player can take it.-->
1588 <!--TODO @Owen - voice lines on rejecting the player?-->
1589 <add_player_choice text="{1002,3021101}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
1590 </do_if>
1591 <do_elseif value="$IntroducedToContact">
1592 <do_if value="$JobsDescribed">
1593 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
1594 <add_player_choice text="{1002,3021102}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
1595 </do_if>
1596 <do_else>
1597 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
1598 </do_else>
1599 </do_elseif>
1600 <do_else>
1601 <add_player_choice text="{1002,3021101}" section="war_subscribe_request" comment="I'm here about the Holy Order."/>
1602 </do_else>
1603 </do_if>
1604 <do_elseif value="$SubscriptionStatus == 'probation'">
1605 <do_if value="$IntroMissionSuccessful">
1606 <add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
1607 </do_if>
1608 <do_else>
1609 <add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
1610 </do_else>
1611 </do_elseif>
1612 </do_else>
1613 </actions>
1614 </library>
1615
1616 <cue name="ARG_VS_HOL_Contact_NextSection" instantiate="true">
1617 <conditions>
1618 <event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
1619 </conditions>
1620 <actions>
1621 <set_value name="$AddPlayerChoices" exact="true"/>
1622 <do_if value="event.param == 'war_subscribe_request'">
1623 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
1624 <set_value name="$IntroducedToContact" exact="true"/>
1625 <add_npc_line speaker="$Mission_Contact" line="30211001" hidechoices="true" comment="Ah, very good."/>
1626 <add_npc_line speaker="$Mission_Contact" line="30211002" hidechoices="true"/>
1627 <do_if value="player.entity.race == race.argon">
1628 <!--Argon citizen-->
1629 <add_npc_line speaker="$Mission_Contact" line="30211004" hidechoices="true"/>
1630 </do_if>
1631 <do_else>
1632 <!--Argon friend-->
1633 <add_npc_line speaker="$Mission_Contact" line="30211003" hidechoices="true"/>
1634 </do_else>
1635
1636 <add_npc_line speaker="$Mission_Contact" line="30211005" hidechoices="true"/>
1637 <add_npc_line speaker="$Mission_Contact" line="30211006" hidechoices="true"/>
1638 <add_npc_line speaker="$Mission_Contact" line="30211007" hidechoices="true"/>
1639 <do_if value="player.entity.race == race.paranid">
1640 <!--Paranid player line-->
1641 <add_npc_line speaker="$Mission_Contact" line="30211008" hidechoices="true"/>
1642 </do_if>
1643 <do_else>
1644 <add_npc_line speaker="$Mission_Contact" line="30211009" hidechoices="true"/>
1645 <add_npc_line speaker="$Mission_Contact" line="30211010" hidechoices="true"/>
1646 </do_else>
1647 </do_if>
1648 <do_else>
1649 <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."/>
1650 </do_else>
1651 </do_if>
1652 <do_elseif value="event.param == 'war_subscribe_ask_intro'">
1653 <set_value name="$JobsDescribed" exact="true"/>
1654 <add_npc_line speaker="$Mission_Contact" line="30211011" hidechoices="true"/>
1655 <add_npc_line speaker="$Mission_Contact" line="30211012" hidechoices="true"/>
1656 </do_elseif>
1657 <do_elseif value="event.param == 'war_subscribe_ask_conflict'">
1658 <set_value name="$ConflictDescribed" exact="true"/>
1659 <do_if value="player.entity.race == race.paranid">
1660 <!--Paranid player line-->
1661 <add_npc_line speaker="$Mission_Contact" line="30211013" hidechoices="true"/>
1662 </do_if>
1663 <add_npc_line speaker="$Mission_Contact" line="30211014" hidechoices="true"/>
1664 <add_npc_line speaker="$Mission_Contact" line="30211015" hidechoices="true"/>
1665 </do_elseif>
1666 <do_elseif value="event.param == 'war_subscribe_ask_conflict_2'">
1667 <add_npc_line speaker="$Mission_Contact" line="30211016" hidechoices="true"/>
1668 <add_npc_line speaker="$Mission_Contact" line="30211017" hidechoices="true"/>
1669 <add_npc_line speaker="$Mission_Contact" line="30211018" hidechoices="true"/>
1670 <add_npc_line speaker="$Mission_Contact" line="30211019" hidechoices="true"/>
1671 </do_elseif>
1672 <do_elseif value="event.param == 'war_subscribe_request_2'">
1673 <!--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.-->
1674 <include_actions ref="ARG_VS_HOL_Can_Activate_Introduction"/>
1675 <do_if value="$CanActivateIntro">
1676 <signal_cue cue="ARG_VS_HOL_Introduction"/>
1677 <add_npc_line speaker="$Mission_Contact" line="30211001" hidechoices="true" comment="Ah, very good."/>
1678 </do_if>
1679 <do_else>
1680 <set_value name="$AddPlayerChoices" exact="false"/>
1681 <add_npc_line speaker="$Mission_Contact" line="30211027" hidechoices="true"/>
1682 </do_else>
1683 </do_elseif>
1684 <do_elseif value="event.param == 'war_subscribe_start_intro'">
1685 <set_value name="$AddPlayerChoices" exact="false"/>
1686 <signal_cue cue="ARG_VS_HOL_Player_Requested_Subscription"/>
1687 <add_npc_line speaker="$Mission_Contact" line="30211020" hidechoices="true"/>
1688 <add_npc_line speaker="$Mission_Contact" line="30211021" hidechoices="true"/>
1689 </do_elseif>
1690 <do_elseif value="event.param == 'war_intro_complete'">
1691 <set_value name="$AddPlayerChoices" exact="false"/>
1692 <add_npc_line speaker="$Mission_Contact" line="30211022" hidechoices="true" comment="Yes, I saw. Very good."/>
1693 <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."/>
1694 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
1695 </do_elseif>
1696 <do_elseif value="event.param == 'war_abort_intro'">
1697 <set_value name="$AddPlayerChoices" exact="false"/>
1698 <signal_cue cue="ARG_VS_HOL_Player_Requests_Intro_Abort"/>
1699 </do_elseif>
1700
1701 <do_if value="$AddPlayerChoices">
1702 <include_actions ref="ARG_VS_HOL_Contact_Player_Lines"/>
1703 </do_if>
1704 </actions>
1705 </cue>
1706 </cues>
1707 </cue>
1708
1709
1710 <!--event.param = table[
1711 $cue = thread cue namespace,
1712 $completedmissions = number of completed missions,
1713 $failedmissions = number of failed missions]-->
1714 <cue name="ARG_VS_HOL_Thread_Finished" instantiate="true">
1715 <conditions>
1716 <event_cue_signalled cue="Cleanup_Thread"/>
1717 <check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
1718 <check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
1719 </conditions>
1720 <actions>
1721 <!--TODO @Owen spoken feedback?-->
1722 <debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
1723
1724 <set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
1725 <set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
1726
1727 <do_if value="$MissionsCompleted ge 20">
1728 <unlock_achievement name="WAR_MISSIONS" />
1729 </do_if>
1730
1731 <do_if value="event.param.$failed">
1732 <set_value name="$ThreadsFailed" operation="add"/>
1733 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'cooldown'"/>
1734 </do_if>
1735 <do_else>
1736 <set_value name="$ThreadsCompleted" operation="add"/>
1737 <signal_cue cue="CalculateThreads"/>
1738 </do_else>
1739 </actions>
1740 </cue>
1741
1742 <!--
1743 ####################
1744 INTRODUCTION
1745 ####################-->
1746
1747 <cue name="ARG_VS_HOL_Player_Requested_Subscription" instantiate="true">
1748 <conditions>
1749 <event_cue_signalled/>
1750 </conditions>
1751 </cue>
1752
1753 <cue name="ARG_VS_HOL_Player_Requests_Intro_Abort" instantiate="true">
1754 <conditions>
1755 <event_cue_signalled/>
1756 </conditions>
1757 </cue>
1758
1759 <library name="ARG_VS_HOL_Can_Activate_Introduction">
1760 <actions>
1761 <!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
1762 <set_value name="$CanActivateIntro" exact="false"/>
1763 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
1764 <set_value name="$CanActivateIntro" exact="true"/>
1765 </do_if>
1766 </actions>
1767 </library>
1768
1769 <cue name="ARG_VS_HOL_Introduction" version="2">
1770 <conditions>
1771 <event_cue_signalled/>
1772 </conditions>
1773 <actions>
1774 <debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
1775 <set_value name="$MissionIntroCue" exact="this"/>
1776 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
1777 </actions>
1778 <patch sinceversion="2" state="complete">
1779 <do_if value="$SubscriptionStatus == 'cooldown'">
1780 <debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
1781 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
1782 </do_if>
1783 </patch>
1784 <cues>
1785 <cue name="ARG_VS_HOL_Introduction_Init">
1786 <actions>
1787 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
1788 <signal_cue cue="ARG_VS_HOL_Introduction_Create_Offer"/>
1789 </do_if>
1790 </actions>
1791 </cue>
1792
1793 <cue name="ARG_VS_HOL_Introduction_Create_Offer">
1794 <conditions>
1795 <check_any>
1796 <check_all>
1797 <event_player_relation_changed faction="$Faction"/>
1798 <check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
1799 </check_all>
1800 <event_cue_signalled/>
1801 </check_any>
1802 </conditions>
1803 <actions>
1804 <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]'"/>
1805 <do_if value="not $Mission_Contact.isclass.npc">
1806 <signal_cue_instantly cue="$ContactCreatorCue"/>
1807 </do_if>
1808
1809 <do_if value="$Mission_Contact">
1810 <debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
1811 <create_offer cue="$MissionIntroCue" actor="$Mission_Contact" type="missiontype.fight" name="{30211,1}" description="{30211,2}" difficulty="level.easy" faction="faction.argon" group="$MissionGroup">
1812 <briefing>
1813 <objective step="1" action="objective.talkto" object="$Mission_Contact"/>
1814 </briefing>
1815 </create_offer>
1816 </do_if>
1817 <do_else>
1818 <debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
1819 <reset_cue cue="$MissionIntroCue"/>
1820 </do_else>
1821 </actions>
1822 <cues>
1823 <cue name="ARG_VS_HOL_Introduction_Offer_Accepted">
1824 <conditions>
1825 <event_object_signalled object="$Mission_Contact" param="'accept'" />
1826 </conditions>
1827 <actions>
1828 <create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
1829 <update_mission cue="$MissionIntroCue">
1830 <briefing>
1831 <objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
1832 </briefing>
1833 </update_mission>
1834 <remove_offer cue="$MissionIntroCue"/>
1835 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
1836 $actor = $Mission_Contact,
1837 $object = $PlacementObject,
1838 $missioncue = $MissionIntroCue,
1839 $cancelcue = ARG_VS_HOL_Cancel_Intro_Talkto,
1840 $objective = objective.talkto,
1841 $debugchance = $DebugChance]"/>
1842 </actions>
1843 </cue>
1844 </cues>
1845 </cue>
1846
1847 <cue name="ARG_VS_HOL_Intro_Abort">
1848 <conditions>
1849 <check_any>
1850 <event_mission_aborted cue="ARG_VS_HOL_Introduction"/>
1851 <event_cue_signalled cue="ARG_VS_HOL_Player_Requests_Intro_Abort"/>
1852 </check_any>
1853 </conditions>
1854 <actions>
1855 <do_if value="$MissionIntroCue.hasmission">
1856 <remove_mission cue="$MissionIntroCue" type="aborted"/>
1857 </do_if>
1858 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
1859 <reset_cue cue="ARG_VS_HOL_Introduction"/>
1860 </actions>
1861 </cue>
1862
1863 <cue name="ARG_VS_HOL_Cancel_Intro_Talkto" instantiate="true">
1864 <conditions>
1865 <event_cue_signalled/>
1866 </conditions>
1867 </cue>
1868
1869 <cue name="ARG_VS_HOL_Start_Intro_Mission">
1870 <conditions>
1871 <event_cue_signalled cue="ARG_VS_HOL_Player_Requested_Subscription"/>
1872 </conditions>
1873 <actions>
1874 <signal_cue cue="ARG_VS_HOL_Cancel_Intro_Talkto"/>
1875 <signal_cue_instantly cue="ARG_VS_HOL_Set_Subscription_Status" param="'probation'"/>
1876 <set_value name="$IntroMissionSuccessful" exact="false"/>
1877
1878 <do_if value="$MissionIntroCue.hasmissionoffer">
1879 <remove_offer cue="$MissionIntroCue"/>
1880 </do_if>
1881
1882 <do_if value="not $MissionIntroCue.hasmission">
1883 <create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30211}.{1}" description="readtext.{30211}.{2}" difficulty="level.easy" faction="faction.argon" group="$MissionGroup"/>
1884 </do_if>
1885
1886 <create_ship name="$TestShip" zone="player.zone">
1887 <select faction="faction.holyorder" size="class.ship_s"/>
1888 <owner exact="faction.holyorder"/>
1889 <pilot actor="null"/>
1890 <safepos object="player.entity" min="30km" max="40km"/>
1891 </create_ship>
1892
1893 <update_mission cue="$MissionIntroCue">
1894 <briefing>
1895 <objective step="1" action="objective.destroy" object="$TestShip"/>
1896 </briefing>
1897 </update_mission>
1898 <set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
1899 </actions>
1900 <cues>
1901 <cue name="ARG_VS_HOL_Start_Intro_Mission_Successful">
1902 <conditions>
1903 <event_object_destroyed object="$TestShip"/>
1904 </conditions>
1905 <actions>
1906 <update_mission cue="$MissionIntroCue">
1907 <briefing>
1908 <objective step="2" action="objective.talkto" object="$Mission_Contact"/>
1909 </briefing>
1910 </update_mission>
1911 <set_value name="$IntroMissionSuccessful" exact="true"/>
1912 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
1913 $actor = $Mission_Contact,
1914 $object = $PlacementObject,
1915 $missioncue = $MissionIntroCue,
1916 $cancelcue = ARG_VS_HOL_Start_Intro_Mission_Remove_Mission,
1917 $objective = objective.talkto,
1918 $step = 2,
1919 $debugchance = $DebugChance]"/>
1920 </actions>
1921 </cue>
1922
1923 <cue name="ARG_VS_HOL_Start_Intro_Mission_Remove_Mission">
1924 <conditions>
1925 <event_cue_signalled/>
1926 </conditions>
1927 <actions>
1928 <remove_mission cue="$MissionIntroCue" type="completed"/>
1929 <reset_cue cue="ARG_VS_HOL_Introduction"/>
1930 </actions>
1931 </cue>
1932
1933 <cue name="ARG_VS_HOL_Start_Intro_Mission_End">
1934 <conditions>
1935 <event_conversation_started actor="$Mission_Contact"/>
1936 </conditions>
1937 <actions>
1938 <signal_cue cue="ARG_VS_HOL_Start_Intro_Mission_Remove_Mission"/>
1939 </actions>
1940 </cue>
1941 </cues>
1942 </cue>
1943 </cues>
1944 </cue>
1945
1946 <!--
1947 ####################
1948 THREADS
1949 ####################-->
1950 <cue name="ARG_VS_HOL_Reinforce_Defence">
1951 <cues>
1952 <cue name="ARG_VS_HOL_Reinforce_Defence_Register">
1953 <actions>
1954 <!--Argon Vs Holy Order - Reinforce Defence-->
1955 <set_value name="$ThreadID" exact="'$arg_vs_hol_reinforce_defence'"/>
1956 <set_value name="$Thread" exact="table[
1957 $ID = $ThreadID,
1958 $Faction = $Faction,
1959 $EnemyFaction = $EnemyFaction,
1960 $MissionGroup = $MissionGroup,
1961 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
1962 $ThreadType = 'sequential',
1963 $MissionType = missiontype.protect,
1964 $Difficulty = level.medium,
1965 $SubMissionLib = ARG_VS_HOL_Reinforce_Defence_Get_Submissions,
1966 $NameLib = ARG_VS_HOL_Reinforce_Defence_Construct_Name,
1967 $DescriptionLib = ARG_VS_HOL_Reinforce_Defence_Construct_Description,
1968 $MinMissions = 4,
1969 $MaxMissions = 5,
1970 $ThreadAbortRelation = -0.00064]"/>
1971
1972 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
1973 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
1974 </actions>
1975 </cue>
1976
1977 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
1978 <library name="ARG_VS_HOL_Reinforce_Defence_Get_Submissions">
1979 <actions>
1980 <set_value name="$Submissions" exact="table[]"/>
1981 <set_value name="$Submissions.$deploy_lasertowers"
1982 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [101000], $Sequence = -1 ]"/>
1983 <set_value name="$Submissions.$deploy_mines"
1984 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
1985 <set_value name="$Submissions.$achieve_coverage__host_sector"
1986 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [102000], $Sequence = -1 ]"/>
1987 <set_value name="$Submissions.$repair__damagedship"
1988 exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30211, $TextOffset = [103000], $Sequence = -1 ]"/>
1989 <set_value name="$Submissions.$taxi__specialist"
1990 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30211, $TextOffset = [104000], $Sequence = -1 ]"/>
1991 <set_value name="$Submissions.$deliver__crew"
1992 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30211, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
1993
1994 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
1995 </actions>
1996 </library>
1997
1998 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
1999 <library name="ARG_VS_HOL_Reinforce_Defence_Construct_Name">
2000 <actions>
2001 <do_any>
2002 <set_value name="this.$Name" exact="{30211, 3000}"/>
2003 <set_value name="this.$Name" exact="{30211, 3001}"/>
2004 <set_value name="this.$Name" exact="{30211, 3002}"/>
2005 </do_any>
2006 </actions>
2007 </library>
2008
2009 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
2010 <library name="ARG_VS_HOL_Reinforce_Defence_Construct_Description">
2011 <actions>
2012 <do_if value="$ThreadMood == 'negative'">
2013 <do_any>
2014 <set_value name="this.$Description" exact="{30211, 3101}"/>
2015 <set_value name="this.$Description" exact="{30211, 3102}"/>
2016 </do_any>
2017
2018 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 3111}"/>
2019
2020 <do_any>
2021 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 3121}"/>
2022 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 3122}"/>
2023 </do_any>
2024 </do_if>
2025 <do_elseif value="$ThreadMood == 'positive'">
2026 <do_any>
2027 <set_value name="this.$Description" exact="{30211, 3201}"/>
2028 <set_value name="this.$Description" exact="{30211, 3202}"/>
2029 </do_any>
2030
2031 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 3211}"/>
2032 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 3221}"/>
2033 </do_elseif>
2034 </actions>
2035 </library>
2036 </cues>
2037 </cue>
2038
2039 <cue name="ARG_VS_HOL_Construct_Defence">
2040 <cues>
2041 <cue name="ARG_VS_HOL_Construct_Defence_Register" version="2">
2042 <actions>
2043 <!--Argon Vs Holy Order - Construct Defence-->
2044 <set_value name="$ThreadID" exact="'$arg_vs_hol_construct_defence'"/>
2045 <set_value name="$Thread" exact="table[
2046 $ID = $ThreadID,
2047 $Faction = $Faction,
2048 $EnemyFaction = $EnemyFaction,
2049 $MissionGroup = $MissionGroup,
2050 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
2051 $ThreadType = 'sequential',
2052 $MissionType = missiontype.build,
2053 $Difficulty = level.medium,
2054 $SubMissionLib = ARG_VS_HOL_Construct_Defence_Get_Submissions,
2055 $NameLib = ARG_VS_HOL_Construct_Defence_Construct_Name,
2056 $DescriptionLib = ARG_VS_HOL_Construct_Defence_Construct_Description,
2057 $MinMissions = 1,
2058 $MaxMissions = 2,
2059 $ThreadAbortRelation = -0.00064]"/>
2060
2061 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
2062 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
2063 </actions>
2064 <patch sinceversion="2">
2065 <append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
2066 </patch>
2067 </cue>
2068
2069 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2070 <library name="ARG_VS_HOL_Construct_Defence_Get_Submissions">
2071 <actions>
2072 <set_value name="$Submissions" exact="table[]"/>
2073 <set_value name="$Submissions.$build__defencestation"
2074 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30211, $TextOffset = [105000], $Sequence = -1 ]"/>
2075 <set_value name="$Submissions.$build__fleet"
2076 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30211, $TextOffset = [120000], $Sequence = -1 ]"/>
2077
2078 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
2079 </actions>
2080 </library>
2081
2082 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2083 <library name="ARG_VS_HOL_Construct_Defence_Construct_Name">
2084 <actions>
2085 <do_any>
2086 <set_value name="this.$Name" exact="{30211, 4000}"/>
2087 <set_value name="this.$Name" exact="{30211, 4001}"/>
2088 </do_any>
2089 </actions>
2090 </library>
2091
2092 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
2093 <library name="ARG_VS_HOL_Construct_Defence_Construct_Description">
2094 <actions>
2095 <do_if value="$ThreadMood == 'negative'">
2096 <do_any>
2097 <set_value name="this.$Description" exact="{30211, 4101}"/>
2098 <set_value name="this.$Description" exact="{30211, 4102}"/>
2099 </do_any>
2100
2101 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 4111}"/>
2102
2103 <do_any>
2104 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 4121}"/>
2105 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 4122}"/>
2106 </do_any>
2107 </do_if>
2108 <do_elseif value="$ThreadMood == 'positive'">
2109 <do_any>
2110 <set_value name="this.$Description" exact="{30211, 4201}"/>
2111 <set_value name="this.$Description" exact="{30211, 4202}"/>
2112 </do_any>
2113
2114 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 4211}"/>
2115 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 4221}"/>
2116 </do_elseif>
2117 </actions>
2118 </library>
2119 </cues>
2120 </cue>
2121
2122 <cue name="ARG_VS_HOL_Secure_Resources">
2123 <cues>
2124 <cue name="ARG_VS_HOL_Secure_Resources_Register">
2125 <actions>
2126 <!--Argon Vs Holy Order - Secure Resources-->
2127 <set_value name="$ThreadID" exact="'$arg_vs_hol_secure_resources'"/>
2128 <set_value name="$Thread" exact="table[
2129 $ID = $ThreadID,
2130 $Faction = $Faction,
2131 $EnemyFaction = $EnemyFaction,
2132 $MissionGroup = $MissionGroup,
2133 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
2134 $ThreadType = 'sequential',
2135 $MissionType = missiontype.trade,
2136 $Difficulty = level.medium,
2137 $SubMissionLib = ARG_VS_HOL_Secure_Resources_Get_Submissions,
2138 $NameLib = ARG_VS_HOL_Secure_Resources_Construct_Name,
2139 $DescriptionLib = ARG_VS_HOL_Secure_Resources_Construct_Description,
2140 $MinMissions = 4,
2141 $MaxMissions = 5,
2142 $ThreadAbortRelation = -0.00064]"/>
2143
2144 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
2145 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
2146 </actions>
2147 </cue>
2148
2149 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2150 <library name="ARG_VS_HOL_Secure_Resources_Get_Submissions">
2151 <actions>
2152 <set_value name="$Submissions" exact="table[]"/>
2153 <set_value name="$Submissions.$large_supply__food"
2154 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30211, $TextOffset = [100000], $Sequence = -1 ]"/>
2155 <set_value name="$Submissions.$large_supply__shiptech"
2156 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30211, $TextOffset = [100100], $Sequence = -1 ]"/>
2157 <set_value name="$Submissions.$deploy_lasertowers_at_resources"
2158 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [101300], $Sequence = -1 ]"/>
2159 <set_value name="$Submissions.$find_resources__ores"
2160 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [106000], $Sequence = -1 ]"/>
2161 <set_value name="$Submissions.$supply_station"
2162 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [130000], $Sequence = -1 ]"/>
2163
2164 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
2165 </actions>
2166 </library>
2167
2168 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2169 <library name="ARG_VS_HOL_Secure_Resources_Construct_Name">
2170 <actions>
2171 <do_any>
2172 <set_value name="this.$Name" exact="{30211, 5000}"/>
2173 <set_value name="this.$Name" exact="{30211, 5001}"/>
2174 </do_any>
2175 </actions>
2176 </library>
2177
2178 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
2179 <library name="ARG_VS_HOL_Secure_Resources_Construct_Description">
2180 <actions>
2181 <do_if value="$ThreadMood == 'negative'">
2182 <do_any>
2183 <set_value name="this.$Description" exact="{30211, 5101}"/>
2184 <set_value name="this.$Description" exact="{30211, 5102}"/>
2185 </do_any>
2186
2187 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 5111}"/>
2188
2189 <do_any>
2190 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 5121}"/>
2191 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 5122}"/>
2192 </do_any>
2193 </do_if>
2194 <do_elseif value="$ThreadMood == 'positive'">
2195 <do_any>
2196 <set_value name="this.$Description" exact="{30211, 5201}"/>
2197 <set_value name="this.$Description" exact="{30211, 5202}"/>
2198 </do_any>
2199
2200 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 5211}"/>
2201 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 5221}"/>
2202 </do_elseif>
2203 </actions>
2204 </library>
2205 </cues>
2206 </cue>
2207
2208 <cue name="ARG_VS_HOL_Preemptive_Offensive">
2209 <cues>
2210 <cue name="ARG_VS_HOL_Preemptive_Offensive_Register">
2211 <actions>
2212 <!--Argon Vs Holy Order - Preemptive Offensive-->
2213 <set_value name="$ThreadID" exact="'$arg_vs_hol_preemptive_offensive'"/>
2214 <set_value name="$Thread" exact="table[
2215 $ID = $ThreadID,
2216 $Faction = $Faction,
2217 $EnemyFaction = $EnemyFaction,
2218 $MissionGroup = $MissionGroup,
2219 $ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
2220 $ThreadType = 'sequential',
2221 $MissionType = missiontype.fight,
2222 $Difficulty = level.medium,
2223 $SubMissionLib = ARG_VS_HOL_Preemptive_Offensive_Get_Submissions,
2224 $NameLib = ARG_VS_HOL_Preemptive_Offensive_Construct_Name,
2225 $DescriptionLib = ARG_VS_HOL_Preemptive_Offensive_Construct_Description,
2226 $MinMissions = 4,
2227 $MaxMissions = 5,
2228 $ThreadAbortRelation = -0.00064]"/>
2229
2230 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
2231 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
2232 </actions>
2233 </cue>
2234
2235 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2236 <library name="ARG_VS_HOL_Preemptive_Offensive_Get_Submissions">
2237 <actions>
2238 <set_value name="$Submissions" exact="table[]"/>
2239 <set_value name="$Submissions.$assassination__informant"
2240 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30211, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
2241
2242 <set_value name="$Submissions.$board_ship"
2243 exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30211, $TextOffset = [108000], $Sequence = -1 ]"/>
2244 <set_value name="$Submissions.$destroy_rare_ship"
2245 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30211, $TextOffset = [140000], $Sequence = -1 ]"/>
2246
2247 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
2248 </actions>
2249 </library>
2250
2251 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2252 <library name="ARG_VS_HOL_Preemptive_Offensive_Construct_Name">
2253 <actions>
2254 <do_any>
2255 <set_value name="this.$Name" exact="{30211, 6000}"/>
2256 <set_value name="this.$Name" exact="{30211, 6001}"/>
2257 </do_any>
2258 </actions>
2259 </library>
2260
2261 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
2262 <library name="ARG_VS_HOL_Preemptive_Offensive_Construct_Description">
2263 <actions>
2264 <do_if value="$ThreadMood == 'negative'">
2265 <do_any>
2266 <set_value name="this.$Description" exact="{30211, 6101}"/>
2267 <set_value name="this.$Description" exact="{30211, 6102}"/>
2268 </do_any>
2269
2270 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 6111}"/>
2271
2272 <do_any>
2273 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 6121}"/>
2274 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 6122}"/>
2275 </do_any>
2276 </do_if>
2277 <do_elseif value="$ThreadMood == 'positive'">
2278 <do_any>
2279 <set_value name="this.$Description" exact="{30211, 6201}"/>
2280 <set_value name="this.$Description" exact="{30211, 6202}"/>
2281 </do_any>
2282
2283 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 6211}"/>
2284 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 6221}"/>
2285 </do_elseif>
2286 </actions>
2287 </library>
2288 </cues>
2289 </cue>
2290
2291 <cue name="ARG_VS_HOL_Gather_Intel">
2292 <cues>
2293 <cue name="ARG_VS_HOL_Preemptive_Gather_Intel">
2294 <actions>
2295 <!--Argon Vs Holy Order - Gather Intel-->
2296 <set_value name="$ThreadID" exact="'$arg_vs_hol_gather_intel'"/>
2297 <set_value name="$Thread" exact="table[
2298 $ID = $ThreadID,
2299 $Faction = $Faction,
2300 $EnemyFaction = $EnemyFaction,
2301 $MissionGroup = $MissionGroup,
2302 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
2303 $ThreadType = 'sequential',
2304 $MissionType = missiontype.intelligence,
2305 $Difficulty = level.medium,
2306 $SubMissionLib = ARG_VS_HOL_Gather_Intel_Get_Submissions,
2307 $NameLib = ARG_VS_HOL_Gather_Intel_Construct_Name,
2308 $DescriptionLib = ARG_VS_HOL_Gather_Intel_Construct_Description,
2309 $MinMissions = 2,
2310 $MaxMissions = 3,
2311 $ThreadAbortRelation = -0.00064]"/>
2312
2313 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
2314 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
2315 </actions>
2316 </cue>
2317
2318 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2319 <library name="ARG_VS_HOL_Gather_Intel_Get_Submissions">
2320 <actions>
2321 <set_value name="$Submissions" exact="table[]"/>
2322 <set_value name="$Submissions.$deploy_satellite"
2323 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [101400], $Sequence = -1 ]"/>
2324 <set_value name="$Submissions.$achieve_coverage__enemy_sector"
2325 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30211, $TextOffset = [102100], $Sequence = -1 ]"/>
2326 <set_value name="$Submissions.$find_resources__enemy_sector"
2327 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [106100], $Sequence = -1 ]"/>
2328 <set_value name="$Submissions.$scan__ship"
2329 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150000], $Sequence = -1 ]"/>
2330 <set_value name="$Submissions.$scan__station"
2331 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150100], $Sequence = -1 ]"/>
2332 <set_value name="$Submissions.$scan__module"
2333 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150200], $Sequence = -1 ]"/>
2334 <set_value name="$Submissions.$scan__for_ware"
2335 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150300], $Sequence = -1 ]"/>
2336 <set_value name="$Submissions.$scan__for_inventory"
2337 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150400], $Sequence = -1 ]"/>
2338 <!--$scan__for_entity currently disabled as it's quite a chore-->
2339 <!--<set_value name="$Submissions.$scan__for_entity"
2340 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150500], $Sequence = -1 ]"/>-->
2341 <set_value name="$Submissions.$scan__for_idcode"
2342 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30211, $TextOffset = [150600], $Sequence = -1 ]"/>
2343
2344 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
2345 </actions>
2346 </library>
2347
2348 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2349 <library name="ARG_VS_HOL_Gather_Intel_Construct_Name">
2350 <actions>
2351 <do_any>
2352 <set_value name="this.$Name" exact="{30211, 7000}"/>
2353 <set_value name="this.$Name" exact="{30211, 7001}"/>
2354 </do_any>
2355 </actions>
2356 </library>
2357
2358 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
2359 <library name="ARG_VS_HOL_Gather_Intel_Construct_Description">
2360 <actions>
2361 <do_if value="$ThreadMood == 'negative'">
2362 <do_any>
2363 <set_value name="this.$Description" exact="{30211, 7101}"/>
2364 <set_value name="this.$Description" exact="{30211, 7102}"/>
2365 </do_any>
2366
2367 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 7111}"/>
2368
2369 <do_any>
2370 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 7121}"/>
2371 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 7122}"/>
2372 </do_any>
2373 </do_if>
2374 <do_elseif value="$ThreadMood == 'positive'">
2375 <do_any>
2376 <set_value name="this.$Description" exact="{30211, 7201}"/>
2377 <set_value name="this.$Description" exact="{30211, 7202}"/>
2378 </do_any>
2379
2380 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 7211}"/>
2381 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 7221}"/>
2382 </do_elseif>
2383 </actions>
2384 </library>
2385 </cues>
2386 </cue>
2387
2388 <cue name="ARG_VS_HOL_Support_Invasion">
2389 <cues>
2390 <cue name="ARG_VS_HOL_Preemptive_Support_Invasion">
2391 <actions>
2392 <!--Argon Vs Holy Order - Support Invasion-->
2393 <set_value name="$ThreadID" exact="'$arg_vs_hol_support_invasion'"/>
2394 <set_value name="$Thread" exact="table[
2395 $ID = $ThreadID,
2396 $Faction = $Faction,
2397 $EnemyFaction = $EnemyFaction,
2398 $MissionGroup = $MissionGroup,
2399 $ThreadConditionLibs = [Situation__Invading],
2400 $ThreadType = 'sequential',
2401 $MissionType = missiontype.fight,
2402 $Difficulty = level.hard,
2403 $SubMissionLib = ARG_VS_HOL_Support_Invasion_Get_Submissions,
2404 $NameLib = ARG_VS_HOL_Support_Invasion_Construct_Name,
2405 $DescriptionLib = ARG_VS_HOL_Support_Invasion_Construct_Description,
2406 $MinMissions = 4,
2407 $MaxMissions = 5,
2408 $ThreadAbortRelation = -0.00064]"/>
2409
2410 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
2411 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
2412 </actions>
2413 </cue>
2414
2415 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2416 <library name="ARG_VS_HOL_Support_Invasion_Get_Submissions">
2417 <actions>
2418 <set_value name="$Submissions" exact="table[]"/>
2419 <set_value name="$Submissions.$support_invasion"
2420 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30211, $TextOffset = [109000], $Sequence = -1 ]"/>
2421
2422 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
2423 </actions>
2424 </library>
2425
2426 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
2427 <library name="ARG_VS_HOL_Support_Invasion_Construct_Name">
2428 <actions>
2429 <do_any>
2430 <set_value name="this.$Name" exact="{30211, 8000}"/>
2431 </do_any>
2432 </actions>
2433 </library>
2434
2435 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
2436 <library name="ARG_VS_HOL_Support_Invasion_Construct_Description">
2437 <actions>
2438 <do_if value="$ThreadMood == 'negative'">
2439 <do_any>
2440 <set_value name="this.$Description" exact="{30211, 8101}"/>
2441 </do_any>
2442
2443 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 8111}"/>
2444
2445 <do_any>
2446 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 8121}"/>
2447 </do_any>
2448 </do_if>
2449 <do_elseif value="$ThreadMood == 'positive'">
2450 <do_any>
2451 <set_value name="this.$Description" exact="{30211, 8201}"/>
2452 </do_any>
2453
2454 <set_value name="this.$Description" operation="add" exact="' ' + {30211, 8211}"/>
2455 <set_value name="this.$Description" operation="add" exact="'\n' + {30211, 8221}"/>
2456 </do_elseif>
2457 </actions>
2458 </library>
2459 </cues>
2460 </cue>
2461
2462
2463 </cues>
2464 </cue>
2465
2466 <!--
2467 ###################################
2468 PARANID VS HOLY ORDER
2469 ###################################-->
2470 <cue name="PAR_VS_HOL" namespace="this">
2471 <actions>
2472 <!--Common values-->
2473 <set_value name="$ManagerCue" exact="parent.namespace"/>
2474 <set_value name="$Faction" exact="faction.paranid"/>
2475 <set_value name="$EnemyFaction" exact="faction.holyorder"/>
2476 <set_value name="$MissionGroup" exact="missiongroup.paranid_war_holyorder"/>
2477 <set_value name="$Mission_Contact" exact="null"/>
2478 <set_value name="$Page" exact="30212" comment="Paranid-HolyOrder-War page"/>
2479 <set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
2480 <set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
2481 <set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
2482 <set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
2483
2484 <!--Status-->
2485 <set_value name="$SubscriptionStatus" exact="null"/>
2486 <set_value name="$IntroducedToContact" exact="false"/>
2487 <set_value name="$JobsDescribed" exact="false"/>
2488 <set_value name="$ConflictDescribed" exact="false"/>
2489 <set_value name="$IntroMissionSuccessful" exact="false"/>
2490 <set_value name="$CooldownTime" exact="-1s"/>
2491
2492 <!--Stats-->
2493 <set_value name="$ThreadsCompleted" exact="0"/>
2494 <set_value name="$ThreadsFailed" exact="0"/>
2495
2496 <set_value name="$MissionsCompleted" exact="0"/>
2497 <set_value name="$MissionsFailed" exact="0"/>
2498 </actions>
2499 <cues>
2500 <cue name="PAR_VS_HOL_Init">
2501 <actions>
2502 <set_value name="$ContactCreatorCue" exact="PAR_VS_HOL_Create_Contact"/>
2503 <set_value name="$IntroMissionCue" exact="PAR_VS_HOL_Introduction"/>
2504
2505 <!--$SubscriptionStatus:
2506 - 'unsubscribed'
2507 - 'probation'
2508 - 'subscribed'
2509 - 'cooldown'-->
2510 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'unsubscribed'" comment="TODO: @Owen, @Roger - temporary, change back to unsubscribed!"/>
2511 </actions>
2512 </cue>
2513
2514 <!--
2515 ####################
2516 DEBUG
2517 ####################-->
2518 <cue name="PAR_VS_HOL_Debug_Reset">
2519 <conditions>
2520 <event_cue_signalled/>
2521 </conditions>
2522 <actions>
2523 <do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
2524 <do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
2525 <signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
2526 </do_if>
2527 </do_all>
2528 <set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
2529 <do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
2530 <do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
2531 <remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
2532 </do_if>
2533 </do_all>
2534 <do_if value="$Mission_Contact.isclass.npc">
2535 <destroy_object object="$Mission_Contact"/>
2536 </do_if>
2537 <set_value name="$Mission_Contact" exact="null"/>
2538 <reset_cue cue="namespace"/>
2539 <reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
2540 </actions>
2541 </cue>
2542
2543 <cue name="PAR_VS_HOL_Debug_Subscribe" instantiate="true">
2544 <conditions>
2545 <event_cue_signalled/>
2546 </conditions>
2547 <actions>
2548 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
2549 </actions>
2550 </cue>
2551
2552 <!--
2553 ####################
2554 SUBSCRIPTION
2555 ####################-->
2556
2557 <!--event.param == new status-->
2558 <cue name="PAR_VS_HOL_Set_Subscription_Status" instantiate="true">
2559 <conditions>
2560 <event_cue_signalled/>
2561 </conditions>
2562 <actions>
2563 <do_if value="
2564 event.param == 'unsubscribed' or
2565 event.param == 'probation' or
2566 event.param == 'subscribed' or
2567 event.param == 'cooldown'">
2568
2569 <debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
2570 <set_value name="$SubscriptionStatus" exact="event.param"/>
2571
2572 <!--Be careful with state change handlers here if the requested state was the same as the previous one-->
2573 <do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
2574 <unlock_achievement name="JOIN_WAR" />
2575 <do_if value="HOL_VS_PAR.$SubscriptionStatus == 'subscribed'">
2576 <unlock_achievement name="JOIN_DOUBLE_AGENT" />
2577 </do_if>
2578 <signal_cue cue="CalculateThreads"/>
2579 </do_if>
2580 <do_elseif value="event.param == 'cooldown'">
2581 <!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
2582 <set_value name="$CooldownTime" exact="player.age + 5min"/>
2583 </do_elseif>
2584 </do_if>
2585 <do_else>
2586 <assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
2587 </do_else>
2588 </actions>
2589 </cue>
2590
2591 <cue name="PAR_VS_HOL_Check_Cooldown" instantiate="true" checkinterval="5s">
2592 <conditions>
2593 <check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
2594 </conditions>
2595 <actions>
2596 <debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
2597 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
2598 </actions>
2599 </cue>
2600
2601 <!--
2602 ####################
2603 CONTACT
2604 ####################-->
2605
2606 <!--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)-->
2607 <cue name="PAR_VS_HOL_Create_Contact">
2608 <conditions>
2609 <event_cue_signalled/>
2610 </conditions>
2611 <actions>
2612 <set_value name="this.$SelectedSpace" exact="null"/>
2613 <do_if value="event.param and typeof event.param == datatype.table">
2614 <set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
2615 <do_all exact="this.$HostSectorKeys.count" counter="$i">
2616 <do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
2617 <!--Select a sector with stations and a high security value-->
2618 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
2619 <match_content class="class.walkablemodule"/>
2620 </find_station>
2621 <do_if value="this.$PotentialStation">
2622 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
2623 <break/>
2624 </do_if>
2625 </do_if>
2626 </do_all>
2627 <do_if value="not this.$SelectedSpace">
2628 <!--Simply select the furthest sector with stations-->
2629 <do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
2630 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
2631 <match_content class="class.walkablemodule"/>
2632 </find_station>
2633 <do_if value="this.$PotentialStation">
2634 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
2635 <break/>
2636 </do_if>
2637 </do_all>
2638 </do_if>
2639 </do_if>
2640
2641 <do_if value="not this.$SelectedSpace">
2642 <find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
2643 <match_content class="class.walkablemodule"/>
2644 </find_station>
2645 <do_if value="this.$PotentialStation">
2646 <set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
2647 <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"/>
2648 </do_if>
2649 </do_if>
2650 <do_if value="this.$SelectedSpace">
2651 <find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
2652 <match_content class="class.walkablemodule"/>
2653 </find_station>
2654 <assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
2655 <do_if value="$PlacementObject">
2656 <create_cue_actor name="$Mission_Contact" cue="namespace" group="paranid.factionrepresentative">
2657 <page exact="10304"/>
2658 <owner exact="$Faction"/>
2659 </create_cue_actor>
2660 <do_if value="$Mission_Contact">
2661 <set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
2662 <set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
2663 <debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
2664 </do_if>
2665 </do_if>
2666 </do_if>
2667
2668 <assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
2669 <do_if value="not $Mission_Contact">
2670 <reset_cue cue="this"/>
2671 </do_if>
2672 </actions>
2673 <cues>
2674 <cue name="PAR_VS_HOL_Place_Contact_Init">
2675 <actions>
2676 <do_if value="$PlacementObject.attention ge attention.nearby">
2677 <signal_cue cue="PAR_VS_HOL_Place_Contact_Create_Interior"/>
2678 </do_if>
2679 </actions>
2680 </cue>
2681
2682 <cue name="PAR_VS_HOL_Place_Contact_Create_Interior">
2683 <conditions>
2684 <check_any>
2685 <event_cue_signalled/>
2686 <check_all>
2687 <event_object_changed_attention object="$PlacementObject"/>
2688 <check_value value="event.param ge attention.nearby"/>
2689 </check_all>
2690 </check_any>
2691 </conditions>
2692 <actions>
2693 <debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
2694 <get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
2695 <get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
2696
2697 <create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30212,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
2698 <assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
2699 <do_if value="$DynamicInterior">
2700 <find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
2701 <assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
2702 <do_if value="$NPC_Slot">
2703 <add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
2704 <debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
2705 </do_if>
2706 </do_if>
2707 </actions>
2708 <cues>
2709 <cue name="PAR_VS_HOL_Place_Contact_WithinDynamicInterior_Destroy">
2710 <conditions>
2711 <event_object_interiors_despawning object="$PlacementObject"/>
2712 </conditions>
2713 <actions>
2714 <debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
2715 <remove_actor_from_room actor="$Mission_Contact"/>
2716
2717 <destroy_object object="$DynamicInterior"/>
2718 <remove_value name="$DynamicInterior"/>
2719 <remove_value name="$DynamicCorridor"/>
2720 <remove_value name="$DynamicRoom"/>
2721 <reset_cue cue="PAR_VS_HOL_Place_Contact_Create_Interior"/>
2722 </actions>
2723 </cue>
2724 </cues>
2725 </cue>
2726
2727 <cue name="PAR_VS_HOL_Contact_Killed">
2728 <conditions>
2729 <event_object_destroyed object="$Mission_Contact"/>
2730 </conditions>
2731 <actions>
2732 <set_value name="$Mission_Contact" exact="null"/>
2733 <reset_cue cue="PAR_VS_HOL_Create_Contact"/>
2734 </actions>
2735 </cue>
2736
2737 <cue name="PAR_VS_HOL_Contact_Conversation_Started" instantiate="true">
2738 <conditions>
2739 <check_any>
2740 <event_conversation_started actor="$Mission_Contact" />
2741 <event_conversation_returned_to_section actor="$Mission_Contact" />
2742 </check_any>
2743 <check_value value="event.param == 'default'" />
2744 </conditions>
2745 <actions>
2746 <do_if value="event.name == 'event_conversation_started'">
2747 <do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
2748 <do_if value="player.entity.isfemale">
2749 <add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
2750 </do_if>
2751 <do_else>
2752 <add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
2753 </do_else>
2754 </do_if>
2755 <do_else>
2756 <!--More familiar greeting-->
2757 <add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
2758 </do_else>
2759 </do_if>
2760
2761 <include_actions ref="PAR_VS_HOL_Contact_Player_Lines"/>
2762 </actions>
2763 </cue>
2764
2765 <library name="PAR_VS_HOL_Contact_Player_Lines">
2766 <actions>
2767 <!--Specific sections-->
2768 <do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
2769 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
2770 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
2771 </do_if>
2772 </do_if>
2773 <do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
2774 <add_player_choice text="{1002,3021202}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
2775 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
2776 </do_elseif>
2777 <do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
2778 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
2779 </do_elseif>
2780
2781 <!--Start or other sections-->
2782 <do_else>
2783 <do_if value="$SubscriptionStatus == 'unsubscribed'">
2784 <do_if value="PAR_VS_HOL_Introduction.state == cuestate.waiting">
2785 <!--Intro mission is not in a state where the player can take it.-->
2786 <!--TODO @Owen - voice lines on rejecting the player?-->
2787 <add_player_choice text="{1002,3021201}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
2788 </do_if>
2789 <do_elseif value="$IntroducedToContact">
2790 <do_if value="$JobsDescribed">
2791 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
2792 <add_player_choice text="{1002,3021202}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict?"/>
2793 </do_if>
2794 <do_else>
2795 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
2796 </do_else>
2797 </do_elseif>
2798 <do_else>
2799 <add_player_choice text="{1002,3021201}" section="war_subscribe_request" comment="I'm here about The Order."/>
2800 </do_else>
2801 </do_if>
2802 <do_elseif value="$SubscriptionStatus == 'probation'">
2803 <do_if value="$IntroMissionSuccessful">
2804 <add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
2805 </do_if>
2806 <do_else>
2807 <add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
2808 </do_else>
2809 </do_elseif>
2810 </do_else>
2811 </actions>
2812 </library>
2813
2814 <cue name="PAR_VS_HOL_Contact_NextSection" instantiate="true">
2815 <conditions>
2816 <event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
2817 </conditions>
2818 <actions>
2819 <set_value name="$AddPlayerChoices" exact="true"/>
2820 <do_if value="event.param == 'war_subscribe_request'">
2821 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
2822 <set_value name="$IntroducedToContact" exact="true"/>
2823 <add_npc_line speaker="$Mission_Contact" line="30212001" hidechoices="true" comment="Ah, very good."/>
2824 <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'..."/>
2825 <do_if value="player.entity.race == race.paranid">
2826 <!--Paranid citizen-->
2827 <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."/>
2828 </do_if>
2829 <do_else>
2830 <!--Paranid friend-->
2831 <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."/>
2832 </do_else>
2833
2834 <add_npc_line speaker="$Mission_Contact" line="30212005" hidechoices="true" comment="There will always be place for pilots who share our ideals."/>
2835 <add_npc_line speaker="$Mission_Contact" line="30212006" hidechoices="true" comment="Probation line 1"/>
2836 <add_npc_line speaker="$Mission_Contact" line="30212007" hidechoices="true" comment="Probation line 2"/>
2837 <do_if value="player.entity.race != race.paranid">
2838 <!--non-Paranid player line-->
2839 <add_npc_line speaker="$Mission_Contact" line="30212008" hidechoices="true" comment="I am curious to see how you fare compared to my Paranid brethren."/>
2840 </do_if>
2841 <do_else>
2842 <add_npc_line speaker="$Mission_Contact" line="30212009" hidechoices="true" comment="Probation line 3"/>
2843 <add_npc_line speaker="$Mission_Contact" line="30212010" hidechoices="true" comment="Do you have questions?"/>
2844 </do_else>
2845 </do_if>
2846 <do_else>
2847 <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."/>
2848 </do_else>
2849 </do_if>
2850 <do_elseif value="event.param == 'war_subscribe_ask_intro'">
2851 <set_value name="$JobsDescribed" exact="true"/>
2852 <add_npc_line speaker="$Mission_Contact" line="30212011" hidechoices="true"/>
2853 <add_npc_line speaker="$Mission_Contact" line="30212012" hidechoices="true"/>
2854 </do_elseif>
2855 <do_elseif value="event.param == 'war_subscribe_ask_conflict'">
2856 <set_value name="$ConflictDescribed" exact="true"/>
2857 <do_if value="player.entity.race == race.paranid">
2858 <!--Paranid player line-->
2859 <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."/>
2860 </do_if>
2861 <add_npc_line speaker="$Mission_Contact" line="30212014" hidechoices="true" comment="Conflict desc 1"/>
2862 <add_npc_line speaker="$Mission_Contact" line="30212015" hidechoices="true" comment="Conflict desc 2"/>
2863 <add_npc_line speaker="$Mission_Contact" line="30212016" hidechoices="true" comment="Conflict desc 3"/>
2864 <add_npc_line speaker="$Mission_Contact" line="30212017" hidechoices="true" comment="Conflict desc 4"/>
2865 <add_npc_line speaker="$Mission_Contact" line="30212018" hidechoices="true" comment="Conflict desc 5"/>
2866 <add_npc_line speaker="$Mission_Contact" line="30212019" hidechoices="true" comment="Shall we begin?"/>
2867 </do_elseif>
2868 <do_elseif value="event.param == 'war_subscribe_request_2'">
2869 <!--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.-->
2870 <include_actions ref="PAR_VS_HOL_Can_Activate_Introduction"/>
2871 <do_if value="$CanActivateIntro">
2872 <signal_cue cue="PAR_VS_HOL_Introduction"/>
2873 <add_npc_line speaker="$Mission_Contact" line="30212001" hidechoices="true" comment="Ah, very good."/>
2874 </do_if>
2875 <do_else>
2876 <set_value name="$AddPlayerChoices" exact="false"/>
2877 <add_npc_line speaker="$Mission_Contact" line="30212027" hidechoices="true" comment="We are still passing judgement on your previous performance. Leave us."/>
2878 </do_else>
2879 </do_elseif>
2880 <do_elseif value="event.param == 'war_subscribe_start_intro'">
2881 <set_value name="$AddPlayerChoices" exact="false"/>
2882 <signal_cue cue="PAR_VS_HOL_Player_Requested_Subscription"/>
2883 <add_npc_line speaker="$Mission_Contact" line="30212020" hidechoices="true" comment="I will select a suitable task for you momentarily."/>
2884 <add_npc_line speaker="$Mission_Contact" line="30212021" hidechoices="true" comment="I look forward to your return."/>
2885 </do_elseif>
2886 <do_elseif value="event.param == 'war_intro_complete'">
2887 <set_value name="$AddPlayerChoices" exact="false"/>
2888 <add_npc_line speaker="$Mission_Contact" line="30212022" hidechoices="true" comment="Yes, I saw. Very good."/>
2889 <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."/>
2890 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'subscribed'"/>
2891 </do_elseif>
2892 <do_elseif value="event.param == 'war_abort_intro'">
2893 <set_value name="$AddPlayerChoices" exact="false"/>
2894 <signal_cue cue="PAR_VS_HOL_Player_Requests_Intro_Abort"/>
2895 </do_elseif>
2896
2897 <do_if value="$AddPlayerChoices">
2898 <include_actions ref="PAR_VS_HOL_Contact_Player_Lines"/>
2899 </do_if>
2900 </actions>
2901 </cue>
2902 </cues>
2903 </cue>
2904
2905
2906 <!--event.param = table[
2907 $cue = thread cue namespace,
2908 $completedmissions = number of completed missions,
2909 $failedmissions = number of failed missions]-->
2910 <cue name="PAR_VS_HOL_Thread_Finished" instantiate="true">
2911 <conditions>
2912 <event_cue_signalled cue="Cleanup_Thread"/>
2913 <check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
2914 <check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
2915 </conditions>
2916 <actions>
2917 <!--TODO @Owen spoken feedback?-->
2918 <debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
2919
2920 <set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
2921 <set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
2922
2923 <do_if value="$MissionsCompleted ge 20">
2924 <unlock_achievement name="WAR_MISSIONS" />
2925 </do_if>
2926
2927 <do_if value="event.param.$failed">
2928 <set_value name="$ThreadsFailed" operation="add"/>
2929 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'cooldown'"/>
2930 </do_if>
2931 <do_else>
2932 <set_value name="$ThreadsCompleted" operation="add"/>
2933 <signal_cue cue="CalculateThreads"/>
2934 </do_else>
2935 </actions>
2936 </cue>
2937
2938 <!--
2939 ####################
2940 INTRODUCTION
2941 ####################-->
2942
2943 <cue name="PAR_VS_HOL_Player_Requested_Subscription" instantiate="true">
2944 <conditions>
2945 <event_cue_signalled/>
2946 </conditions>
2947 </cue>
2948
2949 <cue name="PAR_VS_HOL_Player_Requests_Intro_Abort" instantiate="true">
2950 <conditions>
2951 <event_cue_signalled/>
2952 </conditions>
2953 </cue>
2954
2955 <library name="PAR_VS_HOL_Can_Activate_Introduction">
2956 <actions>
2957 <!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
2958 <set_value name="$CanActivateIntro" exact="false"/>
2959 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
2960 <set_value name="$CanActivateIntro" exact="true"/>
2961 </do_if>
2962 </actions>
2963 </library>
2964
2965 <cue name="PAR_VS_HOL_Introduction" version="2">
2966 <conditions>
2967 <event_cue_signalled/>
2968 </conditions>
2969 <actions>
2970 <debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
2971 <set_value name="$MissionIntroCue" exact="this"/>
2972 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
2973 </actions>
2974 <patch sinceversion="2" state="complete">
2975 <do_if value="$SubscriptionStatus == 'cooldown'">
2976 <debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
2977 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
2978 </do_if>
2979 </patch>
2980 <cues>
2981 <cue name="PAR_VS_HOL_Introduction_Init">
2982 <actions>
2983 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
2984 <signal_cue cue="PAR_VS_HOL_Introduction_Create_Offer"/>
2985 </do_if>
2986 </actions>
2987 </cue>
2988
2989 <cue name="PAR_VS_HOL_Introduction_Create_Offer">
2990 <conditions>
2991 <check_any>
2992 <check_all>
2993 <event_player_relation_changed faction="$Faction"/>
2994 <check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
2995 </check_all>
2996 <event_cue_signalled/>
2997 </check_any>
2998 </conditions>
2999 <actions>
3000 <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]'"/>
3001 <do_if value="not $Mission_Contact.isclass.npc">
3002 <signal_cue_instantly cue="$ContactCreatorCue"/>
3003 </do_if>
3004
3005 <do_if value="$Mission_Contact">
3006 <debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
3007 <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">
3008 <briefing>
3009 <objective step="1" action="objective.talkto" object="$Mission_Contact"/>
3010 </briefing>
3011 </create_offer>
3012 </do_if>
3013 <do_else>
3014 <debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
3015 <reset_cue cue="$MissionIntroCue"/>
3016 </do_else>
3017 </actions>
3018 <cues>
3019 <cue name="PAR_VS_HOL_Introduction_Offer_Accepted">
3020 <conditions>
3021 <event_object_signalled object="$Mission_Contact" param="'accept'" />
3022 </conditions>
3023 <actions>
3024 <create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
3025 <update_mission cue="$MissionIntroCue">
3026 <briefing>
3027 <objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
3028 </briefing>
3029 </update_mission>
3030 <remove_offer cue="$MissionIntroCue"/>
3031 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
3032 $actor = $Mission_Contact,
3033 $object = $PlacementObject,
3034 $missioncue = $MissionIntroCue,
3035 $cancelcue = PAR_VS_HOL_Cancel_Intro_Talkto,
3036 $objective = objective.talkto,
3037 $debugchance = $DebugChance]"/>
3038 </actions>
3039 </cue>
3040 </cues>
3041 </cue>
3042
3043 <cue name="PAR_VS_HOL_Intro_Abort">
3044 <conditions>
3045 <check_any>
3046 <event_mission_aborted cue="PAR_VS_HOL_Introduction"/>
3047 <event_cue_signalled cue="PAR_VS_HOL_Player_Requests_Intro_Abort"/>
3048 </check_any>
3049 </conditions>
3050 <actions>
3051 <do_if value="$MissionIntroCue.hasmission">
3052 <remove_mission cue="$MissionIntroCue" type="aborted"/>
3053 </do_if>
3054 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'unsubscribed'"/>
3055 <reset_cue cue="PAR_VS_HOL_Introduction"/>
3056 </actions>
3057 </cue>
3058
3059 <cue name="PAR_VS_HOL_Cancel_Intro_Talkto" instantiate="true">
3060 <conditions>
3061 <event_cue_signalled/>
3062 </conditions>
3063 </cue>
3064
3065 <cue name="PAR_VS_HOL_Start_Intro_Mission">
3066 <conditions>
3067 <event_cue_signalled cue="PAR_VS_HOL_Player_Requested_Subscription"/>
3068 </conditions>
3069 <actions>
3070 <signal_cue cue="PAR_VS_HOL_Cancel_Intro_Talkto"/>
3071 <signal_cue_instantly cue="PAR_VS_HOL_Set_Subscription_Status" param="'probation'"/>
3072 <set_value name="$IntroMissionSuccessful" exact="false"/>
3073
3074 <do_if value="$MissionIntroCue.hasmissionoffer">
3075 <remove_offer cue="$MissionIntroCue"/>
3076 </do_if>
3077
3078 <do_if value="not $MissionIntroCue.hasmission">
3079 <create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30212}.{1}" description="readtext.{30212}.{2}" difficulty="level.easy" faction="$Faction" group="$MissionGroup"/>
3080 </do_if>
3081
3082 <create_ship name="$TestShip" zone="player.zone">
3083 <select faction="faction.holyorder" size="class.ship_s"/>
3084 <owner exact="faction.holyorder"/>
3085 <pilot actor="null"/>
3086 <safepos object="player.entity" min="30km" max="40km"/>
3087 </create_ship>
3088
3089 <update_mission cue="$MissionIntroCue">
3090 <briefing>
3091 <objective step="1" action="objective.destroy" object="$TestShip"/>
3092 </briefing>
3093 </update_mission>
3094 <set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
3095 </actions>
3096 <cues>
3097 <cue name="PAR_VS_HOL_Start_Intro_Mission_Successful">
3098 <conditions>
3099 <event_object_destroyed object="$TestShip"/>
3100 </conditions>
3101 <actions>
3102 <update_mission cue="$MissionIntroCue">
3103 <briefing>
3104 <objective step="2" action="objective.talkto" object="$Mission_Contact"/>
3105 </briefing>
3106 </update_mission>
3107 <set_value name="$IntroMissionSuccessful" exact="true"/>
3108 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
3109 $actor = $Mission_Contact,
3110 $object = $PlacementObject,
3111 $missioncue = $MissionIntroCue,
3112 $cancelcue = PAR_VS_HOL_Start_Intro_Mission_Remove_Mission,
3113 $objective = objective.talkto,
3114 $step = 2,
3115 $debugchance = $DebugChance]"/>
3116 </actions>
3117 </cue>
3118
3119 <cue name="PAR_VS_HOL_Start_Intro_Mission_Remove_Mission">
3120 <conditions>
3121 <event_cue_signalled/>
3122 </conditions>
3123 <actions>
3124 <remove_mission cue="$MissionIntroCue" type="completed"/>
3125 <reset_cue cue="PAR_VS_HOL_Introduction"/>
3126 </actions>
3127 </cue>
3128
3129 <cue name="PAR_VS_HOL_Start_Intro_Mission_End">
3130 <conditions>
3131 <event_conversation_started actor="$Mission_Contact"/>
3132 </conditions>
3133 <actions>
3134 <signal_cue cue="PAR_VS_HOL_Start_Intro_Mission_Remove_Mission"/>
3135 </actions>
3136 </cue>
3137 </cues>
3138 </cue>
3139 </cues>
3140 </cue>
3141
3142 <!--
3143 ####################
3144 THREADS
3145 ####################-->
3146 <cue name="PAR_VS_HOL_Reinforce_Defence">
3147 <cues>
3148 <cue name="PAR_VS_HOL_Reinforce_Defence_Register">
3149 <actions>
3150 <!--Paranid Vs Holy Order - Reinforce Defence-->
3151 <set_value name="$ThreadID" exact="'$par_vs_hol_reinforce_defence'"/>
3152 <set_value name="$Thread" exact="table[
3153 $ID = $ThreadID,
3154 $Faction = $Faction,
3155 $EnemyFaction = $EnemyFaction,
3156 $MissionGroup = $MissionGroup,
3157 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
3158 $ThreadType = 'sequential',
3159 $MissionType = missiontype.protect,
3160 $Difficulty = level.medium,
3161 $SubMissionLib = PAR_VS_HOL_Reinforce_Defence_Get_Submissions,
3162 $NameLib = PAR_VS_HOL_Reinforce_Defence_Construct_Name,
3163 $DescriptionLib = PAR_VS_HOL_Reinforce_Defence_Construct_Description,
3164 $MinMissions = 4,
3165 $MaxMissions = 5,
3166 $ThreadAbortRelation = -0.00064]"/>
3167
3168 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
3169 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
3170 </actions>
3171 </cue>
3172
3173 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3174 <library name="PAR_VS_HOL_Reinforce_Defence_Get_Submissions">
3175 <actions>
3176 <set_value name="$Submissions" exact="table[]"/>
3177 <set_value name="$Submissions.$deploy_lasertowers"
3178 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [101000], $Sequence = -1 ]"/>
3179 <set_value name="$Submissions.$deploy_mines"
3180 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
3181 <set_value name="$Submissions.$achieve_coverage__host_sector"
3182 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [102000], $Sequence = -1 ]"/>
3183 <set_value name="$Submissions.$repair__damagedship"
3184 exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30212, $TextOffset = [103000], $Sequence = -1 ]"/>
3185 <set_value name="$Submissions.$taxi__specialist"
3186 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30212, $TextOffset = [104000], $Sequence = 1 ]"/>
3187 <set_value name="$Submissions.$deliver__crew"
3188 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30211, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
3189
3190 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
3191 </actions>
3192 </library>
3193
3194 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3195 <library name="PAR_VS_HOL_Reinforce_Defence_Construct_Name">
3196 <actions>
3197 <do_any>
3198 <set_value name="this.$Name" exact="{30212, 3000}"/>
3199 <set_value name="this.$Name" exact="{30212, 3001}"/>
3200 <set_value name="this.$Name" exact="{30212, 3002}"/>
3201 </do_any>
3202 </actions>
3203 </library>
3204
3205 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
3206 <library name="PAR_VS_HOL_Reinforce_Defence_Construct_Description">
3207 <actions>
3208 <do_if value="$ThreadMood == 'negative'">
3209 <do_any>
3210 <set_value name="this.$Description" exact="{30212, 3101}"/>
3211 <set_value name="this.$Description" exact="{30212, 3102}"/>
3212 </do_any>
3213
3214 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 3111}"/>
3215
3216 <do_any>
3217 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 3121}"/>
3218 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 3122}"/>
3219 </do_any>
3220 </do_if>
3221 <do_elseif value="$ThreadMood == 'positive'">
3222 <do_any>
3223 <set_value name="this.$Description" exact="{30212, 3201}"/>
3224 <set_value name="this.$Description" exact="{30212, 3202}"/>
3225 </do_any>
3226
3227 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 3211}"/>
3228 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 3221}"/>
3229 </do_elseif>
3230 </actions>
3231 </library>
3232 </cues>
3233 </cue>
3234
3235 <cue name="PAR_VS_HOL_Construct_Defence">
3236 <cues>
3237 <cue name="PAR_VS_HOL_Construct_Defence_Register" version="2">
3238 <actions>
3239 <!--Paranid Vs Holy Order - Construct Defence-->
3240 <set_value name="$ThreadID" exact="'$par_vs_hol_construct_defence'"/>
3241 <set_value name="$Thread" exact="table[
3242 $ID = $ThreadID,
3243 $Faction = $Faction,
3244 $EnemyFaction = $EnemyFaction,
3245 $MissionGroup = $MissionGroup,
3246 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
3247 $ThreadType = 'sequential',
3248 $MissionType = missiontype.build,
3249 $Difficulty = level.medium,
3250 $SubMissionLib = PAR_VS_HOL_Construct_Defence_Get_Submissions,
3251 $NameLib = PAR_VS_HOL_Construct_Defence_Construct_Name,
3252 $DescriptionLib = PAR_VS_HOL_Construct_Defence_Construct_Description,
3253 $MinMissions = 1,
3254 $MaxMissions = 2,
3255 $ThreadAbortRelation = -0.00064]"/>
3256
3257 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
3258 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
3259 </actions>
3260 <patch sinceversion="2">
3261 <append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
3262 </patch>
3263 </cue>
3264
3265 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3266 <library name="PAR_VS_HOL_Construct_Defence_Get_Submissions">
3267 <actions>
3268 <set_value name="$Submissions" exact="table[]"/>
3269 <set_value name="$Submissions.$build__defencestation"
3270 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30212, $TextOffset = [105000], $Sequence = -1 ]"/>
3271 <set_value name="$Submissions.$build__fleet"
3272 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30212, $TextOffset = [120000], $Sequence = -1 ]"/>
3273
3274 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
3275 </actions>
3276 </library>
3277
3278 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3279 <library name="PAR_VS_HOL_Construct_Defence_Construct_Name">
3280 <actions>
3281 <do_any>
3282 <set_value name="this.$Name" exact="{30212, 4000}"/>
3283 </do_any>
3284 </actions>
3285 </library>
3286
3287 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
3288 <library name="PAR_VS_HOL_Construct_Defence_Construct_Description">
3289 <actions>
3290 <do_if value="$ThreadMood == 'negative'">
3291 <do_any>
3292 <set_value name="this.$Description" exact="{30212, 4101}"/>
3293 <set_value name="this.$Description" exact="{30212, 4102}"/>
3294 </do_any>
3295
3296 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 4111}"/>
3297
3298 <do_any>
3299 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 4121}"/>
3300 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 4122}"/>
3301 </do_any>
3302 </do_if>
3303 <do_elseif value="$ThreadMood == 'positive'">
3304 <do_any>
3305 <set_value name="this.$Description" exact="{30212, 4201}"/>
3306 <set_value name="this.$Description" exact="{30212, 4202}"/>
3307 </do_any>
3308
3309 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 4211}"/>
3310 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 4221}"/>
3311 </do_elseif>
3312 </actions>
3313 </library>
3314 </cues>
3315 </cue>
3316
3317 <cue name="PAR_VS_HOL_Secure_Resources">
3318 <cues>
3319 <cue name="PAR_VS_HOL_Secure_Resources_Register">
3320 <actions>
3321 <!--Paranid Vs Holy Order - Secure Resources-->
3322 <set_value name="$ThreadID" exact="'$par_vs_hol_secure_resources'"/>
3323 <set_value name="$Thread" exact="table[
3324 $ID = $ThreadID,
3325 $Faction = $Faction,
3326 $EnemyFaction = $EnemyFaction,
3327 $MissionGroup = $MissionGroup,
3328 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
3329 $ThreadType = 'sequential',
3330 $MissionType = missiontype.trade,
3331 $Difficulty = level.medium,
3332 $SubMissionLib = PAR_VS_HOL_Secure_Resources_Get_Submissions,
3333 $NameLib = PAR_VS_HOL_Secure_Resources_Construct_Name,
3334 $DescriptionLib = PAR_VS_HOL_Secure_Resources_Construct_Description,
3335 $MinMissions = 4,
3336 $MaxMissions = 5,
3337 $ThreadAbortRelation = -0.00064]"/>
3338
3339 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
3340 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
3341 </actions>
3342 </cue>
3343
3344 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3345 <library name="PAR_VS_HOL_Secure_Resources_Get_Submissions">
3346 <actions>
3347 <set_value name="$Submissions" exact="table[]"/>
3348 <set_value name="$Submissions.$large_supply__food"
3349 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30212, $TextOffset = [100000], $Sequence = -1 ]"/>
3350 <set_value name="$Submissions.$large_supply__shiptech"
3351 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30212, $TextOffset = [100100], $Sequence = -1 ]"/>
3352 <set_value name="$Submissions.$deploy_lasertowers_at_resources"
3353 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [101300], $Sequence = -1 ]"/>
3354 <set_value name="$Submissions.$find_resources__ores"
3355 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [106000], $Sequence = -1 ]"/>
3356 <set_value name="$Submissions.$supply_station"
3357 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [130000], $Sequence = -1 ]"/>
3358
3359 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
3360 </actions>
3361 </library>
3362
3363 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3364 <library name="PAR_VS_HOL_Secure_Resources_Construct_Name">
3365 <actions>
3366 <do_any>
3367 <set_value name="this.$Name" exact="{30212, 5000}"/>
3368 <set_value name="this.$Name" exact="{30212, 5001}"/>
3369 </do_any>
3370 </actions>
3371 </library>
3372
3373 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
3374 <library name="PAR_VS_HOL_Secure_Resources_Construct_Description">
3375 <actions>
3376 <do_if value="$ThreadMood == 'negative'">
3377 <do_any>
3378 <set_value name="this.$Description" exact="{30212, 5101}"/>
3379 <set_value name="this.$Description" exact="{30212, 5102}"/>
3380 </do_any>
3381
3382 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 5111}"/>
3383
3384 <do_any>
3385 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 5121}"/>
3386 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 5122}"/>
3387 </do_any>
3388 </do_if>
3389 <do_elseif value="$ThreadMood == 'positive'">
3390 <do_any>
3391 <set_value name="this.$Description" exact="{30212, 5201}"/>
3392 <set_value name="this.$Description" exact="{30212, 5202}"/>
3393 </do_any>
3394
3395 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 5211}"/>
3396 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 5221}"/>
3397 </do_elseif>
3398 </actions>
3399 </library>
3400 </cues>
3401 </cue>
3402
3403 <cue name="PAR_VS_HOL_Preemptive_Offensive">
3404 <cues>
3405 <cue name="PAR_VS_HOL_Preemptive_Offensive_Register">
3406 <actions>
3407 <!--Paranid Vs Holy Order - Preemptive Offensive-->
3408 <set_value name="$ThreadID" exact="'$par_vs_hol_preemptive_offensive'"/>
3409 <set_value name="$Thread" exact="table[
3410 $ID = $ThreadID,
3411 $Faction = $Faction,
3412 $EnemyFaction = $EnemyFaction,
3413 $MissionGroup = $MissionGroup,
3414 $ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
3415 $ThreadType = 'sequential',
3416 $MissionType = missiontype.fight,
3417 $Difficulty = level.medium,
3418 $SubMissionLib = PAR_VS_HOL_Preemptive_Offensive_Get_Submissions,
3419 $NameLib = PAR_VS_HOL_Preemptive_Offensive_Construct_Name,
3420 $DescriptionLib = PAR_VS_HOL_Preemptive_Offensive_Construct_Description,
3421 $MinMissions = 4,
3422 $MaxMissions = 5,
3423 $ThreadAbortRelation = -0.00064]"/>
3424
3425 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
3426 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
3427 </actions>
3428 </cue>
3429
3430 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3431 <library name="PAR_VS_HOL_Preemptive_Offensive_Get_Submissions">
3432 <actions>
3433 <set_value name="$Submissions" exact="table[]"/>
3434 <set_value name="$Submissions.$assassination__informant"
3435 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30212, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
3436 <set_value name="$Submissions.$board_ship"
3437 exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30212, $TextOffset = [108000], $Sequence = -1 ]"/>
3438 <set_value name="$Submissions.$destroy_rare_ship"
3439 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30212, $TextOffset = [140000], $Sequence = -1 ]"/>
3440
3441 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
3442 </actions>
3443 </library>
3444
3445 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3446 <library name="PAR_VS_HOL_Preemptive_Offensive_Construct_Name">
3447 <actions>
3448 <do_any>
3449 <set_value name="this.$Name" exact="{30212, 6000}"/>
3450 </do_any>
3451 </actions>
3452 </library>
3453
3454 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
3455 <library name="PAR_VS_HOL_Preemptive_Offensive_Construct_Description">
3456 <actions>
3457 <do_if value="$ThreadMood == 'negative'">
3458 <do_any>
3459 <set_value name="this.$Description" exact="{30212, 6101}"/>
3460 <set_value name="this.$Description" exact="{30212, 6102}"/>
3461 </do_any>
3462
3463 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 6111}"/>
3464
3465 <do_any>
3466 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 6121}"/>
3467 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 6122}"/>
3468 </do_any>
3469 </do_if>
3470 <do_elseif value="$ThreadMood == 'positive'">
3471 <do_any>
3472 <set_value name="this.$Description" exact="{30212, 6201}"/>
3473 <set_value name="this.$Description" exact="{30212, 6202}"/>
3474 </do_any>
3475
3476 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 6211}"/>
3477 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 6221}"/>
3478 </do_elseif>
3479 </actions>
3480 </library>
3481 </cues>
3482 </cue>
3483
3484 <cue name="PAR_VS_HOL_Gather_Intel">
3485 <cues>
3486 <cue name="PAR_VS_HOL_Preemptive_Gather_Intel">
3487 <actions>
3488 <!--Paranid Vs Holy Order - Gather Intel-->
3489 <set_value name="$ThreadID" exact="'$par_vs_hol_gather_intel'"/>
3490 <set_value name="$Thread" exact="table[
3491 $ID = $ThreadID,
3492 $Faction = $Faction,
3493 $EnemyFaction = $EnemyFaction,
3494 $MissionGroup = $MissionGroup,
3495 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
3496 $ThreadType = 'sequential',
3497 $MissionType = missiontype.intelligence,
3498 $Difficulty = level.medium,
3499 $SubMissionLib = PAR_VS_HOL_Gather_Intel_Get_Submissions,
3500 $NameLib = PAR_VS_HOL_Gather_Intel_Construct_Name,
3501 $DescriptionLib = PAR_VS_HOL_Gather_Intel_Construct_Description,
3502 $MinMissions = 2,
3503 $MaxMissions = 3,
3504 $ThreadAbortRelation = -0.00064]"/>
3505
3506 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
3507 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
3508 </actions>
3509 </cue>
3510
3511 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3512 <library name="PAR_VS_HOL_Gather_Intel_Get_Submissions">
3513 <actions>
3514 <set_value name="$Submissions" exact="table[]"/>
3515 <set_value name="$Submissions.$deploy_satellite"
3516 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [101400], $Sequence = -1 ]"/>
3517 <set_value name="$Submissions.$achieve_coverage__enemy_sector"
3518 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30212, $TextOffset = [102100], $Sequence = 1 ]"/>
3519 <set_value name="$Submissions.$find_resources__enemy_sector"
3520 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [106100], $Sequence = -1 ]"/>
3521 <set_value name="$Submissions.$scan__ship"
3522 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150000], $Sequence = -1 ]"/>
3523 <set_value name="$Submissions.$scan__station"
3524 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150100], $Sequence = -1 ]"/>
3525 <set_value name="$Submissions.$scan__module"
3526 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150200], $Sequence = -1 ]"/>
3527 <set_value name="$Submissions.$scan__for_ware"
3528 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150300], $Sequence = -1 ]"/>
3529 <set_value name="$Submissions.$scan__for_inventory"
3530 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150400], $Sequence = -1 ]"/>
3531 <!--$scan__for_entity currently disabled as it's quite a chore-->
3532 <!--<set_value name="$Submissions.$scan__for_entity"
3533 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150500], $Sequence = -1 ]"/>-->
3534 <set_value name="$Submissions.$scan__for_idcode"
3535 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30212, $TextOffset = [150600], $Sequence = -1 ]"/>
3536
3537 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
3538 </actions>
3539 </library>
3540
3541 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3542 <library name="PAR_VS_HOL_Gather_Intel_Construct_Name">
3543 <actions>
3544 <do_any>
3545 <set_value name="this.$Name" exact="{30212, 7000}"/>
3546 </do_any>
3547 </actions>
3548 </library>
3549
3550 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
3551 <library name="PAR_VS_HOL_Gather_Intel_Construct_Description">
3552 <actions>
3553 <do_if value="$ThreadMood == 'negative'">
3554 <do_any>
3555 <set_value name="this.$Description" exact="{30212, 7101}"/>
3556 <set_value name="this.$Description" exact="{30212, 7102}"/>
3557 </do_any>
3558
3559 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 7111}"/>
3560
3561 <do_any>
3562 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 7121}"/>
3563 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 7122}"/>
3564 </do_any>
3565 </do_if>
3566 <do_elseif value="$ThreadMood == 'positive'">
3567 <do_any>
3568 <set_value name="this.$Description" exact="{30212, 7201}"/>
3569 <set_value name="this.$Description" exact="{30212, 7202}"/>
3570 </do_any>
3571
3572 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 7211}"/>
3573 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 7221}"/>
3574 </do_elseif>
3575 </actions>
3576 </library>
3577 </cues>
3578 </cue>
3579
3580 <cue name="PAR_VS_HOL_Support_Invasion">
3581 <cues>
3582 <cue name="PAR_VS_HOL_Preemptive_Support_Invasion">
3583 <actions>
3584 <!--Paranid Vs Holy Order - Support Invasion-->
3585 <set_value name="$ThreadID" exact="'$par_vs_hol_support_invasion'"/>
3586 <set_value name="$Thread" exact="table[
3587 $ID = $ThreadID,
3588 $Faction = $Faction,
3589 $EnemyFaction = $EnemyFaction,
3590 $MissionGroup = $MissionGroup,
3591 $ThreadConditionLibs = [Situation__Invading],
3592 $ThreadType = 'sequential',
3593 $MissionType = missiontype.fight,
3594 $Difficulty = level.hard,
3595 $SubMissionLib = PAR_VS_HOL_Support_Invasion_Get_Submissions,
3596 $NameLib = PAR_VS_HOL_Support_Invasion_Construct_Name,
3597 $DescriptionLib = PAR_VS_HOL_Support_Invasion_Construct_Description,
3598 $MinMissions = 4,
3599 $MaxMissions = 5,
3600 $ThreadAbortRelation = -0.00064]"/>
3601
3602 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
3603 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
3604 </actions>
3605 </cue>
3606
3607 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3608 <library name="PAR_VS_HOL_Support_Invasion_Get_Submissions">
3609 <actions>
3610 <set_value name="$Submissions" exact="table[]"/>
3611 <set_value name="$Submissions.$support_invasion"
3612 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30212, $TextOffset = [109000], $Sequence = -1 ]"/>
3613
3614 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
3615 </actions>
3616 </library>
3617
3618 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
3619 <library name="PAR_VS_HOL_Support_Invasion_Construct_Name">
3620 <actions>
3621 <do_any>
3622 <set_value name="this.$Name" exact="{30212, 8000}"/>
3623 </do_any>
3624 </actions>
3625 </library>
3626
3627 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
3628 <library name="PAR_VS_HOL_Support_Invasion_Construct_Description">
3629 <actions>
3630 <do_if value="$ThreadMood == 'negative'">
3631 <do_any>
3632 <set_value name="this.$Description" exact="{30212, 8101}"/>
3633 </do_any>
3634
3635 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 8111}"/>
3636
3637 <do_any>
3638 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 8121}"/>
3639 </do_any>
3640 </do_if>
3641 <do_elseif value="$ThreadMood == 'positive'">
3642 <do_any>
3643 <set_value name="this.$Description" exact="{30212, 8201}"/>
3644 </do_any>
3645
3646 <set_value name="this.$Description" operation="add" exact="' ' + {30212, 8211}"/>
3647 <set_value name="this.$Description" operation="add" exact="'\n' + {30212, 8221}"/>
3648 </do_elseif>
3649 </actions>
3650 </library>
3651 </cues>
3652 </cue>
3653
3654 </cues>
3655 </cue>
3656
3657 <!--
3658 ###################################
3659 HOLY ORDER VS ARGON
3660 ###################################-->
3661 <cue name="HOL_VS_ARG" namespace="this">
3662 <actions>
3663 <!--Common values-->
3664 <set_value name="$ManagerCue" exact="parent.namespace"/>
3665 <set_value name="$Faction" exact="faction.holyorder"/>
3666 <set_value name="$EnemyFaction" exact="faction.argon"/>
3667 <set_value name="$MissionGroup" exact="missiongroup.holyorder_war_argon"/>
3668 <set_value name="$Mission_Contact" exact="null"/>
3669 <set_value name="$Page" exact="30213" comment="HolyOrder-Argon-War page"/>
3670 <set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
3671 <set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
3672 <set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
3673 <set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
3674
3675 <!--Status-->
3676 <set_value name="$SubscriptionStatus" exact="null"/>
3677 <set_value name="$IntroducedToContact" exact="false"/>
3678 <set_value name="$JobsDescribed" exact="false"/>
3679 <set_value name="$ConflictDescribed" exact="false"/>
3680 <set_value name="$IntroMissionSuccessful" exact="false"/>
3681 <set_value name="$CooldownTime" exact="-1s"/>
3682
3683 <!--Stats-->
3684 <set_value name="$ThreadsCompleted" exact="0"/>
3685 <set_value name="$ThreadsFailed" exact="0"/>
3686
3687 <set_value name="$MissionsCompleted" exact="0"/>
3688 <set_value name="$MissionsFailed" exact="0"/>
3689 </actions>
3690 <cues>
3691 <cue name="HOL_VS_ARG_Init">
3692 <actions>
3693 <set_value name="$ContactCreatorCue" exact="HOL_VS_ARG_Create_Contact"/>
3694 <set_value name="$IntroMissionCue" exact="HOL_VS_ARG_Introduction"/>
3695
3696 <!--$SubscriptionStatus:
3697 - 'unsubscribed'
3698 - 'probation'
3699 - 'subscribed'
3700 - 'cooldown'-->
3701 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'unsubscribed'" comment="TODO: @Owen, @Roger - temporary, change back to unsubscribed!"/>
3702 </actions>
3703 </cue>
3704
3705 <!--
3706 ####################
3707 DEBUG
3708 ####################-->
3709 <cue name="HOL_VS_ARG_Debug_Reset">
3710 <conditions>
3711 <event_cue_signalled/>
3712 </conditions>
3713 <actions>
3714 <do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
3715 <do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
3716 <signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
3717 </do_if>
3718 </do_all>
3719 <set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
3720 <do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
3721 <do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
3722 <remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
3723 </do_if>
3724 </do_all>
3725 <do_if value="$Mission_Contact.isclass.npc">
3726 <destroy_object object="$Mission_Contact"/>
3727 </do_if>
3728 <set_value name="$Mission_Contact" exact="null"/>
3729 <reset_cue cue="namespace"/>
3730 <reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
3731 </actions>
3732 </cue>
3733
3734 <cue name="HOL_VS_ARG_Debug_Subscribe" instantiate="true">
3735 <conditions>
3736 <event_cue_signalled/>
3737 </conditions>
3738 <actions>
3739 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'subscribed'"/>
3740 </actions>
3741 </cue>
3742
3743 <!--
3744 ####################
3745 SUBSCRIPTION
3746 ####################-->
3747
3748 <!--event.param == new status-->
3749 <cue name="HOL_VS_ARG_Set_Subscription_Status" instantiate="true">
3750 <conditions>
3751 <event_cue_signalled/>
3752 </conditions>
3753 <actions>
3754 <do_if value="
3755 event.param == 'unsubscribed' or
3756 event.param == 'probation' or
3757 event.param == 'subscribed' or
3758 event.param == 'cooldown'">
3759
3760 <debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
3761 <set_value name="$SubscriptionStatus" exact="event.param"/>
3762
3763 <!--Be careful with state change handlers here if the requested state was the same as the previous one-->
3764 <do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
3765 <unlock_achievement name="JOIN_WAR" />
3766 <do_if value="ARG_VS_HOL.$SubscriptionStatus == 'subscribed'">
3767 <unlock_achievement name="JOIN_DOUBLE_AGENT" />
3768 </do_if>
3769 <signal_cue cue="CalculateThreads"/>
3770 </do_if>
3771 <do_elseif value="event.param == 'cooldown'">
3772 <!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
3773 <set_value name="$CooldownTime" exact="player.age + 5min"/>
3774 </do_elseif>
3775 </do_if>
3776 <do_else>
3777 <assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
3778 </do_else>
3779 </actions>
3780 </cue>
3781
3782 <cue name="HOL_VS_ARG_Check_Cooldown" instantiate="true" checkinterval="5s">
3783 <conditions>
3784 <check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
3785 </conditions>
3786 <actions>
3787 <debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
3788 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'subscribed'"/>
3789 </actions>
3790 </cue>
3791
3792 <!--
3793 ####################
3794 CONTACT
3795 ####################-->
3796
3797 <!--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)-->
3798 <cue name="HOL_VS_ARG_Create_Contact">
3799 <conditions>
3800 <event_cue_signalled/>
3801 </conditions>
3802 <actions>
3803 <set_value name="this.$SelectedSpace" exact="null"/>
3804 <do_if value="event.param and typeof event.param == datatype.table">
3805 <set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
3806 <do_all exact="this.$HostSectorKeys.count" counter="$i">
3807 <do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
3808 <!--Select a sector with stations and a high security value-->
3809 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
3810 <match_content class="class.walkablemodule"/>
3811 </find_station>
3812 <do_if value="this.$PotentialStation">
3813 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
3814 <break/>
3815 </do_if>
3816 </do_if>
3817 </do_all>
3818 <do_if value="not this.$SelectedSpace">
3819 <!--Simply select the furthest sector with stations-->
3820 <do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
3821 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
3822 <match_content class="class.walkablemodule"/>
3823 </find_station>
3824 <do_if value="this.$PotentialStation">
3825 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
3826 <break/>
3827 </do_if>
3828 </do_all>
3829 </do_if>
3830 </do_if>
3831
3832 <do_if value="not this.$SelectedSpace">
3833 <find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
3834 <match_content class="class.walkablemodule"/>
3835 </find_station>
3836 <do_if value="this.$PotentialStation">
3837 <set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
3838 <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"/>
3839 </do_if>
3840 </do_if>
3841 <do_if value="this.$SelectedSpace">
3842 <find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
3843 <match_content class="class.walkablemodule"/>
3844 </find_station>
3845 <assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
3846 <do_if value="$PlacementObject">
3847 <create_cue_actor name="$Mission_Contact" cue="namespace" group="paranid.factionrepresentative">
3848 <page exact="10305"/>
3849 <owner exact="$Faction"/>
3850 </create_cue_actor>
3851 <do_if value="$Mission_Contact">
3852 <set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
3853 <set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
3854 <debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
3855 </do_if>
3856 </do_if>
3857 </do_if>
3858
3859 <assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
3860 <do_if value="not $Mission_Contact">
3861 <reset_cue cue="this"/>
3862 </do_if>
3863 </actions>
3864 <cues>
3865 <cue name="HOL_VS_ARG_Place_Contact_Init">
3866 <actions>
3867 <do_if value="$PlacementObject.attention ge attention.nearby">
3868 <signal_cue cue="HOL_VS_ARG_Place_Contact_Create_Interior"/>
3869 </do_if>
3870 </actions>
3871 </cue>
3872
3873 <cue name="HOL_VS_ARG_Place_Contact_Create_Interior">
3874 <conditions>
3875 <check_any>
3876 <event_cue_signalled/>
3877 <check_all>
3878 <event_object_changed_attention object="$PlacementObject"/>
3879 <check_value value="event.param ge attention.nearby"/>
3880 </check_all>
3881 </check_any>
3882 </conditions>
3883 <actions>
3884 <debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
3885 <get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
3886 <get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
3887
3888 <create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30213,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
3889 <assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
3890 <do_if value="$DynamicInterior">
3891 <find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
3892 <assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
3893 <do_if value="$NPC_Slot">
3894 <add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
3895 <debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
3896 </do_if>
3897 </do_if>
3898 </actions>
3899 <cues>
3900 <cue name="HOL_VS_ARG_Place_Contact_WithinDynamicInterior_Destroy">
3901 <conditions>
3902 <event_object_interiors_despawning object="$PlacementObject"/>
3903 </conditions>
3904 <actions>
3905 <debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
3906 <remove_actor_from_room actor="$Mission_Contact"/>
3907
3908 <destroy_object object="$DynamicInterior"/>
3909 <remove_value name="$DynamicInterior"/>
3910 <remove_value name="$DynamicCorridor"/>
3911 <remove_value name="$DynamicRoom"/>
3912 <reset_cue cue="HOL_VS_ARG_Place_Contact_Create_Interior"/>
3913 </actions>
3914 </cue>
3915 </cues>
3916 </cue>
3917
3918 <cue name="HOL_VS_ARG_Contact_Killed">
3919 <conditions>
3920 <event_object_destroyed object="$Mission_Contact"/>
3921 </conditions>
3922 <actions>
3923 <set_value name="$Mission_Contact" exact="null"/>
3924 <reset_cue cue="HOL_VS_ARG_Create_Contact"/>
3925 </actions>
3926 </cue>
3927
3928 <cue name="HOL_VS_ARG_Contact_Conversation_Started" instantiate="true">
3929 <conditions>
3930 <check_any>
3931 <event_conversation_started actor="$Mission_Contact" />
3932 <event_conversation_returned_to_section actor="$Mission_Contact" />
3933 </check_any>
3934 <check_value value="event.param == 'default'" />
3935 </conditions>
3936 <actions>
3937 <do_if value="event.name == 'event_conversation_started'">
3938 <do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
3939 <do_if value="player.entity.isfemale">
3940 <add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
3941 </do_if>
3942 <do_else>
3943 <add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
3944 </do_else>
3945 </do_if>
3946 <do_else>
3947 <!--More familiar greeting-->
3948 <add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
3949 </do_else>
3950 </do_if>
3951
3952 <include_actions ref="HOL_VS_ARG_Contact_Player_Lines"/>
3953 </actions>
3954 </cue>
3955
3956 <library name="HOL_VS_ARG_Contact_Player_Lines">
3957 <actions>
3958 <!--Specific sections-->
3959 <do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
3960 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
3961 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
3962 </do_if>
3963 </do_if>
3964 <do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
3965 <add_player_choice text="{1002,3021102}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
3966 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
3967 </do_elseif>
3968 <do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
3969 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
3970 </do_elseif>
3971
3972 <!--Start or other sections-->
3973 <do_else>
3974 <do_if value="$SubscriptionStatus == 'unsubscribed'">
3975 <do_if value="HOL_VS_ARG_Introduction.state == cuestate.waiting">
3976 <!--Intro mission is not in a state where the player can take it.-->
3977 <!--TODO @Owen - voice lines on rejecting the player?-->
3978 <add_player_choice text="{1002,3021301}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
3979 </do_if>
3980 <do_elseif value="$IntroducedToContact">
3981 <do_if value="$JobsDescribed">
3982 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
3983 <add_player_choice text="{1002,3021302}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict?"/>
3984 </do_if>
3985 <do_else>
3986 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
3987 </do_else>
3988 </do_elseif>
3989 <do_else>
3990 <add_player_choice text="{1002,3021301}" section="war_subscribe_request" comment="I'm here about the Argon."/>
3991 </do_else>
3992 </do_if>
3993 <do_elseif value="$SubscriptionStatus == 'probation'">
3994 <do_if value="$IntroMissionSuccessful">
3995 <add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
3996 </do_if>
3997 <do_else>
3998 <add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
3999 </do_else>
4000 </do_elseif>
4001 </do_else>
4002 </actions>
4003 </library>
4004
4005 <cue name="HOL_VS_ARG_Contact_NextSection" instantiate="true">
4006 <conditions>
4007 <event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
4008 </conditions>
4009 <actions>
4010 <set_value name="$AddPlayerChoices" exact="true"/>
4011 <do_if value="event.param == 'war_subscribe_request'">
4012 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
4013 <set_value name="$IntroducedToContact" exact="true"/>
4014 <add_npc_line speaker="$Mission_Contact" line="30213001" hidechoices="true" comment="Ah, very good."/>
4015 <add_npc_line speaker="$Mission_Contact" line="30213002" hidechoices="true"/>
4016 <do_if value="player.entity.race == race.argon">
4017 <!--Holy Order citizen-->
4018 <add_npc_line speaker="$Mission_Contact" line="30213004" hidechoices="true"/>
4019 </do_if>
4020 <do_else>
4021 <!--Holy Order friend-->
4022 <add_npc_line speaker="$Mission_Contact" line="30213003" hidechoices="true"/>
4023 </do_else>
4024
4025 <add_npc_line speaker="$Mission_Contact" line="30213005" hidechoices="true"/>
4026 <add_npc_line speaker="$Mission_Contact" line="30213006" hidechoices="true"/>
4027 <add_npc_line speaker="$Mission_Contact" line="30213007" hidechoices="true"/>
4028 <do_if value="player.entity.race == race.argon">
4029 <!--Argon player line-->
4030 <add_npc_line speaker="$Mission_Contact" line="30213008" hidechoices="true"/>
4031 </do_if>
4032 <do_else>
4033 <add_npc_line speaker="$Mission_Contact" line="30213009" hidechoices="true"/>
4034 <add_npc_line speaker="$Mission_Contact" line="30213010" hidechoices="true"/>
4035 </do_else>
4036 </do_if>
4037 <do_else>
4038 <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."/>
4039 </do_else>
4040 </do_if>
4041 <do_elseif value="event.param == 'war_subscribe_ask_intro'">
4042 <set_value name="$JobsDescribed" exact="true"/>
4043 <add_npc_line speaker="$Mission_Contact" line="30213011" hidechoices="true"/>
4044 <add_npc_line speaker="$Mission_Contact" line="30213012" hidechoices="true"/>
4045 </do_elseif>
4046 <do_elseif value="event.param == 'war_subscribe_ask_conflict'">
4047 <set_value name="$ConflictDescribed" exact="true"/>
4048 <do_if value="player.entity.race == race.argon">
4049 <!--Argon player line-->
4050 <add_npc_line speaker="$Mission_Contact" line="30213013" hidechoices="true"/>
4051 </do_if>
4052 <add_npc_line speaker="$Mission_Contact" line="30213014" hidechoices="true"/>
4053 <add_npc_line speaker="$Mission_Contact" line="30213015" hidechoices="true"/>
4054 <add_npc_line speaker="$Mission_Contact" line="30213016" hidechoices="true"/>
4055 <add_npc_line speaker="$Mission_Contact" line="30213017" hidechoices="true"/>
4056 <add_npc_line speaker="$Mission_Contact" line="30213018" hidechoices="true"/>
4057 <add_npc_line speaker="$Mission_Contact" line="30213019" hidechoices="true"/>
4058 </do_elseif>
4059 <do_elseif value="event.param == 'war_subscribe_request_2'">
4060 <!--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.-->
4061 <include_actions ref="HOL_VS_ARG_Can_Activate_Introduction"/>
4062 <do_if value="$CanActivateIntro">
4063 <signal_cue cue="HOL_VS_ARG_Introduction"/>
4064 <add_npc_line speaker="$Mission_Contact" line="30213001" hidechoices="true" comment="Ah, very good."/>
4065 </do_if>
4066 <do_else>
4067 <set_value name="$AddPlayerChoices" exact="false"/>
4068 <add_npc_line speaker="$Mission_Contact" line="30213027" hidechoices="true"/>
4069 </do_else>
4070 </do_elseif>
4071 <do_elseif value="event.param == 'war_subscribe_start_intro'">
4072 <set_value name="$AddPlayerChoices" exact="false"/>
4073 <signal_cue cue="HOL_VS_ARG_Player_Requested_Subscription"/>
4074 <add_npc_line speaker="$Mission_Contact" line="30213020" hidechoices="true"/>
4075 <add_npc_line speaker="$Mission_Contact" line="30213021" hidechoices="true"/>
4076 </do_elseif>
4077 <do_elseif value="event.param == 'war_intro_complete'">
4078 <set_value name="$AddPlayerChoices" exact="false"/>
4079 <add_npc_line speaker="$Mission_Contact" line="30213022" hidechoices="true" comment="Yes, I saw. Very good."/>
4080 <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."/>
4081 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'subscribed'"/>
4082 </do_elseif>
4083 <do_elseif value="event.param == 'war_abort_intro'">
4084 <set_value name="$AddPlayerChoices" exact="false"/>
4085 <signal_cue cue="HOL_VS_ARG_Player_Requests_Intro_Abort"/>
4086 </do_elseif>
4087
4088 <do_if value="$AddPlayerChoices">
4089 <include_actions ref="HOL_VS_ARG_Contact_Player_Lines"/>
4090 </do_if>
4091 </actions>
4092 </cue>
4093 </cues>
4094 </cue>
4095
4096
4097 <!--event.param = table[
4098 $cue = thread cue namespace,
4099 $completedmissions = number of completed missions,
4100 $failedmissions = number of failed missions]-->
4101 <cue name="HOL_VS_ARG_Thread_Finished" instantiate="true">
4102 <conditions>
4103 <event_cue_signalled cue="Cleanup_Thread"/>
4104 <check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
4105 <check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
4106 </conditions>
4107 <actions>
4108 <!--TODO @Owen spoken feedback?-->
4109 <debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
4110
4111 <set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
4112 <set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
4113
4114 <do_if value="$MissionsCompleted ge 20">
4115 <unlock_achievement name="WAR_MISSIONS" />
4116 </do_if>
4117
4118 <do_if value="event.param.$failed">
4119 <set_value name="$ThreadsFailed" operation="add"/>
4120 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'cooldown'"/>
4121 </do_if>
4122 <do_else>
4123 <set_value name="$ThreadsCompleted" operation="add"/>
4124 <signal_cue cue="CalculateThreads"/>
4125 </do_else>
4126 </actions>
4127 </cue>
4128
4129 <!--
4130 ####################
4131 INTRODUCTION
4132 ####################-->
4133
4134 <cue name="HOL_VS_ARG_Player_Requested_Subscription" instantiate="true">
4135 <conditions>
4136 <event_cue_signalled/>
4137 </conditions>
4138 </cue>
4139
4140 <cue name="HOL_VS_ARG_Player_Requests_Intro_Abort" instantiate="true">
4141 <conditions>
4142 <event_cue_signalled/>
4143 </conditions>
4144 </cue>
4145
4146 <library name="HOL_VS_ARG_Can_Activate_Introduction">
4147 <actions>
4148 <!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
4149 <set_value name="$CanActivateIntro" exact="false"/>
4150 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
4151 <set_value name="$CanActivateIntro" exact="true"/>
4152 </do_if>
4153 </actions>
4154 </library>
4155
4156 <cue name="HOL_VS_ARG_Introduction" version="2">
4157 <conditions>
4158 <event_cue_signalled/>
4159 </conditions>
4160 <actions>
4161 <debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
4162 <set_value name="$MissionIntroCue" exact="this"/>
4163 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'unsubscribed'"/>
4164 </actions>
4165 <patch sinceversion="2" state="complete">
4166 <do_if value="$SubscriptionStatus == 'cooldown'">
4167 <debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
4168 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'unsubscribed'"/>
4169 </do_if>
4170 </patch>
4171 <cues>
4172 <cue name="HOL_VS_ARG_Introduction_Init">
4173 <actions>
4174 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
4175 <signal_cue cue="HOL_VS_ARG_Introduction_Create_Offer"/>
4176 </do_if>
4177 </actions>
4178 </cue>
4179
4180 <cue name="HOL_VS_ARG_Introduction_Create_Offer">
4181 <conditions>
4182 <check_any>
4183 <check_all>
4184 <event_player_relation_changed faction="$Faction"/>
4185 <check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
4186 </check_all>
4187 <event_cue_signalled/>
4188 </check_any>
4189 </conditions>
4190 <actions>
4191 <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]'"/>
4192 <do_if value="not $Mission_Contact.isclass.npc">
4193 <signal_cue_instantly cue="$ContactCreatorCue"/>
4194 </do_if>
4195
4196 <do_if value="$Mission_Contact">
4197 <debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
4198 <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">
4199 <briefing>
4200 <objective step="1" action="objective.talkto" object="$Mission_Contact"/>
4201 </briefing>
4202 </create_offer>
4203 </do_if>
4204 <do_else>
4205 <debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
4206 <reset_cue cue="$MissionIntroCue"/>
4207 </do_else>
4208 </actions>
4209 <cues>
4210 <cue name="HOL_VS_ARG_Introduction_Offer_Accepted">
4211 <conditions>
4212 <event_object_signalled object="$Mission_Contact" param="'accept'" />
4213 </conditions>
4214 <actions>
4215 <create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
4216 <update_mission cue="$MissionIntroCue">
4217 <briefing>
4218 <objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
4219 </briefing>
4220 </update_mission>
4221 <remove_offer cue="$MissionIntroCue"/>
4222 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
4223 $actor = $Mission_Contact,
4224 $object = $PlacementObject,
4225 $missioncue = $MissionIntroCue,
4226 $cancelcue = HOL_VS_ARG_Cancel_Intro_Talkto,
4227 $objective = objective.talkto,
4228 $debugchance = $DebugChance]"/>
4229 </actions>
4230 </cue>
4231 </cues>
4232 </cue>
4233
4234 <cue name="HOL_VS_ARG_Intro_Abort">
4235 <conditions>
4236 <check_any>
4237 <event_mission_aborted cue="HOL_VS_ARG_Introduction"/>
4238 <event_cue_signalled cue="HOL_VS_ARG_Player_Requests_Intro_Abort"/>
4239 </check_any>
4240 </conditions>
4241 <actions>
4242 <do_if value="$MissionIntroCue.hasmission">
4243 <remove_mission cue="$MissionIntroCue" type="aborted"/>
4244 </do_if>
4245 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'unsubscribed'"/>
4246 <reset_cue cue="HOL_VS_ARG_Introduction"/>
4247 </actions>
4248 </cue>
4249
4250 <cue name="HOL_VS_ARG_Cancel_Intro_Talkto" instantiate="true">
4251 <conditions>
4252 <event_cue_signalled/>
4253 </conditions>
4254 </cue>
4255
4256 <cue name="HOL_VS_ARG_Start_Intro_Mission">
4257 <conditions>
4258 <event_cue_signalled cue="HOL_VS_ARG_Player_Requested_Subscription"/>
4259 </conditions>
4260 <actions>
4261 <signal_cue cue="HOL_VS_ARG_Cancel_Intro_Talkto"/>
4262 <signal_cue_instantly cue="HOL_VS_ARG_Set_Subscription_Status" param="'probation'"/>
4263 <set_value name="$IntroMissionSuccessful" exact="false"/>
4264
4265 <do_if value="$MissionIntroCue.hasmissionoffer">
4266 <remove_offer cue="$MissionIntroCue"/>
4267 </do_if>
4268
4269 <do_if value="not $MissionIntroCue.hasmission">
4270 <create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30213}.{1}" description="readtext.{30213}.{2}" difficulty="level.easy" faction="$Faction" group="$MissionGroup"/>
4271 </do_if>
4272
4273 <create_ship name="$TestShip" zone="player.zone">
4274 <select faction="faction.holyorder" size="class.ship_s"/>
4275 <owner exact="faction.holyorder"/>
4276 <pilot actor="null"/>
4277 <safepos object="player.entity" min="30km" max="40km"/>
4278 </create_ship>
4279
4280 <update_mission cue="$MissionIntroCue">
4281 <briefing>
4282 <objective step="1" action="objective.destroy" object="$TestShip"/>
4283 </briefing>
4284 </update_mission>
4285 <set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
4286 </actions>
4287 <cues>
4288 <cue name="HOL_VS_ARG_Start_Intro_Mission_Successful">
4289 <conditions>
4290 <event_object_destroyed object="$TestShip"/>
4291 </conditions>
4292 <actions>
4293 <update_mission cue="$MissionIntroCue">
4294 <briefing>
4295 <objective step="2" action="objective.talkto" object="$Mission_Contact"/>
4296 </briefing>
4297 </update_mission>
4298 <set_value name="$IntroMissionSuccessful" exact="true"/>
4299 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
4300 $actor = $Mission_Contact,
4301 $object = $PlacementObject,
4302 $missioncue = $MissionIntroCue,
4303 $cancelcue = HOL_VS_ARG_Start_Intro_Mission_Remove_Mission,
4304 $objective = objective.talkto,
4305 $step = 2,
4306 $debugchance = $DebugChance]"/>
4307 </actions>
4308 </cue>
4309
4310 <cue name="HOL_VS_ARG_Start_Intro_Mission_Remove_Mission">
4311 <conditions>
4312 <event_cue_signalled/>
4313 </conditions>
4314 <actions>
4315 <remove_mission cue="$MissionIntroCue" type="completed"/>
4316 <reset_cue cue="HOL_VS_ARG_Introduction"/>
4317 </actions>
4318 </cue>
4319
4320 <cue name="HOL_VS_ARG_Start_Intro_Mission_End">
4321 <conditions>
4322 <event_conversation_started actor="$Mission_Contact"/>
4323 </conditions>
4324 <actions>
4325 <signal_cue cue="HOL_VS_ARG_Start_Intro_Mission_Remove_Mission"/>
4326 </actions>
4327 </cue>
4328 </cues>
4329 </cue>
4330 </cues>
4331 </cue>
4332
4333 <!--
4334 ####################
4335 THREADS
4336 ####################-->
4337 <cue name="HOL_VS_ARG_Reinforce_Defence">
4338 <cues>
4339 <cue name="HOL_VS_ARG_Reinforce_Defence_Register">
4340 <actions>
4341 <!--Holy Order Vs Argon - Reinforce Defence-->
4342 <set_value name="$ThreadID" exact="'$hol_vs_arg_reinforce_defence'"/>
4343 <set_value name="$Thread" exact="table[
4344 $ID = $ThreadID,
4345 $Faction = $Faction,
4346 $EnemyFaction = $EnemyFaction,
4347 $MissionGroup = $MissionGroup,
4348 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
4349 $ThreadType = 'sequential',
4350 $MissionType = missiontype.protect,
4351 $Difficulty = level.medium,
4352 $SubMissionLib = HOL_VS_ARG_Reinforce_Defence_Get_Submissions,
4353 $NameLib = HOL_VS_ARG_Reinforce_Defence_Construct_Name,
4354 $DescriptionLib = HOL_VS_ARG_Reinforce_Defence_Construct_Description,
4355 $MinMissions = 4,
4356 $MaxMissions = 5,
4357 $ThreadAbortRelation = -0.00064]"/>
4358
4359 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
4360 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
4361 </actions>
4362 </cue>
4363
4364 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4365 <library name="HOL_VS_ARG_Reinforce_Defence_Get_Submissions">
4366 <actions>
4367 <set_value name="$Submissions" exact="table[]"/>
4368 <set_value name="$Submissions.$deploy_lasertowers"
4369 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [101000], $Sequence = -1 ]"/>
4370 <set_value name="$Submissions.$deploy_mines"
4371 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
4372 <set_value name="$Submissions.$achieve_coverage__host_sector"
4373 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [102000], $Sequence = -1 ]"/>
4374 <set_value name="$Submissions.$repair__damagedship"
4375 exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30213, $TextOffset = [103000], $Sequence = -1 ]"/>
4376 <set_value name="$Submissions.$taxi__specialist"
4377 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30213, $TextOffset = [104000], $Sequence = 1 ]"/>
4378 <set_value name="$Submissions.$deliver__crew"
4379 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30211, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
4380
4381 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
4382 </actions>
4383 </library>
4384
4385 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4386 <library name="HOL_VS_ARG_Reinforce_Defence_Construct_Name">
4387 <actions>
4388 <do_any>
4389 <set_value name="this.$Name" exact="{30213, 3000}"/>
4390 <set_value name="this.$Name" exact="{30213, 3001}"/>
4391 <set_value name="this.$Name" exact="{30213, 3002}"/>
4392 </do_any>
4393 </actions>
4394 </library>
4395
4396 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
4397 <library name="HOL_VS_ARG_Reinforce_Defence_Construct_Description">
4398 <actions>
4399 <do_if value="$ThreadMood == 'negative'">
4400 <do_any>
4401 <set_value name="this.$Description" exact="{30213, 3101}"/>
4402 <set_value name="this.$Description" exact="{30213, 3102}"/>
4403 </do_any>
4404
4405 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 3111}"/>
4406
4407 <do_any>
4408 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 3121}"/>
4409 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 3122}"/>
4410 </do_any>
4411 </do_if>
4412 <do_elseif value="$ThreadMood == 'positive'">
4413 <do_any>
4414 <set_value name="this.$Description" exact="{30213, 3201}"/>
4415 <set_value name="this.$Description" exact="{30213, 3202}"/>
4416 </do_any>
4417
4418 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 3211}"/>
4419 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 3221}"/>
4420 </do_elseif>
4421 </actions>
4422 </library>
4423 </cues>
4424 </cue>
4425
4426 <cue name="HOL_VS_ARG_Construct_Defence">
4427 <cues>
4428 <cue name="HOL_VS_ARG_Construct_Defence_Register" version="2">
4429 <actions>
4430 <!--Holy Order vs Argon - Construct Defence-->
4431 <set_value name="$ThreadID" exact="'$hol_vs_arg_construct_defence'"/>
4432 <set_value name="$Thread" exact="table[
4433 $ID = $ThreadID,
4434 $Faction = $Faction,
4435 $EnemyFaction = $EnemyFaction,
4436 $MissionGroup = $MissionGroup,
4437 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
4438 $ThreadType = 'sequential',
4439 $MissionType = missiontype.build,
4440 $Difficulty = level.medium,
4441 $SubMissionLib = HOL_VS_ARG_Construct_Defence_Get_Submissions,
4442 $NameLib = HOL_VS_ARG_Construct_Defence_Construct_Name,
4443 $DescriptionLib = HOL_VS_ARG_Construct_Defence_Construct_Description,
4444 $MinMissions = 1,
4445 $MaxMissions = 2,
4446 $ThreadAbortRelation = -0.00064]"/>
4447
4448 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
4449 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
4450 </actions>
4451 <patch sinceversion="2">
4452 <append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
4453 </patch>
4454 </cue>
4455
4456 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4457 <library name="HOL_VS_ARG_Construct_Defence_Get_Submissions">
4458 <actions>
4459 <set_value name="$Submissions" exact="table[]"/>
4460 <set_value name="$Submissions.$build__defencestation"
4461 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30213, $TextOffset = [105000], $Sequence = -1 ]"/>
4462 <set_value name="$Submissions.$build__fleet"
4463 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30213, $TextOffset = [120000], $Sequence = -1 ]"/>
4464
4465 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
4466 </actions>
4467 </library>
4468
4469 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4470 <library name="HOL_VS_ARG_Construct_Defence_Construct_Name">
4471 <actions>
4472 <do_any>
4473 <set_value name="this.$Name" exact="{30213, 4000}"/>
4474 </do_any>
4475 </actions>
4476 </library>
4477
4478 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
4479 <library name="HOL_VS_ARG_Construct_Defence_Construct_Description">
4480 <actions>
4481 <do_if value="$ThreadMood == 'negative'">
4482 <do_any>
4483 <set_value name="this.$Description" exact="{30213, 4101}"/>
4484 <set_value name="this.$Description" exact="{30213, 4102}"/>
4485 </do_any>
4486
4487 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 4111}"/>
4488
4489 <do_any>
4490 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 4121}"/>
4491 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 4122}"/>
4492 </do_any>
4493 </do_if>
4494 <do_elseif value="$ThreadMood == 'positive'">
4495 <do_any>
4496 <set_value name="this.$Description" exact="{30213, 4201}"/>
4497 <set_value name="this.$Description" exact="{30213, 4202}"/>
4498 </do_any>
4499
4500 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 4211}"/>
4501 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 4221}"/>
4502 </do_elseif>
4503 </actions>
4504 </library>
4505 </cues>
4506 </cue>
4507
4508 <cue name="HOL_VS_ARG_Secure_Resources">
4509 <cues>
4510 <cue name="HOL_VS_ARG_Secure_Resources_Register">
4511 <actions>
4512 <!--Holy Order vs Argon - Secure Resources-->
4513 <set_value name="$ThreadID" exact="'$hol_vs_arg_secure_resources'"/>
4514 <set_value name="$Thread" exact="table[
4515 $ID = $ThreadID,
4516 $Faction = $Faction,
4517 $EnemyFaction = $EnemyFaction,
4518 $MissionGroup = $MissionGroup,
4519 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
4520 $ThreadType = 'sequential',
4521 $MissionType = missiontype.trade,
4522 $Difficulty = level.medium,
4523 $SubMissionLib = HOL_VS_ARG_Secure_Resources_Get_Submissions,
4524 $NameLib = HOL_VS_ARG_Secure_Resources_Construct_Name,
4525 $DescriptionLib = HOL_VS_ARG_Secure_Resources_Construct_Description,
4526 $MinMissions = 4,
4527 $MaxMissions = 5,
4528 $ThreadAbortRelation = -0.00064]"/>
4529
4530 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
4531 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
4532 </actions>
4533 </cue>
4534
4535 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4536 <library name="HOL_VS_ARG_Secure_Resources_Get_Submissions">
4537 <actions>
4538 <set_value name="$Submissions" exact="table[]"/>
4539 <set_value name="$Submissions.$large_supply__food"
4540 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30213, $TextOffset = [100000], $Sequence = -1 ]"/>
4541 <set_value name="$Submissions.$large_supply__shiptech"
4542 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30213, $TextOffset = [100100], $Sequence = -1 ]"/>
4543 <set_value name="$Submissions.$deploy_lasertowers_at_resources"
4544 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [101300], $Sequence = -1 ]"/>
4545 <set_value name="$Submissions.$find_resources__ores"
4546 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [106000], $Sequence = -1 ]"/>
4547 <set_value name="$Submissions.$supply_station"
4548 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [130000], $Sequence = -1 ]"/>
4549
4550 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
4551 </actions>
4552 </library>
4553
4554 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4555 <library name="HOL_VS_ARG_Secure_Resources_Construct_Name">
4556 <actions>
4557 <do_any>
4558 <set_value name="this.$Name" exact="{30213, 5000}"/>
4559 <set_value name="this.$Name" exact="{30213, 5001}"/>
4560 </do_any>
4561 </actions>
4562 </library>
4563
4564 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
4565 <library name="HOL_VS_ARG_Secure_Resources_Construct_Description">
4566 <actions>
4567 <do_if value="$ThreadMood == 'negative'">
4568 <do_any>
4569 <set_value name="this.$Description" exact="{30213, 5101}"/>
4570 <set_value name="this.$Description" exact="{30213, 5102}"/>
4571 </do_any>
4572
4573 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 5111}"/>
4574
4575 <do_any>
4576 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 5121}"/>
4577 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 5122}"/>
4578 </do_any>
4579 </do_if>
4580 <do_elseif value="$ThreadMood == 'positive'">
4581 <do_any>
4582 <set_value name="this.$Description" exact="{30213, 5201}"/>
4583 <set_value name="this.$Description" exact="{30213, 5202}"/>
4584 </do_any>
4585
4586 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 5211}"/>
4587 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 5221}"/>
4588 </do_elseif>
4589 </actions>
4590 </library>
4591 </cues>
4592 </cue>
4593
4594 <cue name="HOL_VS_ARG_Preemptive_Offensive">
4595 <cues>
4596 <cue name="HOL_VS_ARG_Preemptive_Offensive_Register">
4597 <actions>
4598 <!--Holy Order Vs Argon- Preemptive Offensive-->
4599 <set_value name="$ThreadID" exact="'$hol_vs_arg_preemptive_offensive'"/>
4600 <set_value name="$Thread" exact="table[
4601 $ID = $ThreadID,
4602 $Faction = $Faction,
4603 $EnemyFaction = $EnemyFaction,
4604 $MissionGroup = $MissionGroup,
4605 $ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
4606 $ThreadType = 'sequential',
4607 $MissionType = missiontype.fight,
4608 $Difficulty = level.medium,
4609 $SubMissionLib = HOL_VS_ARG_Preemptive_Offensive_Get_Submissions,
4610 $NameLib = HOL_VS_ARG_Preemptive_Offensive_Construct_Name,
4611 $DescriptionLib = HOL_VS_ARG_Preemptive_Offensive_Construct_Description,
4612 $MinMissions = 4,
4613 $MaxMissions = 5,
4614 $ThreadAbortRelation = -0.00064]"/>
4615
4616 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
4617 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
4618 </actions>
4619 </cue>
4620
4621 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4622 <library name="HOL_VS_ARG_Preemptive_Offensive_Get_Submissions">
4623 <actions>
4624 <set_value name="$Submissions" exact="table[]"/>
4625 <set_value name="$Submissions.$assassination__informant"
4626 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30213, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
4627 <set_value name="$Submissions.$board_ship"
4628 exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30213, $TextOffset = [108000], $Sequence = -1 ]"/>
4629 <set_value name="$Submissions.$destroy_rare_ship"
4630 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30213, $TextOffset = [140000], $Sequence = -1 ]"/>
4631
4632 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
4633 </actions>
4634 </library>
4635
4636 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4637 <library name="HOL_VS_ARG_Preemptive_Offensive_Construct_Name">
4638 <actions>
4639 <do_any>
4640 <set_value name="this.$Name" exact="{30213, 6000}"/>
4641 </do_any>
4642 </actions>
4643 </library>
4644
4645 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
4646 <library name="HOL_VS_ARG_Preemptive_Offensive_Construct_Description">
4647 <actions>
4648 <do_if value="$ThreadMood == 'negative'">
4649 <do_any>
4650 <set_value name="this.$Description" exact="{30213, 6101}"/>
4651 <set_value name="this.$Description" exact="{30213, 6102}"/>
4652 </do_any>
4653
4654 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 6111}"/>
4655
4656 <do_any>
4657 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 6121}"/>
4658 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 6122}"/>
4659 </do_any>
4660 </do_if>
4661 <do_elseif value="$ThreadMood == 'positive'">
4662 <do_any>
4663 <set_value name="this.$Description" exact="{30213, 6201}"/>
4664 <set_value name="this.$Description" exact="{30213, 6202}"/>
4665 </do_any>
4666
4667 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 6211}"/>
4668 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 6221}"/>
4669 </do_elseif>
4670 </actions>
4671 </library>
4672 </cues>
4673 </cue>
4674
4675 <cue name="HOL_VS_ARG_Gather_Intel">
4676 <cues>
4677 <cue name="HOL_VS_ARG_Preemptive_Gather_Intel">
4678 <actions>
4679 <!-- Holy Order Vs Argon - Gather Intel-->
4680 <set_value name="$ThreadID" exact="'$hol_vs_arg_gather_intel'"/>
4681 <set_value name="$Thread" exact="table[
4682 $ID = $ThreadID,
4683 $Faction = $Faction,
4684 $EnemyFaction = $EnemyFaction,
4685 $MissionGroup = $MissionGroup,
4686 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
4687 $ThreadType = 'sequential',
4688 $MissionType = missiontype.intelligence,
4689 $Difficulty = level.medium,
4690 $SubMissionLib = HOL_VS_ARG_Gather_Intel_Get_Submissions,
4691 $NameLib = HOL_VS_ARG_Gather_Intel_Construct_Name,
4692 $DescriptionLib = HOL_VS_ARG_Gather_Intel_Construct_Description,
4693 $MinMissions = 2,
4694 $MaxMissions = 3,
4695 $ThreadAbortRelation = -0.00064]"/>
4696
4697 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
4698 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
4699 </actions>
4700 </cue>
4701
4702 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4703 <library name="HOL_VS_ARG_Gather_Intel_Get_Submissions">
4704 <actions>
4705 <set_value name="$Submissions" exact="table[]"/>
4706 <set_value name="$Submissions.$deploy_satellite"
4707 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [101400], $Sequence = -1 ]"/>
4708 <set_value name="$Submissions.$achieve_coverage__enemy_sector"
4709 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30213, $TextOffset = [102100], $Sequence = 1 ]"/>
4710 <set_value name="$Submissions.$find_resources__enemy_sector"
4711 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [106100], $Sequence = -1 ]"/>
4712 <set_value name="$Submissions.$scan__ship"
4713 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150000], $Sequence = -1 ]"/>
4714 <set_value name="$Submissions.$scan__station"
4715 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150100], $Sequence = -1 ]"/>
4716 <set_value name="$Submissions.$scan__module"
4717 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150200], $Sequence = -1 ]"/>
4718 <set_value name="$Submissions.$scan__for_ware"
4719 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150300], $Sequence = -1 ]"/>
4720 <set_value name="$Submissions.$scan__for_inventory"
4721 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150400], $Sequence = -1 ]"/>
4722 <!--$scan__for_entity currently disabled as it's quite a chore-->
4723 <!--<set_value name="$Submissions.$scan__for_entity"
4724 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150500], $Sequence = -1 ]"/>-->
4725 <set_value name="$Submissions.$scan__for_idcode"
4726 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30213, $TextOffset = [150600], $Sequence = -1 ]"/>
4727
4728 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
4729 </actions>
4730 </library>
4731
4732 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4733 <library name="HOL_VS_ARG_Gather_Intel_Construct_Name">
4734 <actions>
4735 <do_any>
4736 <set_value name="this.$Name" exact="{30213, 7000}"/>
4737 </do_any>
4738 </actions>
4739 </library>
4740
4741 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
4742 <library name="HOL_VS_ARG_Gather_Intel_Construct_Description">
4743 <actions>
4744 <do_if value="$ThreadMood == 'negative'">
4745 <do_any>
4746 <set_value name="this.$Description" exact="{30213, 7101}"/>
4747 <set_value name="this.$Description" exact="{30213, 7102}"/>
4748 </do_any>
4749
4750 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 7111}"/>
4751
4752 <do_any>
4753 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 7121}"/>
4754 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 7122}"/>
4755 </do_any>
4756 </do_if>
4757 <do_elseif value="$ThreadMood == 'positive'">
4758 <do_any>
4759 <set_value name="this.$Description" exact="{30213, 7201}"/>
4760 <set_value name="this.$Description" exact="{30213, 7202}"/>
4761 </do_any>
4762
4763 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 7211}"/>
4764 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 7221}"/>
4765 </do_elseif>
4766 </actions>
4767 </library>
4768 </cues>
4769 </cue>
4770
4771 <cue name="HOL_VS_ARG_Support_Invasion">
4772 <cues>
4773 <cue name="HOL_VS_ARG_Preemptive_Support_Invasion">
4774 <actions>
4775 <!--Argon Vs Holy Order - Support Invasion-->
4776 <set_value name="$ThreadID" exact="'$hol_vs_arg_support_invasion'"/>
4777 <set_value name="$Thread" exact="table[
4778 $ID = $ThreadID,
4779 $Faction = $Faction,
4780 $EnemyFaction = $EnemyFaction,
4781 $MissionGroup = $MissionGroup,
4782 $ThreadConditionLibs = [Situation__Invading],
4783 $ThreadType = 'sequential',
4784 $MissionType = missiontype.fight,
4785 $Difficulty = level.hard,
4786 $SubMissionLib = HOL_VS_ARG_Support_Invasion_Get_Submissions,
4787 $NameLib = HOL_VS_ARG_Support_Invasion_Construct_Name,
4788 $DescriptionLib = HOL_VS_ARG_Support_Invasion_Construct_Description,
4789 $MinMissions = 4,
4790 $MaxMissions = 5,
4791 $ThreadAbortRelation = -0.00064]"/>
4792
4793 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
4794 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
4795 </actions>
4796 </cue>
4797
4798 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4799 <library name="HOL_VS_ARG_Support_Invasion_Get_Submissions">
4800 <actions>
4801 <set_value name="$Submissions" exact="table[]"/>
4802 <set_value name="$Submissions.$support_invasion"
4803 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30213, $TextOffset = [109000], $Sequence = -1 ]"/>
4804
4805 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
4806 </actions>
4807 </library>
4808
4809 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
4810 <library name="HOL_VS_ARG_Support_Invasion_Construct_Name">
4811 <actions>
4812 <do_any>
4813 <set_value name="this.$Name" exact="{30213, 8000}"/>
4814 </do_any>
4815 </actions>
4816 </library>
4817
4818 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
4819 <library name="HOL_VS_ARG_Support_Invasion_Construct_Description">
4820 <actions>
4821 <do_if value="$ThreadMood == 'negative'">
4822 <do_any>
4823 <set_value name="this.$Description" exact="{30213, 8101}"/>
4824 </do_any>
4825
4826 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 8111}"/>
4827
4828 <do_any>
4829 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 8121}"/>
4830 </do_any>
4831 </do_if>
4832 <do_elseif value="$ThreadMood == 'positive'">
4833 <do_any>
4834 <set_value name="this.$Description" exact="{30213, 8201}"/>
4835 </do_any>
4836
4837 <set_value name="this.$Description" operation="add" exact="' ' + {30213, 8211}"/>
4838 <set_value name="this.$Description" operation="add" exact="'\n' + {30213, 8221}"/>
4839 </do_elseif>
4840 </actions>
4841 </library>
4842 </cues>
4843 </cue>
4844
4845
4846 </cues>
4847 </cue>
4848
4849 <!--
4850 ###################################
4851 HOLY ORDER OF THE PARANID vs GODREALM OF THE PARANID
4852 ###################################-->
4853 <cue name="HOL_VS_PAR" namespace="this">
4854 <actions>
4855 <!--Common values-->
4856 <set_value name="$ManagerCue" exact="parent.namespace"/>
4857 <set_value name="$Faction" exact="faction.holyorder"/>
4858 <set_value name="$EnemyFaction" exact="faction.paranid"/>
4859 <set_value name="$MissionGroup" exact="missiongroup.holyorder_war_paranid"/>
4860 <set_value name="$Mission_Contact" exact="null"/>
4861 <set_value name="$Page" exact="30214" comment="HolyOrder-Paranid-War page"/>
4862 <set_value name="$ManagerCue.$MissionGroupCues.{$MissionGroup}" exact="this"/>
4863 <set_value name="$SubscriptionMinRel" exact="$Faction.relation.friend.min"/>
4864 <set_value name="$SubscriptionLossRel" exact="-0.00064" comment="for UI-value -1"/>
4865 <set_value name="$DebugChance" exact="$ManagerCue.$DebugChance"/>
4866
4867 <!--Status-->
4868 <set_value name="$SubscriptionStatus" exact="null"/>
4869 <set_value name="$IntroducedToContact" exact="false"/>
4870 <set_value name="$JobsDescribed" exact="false"/>
4871 <set_value name="$ConflictDescribed" exact="false"/>
4872 <set_value name="$IntroMissionSuccessful" exact="false"/>
4873 <set_value name="$CooldownTime" exact="-1s"/>
4874
4875 <!--Stats-->
4876 <set_value name="$ThreadsCompleted" exact="0"/>
4877 <set_value name="$ThreadsFailed" exact="0"/>
4878
4879 <set_value name="$MissionsCompleted" exact="0"/>
4880 <set_value name="$MissionsFailed" exact="0"/>
4881 </actions>
4882 <cues>
4883 <cue name="HOL_VS_PAR_Init">
4884 <actions>
4885 <set_value name="$ContactCreatorCue" exact="HOL_VS_PAR_Create_Contact"/>
4886 <set_value name="$IntroMissionCue" exact="HOL_VS_PAR_Introduction"/>
4887
4888 <!--$SubscriptionStatus:
4889 - 'unsubscribed'
4890 - 'probation'
4891 - 'subscribed'
4892 - 'cooldown'-->
4893 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'unsubscribed'" comment="TODO: @Owen, @Roger - temporary, change back to unsubscribed!"/>
4894 </actions>
4895 </cue>
4896
4897 <!--
4898 ####################
4899 DEBUG
4900 ####################-->
4901 <cue name="HOL_VS_PAR_Debug_Reset">
4902 <conditions>
4903 <event_cue_signalled/>
4904 </conditions>
4905 <actions>
4906 <do_all exact="$ManagerCue.$Threads.count" counter="$i" reverse="true">
4907 <do_if value="$ManagerCue.$Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == $MissionGroup">
4908 <signal_cue_instantly cue="$ManagerCue.$Threads.{$i}.$CleanupCue"/>
4909 </do_if>
4910 </do_all>
4911 <set_value name="$DefinitionKeys" exact="$ManagerCue.$ThreadDefinitions.keys.list"/>
4912 <do_all exact="$DefinitionKeys.count" counter="$i" reverse="true">
4913 <do_if value="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}.$MissionGroup == $MissionGroup">
4914 <remove_value name="$ManagerCue.$ThreadDefinitions.{$DefinitionKeys.{$i}}"/>
4915 </do_if>
4916 </do_all>
4917 <do_if value="$Mission_Contact.isclass.npc">
4918 <destroy_object object="$Mission_Contact"/>
4919 </do_if>
4920 <set_value name="$Mission_Contact" exact="null"/>
4921 <reset_cue cue="namespace"/>
4922 <reset_cue cue="Gamestart" comment="Trigger CalculateThreads again"/>
4923 </actions>
4924 </cue>
4925
4926 <cue name="HOL_VS_PAR_Debug_Subscribe" instantiate="true">
4927 <conditions>
4928 <event_cue_signalled/>
4929 </conditions>
4930 <actions>
4931 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'subscribed'"/>
4932 </actions>
4933 </cue>
4934
4935 <!--
4936 ####################
4937 SUBSCRIPTION
4938 ####################-->
4939
4940 <!--event.param == new status-->
4941 <cue name="HOL_VS_PAR_Set_Subscription_Status" instantiate="true">
4942 <conditions>
4943 <event_cue_signalled/>
4944 </conditions>
4945 <actions>
4946 <do_if value="
4947 event.param == 'unsubscribed' or
4948 event.param == 'probation' or
4949 event.param == 'subscribed' or
4950 event.param == 'cooldown'">
4951
4952 <debug_text text="'Changing subscription status from ' + $SubscriptionStatus + ' to ' + event.param" chance="$DebugChance"/>
4953 <set_value name="$SubscriptionStatus" exact="event.param"/>
4954
4955 <!--Be careful with state change handlers here if the requested state was the same as the previous one-->
4956 <do_if value="event.param == 'subscribed' and Gamestart.state == cuestate.complete">
4957 <unlock_achievement name="JOIN_WAR" />
4958 <do_if value="PAR_VS_HOL.$SubscriptionStatus == 'subscribed'">
4959 <unlock_achievement name="JOIN_DOUBLE_AGENT" />
4960 </do_if>
4961 <signal_cue cue="CalculateThreads"/>
4962 </do_if>
4963 <do_elseif value="event.param == 'cooldown'">
4964 <!--TODO @Owen balance cooldown. Have a harsher cooldown in certain situations?-->
4965 <set_value name="$CooldownTime" exact="player.age + 5min"/>
4966 </do_elseif>
4967 </do_if>
4968 <do_else>
4969 <assert value="false" text="'Unknown subscription status: ' + event.param + ' [Owen]'"/>
4970 </do_else>
4971 </actions>
4972 </cue>
4973
4974 <cue name="HOL_VS_PAR_Check_Cooldown" instantiate="true" checkinterval="5s">
4975 <conditions>
4976 <check_value value="$SubscriptionStatus == 'cooldown' and player.age gt $CooldownTime"/>
4977 </conditions>
4978 <actions>
4979 <debug_text text="player.age + ' Ending cooldown'" chance="$DebugChance"/>
4980 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'subscribed'"/>
4981 </actions>
4982 </cue>
4983
4984 <!--
4985 ####################
4986 CONTACT
4987 ####################-->
4988
4989 <!--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)-->
4990 <cue name="HOL_VS_PAR_Create_Contact">
4991 <conditions>
4992 <event_cue_signalled/>
4993 </conditions>
4994 <actions>
4995 <set_value name="this.$SelectedSpace" exact="null"/>
4996 <do_if value="event.param and typeof event.param == datatype.table">
4997 <set_value name="this.$HostSectorKeys" exact="event.param.keys.sorted"/>
4998 <do_all exact="this.$HostSectorKeys.count" counter="$i">
4999 <do_if value="this.$HostSectorKeys.{$i}.security ge 0.75f">
5000 <!--Select a sector with stations and a high security value-->
5001 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
5002 <match_content class="class.walkablemodule"/>
5003 </find_station>
5004 <do_if value="this.$PotentialStation">
5005 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
5006 <break/>
5007 </do_if>
5008 </do_if>
5009 </do_all>
5010 <do_if value="not this.$SelectedSpace">
5011 <!--Simply select the furthest sector with stations-->
5012 <do_all exact="this.$HostSectorKeys.count" counter="$i" reverse="true">
5013 <find_station name="this.$PotentialStation" owner="$Faction" space="this.$HostSectorKeys.{$i}">
5014 <match_content class="class.walkablemodule"/>
5015 </find_station>
5016 <do_if value="this.$PotentialStation">
5017 <set_value name="this.$SelectedSpace" exact="this.$HostSectorKeys.{$i}"/>
5018 <break/>
5019 </do_if>
5020 </do_all>
5021 </do_if>
5022 </do_if>
5023
5024 <do_if value="not this.$SelectedSpace">
5025 <find_station name="this.$PotentialStation" owner="$Faction" space="player.galaxy">
5026 <match_content class="class.walkablemodule"/>
5027 </find_station>
5028 <do_if value="this.$PotentialStation">
5029 <set_value name="this.$SelectedSpace" exact="this.$PotentialStation.sector"/>
5030 <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"/>
5031 </do_if>
5032 </do_if>
5033 <do_if value="this.$SelectedSpace">
5034 <find_station name="$PlacementObject" owner="$Faction" space="this.$SelectedSpace" required="true">
5035 <match_content class="class.walkablemodule"/>
5036 </find_station>
5037 <assert value="$PlacementObject.exists" text="'Station was unable to be found in ' + this.$SelectedSpace.knownname + ' even when it should have [Owen]'"/>
5038 <do_if value="$PlacementObject">
5039 <create_cue_actor name="$Mission_Contact" cue="namespace" group="paranid.factionrepresentative">
5040 <page exact="10307"/>
5041 <owner exact="$Faction"/>
5042 </create_cue_actor>
5043 <do_if value="$Mission_Contact">
5044 <set_entity_type entity="$Mission_Contact" type="entitytype.crowd"/>
5045 <set_entity_traits entity="$Mission_Contact" missionactor="true" remote="false" customhandler="true" />
5046 <debug_text text="'Created mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' for placement on ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
5047 </do_if>
5048 </do_if>
5049 </do_if>
5050
5051 <assert value="$Mission_Contact" text="'Unable to generate mission contact [Owen]'"/>
5052 <do_if value="not $Mission_Contact">
5053 <reset_cue cue="this"/>
5054 </do_if>
5055 </actions>
5056 <cues>
5057 <cue name="HOL_VS_PAR_Place_Contact_Init">
5058 <actions>
5059 <do_if value="$PlacementObject.attention ge attention.nearby">
5060 <signal_cue cue="HOL_VS_PAR_Place_Contact_Create_Interior"/>
5061 </do_if>
5062 </actions>
5063 </cue>
5064
5065 <cue name="HOL_VS_PAR_Place_Contact_Create_Interior">
5066 <conditions>
5067 <check_any>
5068 <event_cue_signalled/>
5069 <check_all>
5070 <event_object_changed_attention object="$PlacementObject"/>
5071 <check_value value="event.param ge attention.nearby"/>
5072 </check_all>
5073 </check_any>
5074 </conditions>
5075 <actions>
5076 <debug_text text="'Attempting to create dynamic interior to place NPC'" chance="$DebugChance"/>
5077 <get_room_definition macro="$StartCorridorMacro" tags="tag.corridor" race="$Faction.primaryrace" />
5078 <get_room_definition macro="$StartRoomMacro" doors="$RoomDoors" tags="tag.office" race="$Faction.primaryrace" />
5079
5080 <create_dynamic_interior object="$PlacementObject" corridor="$StartCorridorMacro" room="$StartRoomMacro" name="{30214,3}" interiorname="$DynamicInterior" corridorname="$DynamicCorridor" roomname="$DynamicRoom" />
5081 <assert value="$DynamicInterior" text="'Unable to create dynamic interior for contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' [Owen]'"/>
5082 <do_if value="$DynamicInterior">
5083 <find_npc_slot name="$NPC_Slot" object="$DynamicRoom"/>
5084 <assert value="$NPC_Slot" text="'Can not find slot for mission contact in ' + $DynamicInterior + ' ' + $DynamicInterior.knownname + ' [Owen]'"/>
5085 <do_if value="$NPC_Slot">
5086 <add_actor_to_room actor="$Mission_Contact" slot="$NPC_Slot"/>
5087 <debug_text text="'Added mission contact ' + $Mission_Contact + ' ' + $Mission_Contact.knownname + ' to ' + $PlacementObject + ' ' + $PlacementObject.knownname" chance="$DebugChance"/>
5088 </do_if>
5089 </do_if>
5090 </actions>
5091 <cues>
5092 <cue name="HOL_VS_PAR_Place_Contact_WithinDynamicInterior_Destroy">
5093 <conditions>
5094 <event_object_interiors_despawning object="$PlacementObject"/>
5095 </conditions>
5096 <actions>
5097 <debug_text text="'Interiors despawning. Destroying interior ' + $DynamicInterior" chance="$DebugChance"/>
5098 <remove_actor_from_room actor="$Mission_Contact"/>
5099
5100 <destroy_object object="$DynamicInterior"/>
5101 <remove_value name="$DynamicInterior"/>
5102 <remove_value name="$DynamicCorridor"/>
5103 <remove_value name="$DynamicRoom"/>
5104 <reset_cue cue="HOL_VS_PAR_Place_Contact_Create_Interior"/>
5105 </actions>
5106 </cue>
5107 </cues>
5108 </cue>
5109
5110 <cue name="HOL_VS_PAR_Contact_Killed">
5111 <conditions>
5112 <event_object_destroyed object="$Mission_Contact"/>
5113 </conditions>
5114 <actions>
5115 <set_value name="$Mission_Contact" exact="null"/>
5116 <reset_cue cue="HOL_VS_PAR_Create_Contact"/>
5117 </actions>
5118 </cue>
5119
5120 <cue name="HOL_VS_PAR_Contact_Conversation_Started" instantiate="true">
5121 <conditions>
5122 <check_any>
5123 <event_conversation_started actor="$Mission_Contact" />
5124 <event_conversation_returned_to_section actor="$Mission_Contact" />
5125 </check_any>
5126 <check_value value="event.param == 'default'" />
5127 </conditions>
5128 <actions>
5129 <do_if value="event.name == 'event_conversation_started'">
5130 <do_if value="$SubscriptionStatus == 'unsubscribed' or $SubscriptionStatus == 'cooldown'">
5131 <do_if value="player.entity.isfemale">
5132 <add_npc_line speaker="$Mission_Contact" line="3007" comment="Pilot. (female)"/>
5133 </do_if>
5134 <do_else>
5135 <add_npc_line speaker="$Mission_Contact" line="3006" comment="Pilot. (male)"/>
5136 </do_else>
5137 </do_if>
5138 <do_else>
5139 <!--More familiar greeting-->
5140 <add_npc_line speaker="$Mission_Contact" line="3003" comment="Captain."/>
5141 </do_else>
5142 </do_if>
5143
5144 <include_actions ref="HOL_VS_PAR_Contact_Player_Lines"/>
5145 </actions>
5146 </cue>
5147
5148 <library name="HOL_VS_PAR_Contact_Player_Lines">
5149 <actions>
5150 <!--Specific sections-->
5151 <do_if value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_request'">
5152 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
5153 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
5154 </do_if>
5155 </do_if>
5156 <do_elseif value="event.name == 'event_conversation_next_section' and (event.param == 'war_subscribe_ask_intro' or event.param == 'war_subscribe_request_2')">
5157 <add_player_choice text="{1002,3021402}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
5158 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
5159 </do_elseif>
5160 <do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict'">
5161 <add_player_choice text="{1002,3021403}" section="war_subscribe_ask_conflict_2" comment="What will you do?"/>
5162 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
5163 </do_elseif>
5164 <do_elseif value="event.name == 'event_conversation_next_section' and event.param == 'war_subscribe_ask_conflict_2'">
5165 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
5166 </do_elseif>
5167
5168 <!--Start or other sections-->
5169 <do_else>
5170 <do_if value="$SubscriptionStatus == 'unsubscribed'">
5171 <do_if value="HOL_VS_PAR_Introduction.state == cuestate.waiting">
5172 <!--Intro mission is not in a state where the player can take it.-->
5173 <!--TODO @Owen - voice lines on rejecting the player?-->
5174 <add_player_choice text="{1002,3021401}" section="war_subscribe_request_2" comment="I'm here about the Holy Order."/>
5175 </do_if>
5176 <do_elseif value="$IntroducedToContact">
5177 <do_if value="$JobsDescribed">
5178 <add_player_choice text="{1002,3000402}" section="war_subscribe_start_intro" position="top_right" comment="Let's get started."/>
5179 <add_player_choice text="{1002,3021402}" section="war_subscribe_ask_conflict" comment="What can you tell me about the conflict itself?"/>
5180 </do_if>
5181 <do_else>
5182 <add_player_choice text="{1002,3000401}" section="war_subscribe_ask_intro" comment="What kind of jobs can I expect?"/>
5183 </do_else>
5184 </do_elseif>
5185 <do_else>
5186 <add_player_choice text="{1002,3021401}" section="war_subscribe_request" comment="I'm here about the Holy Order."/>
5187 </do_else>
5188 </do_if>
5189 <do_elseif value="$SubscriptionStatus == 'probation'">
5190 <do_if value="$IntroMissionSuccessful">
5191 <add_player_choice text="{1002,3000404}" section="war_intro_complete" comment="I completed the task."/>
5192 </do_if>
5193 <do_else>
5194 <add_player_choice text="{1002,3000405}" section="war_abort_intro" comment="I would like to stop."/>
5195 </do_else>
5196 </do_elseif>
5197 </do_else>
5198 </actions>
5199 </library>
5200
5201 <cue name="HOL_VS_PAR_Contact_NextSection" instantiate="true">
5202 <conditions>
5203 <event_conversation_next_section actor="$Mission_Contact" sectionprefix="war_"/>
5204 </conditions>
5205 <actions>
5206 <set_value name="$AddPlayerChoices" exact="true"/>
5207 <do_if value="event.param == 'war_subscribe_request'">
5208 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
5209 <set_value name="$IntroducedToContact" exact="true"/>
5210 <add_npc_line speaker="$Mission_Contact" line="30214001" hidechoices="true" comment="Ah, very good."/>
5211 <add_npc_line speaker="$Mission_Contact" line="30214002" hidechoices="true"/>
5212 <do_if value="player.entity.race == race.argon">
5213 <!--Holy Order citizen-->
5214 <add_npc_line speaker="$Mission_Contact" line="30214004" hidechoices="true"/>
5215 </do_if>
5216 <do_else>
5217 <!--Holy Order friend-->
5218 <add_npc_line speaker="$Mission_Contact" line="30214003" hidechoices="true"/>
5219 </do_else>
5220
5221 <add_npc_line speaker="$Mission_Contact" line="30214005" hidechoices="true"/>
5222 <add_npc_line speaker="$Mission_Contact" line="30214006" hidechoices="true"/>
5223 <add_npc_line speaker="$Mission_Contact" line="30214007" hidechoices="true"/>
5224 <do_if value="player.entity.race != race.paranid">
5225 <!--Non-Paranid player line-->
5226 <add_npc_line speaker="$Mission_Contact" line="30214008" hidechoices="true"/>
5227 </do_if>
5228 <do_else>
5229 <add_npc_line speaker="$Mission_Contact" line="30214009" hidechoices="true"/>
5230 <add_npc_line speaker="$Mission_Contact" line="30214010" hidechoices="true"/>
5231 </do_else>
5232 </do_if>
5233 <do_else>
5234 <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."/>
5235 </do_else>
5236 </do_if>
5237 <do_elseif value="event.param == 'war_subscribe_ask_intro'">
5238 <set_value name="$JobsDescribed" exact="true"/>
5239 <add_npc_line speaker="$Mission_Contact" line="30214011" hidechoices="true"/>
5240 <add_npc_line speaker="$Mission_Contact" line="30214012" hidechoices="true"/>
5241 </do_elseif>
5242 <do_elseif value="event.param == 'war_subscribe_ask_conflict'">
5243 <set_value name="$ConflictDescribed" exact="true"/>
5244 <do_if value="player.entity.race != race.paranid">
5245 <!--Non-Paranid player line-->
5246 <add_npc_line speaker="$Mission_Contact" line="30214013" hidechoices="true"/>
5247 </do_if>
5248 <add_npc_line speaker="$Mission_Contact" line="30214014" hidechoices="true"/>
5249 <add_npc_line speaker="$Mission_Contact" line="30214015" hidechoices="true"/>
5250 </do_elseif>
5251 <do_elseif value="event.param == 'war_subscribe_ask_conflict_2'">
5252 <add_npc_line speaker="$Mission_Contact" line="30214016" hidechoices="true"/>
5253 <add_npc_line speaker="$Mission_Contact" line="30214017" hidechoices="true"/>
5254 <add_npc_line speaker="$Mission_Contact" line="30214018" hidechoices="true"/>
5255 <add_npc_line speaker="$Mission_Contact" line="30214019" hidechoices="true"/>
5256 </do_elseif>
5257 <do_elseif value="event.param == 'war_subscribe_request_2'">
5258 <!--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.-->
5259 <include_actions ref="HOL_VS_PAR_Can_Activate_Introduction"/>
5260 <do_if value="$CanActivateIntro">
5261 <signal_cue cue="HOL_VS_PAR_Introduction"/>
5262 <add_npc_line speaker="$Mission_Contact" line="30214001" hidechoices="true" comment="Ah, very good."/>
5263 </do_if>
5264 <do_else>
5265 <set_value name="$AddPlayerChoices" exact="false"/>
5266 <add_npc_line speaker="$Mission_Contact" line="30214027" hidechoices="true"/>
5267 </do_else>
5268 </do_elseif>
5269 <do_elseif value="event.param == 'war_subscribe_start_intro'">
5270 <set_value name="$AddPlayerChoices" exact="false"/>
5271 <signal_cue cue="HOL_VS_PAR_Player_Requested_Subscription"/>
5272 <add_npc_line speaker="$Mission_Contact" line="30214020" hidechoices="true"/>
5273 <add_npc_line speaker="$Mission_Contact" line="30214021" hidechoices="true"/>
5274 </do_elseif>
5275 <do_elseif value="event.param == 'war_intro_complete'">
5276 <set_value name="$AddPlayerChoices" exact="false"/>
5277 <add_npc_line speaker="$Mission_Contact" line="30214022" hidechoices="true" comment="Yes, I saw. Very good."/>
5278 <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."/>
5279 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'subscribed'"/>
5280 </do_elseif>
5281 <do_elseif value="event.param == 'war_abort_intro'">
5282 <set_value name="$AddPlayerChoices" exact="false"/>
5283 <signal_cue cue="HOL_VS_PAR_Player_Requests_Intro_Abort"/>
5284 </do_elseif>
5285
5286 <do_if value="$AddPlayerChoices">
5287 <include_actions ref="HOL_VS_PAR_Contact_Player_Lines"/>
5288 </do_if>
5289 </actions>
5290 </cue>
5291 </cues>
5292 </cue>
5293
5294
5295 <!--event.param = table[
5296 $cue = thread cue namespace,
5297 $completedmissions = number of completed missions,
5298 $failedmissions = number of failed missions]-->
5299 <cue name="HOL_VS_PAR_Thread_Finished" instantiate="true">
5300 <conditions>
5301 <event_cue_signalled cue="Cleanup_Thread"/>
5302 <check_value value="event.param.$cue.$Definition.$MissionGroup == $MissionGroup"/>
5303 <check_value value="$ManagerCue.$ActiveThreads.indexof.{event.param.$cue}"/>
5304 </conditions>
5305 <actions>
5306 <!--TODO @Owen spoken feedback?-->
5307 <debug_text text="'player finished ' + event.param.$cue + ' for ' + $MissionGroup + '. Completed missions: ' + event.param.$completedmissions + ' - Failed missions: ' + event.param.$failedmissions" chance="$DebugChance"/>
5308
5309 <set_value name="$MissionsCompleted" operation="add" exact="event.param.$completedmissions"/>
5310 <set_value name="$MissionsFailed" operation="add" exact="event.param.$completedmissions"/>
5311
5312 <do_if value="$MissionsCompleted ge 20">
5313 <unlock_achievement name="WAR_MISSIONS" />
5314 </do_if>
5315
5316 <do_if value="event.param.$failed">
5317 <set_value name="$ThreadsFailed" operation="add"/>
5318 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'cooldown'"/>
5319 </do_if>
5320 <do_else>
5321 <set_value name="$ThreadsCompleted" operation="add"/>
5322 <signal_cue cue="CalculateThreads"/>
5323 </do_else>
5324 </actions>
5325 </cue>
5326
5327 <!--
5328 ####################
5329 INTRODUCTION
5330 ####################-->
5331
5332 <cue name="HOL_VS_PAR_Player_Requested_Subscription" instantiate="true">
5333 <conditions>
5334 <event_cue_signalled/>
5335 </conditions>
5336 </cue>
5337
5338 <cue name="HOL_VS_PAR_Player_Requests_Intro_Abort" instantiate="true">
5339 <conditions>
5340 <event_cue_signalled/>
5341 </conditions>
5342 </cue>
5343
5344 <library name="HOL_VS_PAR_Can_Activate_Introduction">
5345 <actions>
5346 <!--TODO @Owen other conditions based on if they failed a previous intro mission and need a cooldown-->
5347 <set_value name="$CanActivateIntro" exact="false"/>
5348 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
5349 <set_value name="$CanActivateIntro" exact="true"/>
5350 </do_if>
5351 </actions>
5352 </library>
5353
5354 <cue name="HOL_VS_PAR_Introduction" version="2">
5355 <conditions>
5356 <event_cue_signalled/>
5357 </conditions>
5358 <actions>
5359 <debug_text text="'Starting intro mission handling for ' + $MissionGroup" chance="$DebugChance"/>
5360 <set_value name="$MissionIntroCue" exact="this"/>
5361 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'unsubscribed'"/>
5362 </actions>
5363 <patch sinceversion="2" state="complete">
5364 <do_if value="$SubscriptionStatus == 'cooldown'">
5365 <debug_text text="'Fixing war mission which is still of state cooldown when it should be unsubscribed'" filter="savegame"/>
5366 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'unsubscribed'"/>
5367 </do_if>
5368 </patch>
5369 <cues>
5370 <cue name="HOL_VS_PAR_Introduction_Init">
5371 <actions>
5372 <do_if value="$Faction.relationto.{faction.player} ge $SubscriptionMinRel">
5373 <signal_cue cue="HOL_VS_PAR_Introduction_Create_Offer"/>
5374 </do_if>
5375 </actions>
5376 </cue>
5377
5378 <cue name="HOL_VS_PAR_Introduction_Create_Offer">
5379 <conditions>
5380 <check_any>
5381 <check_all>
5382 <event_player_relation_changed faction="$Faction"/>
5383 <check_value value="event.param2.{1} ge $SubscriptionMinRel"/>
5384 </check_all>
5385 <event_cue_signalled/>
5386 </check_any>
5387 </conditions>
5388 <actions>
5389 <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]'"/>
5390 <do_if value="not $Mission_Contact.isclass.npc">
5391 <signal_cue_instantly cue="$ContactCreatorCue"/>
5392 </do_if>
5393
5394 <do_if value="$Mission_Contact">
5395 <debug_text text="'Player has passed the conditions for the intro mission to be available for group: ' + $MissionGroup" chance="$DebugChance"/>
5396 <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">
5397 <briefing>
5398 <objective step="1" action="objective.talkto" object="$Mission_Contact"/>
5399 </briefing>
5400 </create_offer>
5401 </do_if>
5402 <do_else>
5403 <debug_text text="'Unable to start intro mission due to missing mission client [Owen]'" filter="error"/>
5404 <reset_cue cue="$MissionIntroCue"/>
5405 </do_else>
5406 </actions>
5407 <cues>
5408 <cue name="HOL_VS_PAR_Introduction_Offer_Accepted">
5409 <conditions>
5410 <event_object_signalled object="$Mission_Contact" param="'accept'" />
5411 </conditions>
5412 <actions>
5413 <create_mission cue="$MissionIntroCue" offercue="$MissionIntroCue"/>
5414 <update_mission cue="$MissionIntroCue">
5415 <briefing>
5416 <objective step="1" action="objective.talkto" text="$Mission_Contact.knownname"/>
5417 </briefing>
5418 </update_mission>
5419 <remove_offer cue="$MissionIntroCue"/>
5420 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
5421 $actor = $Mission_Contact,
5422 $object = $PlacementObject,
5423 $missioncue = $MissionIntroCue,
5424 $cancelcue = HOL_VS_PAR_Cancel_Intro_Talkto,
5425 $objective = objective.talkto,
5426 $debugchance = $DebugChance]"/>
5427 </actions>
5428 </cue>
5429 </cues>
5430 </cue>
5431
5432 <cue name="HOL_VS_PAR_Intro_Abort">
5433 <conditions>
5434 <check_any>
5435 <event_mission_aborted cue="HOL_VS_PAR_Introduction"/>
5436 <event_cue_signalled cue="HOL_VS_PAR_Player_Requests_Intro_Abort"/>
5437 </check_any>
5438 </conditions>
5439 <actions>
5440 <do_if value="$MissionIntroCue.hasmission">
5441 <remove_mission cue="$MissionIntroCue" type="aborted"/>
5442 </do_if>
5443 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'unsubscribed'"/>
5444 <reset_cue cue="HOL_VS_PAR_Introduction"/>
5445 </actions>
5446 </cue>
5447
5448 <cue name="HOL_VS_PAR_Cancel_Intro_Talkto" instantiate="true">
5449 <conditions>
5450 <event_cue_signalled/>
5451 </conditions>
5452 </cue>
5453
5454 <cue name="HOL_VS_PAR_Start_Intro_Mission">
5455 <conditions>
5456 <event_cue_signalled cue="HOL_VS_PAR_Player_Requested_Subscription"/>
5457 </conditions>
5458 <actions>
5459 <signal_cue cue="HOL_VS_PAR_Cancel_Intro_Talkto"/>
5460 <signal_cue_instantly cue="HOL_VS_PAR_Set_Subscription_Status" param="'probation'"/>
5461 <set_value name="$IntroMissionSuccessful" exact="false"/>
5462
5463 <do_if value="$MissionIntroCue.hasmissionoffer">
5464 <remove_offer cue="$MissionIntroCue"/>
5465 </do_if>
5466
5467 <do_if value="not $MissionIntroCue.hasmission">
5468 <create_mission cue="$MissionIntroCue" type="missiontype.fight" name="readtext.{30214}.{1}" description="readtext.{30214}.{2}" difficulty="level.easy" faction="$Faction" group="$MissionGroup"/>
5469 </do_if>
5470
5471 <create_ship name="$TestShip" zone="player.zone">
5472 <select faction="faction.holyorder" size="class.ship_s"/>
5473 <owner exact="faction.holyorder"/>
5474 <pilot actor="null"/>
5475 <safepos object="player.entity" min="30km" max="40km"/>
5476 </create_ship>
5477
5478 <update_mission cue="$MissionIntroCue">
5479 <briefing>
5480 <objective step="1" action="objective.destroy" object="$TestShip"/>
5481 </briefing>
5482 </update_mission>
5483 <set_objective cue="$MissionIntroCue" action="objective.destroy" object="$TestShip"/>
5484 </actions>
5485 <cues>
5486 <cue name="HOL_VS_PAR_Start_Intro_Mission_Successful">
5487 <conditions>
5488 <event_object_destroyed object="$TestShip"/>
5489 </conditions>
5490 <actions>
5491 <update_mission cue="$MissionIntroCue">
5492 <briefing>
5493 <objective step="2" action="objective.talkto" object="$Mission_Contact"/>
5494 </briefing>
5495 </update_mission>
5496 <set_value name="$IntroMissionSuccessful" exact="true"/>
5497 <signal_cue_instantly cue="md.GenericMissions.DisconnectedActorObjectiveLibrary" param="table[
5498 $actor = $Mission_Contact,
5499 $object = $PlacementObject,
5500 $missioncue = $MissionIntroCue,
5501 $cancelcue = HOL_VS_PAR_Start_Intro_Mission_Remove_Mission,
5502 $objective = objective.talkto,
5503 $step = 2,
5504 $debugchance = $DebugChance]"/>
5505 </actions>
5506 </cue>
5507
5508 <cue name="HOL_VS_PAR_Start_Intro_Mission_Remove_Mission">
5509 <conditions>
5510 <event_cue_signalled/>
5511 </conditions>
5512 <actions>
5513 <remove_mission cue="$MissionIntroCue" type="completed"/>
5514 <reset_cue cue="HOL_VS_PAR_Introduction"/>
5515 </actions>
5516 </cue>
5517
5518 <cue name="HOL_VS_PAR_Start_Intro_Mission_End">
5519 <conditions>
5520 <event_conversation_started actor="$Mission_Contact"/>
5521 </conditions>
5522 <actions>
5523 <signal_cue cue="HOL_VS_PAR_Start_Intro_Mission_Remove_Mission"/>
5524 </actions>
5525 </cue>
5526 </cues>
5527 </cue>
5528 </cues>
5529 </cue>
5530
5531 <!--
5532 ####################
5533 THREADS
5534 ####################-->
5535 <cue name="HOL_VS_PAR_Reinforce_Defence">
5536 <cues>
5537 <cue name="HOL_VS_PAR_Reinforce_Defence_Register">
5538 <actions>
5539 <!--Holy Order vs Paranid - Reinforce Defence-->
5540 <set_value name="$ThreadID" exact="'$hol_vs_par_reinforce_defence'"/>
5541 <set_value name="$Thread" exact="table[
5542 $ID = $ThreadID,
5543 $Faction = $Faction,
5544 $EnemyFaction = $EnemyFaction,
5545 $MissionGroup = $MissionGroup,
5546 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep],
5547 $ThreadType = 'sequential',
5548 $MissionType = missiontype.protect,
5549 $Difficulty = level.medium,
5550 $SubMissionLib = HOL_VS_PAR_Reinforce_Defence_Get_Submissions,
5551 $NameLib = HOL_VS_PAR_Reinforce_Defence_Construct_Name,
5552 $DescriptionLib = HOL_VS_PAR_Reinforce_Defence_Construct_Description,
5553 $MinMissions = 4,
5554 $MaxMissions = 5,
5555 $ThreadAbortRelation = -0.00064]"/>
5556
5557 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
5558 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
5559 </actions>
5560 </cue>
5561
5562 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5563 <library name="HOL_VS_PAR_Reinforce_Defence_Get_Submissions">
5564 <actions>
5565 <set_value name="$Submissions" exact="table[]"/>
5566 <set_value name="$Submissions.$deploy_lasertowers"
5567 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [101000], $Sequence = -1 ]"/>
5568 <set_value name="$Submissions.$deploy_mines"
5569 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [101100, 101200], $Sequence = -1 ]"/>
5570 <set_value name="$Submissions.$achieve_coverage__host_sector"
5571 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [102000], $Sequence = -1 ]"/>
5572 <set_value name="$Submissions.$repair__damagedship"
5573 exact="table[$Cue = md.X4Ep1_War_Subscriptions.RepairObject__Standard, $MissionType = missiontype.repair, $Page = 30214, $TextOffset = [103000], $Sequence = -1 ]"/>
5574 <set_value name="$Submissions.$taxi__specialist"
5575 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Passenger_Transport__Standard, $MissionType = missiontype.transport, $Page = 30214, $TextOffset = [104000], $Sequence = 1 ]"/>
5576 <set_value name="$Submissions.$deliver__crew"
5577 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Crew__Standard, $MissionType = missiontype.deliver, $Page = 30211, $TextOffset = [110000, 110100], $Sequence = -1 ]"/>
5578
5579 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
5580 </actions>
5581 </library>
5582
5583 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5584 <library name="HOL_VS_PAR_Reinforce_Defence_Construct_Name">
5585 <actions>
5586 <do_any>
5587 <set_value name="this.$Name" exact="{30214, 3000}"/>
5588 <set_value name="this.$Name" exact="{30214, 3001}"/>
5589 <set_value name="this.$Name" exact="{30214, 3002}"/>
5590 </do_any>
5591 </actions>
5592 </library>
5593
5594 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
5595 <library name="HOL_VS_PAR_Reinforce_Defence_Construct_Description">
5596 <actions>
5597 <do_if value="$ThreadMood == 'negative'">
5598 <do_any>
5599 <set_value name="this.$Description" exact="{30214, 3101}"/>
5600 <set_value name="this.$Description" exact="{30214, 3102}"/>
5601 </do_any>
5602
5603 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 3111}"/>
5604
5605 <do_any>
5606 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 3121}"/>
5607 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 3122}"/>
5608 </do_any>
5609 </do_if>
5610 <do_elseif value="$ThreadMood == 'positive'">
5611 <do_any>
5612 <set_value name="this.$Description" exact="{30214, 3201}"/>
5613 <set_value name="this.$Description" exact="{30214, 3202}"/>
5614 </do_any>
5615
5616 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 3211}"/>
5617 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 3221}"/>
5618 </do_elseif>
5619 </actions>
5620 </library>
5621 </cues>
5622 </cue>
5623
5624 <cue name="HOL_VS_PAR_Construct_Defence">
5625 <cues>
5626 <cue name="HOL_VS_PAR_Construct_Defence_Register" version="2">
5627 <actions>
5628 <!--Holy Order vs Paranid - Construct Defence-->
5629 <set_value name="$ThreadID" exact="'$hol_vs_par_construct_defence'"/>
5630 <set_value name="$Thread" exact="table[
5631 $ID = $ThreadID,
5632 $Faction = $Faction,
5633 $EnemyFaction = $EnemyFaction,
5634 $MissionGroup = $MissionGroup,
5635 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Pushback],
5636 $ThreadType = 'sequential',
5637 $MissionType = missiontype.build,
5638 $Difficulty = level.medium,
5639 $SubMissionLib = HOL_VS_PAR_Construct_Defence_Get_Submissions,
5640 $NameLib = HOL_VS_PAR_Construct_Defence_Construct_Name,
5641 $DescriptionLib = HOL_VS_PAR_Construct_Defence_Construct_Description,
5642 $MinMissions = 1,
5643 $MaxMissions = 2,
5644 $ThreadAbortRelation = -0.00064]"/>
5645
5646 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
5647 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
5648 </actions>
5649 <patch sinceversion="2">
5650 <append_to_list name="$Thread.$ThreadConditionLibs" exact="Situation__Pushback"/>
5651 </patch>
5652 </cue>
5653
5654 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5655 <library name="HOL_VS_PAR_Construct_Defence_Get_Submissions">
5656 <actions>
5657 <set_value name="$Submissions" exact="table[]"/>
5658 <set_value name="$Submissions.$build__defencestation"
5659 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Build_Station__Standard, $MissionType = missiontype.build, $Page = 30214, $TextOffset = [105000], $Sequence = -1 ]"/>
5660 <set_value name="$Submissions.$build__fleet"
5661 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Get_Exact_Fleet__Standard, $MissionType = missiontype.build, $Page = 30214, $TextOffset = [120000], $Sequence = -1 ]"/>
5662
5663 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
5664 </actions>
5665 </library>
5666
5667 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5668 <library name="HOL_VS_PAR_Construct_Defence_Construct_Name">
5669 <actions>
5670 <do_any>
5671 <set_value name="this.$Name" exact="{30214, 4000}"/>
5672 </do_any>
5673 </actions>
5674 </library>
5675
5676 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
5677 <library name="HOL_VS_PAR_Construct_Defence_Construct_Description">
5678 <actions>
5679 <do_if value="$ThreadMood == 'negative'">
5680 <do_any>
5681 <set_value name="this.$Description" exact="{30214, 4101}"/>
5682 <set_value name="this.$Description" exact="{30214, 4102}"/>
5683 </do_any>
5684
5685 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 4111}"/>
5686
5687 <do_any>
5688 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 4121}"/>
5689 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 4122}"/>
5690 </do_any>
5691 </do_if>
5692 <do_elseif value="$ThreadMood == 'positive'">
5693 <do_any>
5694 <set_value name="this.$Description" exact="{30214, 4201}"/>
5695 <set_value name="this.$Description" exact="{30214, 4202}"/>
5696 </do_any>
5697
5698 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 4211}"/>
5699 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 4221}"/>
5700 </do_elseif>
5701 </actions>
5702 </library>
5703 </cues>
5704 </cue>
5705
5706 <cue name="HOL_VS_PAR_Secure_Resources">
5707 <cues>
5708 <cue name="HOL_VS_PAR_Secure_Resources_Register">
5709 <actions>
5710 <!--Holy Order vs Paranid - Secure Resources-->
5711 <set_value name="$ThreadID" exact="'$hol_vs_par_secure_resources'"/>
5712 <set_value name="$Thread" exact="table[
5713 $ID = $ThreadID,
5714 $Faction = $Faction,
5715 $EnemyFaction = $EnemyFaction,
5716 $MissionGroup = $MissionGroup,
5717 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Defence_Prep, Situation__Invasion_Prep],
5718 $ThreadType = 'sequential',
5719 $MissionType = missiontype.trade,
5720 $Difficulty = level.medium,
5721 $SubMissionLib = HOL_VS_PAR_Secure_Resources_Get_Submissions,
5722 $NameLib = HOL_VS_PAR_Secure_Resources_Construct_Name,
5723 $DescriptionLib = HOL_VS_PAR_Secure_Resources_Construct_Description,
5724 $MinMissions = 4,
5725 $MaxMissions = 5,
5726 $ThreadAbortRelation = -0.00064]"/>
5727
5728 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
5729 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
5730 </actions>
5731 </cue>
5732
5733 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5734 <library name="HOL_VS_PAR_Secure_Resources_Get_Submissions">
5735 <actions>
5736 <set_value name="$Submissions" exact="table[]"/>
5737 <set_value name="$Submissions.$large_supply__food"
5738 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30214, $TextOffset = [100000], $Sequence = -1 ]"/>
5739 <set_value name="$Submissions.$large_supply__shiptech"
5740 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Large_Supply__Standard, $MissionType = missiontype.trade, $Page = 30214, $TextOffset = [100100], $Sequence = -1 ]"/>
5741 <set_value name="$Submissions.$deploy_lasertowers_at_resources"
5742 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [101300], $Sequence = -1 ]"/>
5743 <set_value name="$Submissions.$find_resources__ores"
5744 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [106000], $Sequence = -1 ]"/>
5745 <set_value name="$Submissions.$supply_station"
5746 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Supply_Factory__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [130000], $Sequence = -1 ]"/>
5747
5748 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
5749 </actions>
5750 </library>
5751
5752 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5753 <library name="HOL_VS_PAR_Secure_Resources_Construct_Name">
5754 <actions>
5755 <do_any>
5756 <set_value name="this.$Name" exact="{30214, 5000}"/>
5757 <set_value name="this.$Name" exact="{30214, 5001}"/>
5758 </do_any>
5759 </actions>
5760 </library>
5761
5762 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
5763 <library name="HOL_VS_PAR_Secure_Resources_Construct_Description">
5764 <actions>
5765 <do_if value="$ThreadMood == 'negative'">
5766 <do_any>
5767 <set_value name="this.$Description" exact="{30214, 5101}"/>
5768 <set_value name="this.$Description" exact="{30214, 5102}"/>
5769 </do_any>
5770
5771 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 5111}"/>
5772
5773 <do_any>
5774 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 5121}"/>
5775 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 5122}"/>
5776 </do_any>
5777 </do_if>
5778 <do_elseif value="$ThreadMood == 'positive'">
5779 <do_any>
5780 <set_value name="this.$Description" exact="{30214, 5201}"/>
5781 <set_value name="this.$Description" exact="{30214, 5202}"/>
5782 </do_any>
5783
5784 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 5211}"/>
5785 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 5221}"/>
5786 </do_elseif>
5787 </actions>
5788 </library>
5789 </cues>
5790 </cue>
5791
5792 <cue name="HOL_VS_PAR_Preemptive_Offensive">
5793 <cues>
5794 <cue name="HOL_VS_PAR_Preemptive_Offensive_Register">
5795 <actions>
5796 <!--Holy Order vs Paranid - Preemptive Offensive-->
5797 <set_value name="$ThreadID" exact="'$hol_vs_par_preemptive_offensive'"/>
5798 <set_value name="$Thread" exact="table[
5799 $ID = $ThreadID,
5800 $Faction = $Faction,
5801 $EnemyFaction = $EnemyFaction,
5802 $MissionGroup = $MissionGroup,
5803 $ThreadConditionLibs = [Situation__Cold_War, Situation__Invasion_Prep],
5804 $ThreadType = 'sequential',
5805 $MissionType = missiontype.fight,
5806 $Difficulty = level.medium,
5807 $SubMissionLib = HOL_VS_PAR_Preemptive_Offensive_Get_Submissions,
5808 $NameLib = HOL_VS_PAR_Preemptive_Offensive_Construct_Name,
5809 $DescriptionLib = HOL_VS_PAR_Preemptive_Offensive_Construct_Description,
5810 $MinMissions = 4,
5811 $MaxMissions = 5,
5812 $ThreadAbortRelation = -0.00064]"/>
5813
5814 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
5815 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
5816 </actions>
5817 </cue>
5818
5819 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5820 <library name="HOL_VS_PAR_Preemptive_Offensive_Get_Submissions">
5821 <actions>
5822 <set_value name="$Submissions" exact="table[]"/>
5823 <set_value name="$Submissions.$assassination__informant"
5824 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Assassinate__Standard, $MissionType = missiontype.kill, $Page = 30214, $TextOffset = [107000, 107100], $Sequence = -1 ]"/>
5825 <set_value name="$Submissions.$board_ship"
5826 exact="table[$Cue = md.X4Ep1_War_Subscriptions.BoardShip__Standard, $MissionType = missiontype.board, $Page = 30214, $TextOffset = [108000], $Sequence = -1 ]"/>
5827 <set_value name="$Submissions.$destroy_rare_ship"
5828 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DestroyRarelyOnSight__Standard, $MissionType = missiontype.destroy, $Page = 30214, $TextOffset = [140000], $Sequence = -1 ]"/>
5829 <!--TODO @Owen
5830 - destroy mining ships / other vulnerable ships
5831 - mine resource areas
5832 - mass traffic destruction
5833 - rescue an allied ship behind enemy lines?-->
5834
5835 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
5836 </actions>
5837 </library>
5838
5839 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5840 <library name="HOL_VS_PAR_Preemptive_Offensive_Construct_Name">
5841 <actions>
5842 <do_any>
5843 <set_value name="this.$Name" exact="{30214, 6000}"/>
5844 </do_any>
5845 </actions>
5846 </library>
5847
5848 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
5849 <library name="HOL_VS_PAR_Preemptive_Offensive_Construct_Description">
5850 <actions>
5851 <do_if value="$ThreadMood == 'negative'">
5852 <do_any>
5853 <set_value name="this.$Description" exact="{30214, 6101}"/>
5854 <set_value name="this.$Description" exact="{30214, 6102}"/>
5855 </do_any>
5856
5857 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 6111}"/>
5858
5859 <do_any>
5860 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 6121}"/>
5861 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 6122}"/>
5862 </do_any>
5863 </do_if>
5864 <do_elseif value="$ThreadMood == 'positive'">
5865 <do_any>
5866 <set_value name="this.$Description" exact="{30214, 6201}"/>
5867 <set_value name="this.$Description" exact="{30214, 6202}"/>
5868 </do_any>
5869
5870 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 6211}"/>
5871 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 6221}"/>
5872 </do_elseif>
5873 </actions>
5874 </library>
5875 </cues>
5876 </cue>
5877
5878 <cue name="HOL_VS_PAR_Gather_Intel">
5879 <cues>
5880 <cue name="HOL_VS_PAR_Preemptive_Gather_Intel">
5881 <actions>
5882 <!--Holy Order vs Paranid - Gather Intel-->
5883 <set_value name="$ThreadID" exact="'$hol_vs_par_gather_intel'"/>
5884 <set_value name="$Thread" exact="table[
5885 $ID = $ThreadID,
5886 $Faction = $Faction,
5887 $EnemyFaction = $EnemyFaction,
5888 $MissionGroup = $MissionGroup,
5889 $ThreadConditionLibs = [Situation__Cold_War, Situation__Contention, Situation__Invasion_Prep],
5890 $ThreadType = 'sequential',
5891 $MissionType = missiontype.intelligence,
5892 $Difficulty = level.medium,
5893 $SubMissionLib = HOL_VS_PAR_Gather_Intel_Get_Submissions,
5894 $NameLib = HOL_VS_PAR_Gather_Intel_Construct_Name,
5895 $DescriptionLib = HOL_VS_PAR_Gather_Intel_Construct_Description,
5896 $MinMissions = 2,
5897 $MaxMissions = 3,
5898 $ThreadAbortRelation = -0.00064]"/>
5899
5900 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
5901 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
5902 </actions>
5903 </cue>
5904
5905 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5906 <library name="HOL_VS_PAR_Gather_Intel_Get_Submissions">
5907 <actions>
5908 <set_value name="$Submissions" exact="table[]"/>
5909 <set_value name="$Submissions.$deploy_satellite"
5910 exact="table[$Cue = md.X4Ep1_War_Subscriptions.DeployInPlace__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [101400], $Sequence = -1 ]"/>
5911 <set_value name="$Submissions.$achieve_coverage__enemy_sector"
5912 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Achieve_Coverage__Standard, $MissionType = missiontype.drop, $Page = 30214, $TextOffset = [102100], $Sequence = 1 ]"/>
5913 <set_value name="$Submissions.$find_resources__enemy_sector"
5914 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Find_Resources__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [106100], $Sequence = -1 ]"/>
5915 <set_value name="$Submissions.$scan__ship"
5916 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150000], $Sequence = -1 ]"/>
5917 <set_value name="$Submissions.$scan__station"
5918 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150100], $Sequence = -1 ]"/>
5919 <set_value name="$Submissions.$scan__module"
5920 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150200], $Sequence = -1 ]"/>
5921 <set_value name="$Submissions.$scan__for_ware"
5922 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150300], $Sequence = -1 ]"/>
5923 <set_value name="$Submissions.$scan__for_inventory"
5924 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150400], $Sequence = -1 ]"/>
5925 <!--$scan__for_entity currently disabled as it's quite a chore-->
5926 <!--<set_value name="$Submissions.$scan__for_entity"
5927 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150500], $Sequence = -1 ]"/>-->
5928 <set_value name="$Submissions.$scan__for_idcode"
5929 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Scan__Standard, $MissionType = missiontype.find, $Page = 30214, $TextOffset = [150600], $Sequence = -1 ]"/>
5930
5931 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
5932 </actions>
5933 </library>
5934
5935 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
5936 <library name="HOL_VS_PAR_Gather_Intel_Construct_Name">
5937 <actions>
5938 <do_any>
5939 <set_value name="this.$Name" exact="{30214, 7000}"/>
5940 </do_any>
5941 </actions>
5942 </library>
5943
5944 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
5945 <library name="HOL_VS_PAR_Gather_Intel_Construct_Description">
5946 <actions>
5947 <do_if value="$ThreadMood == 'negative'">
5948 <do_any>
5949 <set_value name="this.$Description" exact="{30214, 7101}"/>
5950 <set_value name="this.$Description" exact="{30214, 7102}"/>
5951 </do_any>
5952
5953 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 7111}"/>
5954
5955 <do_any>
5956 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 7121}"/>
5957 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 7122}"/>
5958 </do_any>
5959 </do_if>
5960 <do_elseif value="$ThreadMood == 'positive'">
5961 <do_any>
5962 <set_value name="this.$Description" exact="{30214, 7201}"/>
5963 <set_value name="this.$Description" exact="{30214, 7202}"/>
5964 </do_any>
5965
5966 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 7211}"/>
5967 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 7221}"/>
5968 </do_elseif>
5969 </actions>
5970 </library>
5971 </cues>
5972 </cue>
5973
5974 <cue name="HOL_VS_PAR_Support_Invasion">
5975 <cues>
5976 <cue name="HOL_VS_PAR_Preemptive_Support_Invasion">
5977 <actions>
5978 <!--Holy Order vs Paranid - Support Invasion-->
5979 <set_value name="$ThreadID" exact="'$hol_vs_par_support_invasion'"/>
5980 <set_value name="$Thread" exact="table[
5981 $ID = $ThreadID,
5982 $Faction = $Faction,
5983 $EnemyFaction = $EnemyFaction,
5984 $MissionGroup = $MissionGroup,
5985 $ThreadConditionLibs = [Situation__Invading],
5986 $ThreadType = 'sequential',
5987 $MissionType = missiontype.fight,
5988 $Difficulty = level.hard,
5989 $SubMissionLib = HOL_VS_PAR_Support_Invasion_Get_Submissions,
5990 $NameLib = HOL_VS_PAR_Support_Invasion_Construct_Name,
5991 $DescriptionLib = HOL_VS_PAR_Support_Invasion_Construct_Description,
5992 $MinMissions = 4,
5993 $MaxMissions = 5,
5994 $ThreadAbortRelation = -0.00064]"/>
5995
5996 <assert value="not $ManagerCue.$ThreadDefinitions.{$ThreadID}?" text="'Thread definition ' + $ThreadID + ' already exists in this table [Owen]'"/>
5997 <set_value name="$ManagerCue.$ThreadDefinitions.{$ThreadID}" exact="$Thread"/>
5998 </actions>
5999 </cue>
6000
6001 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
6002 <library name="HOL_VS_PAR_Support_Invasion_Get_Submissions">
6003 <actions>
6004 <set_value name="$Submissions" exact="table[]"/>
6005 <set_value name="$Submissions.$support_invasion"
6006 exact="table[$Cue = md.X4Ep1_War_Subscriptions.Support_Invasion__Standard, $MissionType = missiontype.fight, $Page = 30214, $TextOffset = [109000], $Sequence = -1 ]"/>
6007
6008 <set_value name="$New_Thread.$Submissions" exact="$Submissions"/>
6009 </actions>
6010 </library>
6011
6012 <!--Called from CalculateThreads. Result saved to $New_Thread. Namespace is not this parent.-->
6013 <library name="HOL_VS_PAR_Support_Invasion_Construct_Name">
6014 <actions>
6015 <do_any>
6016 <set_value name="this.$Name" exact="{30214, 8000}"/>
6017 </do_any>
6018 </actions>
6019 </library>
6020
6021 <!--Called from CalculateThreads where several values are set to help decide the briefing text. Result saved to $New_Thread. Namespace is not this parent.-->
6022 <library name="HOL_VS_PAR_Support_Invasion_Construct_Description">
6023 <actions>
6024 <do_if value="$ThreadMood == 'negative'">
6025 <do_any>
6026 <set_value name="this.$Description" exact="{30214, 8101}"/>
6027 </do_any>
6028
6029 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 8111}"/>
6030
6031 <do_any>
6032 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 8121}"/>
6033 </do_any>
6034 </do_if>
6035 <do_elseif value="$ThreadMood == 'positive'">
6036 <do_any>
6037 <set_value name="this.$Description" exact="{30214, 8201}"/>
6038 </do_any>
6039
6040 <set_value name="this.$Description" operation="add" exact="' ' + {30214, 8211}"/>
6041 <set_value name="this.$Description" operation="add" exact="'\n' + {30214, 8221}"/>
6042 </do_elseif>
6043 </actions>
6044 </library>
6045 </cues>
6046 </cue>
6047
6048
6049 </cues>
6050 </cue>
6051
6052 <!--
6053 Required variables: $CentralSector = the sector to look for war fronts around (usually the player.sector)-->
6054 <library name="GetWarFronts">
6055 <actions>
6056 <clear_table table="$WarFronts"/>
6057
6058 <do_all chance="$DebugChance">
6059 <do_if value="$CentralSector">
6060 <debug_text text="'Getting WarFronts around ' + $CentralSector.knownname"/>
6061 </do_if>
6062 <do_else>
6063 <debug_text text="'Getting WarFronts in the whole galaxy'"/>
6064 </do_else>
6065 </do_all>
6066
6067 <!--
6068 table[
6069 {$HostFaction} =
6070 table[
6071 $HostEntryPoint = Jumpgate or Super Highway Entry Gate leading from host space to enemy space
6072 $EnemyEntryPoint = Jumpgate or Super Highway Entry Gate leading from enemy space to host space
6073 $EnemyFaction = $EnemyFaction,
6074 $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],
6075 $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],
6076 $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],
6077 $ContestedSectors = [list of sectors which are contested by either {Host and Enemy} or {Ally Vs Enemy} ],
6078 $ContestedSectorsIncludeHost = bool - whether $ContestedSectors is {Host Vs Enemy} or {Ally Vs Enemy (Host is not involved)}
6079 $OfferSectors = [list of sectors where the thread offers are visible],
6080 $HostInvasions = [list of FactionGoal_Invade_Space cues to query for invasion details of the host against the enemy],
6081 $EnemyInvasions = [list of FactionGoal_Invade_Space cues to query for invasion details of the enemy against the host],
6082 $AllyInvasions = [list of FactionGoal_Invade_Space cues to query for invasion details of an ally against the enemy],
6083 $EnemyToAllyInvasions = [list of FactionGoal_Invade_Space cues to query for invasion details of the enemy against an ally],
6084 $ActiveSituations = [list of situation libraries which currently pass for this warfront e.g. Situation__Invading. Populated when iterating over potential threads]
6085 ]
6086 ]-->
6087
6088 <set_value name="$ThreadWarFactionTable" exact="table[]"/>
6089
6090 <set_value name="$ThreadDefinitionIDs" exact="$ThreadDefinitions.keys.list"/>
6091 <do_all exact="$ThreadDefinitionIDs.count" counter="$gwf_i">
6092 <set_value name="$gwf_faction" exact="$ThreadDefinitions.{$ThreadDefinitionIDs.{$gwf_i}}.$Faction"/>
6093 <set_value name="$gwf_enemyfaction" exact="$ThreadDefinitions.{$ThreadDefinitionIDs.{$gwf_i}}.$EnemyFaction"/>
6094 <do_if value="not $ThreadWarFactionTable.{$gwf_faction}?">
6095 <set_value name="$ThreadWarFactionTable.{$gwf_faction}" exact="[]"/>
6096 </do_if>
6097 <do_if value="not $ThreadWarFactionTable.{$gwf_faction}.indexof.{$gwf_enemyfaction}">
6098 <append_to_list name="$ThreadWarFactionTable.{$gwf_faction}" exact="$gwf_enemyfaction"/>
6099 </do_if>
6100 </do_all>
6101
6102 <do_all exact="$NonSubscriptionWars.keys.count" counter="$gwf_i">
6103 <set_value name="$gwf_faction" exact="$NonSubscriptionWars.keys.{$gwf_i}"/>
6104 <do_if value="not $ThreadWarFactionTable.{$gwf_faction}?">
6105 <set_value name="$ThreadWarFactionTable.{$gwf_faction}" exact="[]"/>
6106 </do_if>
6107 <do_all exact="$NonSubscriptionWars.{$gwf_faction}.count" counter="$gwf_k">
6108 <set_value name="$gwf_enemyfaction" exact="$NonSubscriptionWars.{$gwf_faction}.{$gwf_k}"/>
6109 <do_if value="not $ThreadWarFactionTable.{$gwf_faction}.indexof.{$gwf_enemyfaction}">
6110 <append_to_list name="$ThreadWarFactionTable.{$gwf_faction}" exact="$gwf_enemyfaction"/>
6111 </do_if>
6112 </do_all>
6113 </do_all>
6114
6115 <do_if value="$CentralSector">
6116 <find_cluster_in_range name="$LocalCentralClusters" object="$CentralSector" maxdistance="2" multiple="true"/>
6117 </do_if>
6118 <do_else>
6119 <find_cluster name="$LocalCentralClusters" multiple="true"/>
6120 </do_else>
6121
6122 <set_value name="$RelevantFactions" exact="$ThreadWarFactionTable.keys.list"/>
6123 <do_all exact="$RelevantFactions.count" counter="$gwf_i">
6124 <set_value name="$HostFaction" exact="$RelevantFactions.{$gwf_i}"/>
6125 <set_value name="$HostEnemyFactions" exact="$ThreadWarFactionTable.{$HostFaction}"/>
6126 <set_value name="$HostSectors" exact="[]"/>
6127
6128 <do_all chance="$DebugChance">
6129 <do_if value="$CentralSector">
6130 <debug_text text="'Checking for Warfronts for ' + $HostFaction.knownname + ' around ' + $CentralSector + ' ' + $CentralSector.knownname"/>
6131 </do_if>
6132 <do_else>
6133 <debug_text text="'Checking for Warfronts for ' + $HostFaction.knownname"/>
6134 </do_else>
6135 </do_all>
6136 <do_all exact="$LocalCentralClusters.count" counter="$gwf_j">
6137 <find_sector name="$HostSectors" owner="$HostFaction" multiple="true" space="$LocalCentralClusters.{$gwf_j}" append="true"/>
6138 </do_all>
6139 <set_value name="$EnemySectors" exact="[]"/>
6140 <do_all exact="$HostSectors.count" counter="$gwf_j">
6141 <set_value name="$HostSector" exact="$HostSectors.{$gwf_j}"/>
6142 <debug_text text="'checking ' + $HostFaction.knownname + ' sector ' + $HostSector.knownname" chance="$DebugChance2"/>
6143 <set_value name="$LocalSectors" exact="[]"/>
6144 <find_cluster_in_range name="$SurroundingClusters" object="$HostSector" maxdistance="2" multiple="true"/>
6145 <do_all exact="$SurroundingClusters.count" counter="$gwf_k">
6146 <find_sector name="$LocalSectors" space="$SurroundingClusters.{$gwf_k}" multiple="true" append="true"/>
6147 </do_all>
6148 <do_all exact="$HostEnemyFactions.count" counter="$gwf_k">
6149 <set_value name="$EnemyFaction" exact="$HostEnemyFactions.{$gwf_k}"/>
6150 <debug_text text="'Checking if there are any local ' + $EnemyFaction.knownname + ' sectors'" chance="$DebugChance2"/>
6151
6152 <clear_list list="$EnemySectors"/>
6153 <do_all exact="$LocalSectors.count" counter="$gwf_m">
6154 <debug_text text="'has local sector ' + $LocalSectors.{$gwf_m}.knownname" chance="$DebugChance2"/>
6155 <do_if value="$LocalSectors.{$gwf_m}.owner == $EnemyFaction or $LocalSectors.{$gwf_m}.iscontestedby.{$EnemyFaction}">
6156 <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"/>
6157 <append_to_list name="$EnemySectors" exact="$LocalSectors.{$gwf_m}"/>
6158 </do_if>
6159 </do_all>
6160
6161 <!--Find all war fronts closest to $HostSector-->
6162 <do_all exact="$EnemySectors.count" counter="$gwf_m">
6163 <set_value name="$EnemySector" exact="$EnemySectors.{$gwf_m}"/>
6164 <set_value name="$FrontFocus" exact="null"/>
6165 <do_if value="$EnemySector.iscontestedby.{$HostFaction}">
6166 <!--Host and enemy faction are both contesting this sector. $FrontFocus is the sector-->
6167 <set_value name="$FrontFocus" exact="$EnemySector"/>
6168 </do_if>
6169 <do_else>
6170 <!--TODO @Owen handle the case of there being a one way sector-highway front from enemy space to the host-->
6171 <get_global_path component="$GlobalPathComps" uselocalhighways="false" multiple="true">
6172 <start object="$HostSector"/>
6173 <end object="$EnemySector"/>
6174 </get_global_path>
6175 <do_all exact="$GlobalPathComps.count" counter="$gwf_o">
6176 <set_value name="$FrontEntryPoint" exact="null"/>
6177 <do_if value="$GlobalPathComps.{$gwf_o}.isclass.gate and $EnemySectors.indexof.{$GlobalPathComps.{$gwf_o}.destination.sector}">
6178 <set_value name="$FrontEntryPoint" exact="$GlobalPathComps.{$gwf_o}"/>
6179 </do_if>
6180 <do_elseif value="$GlobalPathComps.{$gwf_o}.isclass.highwayentrygate and $EnemySectors.indexof.{$GlobalPathComps.{$gwf_o}.destination.sector}">
6181 <set_value name="$FrontEntryPoint" exact="$GlobalPathComps.{$gwf_o}"/>
6182 </do_elseif>
6183 <do_if value="$FrontEntryPoint">
6184 <!--Check if the WarFront has already been checked-->
6185 <set_value name="$HasFront" exact="false"/>
6186 <do_if value="$WarFronts.{$HostFaction}?">
6187 <set_value name="$HostFronts" exact="$WarFronts.{$HostFaction}"/>
6188 <do_all exact="$HostFronts.count" counter="$gwf_o">
6189 <do_if value="$HostFronts.{$gwf_o}.$EnemyFaction == $EnemyFaction">
6190 <do_if value="$HostFronts.{$gwf_o}.$HostEntryPoint == $FrontEntryPoint">
6191 <debug_text text="'Already has front for this sector ' + $HostFronts.{$gwf_o}" chance="$DebugChance2"/>
6192 <set_value name="$HasFront" exact="true"/>
6193 <break/>
6194 </do_if>
6195 <do_elseif value="$HostFronts.{$gwf_o}.$ContestedSectors.indexof.{$EnemySector}">
6196 <debug_text text="'Already has front for this contested sector ' + $HostFronts.{$gwf_o}" chance="$DebugChance2"/>
6197 <set_value name="$HasFront" exact="true"/>
6198 <break/>
6199 </do_elseif>
6200 </do_if>
6201 </do_all>
6202 </do_if>
6203
6204 <do_if value="not $HasFront">
6205 <set_value name="$FrontFocus" exact="$FrontEntryPoint"/>
6206 </do_if>
6207 <break/>
6208 </do_if>
6209 </do_all>
6210 </do_else>
6211
6212 <do_if value="$FrontFocus">
6213 <set_value name="$WarFrontTable" exact="table[
6214 $HostEntryPoint = null,
6215 $EnemyEntryPoint = null,
6216 $EnemyFaction = $EnemyFaction,
6217 $HostSectors = table[],
6218 $EnemySectors = table[],
6219 $OtherSectors = table[],
6220 $ContestedSectors = [],
6221 $ContestedSectorsIncludeHost = true,
6222 $OfferSectors = [],
6223 $HostInvasions = [],
6224 $EnemyInvasions = [],
6225 $AllyInvasions = [],
6226 $EnemyToAllyInvasions = [],
6227 $ActiveSituations = []]"/>
6228
6229 <do_if value="$FrontFocus.isclass.gate">
6230 <set_value name="$WarFrontTable.$HostEntryPoint" exact="$FrontFocus"/>
6231 <set_value name="$WarFrontTable.$EnemyEntryPoint" exact="$FrontFocus.exit"/>
6232 </do_if>
6233 <do_elseif value="$FrontFocus.isclass.highwayentrygate">
6234 <set_value name="$WarFrontTable.$HostEntryPoint" exact="$FrontFocus"/>
6235 <!--Find the returning highway from enemy space to the host's space-->
6236 <get_global_path component="$GlobalPathComps" uselocalhighways="false" multiple="true">
6237 <start object="$WarFrontTable.$HostEntryPoint.destination"/>
6238 <end object="$WarFrontTable.$HostEntryPoint.sector"/>
6239 </get_global_path>
6240 <!--Iterate in reverse as we're interested in the last highway into host space (will keep the gate case here but should never happen)-->
6241 <do_all exact="$GlobalPathComps.count" counter="$gwf_o" reverse="true">
6242 <do_if value="$GlobalPathComps.{$gwf_o}.isclass.gate">
6243 <set_value name="$WarFrontTable.$EnemyEntryPoint" exact="$GlobalPathComps.{$gwf_o}.exit"/>
6244 <break/>
6245 </do_if>
6246 <do_elseif value="$GlobalPathComps.{$gwf_o}.isclass.highwayexitgate">
6247 <set_value name="$WarFrontTable.$EnemyEntryPoint" exact="$GlobalPathComps.{$gwf_o}.entry"/>
6248 <break/>
6249 </do_elseif>
6250 </do_all>
6251 </do_elseif>
6252 <do_elseif value="$FrontFocus.isclass.sector">
6253 <add_to_group groupname="$WarFrontTable.$ContestedSectors" object="$FrontFocus"/>
6254 </do_elseif>
6255 <do_else>
6256 <assert value="false" text="'Unknown class of $FrontFocus. Should be gate, highwayentrygate or sector. $FrontFocus: ' + $FrontFocus + ' ' + $FrontFocus.knownname + ' [Owen]'"/>
6257 <continue/>
6258 </do_else>
6259
6260 <do_if value="$WarFrontTable.$HostEntryPoint">
6261 <!--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.
6262 This bool helps identify what contents is in $ContestedSectors. In this case, Enemy sectors which are also contested by allies-->
6263 <set_value name="$ContestedSectorsIncludeHost" exact="false"/>
6264
6265 <find_cluster_in_range distances="$HostLocalClusterDistances" object="$WarFrontTable.$HostEntryPoint" maxdistance="3" multiple="true"/>
6266 <find_cluster_in_range distances="$EnemyLocalClusterDistances" object="$WarFrontTable.$HostEntryPoint.exit" maxdistance="3" multiple="true"/>
6267 <set_value name="$HostLocalClusters" exact="$HostLocalClusterDistances.keys.sorted"/>
6268 <set_value name="$EnemyLocalClusters" exact="$EnemyLocalClusterDistances.keys.sorted"/>
6269
6270 <!--Populate $OfferSectors: Find sectors within 1 jump of the entry point leading to enemy space-->
6271 <do_all exact="$HostLocalClusters.count" counter="$gwf_o">
6272 <do_if value="$HostLocalClusterDistances.{$HostLocalClusters.{$gwf_o}} le 1" comment="Is this cluster within 1 jump of the host entry point?">
6273 <find_sector name="$WarFrontTable.$OfferSectors" multiple="true" space="$HostLocalClusters.{$gwf_o}" append="true"/>
6274 </do_if>
6275 <do_else>
6276 <break/>
6277 </do_else>
6278 </do_all>
6279
6280 <!--Populate $HostSectors and $OtherSectors-->
6281 <do_all exact="$WarFrontTable.$OfferSectors.count" counter="$gwf_o">
6282 <set_value name="$OfferSector" exact="$WarFrontTable.$OfferSectors.{$gwf_o}"/>
6283 <!--Check if owned by HostFaction or contested by HostFaction and not EnemyFaction (as that should be it's own front)-->
6284 <do_if value="$OfferSector.owner == $HostFaction or $OfferSector.iscontestedby.{$HostFaction}">
6285 <do_if value="not $OfferSector.iscontestedby.{$EnemyFaction}">
6286 <do_if value="not $EnemyLocalClusterDistances.{$OfferSector.cluster}?">
6287 <!--We already know the jump distances of this sector to the entry point. Use it.-->
6288 <set_value name="$WarFrontTable.$HostSectors.{$OfferSector}" exact="$EnemyLocalClusterDistances.{$OfferSector.cluster}"/>
6289 </do_if>
6290 <do_else>
6291 <!--The distance table doesn't have an entry for this sector. Manually get it.-->
6292 <set_value name="$WarFrontTable.$HostSectors.{$OfferSector}" exact="$WarFrontTable.$HostEntryPoint.exit.gatedistance.{$OfferSector}"/>
6293 </do_else>
6294 </do_if>
6295 </do_if>
6296 <do_elseif value="$OfferSector.owner != $EnemyFaction and not $OfferSector.iscontestedby.{$EnemyFaction}">
6297 <do_if value="$EnemyLocalClusterDistances.{$OfferSector.cluster}?">
6298 <!--We already know the jump distances of this sector to the entry point. Use it.-->
6299 <set_value name="$WarFrontTable.$OtherSectors.{$OfferSector}" exact="$EnemyLocalClusterDistances.{$OfferSector.cluster}"/>
6300 </do_if>
6301 <do_else>
6302 <!--The distance table doesn't have an entry for this sector. Manually get it.-->
6303 <set_value name="$WarFrontTable.$OtherSectors.{$OfferSector}" exact="$WarFrontTable.$HostEntryPoint.exit.gatedistance.{$OfferSector}"/>
6304 </do_else>
6305 </do_elseif>
6306 </do_all>
6307
6308 <!--Populate $EnemySectors-->
6309 <set_value name="$LocalEnemySectors" exact="[]"/>
6310 <do_all exact="$EnemyLocalClusters.count" counter="$gwf_o">
6311 <do_if value="$EnemyLocalClusterDistances.{$EnemyLocalClusters.{$gwf_o}} le 1" comment="Is this cluster within 1 jump of the entry point?">
6312 <find_sector name="$LocalEnemySectors" multiple="true" space="$EnemyLocalClusters.{$gwf_o}" append="true">
6313 <match_any>
6314 <match owner="$EnemyFaction"/>
6315 <match contestedby="$EnemyFaction"/>
6316 </match_any>
6317 </find_sector>
6318 </do_if>
6319 <do_else>
6320 <break/>
6321 </do_else>
6322 </do_all>
6323 <do_all exact="$LocalEnemySectors.count" counter="$gwf_o">
6324 <set_value name="$LocalEnemySector" exact="$LocalEnemySectors.{$gwf_o}"/>
6325 <!--TODO @Owen check if contested by ally here-->
6326 <set_value name="$ContestedByAlly" exact="false"/>
6327 <do_if value="$LocalEnemySector.iscontested">
6328 <set_value name="$ContestingFactions" exact="$LocalEnemySector.contestingfactions"/>
6329 <do_all exact="$ContestingFactions.count" counter="$gwf_p">
6330 <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}">
6331 <set_value name="$ContestedByAlly" exact="true"/>
6332 <break/>
6333 </do_if>
6334 </do_all>
6335 </do_if>
6336 <do_if value="$ContestedByAlly">
6337 <do_if value="$HostLocalClusterDistances.{$LocalEnemySector.cluster}?">
6338 <!--We already know the jump distances of this sector to the exit point. Use it.-->
6339 <set_value name="$WarFrontTable.$ContestedSectors.{$LocalEnemySector}" exact="$HostLocalClusterDistances.{$LocalEnemySector.cluster}"/>
6340 </do_if>
6341 <do_else>
6342 <!--The distance table doesn't have an entry for this sector. Manually get it.-->
6343 <set_value name="$WarFrontTable.$ContestedSectors.{$LocalEnemySector}" exact="$WarFrontTable.$HostEntryPoint.gatedistance.{$LocalEnemySector}"/>
6344 </do_else>
6345 </do_if>
6346 <do_else>
6347 <do_if value="$HostLocalClusterDistances.{$LocalEnemySector.cluster}?">
6348 <!--We already know the jump distances of this sector to the exit point. Use it.-->
6349 <set_value name="$WarFrontTable.$EnemySectors.{$LocalEnemySector}" exact="$HostLocalClusterDistances.{$LocalEnemySector.cluster}"/>
6350 </do_if>
6351 <do_else>
6352 <!--The distance table doesn't have an entry for this sector. Manually get it.-->
6353 <set_value name="$WarFrontTable.$EnemySectors.{$LocalEnemySector}" exact="$WarFrontTable.$HostEntryPoint.gatedistance.{$LocalEnemySector}"/>
6354 </do_else>
6355 </do_else>
6356 </do_all>
6357 </do_if>
6358 <do_else>
6359 <!--If we're not dealing with an entrypoint, we're dealing with sectors contested by both the Host an Enemy factions.
6360 This bool helps identify what contents is in $ContestedSectors. In this case, sectors which are contested by both Host and Enemy factions-->
6361 <set_value name="$ContestedSectorsIncludeHost" exact="true"/>
6362
6363 <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]'"/>
6364 <do_if value="$WarFrontTable.$ContestedSectors.count == 1">
6365 <!--Populate $ContestedSectors: From the contested sector, find all linked contested sectors-->
6366 <create_group groupname="$ContestedSectorGroup"/>
6367 <add_to_group groupname="$ContestedSectorGroup" object="$WarFrontTable.$ContestedSectors.{1}"/>
6368 <set_value name="$CheckedContestedSectors" exact="[]"/>
6369 <do_while value="$CheckedContestedSectors.count != $ContestedSectorGroup.count">
6370 <do_all exact="$ContestedSectorGroup.count" counter="$gwf_o">
6371 <do_if value="not $CheckedContestedSectors.indexof.{$ContestedSectorGroup.{$gwf_o}}">
6372 <append_to_list name="$CheckedContestedSectors" exact="$ContestedSectorGroup.{$gwf_o}"/>
6373 <find_cluster_in_range name="$PotentiallyContestedClusters" object="$ContestedSectorGroup.{$gwf_o}" mindistance="1" maxdistance="1" multiple="true"/>
6374 <do_all exact="$PotentiallyContestedClusters" counter="$gwf_p">
6375 <find_sector groupname="$ContestedSectorGroup" space="$PotentiallyContestedClusters.{$gwf_p}" multiple="true">
6376 <match>
6377 <match contestedby="$HostFaction"/>
6378 <match contestedby="$EnemyFaction"/>
6379 </match>
6380 </find_sector>
6381 </do_all>
6382 </do_if>
6383 </do_all>
6384 </do_while>
6385 <set_value name="$WarFrontTable.$ContestedSectors" exact="$ContestedSectorGroup.list"/>
6386 <remove_value name="$ContestedSectorGroup"/>
6387
6388 <!--Populate $OfferSectors-->
6389 <create_group groupname="$OfferSectorsGroup"/>
6390 <do_all exact="$ContestedSectorGroup.count" counter="$gwf_o">
6391 <find_cluster_in_range name="$PotentialOtherClusters" object="$ContestedSectorGroup.{$gwf_o}" maxdistance="1" multiple="true"/>
6392 <do_all exact="$PotentialOtherClusters" counter="$gwf_p">
6393 <find_sector groupname="$OfferSectorsGroup" multiple="true" space="$PotentialOtherClusters.{$gwf_p}" append="true"/>
6394 </do_all>
6395 </do_all>
6396 <set_value name="$WarFrontTable.$OfferSectors" exact="$OfferSectorsGroup.list"/>
6397
6398 <!--Populate $HostSectors, $EnemySectors or $OtherSectors
6399 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)-->
6400 <do_all exact="$WarFrontTable.$OfferSectors.count" counter="$gwf_o">
6401 <set_value name="$OfferSector" exact="$WarFrontTable.$OfferSectors.{$gwf_o}"/>
6402 <do_if value="not $WarFrontTable.$ContestedSectors.indexof.{$OfferSector}">
6403 <do_if value="$OfferSector.owner == $HostFaction or $OfferSector.iscontestedby.{$HostFaction}">
6404 <!--Owned by host or contested by host but not by enemy-->
6405 <set_value name="$WarFrontTable.$HostSectors.{$OfferSector}" exact="1"/>
6406 </do_if>
6407 <do_elseif value="$OfferSector.owner == $EnemyFaction or $OfferSector.iscontestedby.{$EnemyFaction}">
6408 <!--Owned by enemy or contested by enemy but not by host-->
6409 <set_value name="$WarFrontTable.$EnemySectors.{$OfferSector}" exact="1"/>
6410 </do_elseif>
6411 <do_else>
6412 <!--Not owned or contested by either host or enemy-->
6413 <set_value name="$WarFrontTable.$OtherSectors.{$OfferSector}" exact="1"/>
6414 </do_else>
6415 </do_if>
6416 </do_all>
6417 </do_if>
6418 </do_else>
6419
6420 <set_value name="$HostGoals" exact="null"/>
6421 <set_value name="$EnemyGoals" exact="null"/>
6422
6423 <do_if value="global.$FactionManagers.{$HostFaction}?">
6424 <set_value name="$HostGoals" exact="global.$FactionManagers.{$HostFaction}.$Goals"/>
6425 </do_if>
6426
6427 <do_if value="global.$FactionManagers.{$EnemyFaction}?">
6428 <set_value name="$EnemyGoals" exact="global.$FactionManagers.{$EnemyFaction}.$Goals"/>
6429 </do_if>
6430
6431 <do_if value="$HostGoals">
6432 <!--Check for Invade_Space faction goals for the host faction-->
6433 <do_all exact="$HostGoals.count" counter="$gwf_i">
6434 <do_if value="$HostGoals.{$gwf_i}.static == md.FactionGoal_Invade_Space.Start">
6435 <do_if value="$WarFrontTable.$EnemySectors.{$HostGoals.{$gwf_i}.$Target}? or $WarFrontTable.$ContestedSectors.indexof.{$HostGoals.{$gwf_i}.$Target}">
6436 <append_to_list name="$WarFrontTable.$HostInvasions" exact="$HostGoals.{$gwf_i}"/>
6437 </do_if>
6438 </do_if>
6439 </do_all>
6440 </do_if>
6441
6442 <do_if value="$EnemyGoals">
6443 <!--Check for Invade_Space faction goals for the enemy faction-->
6444 <do_all exact="$EnemyGoals.count" counter="$gwf_i">
6445 <do_if value="$EnemyGoals.{$gwf_i}.static == md.FactionGoal_Invade_Space.Start">
6446 <!--Check if the enemy is invading a sector owned or contested by the host faction-->
6447 <do_if value="$WarFrontTable.$HostSectors.{$EnemyGoals.{$gwf_i}.$Target}? or $WarFrontTable.$ContestedSectors.indexof.{$EnemyGoals.{$gwf_i}.$Target}">
6448 <append_to_list name="$WarFrontTable.$EnemyInvasions" exact="$EnemyGoals.{$gwf_i}"/>
6449 </do_if>
6450 <!--Check if the enemy is invading a sector contested by an ally faction-->
6451 <do_elseif value="$EnemyGoals.{$gwf_i}.$Target.iscontested">
6452 <do_if value="$WarFrontTable.$ContestedSectors.indexof.{$EnemyGoals.{$gwf_i}.$Target}">
6453 <set_value name="$ContestingFactions" exact="$WarFrontTable.$HostSectors.{$EnemyGoals.{$gwf_i}.$Target}.contestingfactions"/>
6454 <do_all exact="$ContestingFactions.count" counter="$gwf_o">
6455 <!--At least for now, treat all neutral (including -0.1) factions as allies against the common enemy-->
6456 <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}">
6457 <append_to_list name="$WarFrontTable.$EnemyToAllyInvasions" exact="$EnemyGoals.{$gwf_i}"/>
6458 </do_if>
6459 </do_all>
6460 </do_if>
6461 </do_elseif>
6462 <!--Check if the enemy is invading a sector owned by an ally faction-->
6463 <do_elseif value="$WarFrontTable.$OtherSectors.{$EnemyGoals.{$gwf_i}.$Target}?">
6464 <set_value name="$EnemyTargetOwner" exact="$EnemyGoals.{$gwf_i}.$Target.owner"/>
6465 <!--At least for now, treat all neutral (including -0.1) factions as allies against the common enemy-->
6466 <do_if value="$HostFaction != $EnemyTargetOwner and $HostFaction.relationto.{$EnemyTargetOwner} ge $HostFaction.relation.neutral.min and $EnemyTargetOwner.hasrelation.enemy.{$EnemyFaction}">
6467 <append_to_list name="$WarFrontTable.$EnemyToAllyInvasions" exact="$EnemyGoals.{$gwf_i}"/>
6468 </do_if>
6469 </do_elseif>
6470 </do_if>
6471 </do_all>
6472 </do_if>
6473
6474 <!--Check if any allies are set to invade the enemy-->
6475 <do_all exact="$WarFrontTable.$OtherSectors.keys.count" counter="$gwf_i">
6476 <set_value name="$OtherSector" exact="$WarFrontTable.$OtherSectors.keys.{$gwf_i}"/>
6477 <do_if value="$OtherSector.iscontested">
6478 <set_value name="$ContestingFactions" exact="$OtherSector.contestingfactions"/>
6479 <do_all exact="$ContestingFactions.count" counter="$gwf_o">
6480 <do_if value="$HostFaction.relationto.{$ContestingFactions.{$gwf_o}} ge $HostFaction.relation.neutral.min and $ContestingFactions.{$gwf_o}.hasrelation.enemy.{$EnemyFaction}">
6481 <do_if value="global.$FactionManagers.{$ContestingFactions.{$gwf_o}}?">
6482 <set_value name="$AllyGoals" exact="global.$FactionManagers.{$ContestingFactions.{$gwf_o}}.$Goals"/>
6483 <!--Check for Invade_Space faction goals for the ally faction-->
6484 <do_all exact="$AllyGoals.count" counter="$gwf_k">
6485 <do_if value="$AllyGoals.{$gwf_k}.static == md.FactionGoal_Invade_Space.Start">
6486 <!--Check if the ally is invading a sector owned or contested by the enemy faction (but is also related to this exact war front)-->
6487 <do_if value="$WarFrontTable.$EnemySectors.{$AllyGoals.{$gwf_k}.$Target}? or $WarFrontTable.$ContestedSectors.indexof.{$AllyGoals.{$gwf_k}.$Target}">
6488 <append_to_list name="$AllyInvasions" exact="$AllyGoals.{$gwf_k}"/>
6489 </do_if>
6490 <!--Check if the ally is invading a sector contested by an ally faction-->
6491 <do_elseif value="$EnemyGoals.{$gwf_k}.$Target.iscontested">
6492 <do_if value="$WarFrontTable.$ContestedSectors.indexof.{$EnemyGoals.{$gwf_k}.$Target}">
6493 <set_value name="$ContestingFactions" exact="$WarFrontTable.$HostSectors.{$EnemyGoals.{$gwf_k}.$Target}.contestingfactions"/>
6494 <do_all exact="$ContestingFactions.count" counter="$gwf_o">
6495 <!--At least for now, treat all neutral (including -0.1) factions as allies against the common enemy-->
6496 <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}">
6497 <append_to_list name="$EnemyToAllyInvasions" exact="$EnemyGoals.{$gwf_k}"/>
6498 </do_if>
6499 </do_all>
6500 </do_if>
6501 </do_elseif>
6502 <!--Check if the enemy is invading a sector owned by an ally faction-->
6503 <do_elseif value="$WarFrontTable.$OtherSectors.indexof.{$EnemyGoals.{$gwf_k}.$Target}">
6504 <set_value name="$EnemyTargetOwner" exact="$EnemyGoals.{$gwf_k}.$Target.owner"/>
6505 <!--At least for now, treat all neutral (including -0.1) factions as allies against the common enemy-->
6506 <do_if value="$HostFaction != $EnemyTargetOwner and $HostFaction.relationto.{$EnemyTargetOwner} ge $HostFaction.relation.neutral.min and $EnemyTargetOwner.hasrelation.enemy.{$EnemyFaction}">
6507 <append_to_list name="$EnemyToAllyInvasions" exact="$EnemyGoals.{$gwf_k}"/>
6508 </do_if>
6509 </do_elseif>
6510 </do_if>
6511 </do_all>
6512 </do_if>
6513 </do_if>
6514 </do_all>
6515 </do_if>
6516 </do_all>
6517
6518 <do_if value="$WarFrontTable.$HostEntryPoint">
6519 <debug_text text="'Registered front for ' + $HostFaction.knownname + ' against ' + $EnemyFaction.knownname + ' from entrypoint ' + $WarFrontTable.$HostEntryPoint + ' in ' + $WarFrontTable.$HostEntryPoint.sector.knownname" chance="$DebugChance"/>
6520 </do_if>
6521 <do_else>
6522 <debug_text text="'Registered front for ' + $HostFaction.knownname + ' against ' + $EnemyFaction.knownname + ' in contested sectors ' + $WarFrontTable.$ContestedSectors + ' which includes ' + $WarFrontTable.$ContestedSectors.knownname" chance="$DebugChance"/>
6523 </do_else>
6524 <do_all chance="$DebugChance2">
6525 <debug_text text="'Host Sectors:'"/>
6526 <do_all exact="$WarFrontTable.$HostSectors.keys.count" counter="$gwf_o">
6527 <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}}"/>
6528 </do_all>
6529 <debug_text text="'Enemy Sectors:'"/>
6530 <do_all exact="$WarFrontTable.$EnemySectors.keys.count" counter="$gwf_o">
6531 <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}}"/>
6532 </do_all>
6533 <debug_text text="'Other Sectors:'"/>
6534 <do_all exact="$WarFrontTable.$OtherSectors.keys.count" counter="$gwf_o">
6535 <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}}"/>
6536 </do_all>
6537 <do_if value="$ContestedSectorsIncludeHost">
6538 <debug_text text="'Sectors contested by Host and Enemy:'"/>
6539 </do_if>
6540 <do_else>
6541 <debug_text text="'Sectors contested by Enemy and Ally:'"/>
6542 </do_else>
6543 <do_all exact="$WarFrontTable.$ContestedSectors.count" counter="$gwf_o">
6544 <debug_text text="$WarFrontTable.$ContestedSectors.{$gwf_o} + ' ' + $WarFrontTable.$ContestedSectors.{$gwf_o}.knownname"/>
6545 </do_all>
6546 <debug_text text="'Offer Sectors:'"/>
6547 <do_all exact="$WarFrontTable.$OfferSectors.count" counter="$gwf_o">
6548 <debug_text text="$WarFrontTable.$OfferSectors.{$gwf_o} + ' ' + $WarFrontTable.$OfferSectors.{$gwf_o}.knownname"/>
6549 </do_all>
6550 <debug_text text="'Host invasions against enemy:'"/>
6551 <do_all exact="$WarFrontTable.$HostInvasions.count" counter="$gwf_o">
6552 <debug_text text="'Invading: ' + $WarFrontTable.$HostInvasions.{$gwf_o}.$Target.knownname"/>
6553 </do_all>
6554 <debug_text text="'Enemy invasions against host:'"/>
6555 <do_all exact="$WarFrontTable.$EnemyInvasions.count" counter="$gwf_o">
6556 <debug_text text="'Invading: ' + $WarFrontTable.$EnemyInvasions.{$gwf_o}.$Target.knownname"/>
6557 </do_all>
6558 <debug_text text="'Ally invasions against enemy:'"/>
6559 <do_all exact="$WarFrontTable.$AllyInvasions.count" counter="$gwf_o">
6560 <debug_text text="'Invading: ' + $WarFrontTable.$AllyInvasions.{$gwf_o}.$Target.knownname"/>
6561 </do_all>
6562 <debug_text text="'Enemy invasions against ally:'"/>
6563 <do_all exact="$WarFrontTable.$EnemyToAllyInvasions.count" counter="$gwf_o">
6564 <debug_text text="'Invading: ' + $WarFrontTable.$EnemyToAllyInvasions.{$gwf_o}.$Target.knownname"/>
6565 </do_all>
6566 </do_all>
6567 <do_if value="not $WarFronts.{$HostFaction}?">
6568 <set_value name="$WarFronts.{$HostFaction}" exact="[]"/>
6569 </do_if>
6570 <append_to_list name="$WarFronts.{$HostFaction}" exact="$WarFrontTable"/>
6571 </do_if>
6572
6573 </do_all>
6574 </do_all>
6575 </do_all>
6576 </do_all>
6577 </actions>
6578 </library>
6579
6580 <cue name="Gamestart">
6581 <delay exact="2s"/>
6582 <actions>
6583 <signal_cue cue="CalculateThreads"/>
6584 </actions>
6585 </cue>
6586
6587 <cue name="CalculateThreads" instantiate="true">
6588 <conditions>
6589 <check_any>
6590 <event_object_changed_sector object="player.entity"/>
6591 <event_cue_signalled/>
6592 </check_any>
6593 <check_value value="player.sector"/>
6594 </conditions>
6595 <actions>
6596 <do_if value="not $ThreadList?">
6597 <set_value name="$ThreadList" exact="[]"/>
6598 </do_if>
6599
6600 <debug_text text="'Player is now in ' + player.sector + ' ' + player.sector.knownname" chance="$DebugChance"/>
6601 <!--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-->
6602 <set_value name="$CentralSector" exact="player.sector"/>
6603 <include_actions ref="GetWarFronts"/>
6604
6605 <set_value name="$ThreadDefinitionIDs" exact="$ThreadDefinitions.keys.list"/>
6606 <set_value name="$WarFrontFactions" exact="$WarFronts.keys.list"/>
6607 <set_value name="$SignalledIntroMissions" exact="[]"/>
6608 <do_all exact="$WarFrontFactions.count" counter="$i">
6609 <debug_text text="'Checkin war fronts for faction: ' + $WarFrontFactions.{$i}" chance="$DebugChance2"/>
6610 <set_value name="$FactionWarFronts" exact="$WarFronts.{$WarFrontFactions.{$i}}"/>
6611 <do_all exact="$FactionWarFronts.count" counter="$j">
6612 <set_value name="$WarFront" exact="$FactionWarFronts.{$j}"/>
6613
6614 <do_all exact="$ThreadDefinitionIDs.count" counter="$d">
6615 <set_value name="$Potential_Thread" exact="$ThreadDefinitions.{$ThreadDefinitionIDs.{$d}}"/>
6616 <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"/>
6617
6618 <debug_text text="'$WarFrontFactions.{$i}: ' + $WarFrontFactions.{$i}" chance="$DebugChance2"/>
6619 <debug_text text="'$Potential_Thread.$Faction: ' + $Potential_Thread.$Faction" chance="$DebugChance2"/>
6620 <debug_text text="'$WarFront.$EnemyFaction: ' + $WarFront.$EnemyFaction" chance="$DebugChance2"/>
6621 <debug_text text="'$Potential_Thread.$EnemyFaction: ' + $Potential_Thread.$EnemyFaction" chance="$DebugChance2"/>
6622 <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"/>
6623
6624 <do_if value="$WarFrontFactions.{$i} == $Potential_Thread.$Faction and $WarFront.$EnemyFaction == $Potential_Thread.$EnemyFaction">
6625 <set_value name="$ThreadValid" exact="true"/>
6626
6627 <!--First, check that there isn't already the same thread already running for this WarFront-->
6628 <do_all exact="$Threads.count" counter="$tc_k">
6629 <do_if value="$Threads.{$tc_k}.$ThreadCue.$Definition.$ID == $Potential_Thread.$ID">
6630 <set_value name="$ThreadInstanceDefinition" exact="$Threads.{$tc_k}.$ThreadCue.$Definition"/>
6631 <do_if value="$WarFront.$EnemyFaction == $ThreadInstanceDefinition.$WarFront.$EnemyFaction">
6632 <do_if value="$WarFront.$HostEntryPoint and $WarFront.$HostEntryPoint == $ThreadInstanceDefinition.$WarFront.$HostEntryPoint">
6633 <set_value name="$ThreadValid" exact="false"/>
6634 <debug_text text="'$ThreadValid 1: ' + $ThreadValid" chance="$DebugChance2"/>
6635 <break/>
6636 </do_if>
6637 <do_elseif value="$WarFront.$ContestedSectors.count and $ThreadInstanceDefinition.$WarFront.$ContestedSectors.count">
6638 <do_all exact="$WarFront.$ContestedSectors.count" counter="$tc_o">
6639 <do_if value="$ThreadInstanceDefinition.$WarFront.$ContestedSectors.indexof.{$WarFront.$ContestedSectors.{$tc_o}}">
6640 <set_value name="$ThreadValid" exact="false"/>
6641 <debug_text text="'$ThreadValid 2: ' + $ThreadValid" chance="$DebugChance2"/>
6642 <break/>
6643 </do_if>
6644 </do_all>
6645 </do_elseif>
6646 </do_if>
6647 </do_if>
6648 </do_all>
6649
6650 <!--TODO @Owen take $ThreadAbortRelation into account-->
6651 <do_if value="$ThreadValid">
6652 <set_value name="$ThreadValid" exact="false"/>
6653 <debug_text text="'$ThreadValid 3: ' + $ThreadValid" chance="$DebugChance2"/>
6654 <do_if value="@$Potential_Thread.$ThreadConditionLibs.count">
6655 <do_all exact="$Potential_Thread.$ThreadConditionLibs.count" counter="$o">
6656 <do_if value="$WarFront.$ActiveSituations.indexof.{$Potential_Thread.$ThreadConditionLibs.{$o}}">
6657 <set_value name="$ThreadValid" exact="true"/>
6658 <debug_text text="'$ThreadValid 4: ' + $ThreadValid" chance="$DebugChance2"/>
6659 </do_if>
6660 <do_else>
6661 <include_actions ref="$Potential_Thread.$ThreadConditionLibs.{$o}"/>
6662 <do_if value="$SituationValid">
6663 <append_to_list name="$WarFront.$ActiveSituations" exact="$Potential_Thread.$ThreadConditionLibs.{$o}"/>
6664 <set_value name="$ThreadValid" exact="true"/>
6665 <debug_text text="'$ThreadValid 5: ' + $ThreadValid" chance="$DebugChance2"/>
6666 </do_if>
6667 </do_else>
6668 </do_all>
6669 </do_if>
6670 <do_else>
6671 <set_value name="$ThreadValid" exact="true"/>
6672 <debug_text text="'$ThreadValid 6: ' + $ThreadValid" chance="$DebugChance2"/>
6673 </do_else>
6674 </do_if>
6675
6676 <do_if value="$ThreadValid">
6677 <debug_text text="'$ThreadValid 7: ' + $ThreadValid" chance="$DebugChance2"/>
6678 <set_value name="$MissionGroupCue" exact="$MissionGroupCues.{$Potential_Thread.$MissionGroup}"/>
6679 <debug_text text="'$MissionGroupCue: ' + $MissionGroupCue" chance="$DebugChance2"/>
6680 <debug_text text="'$MissionGroupCue.$SubscriptionStatus: ' + $MissionGroupCue.$SubscriptionStatus" chance="$DebugChance2"/>
6681 <do_if value="$MissionGroupCue.$SubscriptionStatus == 'unsubscribed'">
6682 <do_if value="$MissionGroupCue.$IntroMissionCue.state == cuestate.waiting and not $SignalledIntroMissions.indexof.{$MissionGroupCue.$IntroMissionCue}">
6683 <debug_text text="'Signalling intro mission cue ' + $MissionGroupCue.$IntroMissionCue + ' for mission group ' + $Potential_Thread.$MissionGroup" chance="$DebugChance"/>
6684 <append_to_list name="$SignalledIntroMissions" exact="$MissionGroupCue.$IntroMissionCue"/>
6685
6686 <do_if value="not $MissionGroupCue.$Mission_Contact.isclass.npc" comment="class check incase of disconnected (should we allow disconnected contacts?)">
6687 <signal_cue_instantly cue="$MissionGroupCue.$ContactCreatorCue" param="$WarFront.$HostSectors.clone"/>
6688 </do_if>
6689 <signal_cue cue="$MissionGroupCue.$IntroMissionCue"/>
6690 </do_if>
6691 </do_if>
6692 <do_elseif value="$MissionGroupCue.$SubscriptionStatus == 'subscribed'">
6693
6694 <set_value name="$New_Thread" exact="$Potential_Thread.clone"/>
6695 <!--TODO @Owen sanity checks-->
6696 <do_if value="not $MissionGroupCue.$Mission_Contact.isclass.npc" comment="class check incase of disconnected (should we allow disconnected contacts?)">
6697 <signal_cue_instantly cue="$MissionGroupCues.{$New_Thread.$MissionGroup}.$ContactCreatorCue" param="$WarFront.$HostSectors.clone"/>
6698 </do_if>
6699 <set_value name="$New_Thread.$Contact" exact="$MissionGroupCue.$Mission_Contact"/>
6700 <set_value name="$New_Thread.$HQ" exact="$New_Thread.$Faction.headquarters"/>
6701 <!--WarFront should essentially be read-only, so we're not going to clone it-->
6702 <set_value name="$New_Thread.$WarFront" exact="$WarFront"/>
6703 <set_value name="$New_Thread.$OfferSectors" exact="$WarFront.$OfferSectors"/>
6704
6705 <set_value name="$New_Thread.$DebugChance" exact="$DebugChance"/>
6706
6707 <!--TODO @Guage the current mood of this faction on this war front-->
6708 <do_any>
6709 <set_value name="$ThreadMood" exact="'negative'"/>
6710 <set_value name="$ThreadMood" exact="'positive'"/>
6711 </do_any>
6712
6713 <do_if value="$New_Thread.$NameLib?" comment="Support for older mission threads without text construction libs">
6714 <!--Get sub-missions-->
6715 <include_actions ref="$New_Thread.$SubMissionLib"/>
6716
6717 <!--Get thread name-->
6718 <include_actions ref="$New_Thread.$NameLib"/>
6719 <set_value name="$New_Thread.$ThreadName" exact="this.$Name"/>
6720
6721 <!--Construct a suitable description-->
6722 <include_actions ref="$New_Thread.$DescriptionLib"/>
6723 <set_value name="$New_Thread.$ThreadDescription" exact="this.$Description"/>
6724 </do_if>
6725
6726 <set_value name="$ThreadManagerParams" exact="table[
6727 $ThreadDefinition = $New_Thread,
6728 $RegisterThreadCue = Register_Thread,
6729 $ThreadAcceptedCue = Thread_Accepted,
6730 $CleanupThreadCue = Cleanup_Thread]"/>
6731 <signal_cue_instantly cue="md.MC_Management.Thread_Manager" param="$ThreadManagerParams"/>
6732 </do_elseif>
6733 </do_if>
6734 </do_if>
6735 </do_all>
6736 </do_all>
6737 </do_all>
6738 </actions>
6739 </cue>
6740
6741 <!--event.param = thread table: table[$ThreadCue, $CleanupCue]-->
6742 <cue name="Register_Thread" instantiate="true">
6743 <conditions>
6744 <event_cue_signalled/>
6745 </conditions>
6746 <actions>
6747 <append_to_list name="$Threads" exact="event.param"/>
6748 </actions>
6749 </cue>
6750
6751 <!-- Store the selected mission-thread in $ActiveThreads, and disable all other mission-thread cues of that mission group-->
6752 <cue name="Thread_Accepted" instantiate="true">
6753 <conditions>
6754 <event_cue_signalled/>
6755 </conditions>
6756 <actions>
6757 <debug_text text="'Accepted mission thread: ' + event.param.$Definition.$ID" chance="$DebugChance"/>
6758 <append_to_list name="$ActiveThreads" exact="event.param"/>
6759 <do_all exact="$Threads.count" counter="$i" reverse="true">
6760 <do_if value="$Threads.{$i}.$ThreadCue != event.param and $Threads.{$i}.$ThreadCue.$Definition.$MissionGroup == event.param.$Definition.$MissionGroup">
6761 <signal_cue_instantly cue="$Threads.{$i}.$CleanupCue"/>
6762 </do_if>
6763 </do_all>
6764 </actions>
6765 </cue>
6766
6767 <!--event.param = table[
6768 $cue = thread cue namespace,
6769 $completedmissions = number of completed missions,
6770 $failedmissions = number of failed missions]-->
6771 <cue name="Cleanup_Thread" instantiate="true">
6772 <conditions>
6773 <event_cue_signalled/>
6774 </conditions>
6775 <actions>
6776 <debug_text text="'Attempting to clean up mission thread: ' + event.param.$cue.$Definition.$ID" chance="$DebugChance"/>
6777
6778 <set_value name="this.$ActiveThreadIdx" exact="$ActiveThreads.indexof.{event.param.$cue}"/>
6779 <do_if value="this.$ActiveThreadIdx">
6780 <remove_value name="$ActiveThreads.{this.$ActiveThreadIdx}"/>
6781 </do_if>
6782 <set_value name="this.$Removed" exact="false"/>
6783 <do_all exact="$Threads.count" counter="$Cleanup_Thread_i" reverse="true">
6784 <do_if value="$Threads.{$Cleanup_Thread_i}.$ThreadCue == event.param.$cue">
6785 <assert value="not this.$Removed" text="'Matching thread was already removed. Should not happen again. Thread: ' + event.param.$cue.$Definition.$ID + ' [Owen]'"/>
6786 <set_value name="this.$Removed" exact="true"/>
6787 <remove_value name="$Threads.{$Cleanup_Thread_i}"/>
6788 </do_if>
6789 </do_all>
6790 <assert value="this.$Removed" text="'No matching thread was found to be removed. Thread: ' + event.param.$cue.$Definition.$ID + ' [Owen]'"/>
6791 </actions>
6792 </cue>
6793 </cues>
6794 </cue>
6795
6796 <!--Generic Event-handling code -->
6797
6798 <library name="MM__Standard_GM_Event">
6799 <actions>
6800 <do_if value="@static.$EndFeedbackValue" comment="Evaluate return-value of GM (success/failure)">
6801 <debug_text text="'Mission ended. feedback' + static.$EndFeedbackValue" chance="$DebugChance"/>
6802
6803 <do_if value="$SuccessfullyGenerated">
6804 <signal_cue_instantly cue="$Definition.$EndedCue" param="table[$wrappercue = namespace, $feedback = static.$EndFeedbackValue]"/>
6805 </do_if>
6806 <do_else>
6807 <signal_cue_instantly cue="$Definition.$SpawnFailedCue"/>
6808 </do_else>
6809
6810 <do_if value="static.$EndFeedbackValue.$type" exact="'success'" comment="see the $FeedbackValues table in the Generic Mission">
6811 <do_if value="@$MissionDataTable.$NextMission">
6812 <do_if value="false" comment="Forced failure as there are no valid NextMission cases defined for this mission. Replace with valid case if needed.">
6813
6814 </do_if>
6815 <do_else>
6816 <!--If there is a followup mission, signal it with whatever parameters it needs-->
6817 <assert value="false" text="'Next mission ' + $MissionDataTable.$NextMission + ' is missing handling in ' + namespace + '. It should be explicitly signalled with whatever parameters it requires. [Owen]'"/>
6818 </do_else>
6819 </do_if>
6820 </do_if>
6821 <do_elseif value="static.$EndFeedbackValue.$ID" exact="'$MISSION_TIMEOUT'">
6822 </do_elseif>
6823
6824 <cancel_cue cue="namespace"/>
6825 </do_if>
6826 <do_elseif value="@static.$FeedbackValue">
6827 <debug_text text="'Mission signalled with feedback' + static.$FeedbackValue" chance="$DebugChance"/>
6828 <do_if value="static.$FeedbackValue.$ID == '$MISSION_GENERATED'">
6829 <!--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-->
6830 <do_if value="not $FollowUp">
6831 <set_value name="$MissionDataTable" exact="event.param.clone"/>
6832 <set_value name="$MissionDataTable.$WrapperCue" exact="namespace"/>
6833 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
6834 </do_if>
6835 <set_value name="$SuccessfullyGenerated" exact="true"/>
6836 </do_if>
6837 </do_elseif>
6838 </actions>
6839 </library>
6840
6841 <!--
6842 ############################
6843 Mission Thread Condition Libraries
6844 ############################-->
6845
6846 <!-- For debugging, to always enable a specific subscription -->
6847 <library name="Situation__Always">
6848 <actions>
6849 <set_value name="$SituationValid" exact="true"/>
6850 </actions>
6851 </library>
6852
6853 <!--
6854 Required variables:
6855 - $WarFront = Current war front being checked (already checked that the Host and Enemy factions match this thread)
6856 - $Potential_Thread = Thread definition to check if it's possible with the war front and active faction logic behaviours
6857
6858 Values to set for conditions:
6859 - $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.
6860 - $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.
6861 - $ContestedSectors: -1 = No filter. 0 = No contested sectors. 1 = At least 1 contested sector-->
6862
6863 <!--Cold War / Cleanup
6864 Host: No invasions
6865 Enemy: No invasion
6866 Ally: N/A
6867 Enemy Vs. Ally: N/A
6868 Contested sectors: None-->
6869 <library name="Situation__Cold_War">
6870 <actions>
6871 <set_value name="$HostInvasionPhase" exact="'none'"/>
6872 <set_value name="$EnemyInvasionPhase" exact="'none'"/>
6873 <set_value name="$AllyInvasionPhase" exact="null"/>
6874 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
6875 <set_value name="$ContestedSectors" exact="0"/>
6876 <include_actions ref="Thread_Conditions__Common"/>
6877 </actions>
6878 </library>
6879
6880 <!--Contention
6881 Host: No invasions
6882 Enemy: No invasions
6883 Ally: N/A
6884 Enemy Vs. Ally: N/A
6885 Contested sectors: ge 1-->
6886 <library name="Situation__Contention">
6887 <actions>
6888 <set_value name="$HostInvasionPhase" exact="'none'"/>
6889 <set_value name="$EnemyInvasionPhase" exact="'none'"/>
6890 <set_value name="$AllyInvasionPhase" exact="null"/>
6891 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
6892 <set_value name="$ContestedSectors" exact="1"/>
6893 <include_actions ref="Thread_Conditions__Common"/>
6894 </actions>
6895 </library>
6896
6897 <!--Invasion preparation
6898 Host: At least 1 invasion in 'prepare_for_invasion' phase
6899 Enemy: N/A
6900 Ally: N/A
6901 Enemy Vs. Ally: N/A
6902 Contested sectors: N/A-->
6903 <library name="Situation__Invasion_Prep">
6904 <actions>
6905 <set_value name="$HostInvasionPhase" exact="'prepare_for_invasion'"/>
6906 <set_value name="$EnemyInvasionPhase" exact="null"/>
6907 <set_value name="$AllyInvasionPhase" exact="null"/>
6908 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
6909 <set_value name="$ContestedSectors" exact="-1"/>
6910 <include_actions ref="Thread_Conditions__Common"/>
6911 </actions>
6912 </library>
6913
6914 <!--Defence preparation
6915 Host: N/A
6916 Enemy: At least 1 invasion in 'prepare_for_invasion' phase
6917 Ally: N/A
6918 Enemy Vs. Ally: N/A
6919 Contested sectors: N/A-->
6920 <library name="Situation__Defence_Prep">
6921 <actions>
6922 <set_value name="$HostInvasionPhase" exact="null"/>
6923 <set_value name="$EnemyInvasionPhase" exact="'prepare_for_invasion'"/>
6924 <set_value name="$AllyInvasionPhase" exact="null"/>
6925 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
6926 <set_value name="$ContestedSectors" exact="-1"/>
6927 <include_actions ref="Thread_Conditions__Common"/>
6928 </actions>
6929 </library>
6930
6931 <!--Invading
6932 Host: At least 1 invasion in 'beachhead' phase
6933 Enemy: N/A
6934 Ally: N/A
6935 Enemy Vs. Ally: N/A
6936 Contested sectors: N/A-->
6937 <library name="Situation__Invading">
6938 <actions>
6939 <set_value name="$HostInvasionPhase" exact="'beachhead'"/>
6940 <set_value name="$EnemyInvasionPhase" exact="null"/>
6941 <set_value name="$AllyInvasionPhase" exact="null"/>
6942 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
6943 <set_value name="$ContestedSectors" exact="-1"/>
6944 <include_actions ref="Thread_Conditions__Common"/>
6945 </actions>
6946 </library>
6947
6948 <!--Defending
6949 Host: N/A
6950 Enemy: At least 1 invasion in 'beachhead' phase
6951 Ally: N/A
6952 Enemy Vs. Ally: N/A
6953 Contested sectors: N/A-->
6954 <library name="Situation__Defending">
6955 <actions>
6956 <set_value name="$HostInvasionPhase" exact="null"/>
6957 <set_value name="$EnemyInvasionPhase" exact="'beachhead'"/>
6958 <set_value name="$AllyInvasionPhase" exact="null"/>
6959 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
6960 <set_value name="$ContestedSectors" exact="-1"/>
6961 <include_actions ref="Thread_Conditions__Common"/>
6962 </actions>
6963 </library>
6964
6965 <!--Support invading ally
6966 Host: No invasions
6967 Enemy: No invasions
6968 Ally: At least 1 invasion in 'beachhead' phase
6969 Enemy Vs. Ally: N/A
6970 Contested sectors: N/A-->
6971 <library name="Situation__Invading_Ally">
6972 <actions>
6973 <set_value name="$HostInvasionPhase" exact="'none'"/>
6974 <set_value name="$EnemyInvasionPhase" exact="'none'"/>
6975 <set_value name="$AllyInvasionPhase" exact="'beachhead'"/>
6976 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
6977 <set_value name="$ContestedSectors" exact="-1"/>
6978 <include_actions ref="Thread_Conditions__Common"/>
6979 </actions>
6980 </library>
6981
6982 <!--Support defending ally
6983 Host: No invasions
6984 Enemy: No invasions
6985 Ally: N/A
6986 Enemy Vs. Ally: At least 1 invasion in 'beachhead' phase
6987 Contested sectors: N/A-->
6988 <library name="Situation__Defending_Ally">
6989 <actions>
6990 <set_value name="$HostInvasionPhase" exact="'none'"/>
6991 <set_value name="$EnemyInvasionPhase" exact="'none'"/>
6992 <set_value name="$AllyInvasionPhase" exact="null"/>
6993 <set_value name="$EnemyVsAllyInvasionPhase" exact="['prepare_for_invasion', 'beachhead']"/>
6994 <set_value name="$ContestedSectors" exact="-1"/>
6995 <include_actions ref="Thread_Conditions__Common"/>
6996 </actions>
6997 </library>
6998
6999 <!--Retreat
7000 Host: At least 1 invasion in 'retreat' phase
7001 Enemy: N/A
7002 Ally: N/A
7003 Enemy Vs. Ally: N/A
7004 Contested sectors: N/A-->
7005 <library name="Situation__Retreat">
7006 <actions>
7007 <set_value name="$HostInvasionPhase" exact="'retreat'"/>
7008 <set_value name="$EnemyInvasionPhase" exact="null"/>
7009 <set_value name="$AllyInvasionPhase" exact="null"/>
7010 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
7011 <set_value name="$ContestedSectors" exact="-1"/>
7012 <include_actions ref="Thread_Conditions__Common"/>
7013 </actions>
7014 </library>
7015
7016 <!--Push back
7017 Host: N/A
7018 Enemy: At least 1 invasion in 'retreat' phase
7019 Ally: N/A
7020 Enemy Vs. Ally: N/A
7021 Contested sectors: N/A-->
7022 <library name="Situation__Pushback">
7023 <actions>
7024 <set_value name="$HostInvasionPhase" exact="null"/>
7025 <set_value name="$EnemyInvasionPhase" exact="'retreat'"/>
7026 <set_value name="$AllyInvasionPhase" exact="null"/>
7027 <set_value name="$EnemyVsAllyInvasionPhase" exact="null"/>
7028 <set_value name="$ContestedSectors" exact="-1"/>
7029 <include_actions ref="Thread_Conditions__Common"/>
7030 </actions>
7031 </library>
7032
7033 <!--For internal use by the above libraries
7034 Library requires the same parameters stated above.
7035 Values to set for conditions:
7036 - $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.
7037 - $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.
7038 - $ContestedSectors: -1 = No filter. 0 = No contested sectors. 1 = At least 1 contested sector-->
7039 <library name="Thread_Conditions__Common">
7040 <actions>
7041 <set_value name="$SituationValid" exact="true"/>
7042
7043 <do_if value="$SituationValid and $HostInvasionPhase">
7044 <set_value name="$SituationValid" exact="false"/>
7045
7046 <do_if value="$HostInvasionPhase == 'none'">
7047 <do_if value="$WarFront.$HostInvasions.count == 0">
7048 <set_value name="$SituationValid" exact="true"/>
7049 </do_if>
7050 </do_if>
7051 <do_elseif value="typeof $HostInvasionPhase == datatype.list">
7052 <do_all exact="$WarFront.$HostInvasions.count" counter="$tc_i">
7053 <do_if value="$WarFront.$HostInvasions.{$tc_i}.exists and $HostInvasionPhase.indexof.{$WarFront.$HostInvasions.{$tc_i}.$Phase}">
7054 <set_value name="$SituationValid" exact="true"/>
7055 <break/>
7056 </do_if>
7057 </do_all>
7058 </do_elseif>
7059 <do_else>
7060 <do_all exact="$WarFront.$HostInvasions.count" counter="$tc_i">
7061 <do_if value="$WarFront.$HostInvasions.{$tc_i}.exists and $HostInvasionPhase == $WarFront.$HostInvasions.{$tc_i}.$Phase">
7062 <set_value name="$SituationValid" exact="true"/>
7063 <break/>
7064 </do_if>
7065 </do_all>
7066 </do_else>
7067 </do_if>
7068
7069 <do_if value="$SituationValid and $EnemyInvasionPhase">
7070 <set_value name="$SituationValid" exact="false"/>
7071
7072 <do_if value="$EnemyInvasionPhase == 'none'">
7073 <do_if value="$WarFront.$EnemyInvasions.count == 0">
7074 <set_value name="$SituationValid" exact="true"/>
7075 </do_if>
7076 </do_if>
7077 <do_elseif value="typeof $EnemyInvasionPhase == datatype.list">
7078 <do_all exact="$WarFront.$EnemyInvasions.count" counter="$tc_i">
7079 <do_if value="$WarFront.$EnemyInvasions.{$tc_i}.exists and $EnemyInvasionPhase.indexof.{$WarFront.$EnemyInvasions.{$tc_i}.$Phase}">
7080 <set_value name="$SituationValid" exact="true"/>
7081 <break/>
7082 </do_if>
7083 </do_all>
7084 </do_elseif>
7085 <do_else>
7086 <do_all exact="$WarFront.$EnemyInvasions.count" counter="$tc_i">
7087 <do_if value="$WarFront.$EnemyInvasions.{$tc_i}.exists and $EnemyInvasionPhase == $WarFront.$EnemyInvasions.{$tc_i}.$Phase">
7088 <set_value name="$SituationValid" exact="true"/>
7089 <break/>
7090 </do_if>
7091 </do_all>
7092 </do_else>
7093 </do_if>
7094
7095 <do_if value="$SituationValid and $AllyInvasionPhase">
7096 <set_value name="$SituationValid" exact="false"/>
7097
7098 <do_if value="$AllyInvasionPhase == 'none'">
7099 <do_if value="$WarFront.$AllyInvasions.count == 0">
7100 <set_value name="$SituationValid" exact="true"/>
7101 </do_if>
7102 </do_if>
7103 <do_elseif value="typeof $AllyInvasionPhase == datatype.list">
7104 <do_all exact="$WarFront.$AllyInvasions.count" counter="$tc_i">
7105 <do_if value="$WarFront.$AllyInvasions.{$tc_i}.exists and $AllyInvasionPhase.indexof.{$WarFront.$AllyInvasions.{$tc_i}.$Phase}">
7106 <set_value name="$SituationValid" exact="true"/>
7107 <break/>
7108 </do_if>
7109 </do_all>
7110 </do_elseif>
7111 <do_else>
7112 <do_all exact="$WarFront.$AllyInvasions.count" counter="$tc_i">
7113 <do_if value="$WarFront.$AllyInvasions.{$tc_i}.exists and $AllyInvasionPhase == $WarFront.$AllyInvasions.{$tc_i}.$Phase">
7114 <set_value name="$SituationValid" exact="true"/>
7115 <break/>
7116 </do_if>
7117 </do_all>
7118 </do_else>
7119 </do_if>
7120
7121 <do_if value="$SituationValid and $EnemyVsAllyInvasionPhase">
7122 <set_value name="$SituationValid" exact="false"/>
7123
7124 <do_if value="$EnemyVsAllyInvasionPhase == 'none'">
7125 <do_if value="$WarFront.$EnemyToAllyInvasions.count == 0">
7126 <set_value name="$SituationValid" exact="true"/>
7127 </do_if>
7128 </do_if>
7129 <do_elseif value="typeof $EnemyVsAllyInvasionPhase == datatype.list">
7130 <do_all exact="$WarFront.$EnemyToAllyInvasions.count" counter="$tc_i">
7131 <do_if value="$WarFront.$EnemyToAllyInvasions.{$tc_i}.exists and $EnemyVsAllyInvasionPhase.indexof.{$WarFront.$EnemyToAllyInvasions.{$tc_i}.$Phase}">
7132 <set_value name="$SituationValid" exact="true"/>
7133 <break/>
7134 </do_if>
7135 </do_all>
7136 </do_elseif>
7137 <do_else>
7138 <do_all exact="$WarFront.$EnemyToAllyInvasions.count" counter="$tc_i">
7139 <do_if value="$WarFront.$EnemyToAllyInvasions.{$tc_i}.exists and $EnemyVsAllyInvasionPhase == $WarFront.$EnemyToAllyInvasions.{$tc_i}.$Phase">
7140 <set_value name="$SituationValid" exact="true"/>
7141 <break/>
7142 </do_if>
7143 </do_all>
7144 </do_else>
7145 </do_if>
7146
7147 <do_if value="$SituationValid">
7148 <set_value name="$SituationValid" exact="false"/>
7149
7150 <do_if value="$ContestedSectors == -1">
7151 <!--No filter-->
7152 <set_value name="$SituationValid" exact="true"/>
7153 </do_if>
7154 <do_elseif value="$ContestedSectors == 0">
7155 <do_if value="$WarFront.$ContestedSectors.count == 0">
7156 <set_value name="$SituationValid" exact="true"/>
7157 </do_if>
7158 </do_elseif>
7159 <do_elseif value="$ContestedSectors == 1">
7160 <do_if value="$WarFront.$ContestedSectors.count gt 0">
7161 <set_value name="$SituationValid" exact="true"/>
7162 </do_if>
7163 </do_elseif>
7164 </do_if>
7165 </actions>
7166 </library>
7167
7168 <!--
7169 ######################
7170 Submission Libraries
7171 ######################-->
7172
7173 <!--Variant Helper Libraries
7174 Helper libraries to be call from different threads but want to have the same basic variant rules
7175 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-->
7176
7177 <library name="Large_Supply__Food">
7178 <actions>
7179 <set_value name="$StationSpace" exact="null"/>
7180 <do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
7181 <do_any>
7182 <set_value name="$StationSpace" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted.{1}"/>
7183 <set_value name="$StationSpace" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.random"/>
7184 </do_any>
7185 </do_if>
7186 <do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
7187 <set_value name="$StationSpace" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.random"/>
7188 </do_elseif>
7189
7190 <do_if value="$StationSpace">
7191 <set_value name="$WorkforceResources" exact="$Definition.$ThreadData.$Faction.primaryrace.workforce.resources.list"/>
7192
7193 <set_value name="$StationSupply" exact="[]"/>
7194 <set_value name="$ResourceFactor" min="4" max="6"/>
7195 <do_all exact="$WorkforceResources.count" counter="$i">
7196 <append_to_list name="$StationSupply" exact="table[
7197 $amount = $Definition.$ThreadData.$Faction.primaryrace.workforce.resources.{$WorkforceResources.{$i}}.count * $ResourceFactor,
7198 $delivered = 0,
7199 $ware = $WorkforceResources.{$i}]"/>
7200 </do_all>
7201
7202 <do_if value="$StationSupply.count">
7203 <!--Check that there are enough stations to deliver to-->
7204 <set_value name="$SupplyWares" exact="[]"/>
7205 <do_all exact="$StationSupply.count" counter="$supply_i">
7206 <append_to_list name="$SupplyWares" exact="$StationSupply.{$supply_i}.$ware"/>
7207 </do_all>
7208 <find_station name="$MatchingStations" owner="$Definition.$ThreadData.$Faction" space="$StationSpace" multiple="true">
7209 <match_resources wares="$SupplyWares"/>
7210 </find_station>
7211 <do_if value="$MatchingStations.count gt 2">
7212 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
7213 </do_if>
7214 </do_if>
7215 </do_if>
7216 </actions>
7217 </library>
7218
7219 <library name="Large_Supply__Ship_Construction_Tech">
7220 <actions>
7221 <!--Grab the list of shiptech goods from their waregroup-->
7222 <set_value name="$ShipTechWares" exact="waregroup.shiptech.list"/>
7223 <!--Get all host sectors sorted by distance to enemy space-->
7224 <set_value name="$SortedHostSectors" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted"/>
7225 <set_value name="$NeededWaresTable" exact="table[]"/>
7226 <set_value name="$StationSupply" exact="[]"/>
7227 <do_all exact="$SortedHostSectors.count" counter="$i">
7228 <!--Find shipyards or equipmentdocks for this faction in this sector-->
7229 <find_station name="$ShipyardOrEQDocks" space="$SortedHostSectors.{$i}" owner="$Definition.$ThreadData.$Faction" multiple="true">
7230 <match_any>
7231 <match shipyard="true"/>
7232 <match equipmentdock="true"/>
7233 </match_any>
7234 </find_station>
7235 <!--Build a table of needed wares-->
7236 <clear_table table="$NeededWaresTable"/>
7237 <do_all exact="$ShipyardOrEQDocks.count" counter="$k">
7238 <find_buy_offer result="$BuyOffers" buyer="$ShipyardOrEQDocks.{$k}" wares="$ShipTechWares" multiple="true"/>
7239 <do_all exact="$BuyOffers.count" counter="$m">
7240 <set_value name="$NeededWaresTable.{$BuyOffers.{$m}.ware}" exact="$BuyOffers.{$m}.amount" operation="add"/>
7241 </do_all>
7242 </do_all>
7243 <debug_text text="'Needed shiptech wares: ' + $NeededWaresTable" chance="$DebugChance"/>
7244 <do_if value="$NeededWaresTable.keys.count">
7245 <set_value name="$SortedWares" exact="$NeededWaresTable.keys.sorted"/>
7246 <do_all exact="[$SortedWares.count, 3].min" counter="$k" reverse="true">
7247 <append_to_list name="$StationSupply" exact="table[
7248 $amount = [$NeededWaresTable.{$SortedWares.{$k}} / 2, 1].max,
7249 $ware = $SortedWares.{$k},
7250 $delivered = 0]"/>
7251 </do_all>
7252
7253 <set_value name="$StationSpace" exact="$SortedHostSectors.{$i}"/>
7254 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
7255 <break/>
7256 </do_if>
7257 </do_all>
7258 </actions>
7259 </library>
7260
7261 <cue name="Large_Supply__Standard" instantiate="true" namespace="this">
7262 <conditions>
7263 <event_cue_signalled/>
7264 <!--Signal the static cue to trigger a new instance of this mission.
7265 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
7266 </conditions>
7267 <actions>
7268 <set_value name="$Definition" exact="event.param"/>
7269 <set_value name="$Page" exact="$Definition.$Page"/>
7270 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
7271 <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."/>
7272 <set_value name="$SuccessfullyGenerated" exact="false"/>
7273 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
7274
7275 <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]'"/>
7276
7277 <!--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.
7278 $Valid:
7279 0: Page/TextOffset not handled
7280 1: Correct Page/TextOffset but unable to setup mission
7281 2: Mission can attempt to be spawned -->
7282 <set_value name="$Valid" exact="0"/>
7283
7284 <!--### ARGON VS XENON ###-->
7285 <do_if value="$Page == 30210">
7286 <do_if value="$TextOffset == 100000">
7287 <!--Food supplies for workforce-->
7288 <!--TODO @Owen check if there are enough stations in need of these resources-->
7289 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7290 <include_actions ref="Large_Supply__Food"/>
7291 </do_if>
7292 <do_elseif value="$TextOffset == 100100">
7293 <!--Construction supplies for ship construction-->
7294 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7295 <include_actions ref="Large_Supply__Ship_Construction_Tech"/>
7296 </do_elseif>
7297 </do_if>
7298
7299 <!--### ARGON VS HOLY ORDER ###-->
7300 <do_elseif value="$Page == 30211">
7301 <do_if value="$TextOffset == 100000">
7302 <!--Food supplies for workforce-->
7303 <!--TODO @Owen check if there are enough stations in need of these resources-->
7304 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7305 <include_actions ref="Large_Supply__Food"/>
7306 </do_if>
7307 <do_elseif value="$TextOffset == 100100">
7308 <!--Construction supplies for ship construction-->
7309 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7310 <include_actions ref="Large_Supply__Ship_Construction_Tech"/>
7311 </do_elseif>
7312 </do_elseif>
7313
7314 <!--### PARANID VS HOLY ORDER ###-->
7315 <do_elseif value="$Page == 30212">
7316 <do_if value="$TextOffset == 100000">
7317 <!--Food supplies for workforce-->
7318 <!--TODO @Owen check if there are enough stations in need of these resources-->
7319 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7320 <include_actions ref="Large_Supply__Food"/>
7321 </do_if>
7322 <do_elseif value="$TextOffset == 100100">
7323 <!--Construction supplies for ship construction-->
7324 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7325 <include_actions ref="Large_Supply__Ship_Construction_Tech"/>
7326 </do_elseif>
7327 </do_elseif>
7328
7329 <!--### HOLY ORDER VS ARGON ###-->
7330 <do_elseif value="$Page == 30213">
7331 <do_if value="$TextOffset == 100000">
7332 <!--Food supplies for workforce-->
7333 <!--TODO @Owen check if there are enough stations in need of these resources-->
7334 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7335 <include_actions ref="Large_Supply__Food"/>
7336 </do_if>
7337 <do_elseif value="$TextOffset == 100100">
7338 <!--Construction supplies for ship construction-->
7339 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7340 <include_actions ref="Large_Supply__Ship_Construction_Tech"/>
7341 </do_elseif>
7342 </do_elseif>
7343
7344 <!--### HOLY ORDER VS PARANID ###-->
7345 <do_elseif value="$Page == 30214">
7346 <do_if value="$TextOffset == 100000">
7347 <!--Food supplies for workforce-->
7348 <!--TODO @Owen check if there are enough stations in need of these resources-->
7349 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7350 <include_actions ref="Large_Supply__Food"/>
7351 </do_if>
7352 <do_elseif value="$TextOffset == 100100">
7353 <!--Construction supplies for ship construction-->
7354 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7355 <include_actions ref="Large_Supply__Ship_Construction_Tech"/>
7356 </do_elseif>
7357 </do_elseif>
7358
7359 <do_if value="$Valid == 2">
7360 <do_if value="$FollowUp">
7361 <!--Followup missions use the namespace as the mission cue-->
7362 <set_value name="$MissionCue" exact="namespace"/>
7363 </do_if>
7364 <do_else>
7365 <set_value name="$MissionCue" exact="null"/>
7366 </do_else>
7367 </do_if>
7368 <do_else>
7369 <do_if value="$Valid == 1">
7370 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
7371 </do_if>
7372 <do_else>
7373 <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]'"/>
7374 </do_else>
7375 <signal_cue cue="$Definition.$SpawnFailedCue"/>
7376 <cancel_cue cue="this"/>
7377 </do_else>
7378 </actions>
7379 <cues>
7380 <cue name="Large_Supply__Standard_FollowUp_Manager" onfail="cancel">
7381 <conditions>
7382 <check_value value="$FollowUp"/>
7383 </conditions>
7384 <actions>
7385 <!--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.-->
7386 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
7387 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
7388 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
7389 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
7390 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
7391 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
7392 </actions>
7393 <cues>
7394 <cue name="Large_Supply__Standard_FollowUp_Offer_Accepted">
7395 <conditions>
7396 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
7397 <check_value value="event.param == $MissionCue"/>
7398 </conditions>
7399 <actions>
7400 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
7401 TODO @Owen Move this to a library in the GM file?-->
7402 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
7403 <briefing>
7404 <!--TODO @Owen Better objective?-->
7405 <objective step="1" action="objective.deliver"/>
7406 </briefing>
7407 </create_mission>
7408 </actions>
7409 </cue>
7410
7411 <cue name="Large_Supply__Standard_Aborted">
7412 <conditions>
7413 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
7414 </conditions>
7415 <actions>
7416 <cancel_cue cue="namespace"/>
7417 </actions>
7418 </cue>
7419
7420 <!--namespace signalled to activate followup mission
7421 event.param = Station to supply-->
7422 <cue name="Large_Supply__Standard_Activate_FollowUp">
7423 <conditions>
7424 <event_cue_signalled cue="namespace"/>
7425 </conditions>
7426 <actions>
7427 <!--Check that the correct parameters have been passed-->
7428 <do_if value="false">
7429 <!--Currently no followup case for this type of mission-->
7430 <signal_cue cue="Large_Supply__Standard_Create_GM"/>
7431 <cancel_cue cue="parent"/>
7432 </do_if>
7433 <do_else>
7434 <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.'"/>
7435 <!--TODO @Owen what if there is another followup mission?-->
7436 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
7437 <cancel_cue cue="namespace"/>
7438 </do_else>
7439 </actions>
7440 </cue>
7441 </cues>
7442 </cue>
7443
7444 <cue name="Large_Supply__Standard_Not_FollowUp" onfail="cancel">
7445 <conditions>
7446 <check_value value="not $FollowUp"/>
7447 </conditions>
7448 <actions>
7449 <signal_cue cue="Large_Supply__Standard_Create_GM"/>
7450 </actions>
7451 </cue>
7452
7453 <cue name="Large_Supply__Standard_Create_GM">
7454 <conditions>
7455 <event_cue_signalled/>
7456 </conditions>
7457 <cues>
7458 <!-- Trigger actual GM, passing the specified parameters -->
7459 <cue name="Large_Supply__Standard_Ref" ref="md.GM_LargeSupply.Start">
7460 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
7461 <param name="MissionCue" value="$MissionCue"/>
7462 <param name="MissionThread" value="$Definition.$ThreadCue"/>
7463 <param name="ReportSignalCue" value="Large_Supply__Standard_GM_Event"/>
7464 <param name="WithoutOffer" value="true"/>
7465 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
7466 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
7467
7468 <param name="Page" value="$Definition.$Page"/>
7469 <param name="TextOffset" value="$TextOffset"/>
7470
7471 <param name="MissionLevel" value="3"/>
7472 <param name="Difficulty" value="level.medium"/>
7473
7474 <param name="Faction" value="$Definition.$ThreadData.$Faction"/>
7475 <param name="StationSpace" value="$StationSpace" comment="todo: narrow down the space"/>
7476 <param name="StationSupply" value="$StationSupply" comment="wants these stations supplied with the specified resources"/>
7477
7478 <param name="DebugChance" value="$DebugChance"/>
7479 </cue>
7480
7481 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
7482 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
7483 <cue name="Large_Supply__Standard_GM_Event" instantiate="true">
7484 <conditions>
7485 <event_cue_signalled/>
7486 </conditions>
7487 <actions>
7488 <include_actions ref="MM__Standard_GM_Event"/>
7489 </actions>
7490 </cue>
7491 </cues>
7492 </cue>
7493 </cues>
7494 </cue>
7495
7496 <cue name="Get_Exact_Crew__Standard" instantiate="true" namespace="this">
7497 <conditions>
7498 <event_cue_signalled/>
7499 <!--Signal the static cue to trigger a new instance of this mission.
7500 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
7501 </conditions>
7502 <actions>
7503 <set_value name="$Definition" exact="event.param"/>
7504 <set_value name="$Page" exact="$Definition.$Page"/>
7505 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
7506 <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."/>
7507 <set_value name="$SuccessfullyGenerated" exact="false"/>
7508 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
7509 <set_value name="$Destination" exact="player.ship"/>
7510 <set_value name="$Faction" exact="$Definition.$ThreadData.$Faction"/>
7511 <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]'"/>
7512
7513 <!--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.
7514 $Valid:
7515 0: Page/TextOffset not handled
7516 1: Correct Page/TextOffset but unable to setup mission
7517 2: Mission can attempt to be spawned -->
7518 <set_value name="$Valid" exact="0"/>
7519 <include_actions ref="md.GM_GetExactCrew.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $NpcCount"/>
7520 <include_actions ref="md.GM_GetExactCrew.DetermineDestinationStation" comment="Input: $Faction-, output: $Destination"/>
7521
7522 <!--### ARGON VS XENON ###-->
7523 <do_if value="not $Destination">
7524 <!-- intentional fallthrough -->
7525 <debug_text text="'No suitable destination-station found!'"/>
7526 <set_value name="$Valid" exact="1" comment="No suitable variation found"/>
7527 </do_if>
7528 <do_elseif value="$Page == 30210">
7529 <do_if value="$TextOffset == 110000" comment="pilot variation">
7530 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7531 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
7532 </do_if>
7533 <do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
7534 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7535 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
7536 </do_elseif>
7537 </do_elseif>
7538
7539 <!-- ### ARGON VS HOLY ORDER ###-->
7540 <do_elseif value="$Page == 30211">
7541 <do_if value="$TextOffset == 110000" comment="pilot variation">
7542 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7543 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
7544 </do_if>
7545 <do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
7546 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7547 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
7548 </do_elseif>
7549 </do_elseif>
7550
7551 <!-- ### PARANID VS HOLY ORDER ###-->
7552 <do_elseif value="$Page == 30212">
7553 <do_if value="$TextOffset == 110000" comment="pilot variation">
7554 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7555 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
7556 </do_if>
7557 <do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
7558 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7559 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
7560 </do_elseif>
7561 </do_elseif>
7562
7563 <!-- ### HOLY ORDER VS ARGON ###-->
7564 <do_elseif value="$Page == 30213">
7565 <do_if value="$TextOffset == 110000" comment="pilot variation">
7566 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7567 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
7568 </do_if>
7569 <do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
7570 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7571 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
7572 </do_elseif>
7573 </do_elseif>
7574
7575 <!-- ### HOLY ORDER VS PARANID ###-->
7576 <do_elseif value="$Page == 30214">
7577 <do_if value="$TextOffset == 110000" comment="pilot variation">
7578 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7579 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Pilots"/>
7580 </do_if>
7581 <do_elseif value="$TextOffset == 110100" comment="engineers for station variation">
7582 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7583 <include_actions ref="md.GM_GetExactCrew.Get_Exact_Crew_Engineers"/>
7584 </do_elseif>
7585 </do_elseif>
7586
7587 <do_if value="@$Skills.keys.count">
7588 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
7589 </do_if>
7590
7591 <do_if value="$Valid == 2">
7592 <do_if value="$FollowUp">
7593 <!--Followup missions use the namespace as the mission cue-->
7594 <set_value name="$MissionCue" exact="namespace"/>
7595 </do_if>
7596 <do_else>
7597 <set_value name="$MissionCue" exact="null"/>
7598 </do_else>
7599 </do_if>
7600 <do_else>
7601 <do_if value="$Valid == 1">
7602 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
7603 </do_if>
7604 <do_else>
7605 <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]'"/>
7606 </do_else>
7607 <signal_cue cue="$Definition.$SpawnFailedCue"/>
7608 <cancel_cue cue="this"/>
7609 </do_else>
7610 </actions>
7611 <cues>
7612 <cue name="Get_Exact_Crew__Standard_FollowUp_Manager" onfail="cancel">
7613 <conditions>
7614 <check_value value="$FollowUp"/>
7615 </conditions>
7616 <actions>
7617 <!--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.-->
7618 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
7619 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
7620 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
7621 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
7622 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
7623 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
7624 </actions>
7625 <cues>
7626 <cue name="Get_Exact_Crew__Standard_FollowUp_Offer_Accepted">
7627 <conditions>
7628 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
7629 <check_value value="event.param == $MissionCue"/>
7630 </conditions>
7631 <actions>
7632 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
7633 TODO @Owen Move this to a library in the GM file?-->
7634 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
7635 <briefing>
7636 <!--TODO @Owen Better objective?-->
7637 <objective step="1" action="objective.acquire_crew"/>
7638 </briefing>
7639 </create_mission>
7640 </actions>
7641 </cue>
7642
7643 <cue name="Get_Exact_Crew__Standard_Aborted">
7644 <conditions>
7645 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
7646 </conditions>
7647 <actions>
7648 <cancel_cue cue="namespace"/>
7649 </actions>
7650 </cue>
7651
7652 <!--namespace signalled to activate followup mission
7653 event.param = Station to supply-->
7654 <cue name="Get_Exact_Crew__Standard_Activate_FollowUp">
7655 <conditions>
7656 <event_cue_signalled cue="namespace"/>
7657 </conditions>
7658 <actions>
7659 <!--Check that the correct parameters have been passed-->
7660 <do_if value="false">
7661 <!--Currently no followup case for this type of mission-->
7662 <signal_cue cue="Get_Exact_Crew__Standard_Create_GM"/>
7663 <cancel_cue cue="parent"/>
7664 </do_if>
7665 <do_else>
7666 <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.'"/>
7667 <!--TODO @Owen what if there is another followup mission?-->
7668 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
7669 <cancel_cue cue="namespace"/>
7670 </do_else>
7671 </actions>
7672 </cue>
7673 </cues>
7674 </cue>
7675
7676 <cue name="Get_Exact_Crew__Standard_Not_FollowUp" onfail="cancel">
7677 <conditions>
7678 <check_value value="not $FollowUp"/>
7679 </conditions>
7680 <actions>
7681 <signal_cue cue="Get_Exact_Crew__Standard_Create_GM"/>
7682 </actions>
7683 </cue>
7684
7685 <cue name="Get_Exact_Crew__Standard_Create_GM">
7686 <conditions>
7687 <event_cue_signalled/>
7688 </conditions>
7689 <cues>
7690 <!-- Trigger actual GM, passing the specified parameters -->
7691 <cue name="Get_Exact_Crew__Standard_Ref" ref="md.GM_GetExactCrew.Start">
7692 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
7693 <param name="MissionCue" value="$MissionCue"/>
7694 <param name="MissionThread" value="$Definition.$ThreadCue"/>
7695 <param name="ReportSignalCue" value="Get_Exact_Crew__Standard_GM_Event"/>
7696 <param name="WithoutOffer" value="true"/>
7697 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
7698 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
7699
7700 <param name="Page" value="$Page"/>
7701 <param name="TextOffset" value="$TextOffset"/>
7702 <param name="MissionLevel" value="3"/>
7703 <param name="Difficulty" value="$Difficulty"/>
7704
7705 <param name="Faction" value="$Faction"/>
7706 <param name="NpcCount" value="$NpcCount"/>
7707 <param name="Skills" value="$Skills"/>
7708 <param name="Destination" value="$Destination"/>
7709
7710 <param name="DebugChance" value="$DebugChance"/>
7711 </cue>
7712
7713 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
7714 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
7715 <cue name="Get_Exact_Crew__Standard_GM_Event" instantiate="true">
7716 <conditions>
7717 <event_cue_signalled/>
7718 </conditions>
7719 <actions>
7720 <include_actions ref="MM__Standard_GM_Event"/>
7721 </actions>
7722 </cue>
7723 </cues>
7724 </cue>
7725 </cues>
7726 </cue>
7727
7728 <cue name="Get_Exact_Fleet__Standard" instantiate="true" namespace="this">
7729 <conditions>
7730 <event_cue_signalled/>
7731 <!--Signal the static cue to trigger a new instance of this mission.
7732 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
7733 </conditions>
7734 <actions>
7735 <set_value name="$Definition" exact="event.param"/>
7736 <set_value name="$Page" exact="$Definition.$Page"/>
7737 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
7738 <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."/>
7739 <set_value name="$SuccessfullyGenerated" exact="false"/>
7740 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
7741
7742 <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]'"/>
7743
7744 <!--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.
7745 $Valid:
7746 0: Page/TextOffset not handled
7747 1: Correct Page/TextOffset but unable to setup mission
7748 2: Mission can attempt to be spawned -->
7749 <set_value name="$Valid" exact="0"/>
7750 <set_value name="$Fleet" exact="null"/>
7751
7752 <!--### ARGON VS XENON ###-->
7753 <do_if value="$Page == 30210">
7754 <do_if value="$TextOffset == 120000" comment="build a fleet">
7755 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7756 <do_any>
7757 <set_value name="$Fleet" exact="[
7758 table[
7759 $macro = macro.ship_arg_xl_carrier_01_a_macro,
7760 $amount = 1,
7761 $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],
7762 $wares = table[{ware.countermeasure_flares_01} = 10, {ware.satellite_mk1} = 1],
7763 ],
7764 table[
7765 $macro = macro.ship_arg_l_destroyer_01_a_macro,
7766 $amount = 1,
7767 $equipment = [macro.engine_arg_l_travel_01_mk1_macro, macro.thruster_gen_l_allround_01_mk2_macro],
7768 ],
7769 table[
7770 $macro = macro.ship_arg_m_frigate_01_a_macro,
7771 $amount = 3,
7772 $mods = [ware.mod_weapon_damage_01_mk1],
7773 ]
7774 ]"/>
7775 </do_any>
7776 </do_if>
7777 </do_if>
7778
7779 <!-- ### ARGON VS HOLY ORDER ###-->
7780 <do_elseif value="$Page == 30211">
7781 <do_if value="$TextOffset == 120000" comment="build a fleet">
7782 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7783 <do_any>
7784 <set_value name="$Fleet" exact="[
7785 table[
7786 $macro = macro.ship_arg_xl_carrier_01_a_macro,
7787 $amount = 1,
7788 $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],
7789 $wares = table[{ware.countermeasure_flares_01} = 10, {ware.satellite_mk1} = 1],
7790 ],
7791 table[
7792 $macro = macro.ship_arg_l_destroyer_01_a_macro,
7793 $amount = 1,
7794 $equipment = [macro.engine_par_l_travel_01_mk1_macro, macro.thruster_gen_l_allround_01_mk3_macro],
7795 ],
7796 table[
7797 $macro = macro.ship_arg_m_frigate_01_a_macro,
7798 $amount = 3,
7799 ]
7800 ]"/>
7801 </do_any>
7802 </do_if>
7803 </do_elseif>
7804
7805 <!-- ### PARANID VS HOLY ORDER ###-->
7806 <do_elseif value="$Page == 30212">
7807 <do_if value="$TextOffset == 120000" comment="build a fleet">
7808 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7809 <do_any>
7810 <set_value name="$Fleet" exact="[
7811 table[
7812 $macro = macro.ship_par_xl_carrier_01_a_macro,
7813 $amount = 1,
7814 $equipment = [macro.engine_par_xl_travel_01_mk1_macro, macro.shield_par_xl_standard_01_mk1_macro],
7815 $wares = table[{ware.countermeasure_flares_01} = 10],
7816 ],
7817 table[
7818 $macro = macro.ship_par_l_destroyer_01_a_macro,
7819 $amount = 1,
7820 $equipment = [macro.engine_par_l_travel_01_mk1_macro],
7821 ],
7822 table[
7823 $macro = macro.ship_par_m_frigate_01_a_macro,
7824 $amount = 2,
7825 ]
7826 ]"/>
7827 </do_any>
7828 </do_if>
7829 </do_elseif>
7830
7831 <!-- ### HOLY ORDER VS ARGON ###-->
7832 <do_elseif value="$Page == 30213">
7833 <do_if value="$TextOffset == 120000" comment="build a fleet">
7834 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7835 <do_any>
7836 <set_value name="$Fleet" exact="[
7837 table[
7838 $macro = macro.ship_par_l_destroyer_01_b_macro,
7839 $amount = 1,
7840 $equipment = [macro.engine_par_l_travel_01_mk1_macro],
7841 ],
7842 table[
7843 $macro = macro.ship_par_m_frigate_01_b_macro,
7844 $amount = 3,
7845 ]
7846 ]"/>
7847 </do_any>
7848 </do_if>
7849 </do_elseif>
7850
7851 <!-- ### HOLY ORDER VS PARANID ###-->
7852 <do_elseif value="$Page == 30214">
7853 <do_if value="$TextOffset == 120000" comment="build a fleet">
7854 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
7855 <do_any>
7856 <set_value name="$Fleet" exact="[
7857 table[
7858 $macro = macro.ship_par_l_destroyer_01_b_macro,
7859 $amount = 1,
7860 $equipment = [macro.engine_par_l_travel_01_mk1_macro],
7861 ],
7862 table[
7863 $macro = macro.ship_par_m_frigate_01_b_macro,
7864 $amount = 3,
7865 ]
7866 ]"/>
7867 </do_any>
7868 </do_if>
7869 </do_elseif>
7870
7871 <do_if value="$Fleet">
7872 <set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.list"/>
7873 <do_if value="$Definition.$ThreadData.$WarFront.$ContestedSectorsIncludeHost">
7874 <do_all exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.count" counter="$i">
7875 <append_to_list name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.{$i}"/>
7876 </do_all>
7877 </do_if>
7878
7879 <do_if value="$PotentialLocations.count">
7880 <set_value name="$Sector" exact="$PotentialLocations.random"/>
7881 <find_station name="$PositionObject" space="$Sector" owner="$Definition.$ThreadData.$Faction"/>
7882 <do_if value="$PositionObject">
7883 <get_safe_pos result="$Offset" object="$PositionObject" sector="$Sector" allowyaxis="false" min="5km" max="10km"/>
7884 </do_if>
7885 <do_else>
7886 <create_position name="$Offset" space="$Sector" min="5km" max="250km" />
7887 <set_value name="$Offset" exact="position.[$Offset.x, 0, $Offset.z]" comment="Engine limitation, keep it on ecliptic (y=0)"/>
7888 </do_else>
7889 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
7890 </do_if>
7891 </do_if>
7892
7893 <do_if value="$Valid == 2">
7894 <do_if value="$FollowUp">
7895 <!--Followup missions use the namespace as the mission cue-->
7896 <set_value name="$MissionCue" exact="namespace"/>
7897 </do_if>
7898 <do_else>
7899 <set_value name="$MissionCue" exact="null"/>
7900 </do_else>
7901 </do_if>
7902 <do_else>
7903 <do_if value="$Valid == 1">
7904 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
7905 </do_if>
7906 <do_else>
7907 <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]'"/>
7908 </do_else>
7909 <signal_cue cue="$Definition.$SpawnFailedCue"/>
7910 <cancel_cue cue="this"/>
7911 </do_else>
7912 </actions>
7913 <cues>
7914 <cue name="Get_Exact_Fleet__Standard_FollowUp_Manager" onfail="cancel">
7915 <conditions>
7916 <check_value value="$FollowUp"/>
7917 </conditions>
7918 <actions>
7919 <!--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.-->
7920 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
7921 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
7922 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
7923 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
7924 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
7925 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
7926 </actions>
7927 <cues>
7928 <cue name="Get_Exact_Fleet__Standard_FollowUp_Offer_Accepted">
7929 <conditions>
7930 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
7931 <check_value value="event.param == $MissionCue"/>
7932 </conditions>
7933 <actions>
7934 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
7935 TODO @Owen Move this to a library in the GM file?-->
7936 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
7937 <briefing>
7938 <!--TODO @Owen Better objective?-->
7939 <objective step="1" action="objective.build_ship"/>
7940 </briefing>
7941 </create_mission>
7942 </actions>
7943 </cue>
7944
7945 <cue name="Get_Exact_Fleet__Standard_Aborted">
7946 <conditions>
7947 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
7948 </conditions>
7949 <actions>
7950 <cancel_cue cue="namespace"/>
7951 </actions>
7952 </cue>
7953
7954 <!--namespace signalled to activate followup mission
7955 event.param = Station to supply-->
7956 <cue name="Get_Exact_Fleet__Standard_Activate_FollowUp">
7957 <conditions>
7958 <event_cue_signalled cue="namespace"/>
7959 </conditions>
7960 <actions>
7961 <!--Check that the correct parameters have been passed-->
7962 <do_if value="false">
7963 <!--Currently no followup case for this type of mission-->
7964 <signal_cue cue="Get_Exact_Fleet__Standard_Create_GM"/>
7965 <cancel_cue cue="parent"/>
7966 </do_if>
7967 <do_else>
7968 <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.'"/>
7969 <!--TODO @Owen what if there is another followup mission?-->
7970 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
7971 <cancel_cue cue="namespace"/>
7972 </do_else>
7973 </actions>
7974 </cue>
7975 </cues>
7976 </cue>
7977
7978 <cue name="Get_Exact_Fleet__Standard_Not_FollowUp" onfail="cancel">
7979 <conditions>
7980 <check_value value="not $FollowUp"/>
7981 </conditions>
7982 <actions>
7983 <signal_cue cue="Get_Exact_Fleet__Standard_Create_GM"/>
7984 </actions>
7985 </cue>
7986
7987 <cue name="Get_Exact_Fleet__Standard_Create_GM">
7988 <conditions>
7989 <event_cue_signalled/>
7990 </conditions>
7991 <cues>
7992 <!-- Trigger actual GM, passing the specified parameters -->
7993 <cue name="Get_Exact_Fleet__Standard_Ref" ref="md.GM_GetExactFleet.Start">
7994 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
7995 <param name="MissionCue" value="$MissionCue"/>
7996 <param name="MissionThread" value="$Definition.$ThreadCue"/>
7997 <param name="ReportSignalCue" value="Get_Exact_Fleet__Standard_GM_Event"/>
7998 <param name="WithoutOffer" value="true"/>
7999 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
8000 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
8001
8002 <param name="Page" value="$Page"/>
8003 <param name="TextOffset" value="$TextOffset"/>
8004 <param name="MissionLevel" value="3"/>
8005 <param name="Difficulty" value="level.medium"/>
8006
8007 <param name="Faction" value="$Definition.$ThreadData.$Faction"/>
8008 <param name="Fleet" value="$Fleet" comment="is looking for these ships with the specified upgrades"/>
8009 <param name="TargetSector" value="$Sector"/>
8010 <param name="TargetOffset" value="$Offset"/>
8011
8012 <param name="DebugChance" value="$DebugChance"/>
8013 </cue>
8014
8015 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
8016 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
8017 <cue name="Get_Exact_Fleet__Standard_GM_Event" instantiate="true">
8018 <conditions>
8019 <event_cue_signalled/>
8020 </conditions>
8021 <actions>
8022 <include_actions ref="MM__Standard_GM_Event"/>
8023 </actions>
8024 </cue>
8025 </cues>
8026 </cue>
8027 </cues>
8028 </cue>
8029
8030 <!--Variant Helper Libraries
8031 Helper libraries to be call from different threads but want to have the same basic variant rules
8032 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-->
8033
8034 <library name="Achieve_Coverage__Host_Space">
8035 <actions>
8036 <set_value name="$Location" exact="null"/>
8037 <do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
8038 <set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted"/>
8039 </do_if>
8040 <do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
8041 <set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.clone"/>
8042 </do_elseif>
8043 <shuffle_list list="$PotentialLocations"/>
8044
8045 <do_while value="$PotentialLocations.count or not $Location">
8046 <do_any>
8047 <set_value name="$PotentialLocation" exact="$PotentialLocations.{1}" weight="50"/>
8048 <set_value name="$PotentialLocation" exact="$PotentialLocations.random" weight="20"/>
8049 </do_any>
8050
8051 <!--Check that there are not already a huge amount of satellites already in this location-->
8052 <find_object name="$ExistingSatellites" class="class.satellite" owner="[faction.player, $Definition.$ThreadData.$Faction]" space="$PotentialLocation" multiple="true"/>
8053 <do_if value="$ExistingSatellites.count lt 100">
8054 <set_value name="$Location" exact="$PotentialLocation"/>
8055 <break/>
8056 </do_if>
8057 <do_else>
8058 <remove_value name="$PotentialLocations.{$PotentialLocations.indexof.{$PotentialLocation}}"/>
8059 </do_else>
8060 </do_while>
8061
8062 <do_if value="$Location">
8063 <create_position name="$Offset" space="$Location" max="150km" />
8064 <set_value name="$Y" min="-2km" max="2km" comment="Keep Y close to the ecliptic"/>
8065 <set_value name="$Offset" exact="position.[$Offset.x, $Y, $Offset.z]"/>
8066 <get_safe_pos result="$Offset" sector="$Location" allowyaxis="false" radius="5km"/>
8067
8068 <set_value name="$DifficultyVsRadius" exact="table[
8069 {level.trivial } = [ macro.eq_arg_satellite_01_macro.maxradarrange * 0.80 ],
8070 {level.easy } = [ macro.eq_arg_satellite_01_macro.maxradarrange * 1.20 ],
8071 {level.medium } = [ macro.eq_arg_satellite_02_macro.maxradarrange * 0.80 ],
8072 {level.hard } = [ macro.eq_arg_satellite_02_macro.maxradarrange * 1.20 ],
8073 ]"/>
8074
8075 <set_value name="$Difficulty" exact="$DifficultyVsRadius.keys.random"/>
8076 <do_if value="$DifficultyVsRadius.{$Difficulty}">
8077 <set_value name="$Radius" exact="$DifficultyVsRadius.{$Difficulty}.{1}"/>
8078 </do_if>
8079
8080 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8081 </do_if>
8082 </actions>
8083 </library>
8084
8085 <library name="Achieve_Coverage__Enemy_Space">
8086 <actions>
8087 <set_value name="$Location" exact="null"/>
8088 <do_if value="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.count">
8089 <set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.sorted"/>
8090 <do_while value="$PotentialLocations.count or not $Location">
8091 <do_any>
8092 <set_value name="$PotentialLocation" exact="$PotentialLocations.{1}" weight="50"/>
8093 <set_value name="$PotentialLocation" exact="$PotentialLocations.random" weight="20"/>
8094 </do_any>
8095
8096 <!--Check that there are not already a huge amount of satellites already in this location-->
8097 <find_object name="$ExistingSatellites" class="class.satellite" owner="[faction.player, $Definition.$ThreadData.$Faction]" space="$PotentialLocation" multiple="true"/>
8098 <do_if value="$ExistingSatellites.count lt 100">
8099 <set_value name="$Location" exact="$PotentialLocation"/>
8100 <break/>
8101 </do_if>
8102 <do_else>
8103 <remove_value name="$PotentialLocations.{$PotentialLocations.indexof.{$PotentialLocation}}"/>
8104 </do_else>
8105 </do_while>
8106 </do_if>
8107
8108 <do_if value="$Location">
8109 <create_position name="$Offset" space="$Location" max="150km" />
8110 <set_value name="$Y" min="-2km" max="2km" comment="Keep Y close to the ecliptic"/>
8111 <set_value name="$Offset" exact="position.[$Offset.x, $Y, $Offset.z]"/>
8112 <get_safe_pos result="$Offset" sector="$Location" allowyaxis="false" radius="5km"/>
8113
8114 <set_value name="$DifficultyVsRadius" exact="table[
8115 {level.trivial } = [ macro.eq_arg_satellite_01_macro.maxradarrange * 0.80 ],
8116 {level.easy } = [ macro.eq_arg_satellite_01_macro.maxradarrange * 1.20 ],
8117 {level.medium } = [ macro.eq_arg_satellite_02_macro.maxradarrange * 0.80 ],
8118 {level.hard } = [ macro.eq_arg_satellite_02_macro.maxradarrange * 1.20 ],
8119 ]"/>
8120
8121 <set_value name="$Difficulty" exact="$DifficultyVsRadius.keys.random"/>
8122 <do_if value="$DifficultyVsRadius.{$Difficulty}">
8123 <set_value name="$Radius" exact="$DifficultyVsRadius.{$Difficulty}.{1}"/>
8124 </do_if>
8125
8126 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8127 </do_if>
8128 </actions>
8129 </library>
8130
8131 <cue name="Achieve_Coverage__Standard" instantiate="true" namespace="this">
8132 <conditions>
8133 <event_cue_signalled/>
8134 <!--Signal the static cue to trigger a new instance of this mission.
8135 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
8136 </conditions>
8137 <actions>
8138 <set_value name="$Definition" exact="event.param"/>
8139 <set_value name="$Page" exact="$Definition.$Page"/>
8140 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
8141 <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."/>
8142 <set_value name="$SuccessfullyGenerated" exact="false"/>
8143 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
8144
8145 <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]'"/>
8146
8147 <!--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.
8148 $Valid:
8149 0: Page/TextOffset not handled
8150 1: Correct Page/TextOffset but unable to setup mission
8151 2: Mission can attempt to be spawned -->
8152 <set_value name="$Valid" exact="0"/>
8153 <set_value name="$Difficulty" exact="level.medium"/>
8154
8155 <!--### ARGON VS XENON ###-->
8156 <do_if value="$Page == 30210">
8157 <do_if value="$TextOffset == 102000">
8158 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8159 <include_actions ref="Achieve_Coverage__Host_Space"/>
8160 </do_if>
8161 <do_elseif value="$TextOffset == 102100">
8162 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8163 <include_actions ref="Achieve_Coverage__Enemy_Space"/>
8164 </do_elseif>
8165 </do_if>
8166
8167 <!--### ARGON VS HOLY ORDER ###-->
8168 <do_elseif value="$Page == 30211">
8169 <do_if value="$TextOffset == 102000">
8170 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8171 <include_actions ref="Achieve_Coverage__Host_Space"/>
8172 </do_if>
8173 <do_elseif value="$TextOffset == 102100">
8174 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8175 <include_actions ref="Achieve_Coverage__Enemy_Space"/>
8176 </do_elseif>
8177 </do_elseif>
8178
8179 <!--### PARANID VS HOLY ORDER ###-->
8180 <do_elseif value="$Page == 30212">
8181 <do_if value="$TextOffset == 102000">
8182 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8183 <include_actions ref="Achieve_Coverage__Host_Space"/>
8184 </do_if>
8185 <do_elseif value="$TextOffset == 102100">
8186 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8187 <include_actions ref="Achieve_Coverage__Enemy_Space"/>
8188 </do_elseif>
8189 </do_elseif>
8190
8191 <!--### HOLY ORDER VS ARGON ###-->
8192 <do_elseif value="$Page == 30213">
8193 <do_if value="$TextOffset == 102000">
8194 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8195 <include_actions ref="Achieve_Coverage__Host_Space"/>
8196 </do_if>
8197 <do_elseif value="$TextOffset == 102100">
8198 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8199 <include_actions ref="Achieve_Coverage__Enemy_Space"/>
8200 </do_elseif>
8201 </do_elseif>
8202
8203 <!--### HOLY ORDER VS PARANID ###-->
8204 <do_elseif value="$Page == 30214">
8205 <do_if value="$TextOffset == 102000">
8206 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8207 <include_actions ref="Achieve_Coverage__Host_Space"/>
8208 </do_if>
8209 <do_elseif value="$TextOffset == 102100">
8210 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8211 <include_actions ref="Achieve_Coverage__Enemy_Space"/>
8212 </do_elseif>
8213 </do_elseif>
8214
8215 <do_if value="$Valid == 2">
8216 <do_if value="$FollowUp">
8217 <!--Followup missions use the namespace as the mission cue-->
8218 <set_value name="$MissionCue" exact="namespace"/>
8219 </do_if>
8220 <do_else>
8221 <set_value name="$MissionCue" exact="null"/>
8222 </do_else>
8223 </do_if>
8224 <do_else>
8225 <do_if value="$Valid == 1">
8226 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
8227 </do_if>
8228 <do_else>
8229 <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]'"/>
8230 </do_else>
8231 <signal_cue cue="$Definition.$SpawnFailedCue"/>
8232 <cancel_cue cue="this"/>
8233 </do_else>
8234 </actions>
8235 <cues>
8236 <cue name="Achieve_Coverage__Standard_FollowUp_Manager" onfail="cancel">
8237 <conditions>
8238 <check_value value="$FollowUp"/>
8239 </conditions>
8240 <actions>
8241 <!--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.-->
8242 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
8243 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
8244 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
8245 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
8246 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
8247 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
8248 </actions>
8249 <cues>
8250 <cue name="Achieve_Coverage__Standard_FollowUp_Offer_Accepted">
8251 <conditions>
8252 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
8253 <check_value value="event.param == $MissionCue"/>
8254 </conditions>
8255 <actions>
8256 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
8257 TODO @Owen Move this to a library in the GM file?-->
8258 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
8259 <briefing>
8260 <!--TODO @Owen Better objective-->
8261 <objective step="1" action="objective.custom" customaction="'TEMP: Achieve coverage'"/>
8262 </briefing>
8263 </create_mission>
8264 </actions>
8265 </cue>
8266
8267 <cue name="Achieve_Coverage__Standard_Aborted">
8268 <conditions>
8269 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
8270 </conditions>
8271 <actions>
8272 <cancel_cue cue="namespace"/>
8273 </actions>
8274 </cue>
8275
8276 <!--namespace signalled to activate followup mission
8277 event.param = Station to supply-->
8278 <cue name="Achieve_Coverage__Standard_Activate_FollowUp">
8279 <conditions>
8280 <event_cue_signalled cue="namespace"/>
8281 </conditions>
8282 <actions>
8283 <!--Check that the correct parameters have been passed-->
8284 <do_if value="false">
8285 <!--Currently no followup case for this type of mission-->
8286 <signal_cue cue="Achieve_Coverage__Standard_Create_GM"/>
8287 <cancel_cue cue="parent"/>
8288 </do_if>
8289 <do_else>
8290 <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.'"/>
8291 <!--TODO @Owen what if there is another followup mission?-->
8292 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
8293 <cancel_cue cue="namespace"/>
8294 </do_else>
8295 </actions>
8296 </cue>
8297 </cues>
8298 </cue>
8299
8300 <cue name="Achieve_Coverage__Standard_Not_FollowUp" onfail="cancel">
8301 <conditions>
8302 <check_value value="not $FollowUp"/>
8303 </conditions>
8304 <actions>
8305 <signal_cue cue="Achieve_Coverage__Standard_Create_GM"/>
8306 </actions>
8307 </cue>
8308
8309 <cue name="Achieve_Coverage__Standard_Create_GM">
8310 <conditions>
8311 <event_cue_signalled/>
8312 </conditions>
8313 <cues>
8314 <cue name="Achieve_Coverage__Standard_Ref" ref="md.GM_AchieveCoverage.Start">
8315 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
8316 <param name="MissionCue" value="$MissionCue"/>
8317 <param name="MissionThread" value="$Definition.$ThreadCue"/>
8318 <param name="ReportSignalCue" value="Achieve_Coverage__Standard_GM_Event"/>
8319 <param name="WithoutOffer" value="true"/>
8320 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
8321 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
8322
8323 <param name="Page" value="$Page"/>
8324 <param name="TextOffset" value="$TextOffset"/>
8325 <param name="MissionLevel" value="3"/>
8326 <param name="Difficulty" value="$Difficulty"/>
8327
8328 <param name="Faction" value="$Definition.$ThreadData.$Faction"/>
8329 <param name="CoverageSector" value="$Location"/>
8330 <param name="CoverageOffset" value="$Offset"/>
8331 <param name="CoverageRadius" value="$Radius"/>
8332 <param name="CoveragePercent" value="75"/>
8333
8334 <param name="DebugChance" value="$DebugChance"/>
8335 </cue>
8336
8337 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
8338 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
8339 <cue name="Achieve_Coverage__Standard_GM_Event" instantiate="true">
8340 <conditions>
8341 <event_cue_signalled/>
8342 </conditions>
8343 <actions>
8344 <include_actions ref="MM__Standard_GM_Event"/>
8345 </actions>
8346 </cue>
8347 </cues>
8348 </cue>
8349 </cues>
8350 </cue>
8351
8352 <!--Variant Helper Libraries
8353 Helper libraries to be call from different threads but want to have the same basic variant rules
8354 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-->
8355
8356 <library name="Build_Station__Allied_Space">
8357 <actions>
8358 <do_any>
8359 <set_value name="$PlotSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted.{1}"/>
8360 <set_value name="$PlotSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.random"/>
8361 </do_any>
8362
8363 <do_if value="$PlotSector">
8364 <do_if value="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint and $Definition.$ThreadData.$WarFront.$EnemyEntryPoint.destination.sector == $PlotSector">
8365 <set_value name="$X_Offset" min="-30km" max="30km"/>
8366 <set_value name="$Z_Offset" min="8km" max="30km"/>
8367 <create_position name="$PlotOffset" object="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint.exit" space="$PlotSector" x="$X_Offset" z="$Z_Offset"/>
8368 </do_if>
8369 <do_else>
8370 <!--TODO @Owen expose the 'sector core boxes'?-->
8371 <create_position name="$TargetOffset" space="$PlotSector" max="300km"/>
8372 <set_value name="$PlotOffset" exact="position.[$TargetOffset.x, 0m, $TargetOffset.z]" comment="Engine limitation, can only build station on ecliptic (y=0)"/>
8373 </do_else>
8374 <set_value name="$PlotRange" exact="10km"/>
8375 <set_value name="$PlotSize" exact="vector.[4km,3km,2km]"/>
8376
8377 <set_value name="$StationSpecs" exact="table[
8378 $containedclasses = [[10, class.turret, 'Turret', 'Turrets']],
8379 $containerstorage = 40000,
8380 ]"/>
8381
8382 <debug_text text="'Selected ' + $PlotSector + ' ' + $PlotSector.knownname + ' to be the sector to build the station in'" chance="$DebugChance"/>
8383 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8384 </do_if>
8385 </actions>
8386 </library>
8387
8388 <cue name="Build_Station__Standard" instantiate="true" namespace="this">
8389 <conditions>
8390 <event_cue_signalled/>
8391 <!--Signal the static cue to trigger a new instance of this mission.
8392 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
8393 </conditions>
8394 <actions>
8395 <set_value name="$Definition" exact="event.param"/>
8396 <set_value name="$Page" exact="$Definition.$Page"/>
8397 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
8398 <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."/>
8399 <set_value name="$SuccessfullyGenerated" exact="false"/>
8400 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
8401
8402 <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]'"/>
8403
8404 <!--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.
8405 $Valid:
8406 0: Page/TextOffset not handled
8407 1: Correct Page/TextOffset but unable to setup mission
8408 2: Mission can attempt to be spawned -->
8409 <set_value name="$Valid" exact="0"/>
8410
8411 <!--### ARGON VS XENON ###-->
8412 <do_if value="$Page == 30210">
8413 <do_if value="$TextOffset == 105000" comment="Build defence outpost">
8414 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8415 <include_actions ref="Build_Station__Allied_Space"/>
8416 </do_if>
8417 </do_if>
8418
8419 <!--### ARGON VS HOLY ORDER ###-->
8420 <do_elseif value="$Page == 30211">
8421 <do_if value="$TextOffset == 105000" comment="Build defence outpost">
8422 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8423 <include_actions ref="Build_Station__Allied_Space"/>
8424 </do_if>
8425 </do_elseif>
8426
8427 <!--### PARANID VS HOLY ORDER ###-->
8428 <do_elseif value="$Page == 30212">
8429 <do_if value="$TextOffset == 105000" comment="Build defence outpost">
8430 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8431 <include_actions ref="Build_Station__Allied_Space"/>
8432 </do_if>
8433 </do_elseif>
8434
8435 <!--### HOLY ORDER VS ARGON ###-->
8436 <do_elseif value="$Page == 30213">
8437 <do_if value="$TextOffset == 105000" comment="Build defence outpost">
8438 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8439 <include_actions ref="Build_Station__Allied_Space"/>
8440 </do_if>
8441 </do_elseif>
8442
8443 <!--### HOLY ORDER VS ARGON ###-->
8444 <do_elseif value="$Page == 30214">
8445 <do_if value="$TextOffset == 105000" comment="Build defence outpost">
8446 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8447 <include_actions ref="Build_Station__Allied_Space"/>
8448 </do_if>
8449 </do_elseif>
8450
8451 <do_if value="$Valid == 2">
8452 <do_if value="$FollowUp">
8453 <!--Followup missions use the namespace as the mission cue-->
8454 <set_value name="$MissionCue" exact="namespace"/>
8455 </do_if>
8456 <do_else>
8457 <set_value name="$MissionCue" exact="null"/>
8458 </do_else>
8459 </do_if>
8460 <do_else>
8461 <do_if value="$Valid == 1">
8462 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
8463 </do_if>
8464 <do_else>
8465 <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]'"/>
8466 </do_else>
8467 <signal_cue cue="$Definition.$SpawnFailedCue"/>
8468 <cancel_cue cue="this"/>
8469 </do_else>
8470 </actions>
8471 <cues>
8472 <cue name="Build_Station__Standard_FollowUp_Manager" onfail="cancel">
8473 <conditions>
8474 <check_value value="$FollowUp"/>
8475 </conditions>
8476 <actions>
8477 <!--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.-->
8478 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
8479 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
8480 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
8481 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
8482 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
8483 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
8484 </actions>
8485 <cues>
8486 <cue name="Build_Station__Standard_FollowUp_Offer_Accepted">
8487 <conditions>
8488 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
8489 <check_value value="event.param == $MissionCue"/>
8490 </conditions>
8491 <actions>
8492 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
8493 TODO @Owen Move this to a library in the GM file?-->
8494 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
8495 <briefing>
8496 <!--TODO @Owen Better objective?-->
8497 <objective step="1" action="objective.build_station"/>
8498 </briefing>
8499 </create_mission>
8500 </actions>
8501 </cue>
8502
8503 <cue name="Build_Station__Standard_Aborted">
8504 <conditions>
8505 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
8506 </conditions>
8507 <actions>
8508 <cancel_cue cue="namespace"/>
8509 </actions>
8510 </cue>
8511
8512 <!--namespace signalled to activate followup mission
8513 event.param = Station to supply-->
8514 <cue name="Build_Station__Standard_Activate_FollowUp">
8515 <conditions>
8516 <event_cue_signalled cue="namespace"/>
8517 </conditions>
8518 <actions>
8519 <!--Check that the correct parameters have been passed-->
8520 <do_if value="false">
8521 <!--Currently no followup case for this type of mission-->
8522 <signal_cue cue="Build_Station__Standard_Create_GM"/>
8523 <cancel_cue cue="parent"/>
8524 </do_if>
8525 <do_else>
8526 <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.'"/>
8527 <!--TODO @Owen what if there is another followup mission?-->
8528 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
8529 <cancel_cue cue="namespace"/>
8530 </do_else>
8531 </actions>
8532 </cue>
8533 </cues>
8534 </cue>
8535
8536 <cue name="Build_Station__Standard_Not_FollowUp" onfail="cancel">
8537 <conditions>
8538 <check_value value="not $FollowUp"/>
8539 </conditions>
8540 <actions>
8541 <signal_cue cue="Build_Station__Standard_Create_GM"/>
8542 </actions>
8543 </cue>
8544
8545 <cue name="Build_Station__Standard_Create_GM">
8546 <conditions>
8547 <event_cue_signalled/>
8548 </conditions>
8549 <actions>
8550 <set_value name="$ResultTable" exact="table[]"/>
8551 </actions>
8552 <cues>
8553 <!-- Trigger actual GM, passing the specified parameters -->
8554 <cue name="Build_Station__Standard_Ref" ref="md.GM_BuildStation.Start">
8555 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
8556 <param name="MissionCue" value="$MissionCue"/>
8557 <param name="MissionThread" value="$Definition.$ThreadCue"/>
8558 <param name="ReportSignalCue" value="Build_Station__Standard_GM_Event"/>
8559 <param name="WithoutOffer" value="true"/>
8560 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
8561 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
8562
8563 <param name="Page" value="$Page"/>
8564 <param name="TextOffset" value="$TextOffset"/>
8565 <param name="MissionLevel" value="3"/>
8566 <param name="Difficulty" value="level.medium"/>
8567
8568 <param name="Faction" value="$Definition.$ThreadData.$Faction"/>
8569 <param name="PlotSector" value="$PlotSector"/>
8570 <param name="PlotOffset" value="$PlotOffset"/>
8571 <param name="PlotRange" value="$PlotRange"/>
8572 <param name="PlotSize" value="$PlotSize"/>
8573 <param name="StationSpecs" value="$StationSpecs"/>
8574
8575 <param name="ResultTable" value="$ResultTable"/>
8576
8577 <param name="DebugChance" value="$DebugChance"/>
8578 </cue>
8579
8580 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
8581 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
8582 <cue name="Build_Station__Standard_GM_Event" instantiate="true">
8583 <conditions>
8584 <event_cue_signalled/>
8585 </conditions>
8586 <actions>
8587 <include_actions ref="MM__Standard_GM_Event"/>
8588 </actions>
8589 </cue>
8590 </cues>
8591 </cue>
8592 </cues>
8593 </cue>
8594
8595 <cue name="Supply_Factory__Standard" instantiate="true" namespace="this">
8596 <conditions>
8597 <event_cue_signalled/>
8598 <!--Signal the static cue to trigger a new instance of this mission.
8599 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
8600 </conditions>
8601 <actions>
8602 <set_value name="$Definition" exact="event.param"/>
8603 <set_value name="$Page" exact="$Definition.$Page"/>
8604 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
8605 <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."/>
8606 <set_value name="$SuccessfullyGenerated" exact="false"/>
8607 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
8608
8609 <!--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.
8610 $Valid:
8611 0: Page/TextOffset not handled
8612 1: Correct Page/TextOffset but unable to setup mission
8613 2: Mission can attempt to be spawned -->
8614 <set_value name="$Valid" exact="0"/>
8615 <set_value name="$Faction" exact="$Definition.$ThreadData.$Faction"/>
8616
8617 <!--### ARGON VS XENON ###-->
8618 <do_if value="$Page == 30210">
8619 <do_if value="$TextOffset == 130000">
8620 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8621 <include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
8622 <do_if value="not $FollowUp">
8623 <include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
8624 <do_if value="$TargetStation">
8625 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8626 </do_if>
8627 </do_if>
8628 <do_else>
8629 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8630 </do_else>
8631 </do_if>
8632 </do_if>
8633
8634 <!--### ARGON VS HOLY ORDER ###-->
8635 <do_if value="$Page == 30211">
8636 <do_if value="$TextOffset == 130000">
8637 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8638 <include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
8639 <do_if value="not $FollowUp">
8640 <include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
8641 <do_if value="$TargetStation">
8642 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8643 </do_if>
8644 </do_if>
8645 <do_else>
8646 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8647 </do_else>
8648 </do_if>
8649 </do_if>
8650
8651 <!--### PARANID VS HOLY ORDER ###-->
8652 <do_if value="$Page == 30212">
8653 <do_if value="$TextOffset == 130000">
8654 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8655 <include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
8656 <do_if value="not $FollowUp">
8657 <include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
8658 <do_if value="$TargetStation">
8659 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8660 </do_if>
8661 </do_if>
8662 <do_else>
8663 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8664 </do_else>
8665 </do_if>
8666 </do_if>
8667
8668 <!--### HOLY ORDER VS ARGON ###-->
8669 <do_if value="$Page == 30213">
8670 <do_if value="$TextOffset == 130000">
8671 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8672 <include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
8673 <do_if value="not $FollowUp">
8674 <include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
8675 <do_if value="$TargetStation">
8676 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8677 </do_if>
8678 </do_if>
8679 <do_else>
8680 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8681 </do_else>
8682 </do_if>
8683 </do_if>
8684
8685 <!--### HOLY ORDER VS PARANID ###-->
8686 <do_if value="$Page == 30214">
8687 <do_if value="$TextOffset == 130000">
8688 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8689 <include_actions ref="md.GM_SupplyFactory.ConfigureDifficulty" comment="Input: -, output: $Difficulty, $SupplyStorageMinPercent, $MissionDuration"/>
8690 <do_if value="not $FollowUp">
8691 <include_actions ref="md.GM_SupplyFactory.SupplyFactory_FriendlyFactory" comment="input: $Faction, output: $TargetStation"/>
8692 <do_if value="$TargetStation">
8693 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8694 </do_if>
8695 </do_if>
8696 <do_else>
8697 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8698 </do_else>
8699 </do_if>
8700 </do_if>
8701
8702 <do_if value="$Valid == 2">
8703 <do_if value="$FollowUp">
8704 <!--Followup missions use the namespace as the mission cue-->
8705 <set_value name="$MissionCue" exact="namespace"/>
8706 </do_if>
8707 <do_else>
8708 <set_value name="$MissionCue" exact="null"/>
8709 </do_else>
8710 </do_if>
8711 <do_else>
8712 <do_if value="$Valid == 1">
8713 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
8714 </do_if>
8715 <do_else>
8716 <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]'"/>
8717 </do_else>
8718 <signal_cue cue="$Definition.$SpawnFailedCue"/>
8719 <cancel_cue cue="this"/>
8720 </do_else>
8721 </actions>
8722 <cues>
8723 <cue name="Supply_Factory__Standard_FollowUp_Manager" onfail="cancel">
8724 <conditions>
8725 <check_value value="$FollowUp"/>
8726 </conditions>
8727 <actions>
8728 <!--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.-->
8729 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
8730 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
8731 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
8732 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
8733 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
8734 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
8735 </actions>
8736 <cues>
8737 <cue name="Supply_Factory__Standard_FollowUp_Offer_Accepted">
8738 <conditions>
8739 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
8740 <check_value value="event.param == $MissionCue"/>
8741 </conditions>
8742 <actions>
8743 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
8744 TODO @Owen Move this to a library in the GM file?-->
8745 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
8746 <briefing>
8747 <objective step="1" action="objective.deliver" text="{30147,2}" comment="Production resources"/>
8748 </briefing>
8749 </create_mission>
8750 </actions>
8751 </cue>
8752
8753 <cue name="Supply_Factory__Standard_Aborted">
8754 <conditions>
8755 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
8756 </conditions>
8757 <actions>
8758 <cancel_cue cue="namespace"/>
8759 </actions>
8760 </cue>
8761
8762 <!--namespace signalled to activate followup mission
8763 event.param = Station to supply-->
8764 <cue name="Supply_Factory__Standard_Activate_FollowUp">
8765 <conditions>
8766 <event_cue_signalled cue="namespace"/>
8767 </conditions>
8768 <actions>
8769 <!--Check that the correct parameters have been passed-->
8770 <do_if value="event.param.isclass.station">
8771 <set_value name="$TargetStation" exact="event.param"/>
8772 <signal_cue cue="Supply_Factory__Standard_Create_GM"/>
8773 <cancel_cue cue="parent"/>
8774 </do_if>
8775 <do_else>
8776 <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.'"/>
8777 <!--TODO @Owen what if there is another followup mission?-->
8778 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
8779 <cancel_cue cue="namespace"/>
8780 </do_else>
8781 </actions>
8782 </cue>
8783 </cues>
8784 </cue>
8785
8786 <cue name="Supply_Factory__Standard_Not_FollowUp" onfail="cancel">
8787 <conditions>
8788 <check_value value="not $FollowUp"/>
8789 </conditions>
8790 <actions>
8791 <signal_cue cue="Supply_Factory__Standard_Create_GM"/>
8792 </actions>
8793 </cue>
8794
8795 <cue name="Supply_Factory__Standard_Create_GM">
8796 <conditions>
8797 <event_cue_signalled/>
8798 </conditions>
8799 <cues>
8800 <!-- Trigger actual GM, passing the specified parameters -->
8801 <cue name="Supply_Factory__Standard_Ref" ref="md.GM_SupplyFactory.Start">
8802 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
8803 <param name="MissionCue" value="$MissionCue"/>
8804 <param name="MissionThread" value="$Definition.$ThreadCue"/>
8805 <param name="ReportSignalCue" value="Supply_Factory__Standard_GM_Event"/>
8806 <param name="WithoutOffer" value="true"/>
8807 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
8808 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
8809
8810 <param name="Page" value="$Page"/>
8811 <param name="TextOffset" value="$TextOffset"/>
8812 <param name="MissionLevel" value="3"/>
8813 <param name="Difficulty" value="level.medium"/>
8814 <param name="MissionDuration" value="1h"/>
8815
8816 <param name="TargetStation" value="$TargetStation"/>
8817 <param name="SupplyStorageMinPercent" value="$SupplyStorageMinPercent"/>
8818
8819 <param name="DebugChance" value="$DebugChance"/>
8820 </cue>
8821
8822 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
8823 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
8824 <cue name="Supply_Factory__Standard_GM_Event" instantiate="true">
8825 <conditions>
8826 <event_cue_signalled/>
8827 </conditions>
8828 <actions>
8829 <include_actions ref="MM__Standard_GM_Event"/>
8830 </actions>
8831 </cue>
8832 </cues>
8833 </cue>
8834 </cues>
8835 </cue>
8836
8837
8838 <!--Variant Helper Libraries
8839 Helper libraries to be call from different threads but want to have the same basic variant rules
8840 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-->
8841
8842 <library name="DeployInPlace__LaserTowers_Around_Allied_Object">
8843 <actions>
8844 <do_any>
8845 <set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted.{1}"/>
8846 <set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.random"/>
8847 </do_any>
8848 <do_if value="$TargetSector">
8849 <!--TODO @Owen find entry points towards enemy space-->
8850 <find_station name="$AnchorObject" space="$TargetSector">
8851 <match_relation_of faction="$Definition.$ThreadData.$Faction" relation="friend" comparison="ge"/>
8852 </find_station>
8853
8854 <do_if value="$AnchorObject">
8855 <create_position name="$TargetOffset" object="$AnchorObject" space="$TargetSector" />
8856 <!--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 -->
8857 <!--<set_value name="$TargetOffset" exact="position.[$TargetOffset.x, 0, $TargetOffset.z]" comment="Keep guidance sphere on ecliptic (y=0)"/>-->
8858 <set_value name="$TargetRadius" exact="$AnchorObject.size + 5km"/>
8859
8860 <set_value name="$DeployableCategory" exact="deployablecategory.lasertower"/>
8861 <set_value name="$DropAmount" exact="3"/>
8862
8863 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8864 </do_if>
8865 </do_if>
8866 </actions>
8867 </library>
8868
8869 <!--Additional params:
8870 - $OwnEntryPointID - Text ID for the mission variant where the entry point is in host faction space
8871 - $AlliedEntryPointID - Text ID for the mission variant where the entry point is in allied space-->
8872 <library name="DeployInPlace__Mine_Entry_Point">
8873 <actions>
8874 <do_if value="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint">
8875 <!--Clear $TextOffset as it will be set below based on the situation-->
8876 <set_value name="$TextOffset" exact="null"/>
8877 <set_value name="$ExitPointSector" exact="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint.destination.sector"/>
8878 <do_if value="$ExitPointSector.owner == $Definition.$ThreadData.$Faction or $ExitPointSector.iscontestedby.{$Definition.$ThreadData.$Faction}">
8879 <do_if value="$Definition.$TextOffset.indexof.{$OwnEntryPointID}">
8880 <!--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-->
8881 <set_value name="$TextOffset" exact="$OwnEntryPointID"/>
8882 <debug_text text="'Setting text offset to ' + $TextOffset + ' as exit point is in space owned or contested by ' + $Definition.$ThreadData.$Faction" chance="$DebugChance"/>
8883 </do_if>
8884 </do_if>
8885 <do_else>
8886 <do_if value="$Definition.$TextOffset.indexof.{$AlliedEntryPointID}">
8887 <!--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-->
8888 <set_value name="$TextOffset" exact="$AlliedEntryPointID"/>
8889 <debug_text text="'Setting text offset to ' + $TextOffset + ' as exit point is not in space owned or contested by ' + $Definition.$ThreadData.$Faction" chance="$DebugChance"/>
8890 </do_if>
8891 </do_else>
8892
8893 <do_if value="$TextOffset">
8894 <create_position name="$TargetOffset" object="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint.exit" space="$ExitPointSector" z="5km" max="500m"/>
8895 <!--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 -->
8896 <!--<set_value name="$TargetOffset" exact="position.[$TargetOffset.x, 0, $TargetOffset.z]" comment="Keep guidance sphere on ecliptic (y=0)"/>-->
8897 <set_value name="$TargetSector" exact="$ExitPointSector"/>
8898 <set_value name="$TargetRadius" exact="$Definition.$ThreadData.$WarFront.$EnemyEntryPoint.exit.size"/>
8899
8900 <set_value name="$DeployableCategory" exact="deployablecategory.mine"/>
8901 <set_value name="$DropAmount" exact="5"/>
8902
8903 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8904 </do_if>
8905 </do_if>
8906 </actions>
8907 </library>
8908
8909 <library name="DeployInPlace__LaserTowers_In_Resource_Regions">
8910 <actions>
8911 <do_any>
8912 <set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted.{1}"/>
8913 <set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.random"/>
8914 </do_any>
8915 <do_if value="$TargetSector">
8916 <set_value name="$Resources" exact="[ware.ice, ware.ore, ware.silicon]"/>
8917 <shuffle_list list="$Resources"/>
8918 <set_value name="$ResultSector" exact="null"/>
8919 <do_all exact="$Resources.count" counter="$i">
8920 <find_resource ware="$Resources.{$i}" refobject="$TargetSector" sector="$ResultSector" position="$TargetOffset" snap="false"/>
8921 <do_if value="$ResultSector">
8922 <break/>
8923 </do_if>
8924 </do_all>
8925
8926 <do_if value="$ResultSector">
8927 <set_value name="$TargetRadius" exact="10km"/>
8928
8929 <set_value name="$DeployableCategory" exact="deployablecategory.lasertower"/>
8930 <set_value name="$DropAmount" exact="3"/>
8931
8932 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8933 </do_if>
8934 </do_if>
8935 </actions>
8936 </library>
8937
8938 <library name="DeployInPlace__Satellite_In_Enemy_Space">
8939 <actions>
8940 <do_any>
8941 <set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.sorted.{1}" weight="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.count gt 0"/>
8942 <set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.random" weight="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.count gt 0"/>
8943 <set_value name="$TargetSector" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.keys.random" weight="$Definition.$ThreadData.$WarFront.$ContestedSectors.count gt 0"/>
8944 </do_any>
8945
8946 <do_if value="$TargetSector">
8947 <create_position name="$TargetOffset" max="150km"/>
8948 <set_value name="$Y" min="-5km" max="5km"/>
8949 <set_value name="$TargetOffset" exact="position.[$TargetOffset.x, $Y, $TargetOffset.z]"/>
8950 <get_safe_pos result="$TargetOffset" sector="$TargetSector" allowyaxis="false" radius="5km" value="$TargetOffset"/>
8951 <set_value name="$TargetRadius" exact="1000m"/>
8952
8953 <set_value name="$DeployableCategory" exact="deployablecategory.satellite"/>
8954 <set_value name="$DropAmount" exact="1"/>
8955
8956 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
8957 </do_if>
8958 </actions>
8959 </library>
8960
8961 <cue name="DeployInPlace__Standard" instantiate="true" namespace="this">
8962 <conditions>
8963 <event_cue_signalled/>
8964 <!--Signal the static cue to trigger a new instance of this mission.
8965 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
8966 </conditions>
8967 <actions>
8968 <set_value name="$Definition" exact="event.param"/>
8969 <set_value name="$Page" exact="$Definition.$Page"/>
8970 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
8971 <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."/>
8972 <set_value name="$SuccessfullyGenerated" exact="false"/>
8973 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
8974
8975 <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]'"/>
8976
8977 <!--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.
8978 $Valid:
8979 0: Page/TextOffset not handled
8980 1: Correct Page/TextOffset but unable to setup mission
8981 2: Mission can attempt to be spawned -->
8982 <set_value name="$Valid" exact="0"/>
8983
8984 <!--### ARGON VS XENON ###-->
8985 <do_if value="$Page == 30210">
8986 <do_if value="$TextOffset == 101000">
8987 <!--Deploy laser towers around an allied object-->
8988 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8989 <include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
8990 </do_if>
8991
8992 <do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
8993 <!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
8994 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
8995 <set_value name="$OwnEntryPointID" exact="101200"/>
8996 <set_value name="$AlliedEntryPointID" exact="101100"/>
8997 <include_actions ref="DeployInPlace__Mine_Entry_Point"/>
8998 </do_elseif>
8999
9000 <do_elseif value="$TextOffset == 101300">
9001 <!--Deploy laser towers in resource regions-->
9002 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9003 <include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
9004 </do_elseif>
9005
9006 <do_elseif value="$TextOffset == 101400">
9007 <!--Deploy satellite in enemy territory-->
9008 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9009 <include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
9010 </do_elseif>
9011 </do_if>
9012
9013 <!--### ARGON VS HOLY ORDER ###-->
9014 <do_elseif value="$Page == 30211">
9015 <do_if value="$TextOffset == 101000">
9016 <!--Deploy laser towers around an allied object-->
9017 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9018 <include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
9019 </do_if>
9020
9021 <do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
9022 <!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
9023 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9024 <set_value name="$OwnEntryPointID" exact="101200"/>
9025 <set_value name="$AlliedEntryPointID" exact="101100"/>
9026 <include_actions ref="DeployInPlace__Mine_Entry_Point"/>
9027 </do_elseif>
9028
9029 <do_elseif value="$TextOffset == 101300">
9030 <!--Deploy laser towers in resource regions-->
9031 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9032 <include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
9033 </do_elseif>
9034
9035 <do_elseif value="$TextOffset == 101400">
9036 <!--Deploy satellite in enemy territory-->
9037 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9038 <include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
9039 </do_elseif>
9040 </do_elseif>
9041
9042 <!--### PARANID VS HOLY ORDER ###-->
9043 <do_elseif value="$Page == 30212">
9044 <do_if value="$TextOffset == 101000">
9045 <!--Deploy laser towers around an allied object-->
9046 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9047 <include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
9048 </do_if>
9049
9050 <do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
9051 <!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
9052 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9053 <set_value name="$OwnEntryPointID" exact="101200"/>
9054 <set_value name="$AlliedEntryPointID" exact="101100"/>
9055 <include_actions ref="DeployInPlace__Mine_Entry_Point"/>
9056 </do_elseif>
9057
9058 <do_elseif value="$TextOffset == 101300">
9059 <!--Deploy laser towers in resource regions-->
9060 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9061 <include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
9062 </do_elseif>
9063
9064 <do_elseif value="$TextOffset == 101400">
9065 <!--Deploy satellite in enemy territory-->
9066 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9067 <include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
9068 </do_elseif>
9069 </do_elseif>
9070
9071 <!--### HOLY ORDER VS ARGON ###-->
9072 <do_elseif value="$Page == 30213">
9073 <do_if value="$TextOffset == 101000">
9074 <!--Deploy laser towers around an allied object-->
9075 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9076 <include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
9077 </do_if>
9078
9079 <do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
9080 <!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
9081 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9082 <set_value name="$OwnEntryPointID" exact="101200"/>
9083 <set_value name="$AlliedEntryPointID" exact="101100"/>
9084 <include_actions ref="DeployInPlace__Mine_Entry_Point"/>
9085 </do_elseif>
9086
9087 <do_elseif value="$TextOffset == 101300">
9088 <!--Deploy laser towers in resource regions-->
9089 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9090 <include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
9091 </do_elseif>
9092
9093 <do_elseif value="$TextOffset == 101400">
9094 <!--Deploy satellite in enemy territory-->
9095 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9096 <include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
9097 </do_elseif>
9098 </do_elseif>
9099
9100 <!--### HOLY ORDER VS PARANID ###-->
9101 <do_elseif value="$Page == 30214">
9102 <do_if value="$TextOffset == 101000">
9103 <!--Deploy laser towers around an allied object-->
9104 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9105 <include_actions ref="DeployInPlace__LaserTowers_Around_Allied_Object"/>
9106 </do_if>
9107
9108 <do_elseif value="$TextOffset == 101100 or $TextOffset == 101200">
9109 <!--Create mine field around enemy entry point. Different variants for whether the area is in $Faction owned space or not-->
9110 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9111 <set_value name="$OwnEntryPointID" exact="101200"/>
9112 <set_value name="$AlliedEntryPointID" exact="101100"/>
9113 <include_actions ref="DeployInPlace__Mine_Entry_Point"/>
9114 </do_elseif>
9115
9116 <do_elseif value="$TextOffset == 101300">
9117 <!--Deploy laser towers in resource regions-->
9118 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9119 <include_actions ref="DeployInPlace__LaserTowers_In_Resource_Regions"/>
9120 </do_elseif>
9121
9122 <do_elseif value="$TextOffset == 101400">
9123 <!--Deploy satellite in enemy territory-->
9124 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9125 <include_actions ref="DeployInPlace__Satellite_In_Enemy_Space"/>
9126 </do_elseif>
9127 </do_elseif>
9128
9129 <do_if value="$Valid == 2">
9130 <do_if value="$FollowUp">
9131 <!--Followup missions use the namespace as the mission cue-->
9132 <set_value name="$MissionCue" exact="namespace"/>
9133 </do_if>
9134 <do_else>
9135 <set_value name="$MissionCue" exact="null"/>
9136 </do_else>
9137 </do_if>
9138 <do_else>
9139 <do_if value="$Valid == 1">
9140 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
9141 </do_if>
9142 <do_else>
9143 <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]'"/>
9144 </do_else>
9145 <signal_cue cue="$Definition.$SpawnFailedCue"/>
9146 <cancel_cue cue="this"/>
9147 </do_else>
9148 </actions>
9149 <cues>
9150 <cue name="DeployInPlace__Standard_FollowUp_Manager" onfail="cancel">
9151 <conditions>
9152 <check_value value="$FollowUp"/>
9153 </conditions>
9154 <actions>
9155 <!--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.-->
9156 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
9157 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
9158 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
9159 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
9160 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
9161 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
9162 </actions>
9163 <cues>
9164 <cue name="DeployInPlace__Standard_FollowUp_Offer_Accepted">
9165 <conditions>
9166 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
9167 <check_value value="event.param == $MissionCue"/>
9168 </conditions>
9169 <actions>
9170 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
9171 TODO @Owen Move this to a library in the GM file?-->
9172 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
9173 <briefing>
9174 <!--TODO @Owen Better objective?-->
9175 <objective step="1" action="objective.deploy"/>
9176 </briefing>
9177 </create_mission>
9178 </actions>
9179 </cue>
9180
9181 <cue name="DeployInPlace__Standard_Aborted">
9182 <conditions>
9183 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
9184 </conditions>
9185 <actions>
9186 <cancel_cue cue="namespace"/>
9187 </actions>
9188 </cue>
9189
9190 <!--namespace signalled to activate followup mission
9191 event.param = Station to supply-->
9192 <cue name="DeployInPlace__Standard_Activate_FollowUp">
9193 <conditions>
9194 <event_cue_signalled cue="namespace"/>
9195 </conditions>
9196 <actions>
9197 <!--Check that the correct parameters have been passed-->
9198 <do_if value="false">
9199 <!--Currently no followup case for this type of mission-->
9200 <signal_cue cue="DeployInPlace__Standard_Create_GM"/>
9201 <cancel_cue cue="parent"/>
9202 </do_if>
9203 <do_else>
9204 <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.'"/>
9205 <!--TODO @Owen what if there is another followup mission?-->
9206 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
9207 <cancel_cue cue="namespace"/>
9208 </do_else>
9209 </actions>
9210 </cue>
9211 </cues>
9212 </cue>
9213
9214 <cue name="DeployInPlace__Standard_Not_FollowUp" onfail="cancel">
9215 <conditions>
9216 <check_value value="not $FollowUp"/>
9217 </conditions>
9218 <actions>
9219 <signal_cue cue="DeployInPlace__Standard_Create_GM"/>
9220 </actions>
9221 </cue>
9222
9223 <cue name="DeployInPlace__Standard_Create_GM">
9224 <conditions>
9225 <event_cue_signalled/>
9226 </conditions>
9227 <cues>
9228 <!-- Trigger actual GM, passing the specified parameters -->
9229 <cue name="DeployInPlace__Standard_Ref" ref="md.GM_DeployInPlace.Start">
9230 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
9231 <param name="MissionCue" value="$MissionCue"/>
9232 <param name="MissionThread" value="$Definition.$ThreadCue"/>
9233 <param name="ReportSignalCue" value="DeployInPlace__Standard_GM_Event"/>
9234 <param name="WithoutOffer" value="true"/>
9235 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
9236 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
9237
9238 <param name="Page" value="$Page"/>
9239 <param name="TextOffset" value="$TextOffset"/>
9240 <param name="MissionLevel" value="3"/>
9241 <param name="Difficulty" value="level.easy"/>
9242
9243 <param name="Faction" value="$Definition.$ThreadData.$Faction"/>
9244 <param name="TargetSector" value="$TargetSector"/>
9245 <param name="TargetOffset" value="$TargetOffset"/>
9246 <param name="TargetRadius" value="$TargetRadius"/>
9247 <param name="TargetCount" value="$DropAmount"/>
9248 <param name="DeployableCategory" value="$DeployableCategory"/>
9249
9250 <param name="DebugChance" value="$DebugChance"/>
9251 </cue>
9252
9253 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
9254 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
9255 <cue name="DeployInPlace__Standard_GM_Event" instantiate="true">
9256 <conditions>
9257 <event_cue_signalled/>
9258 </conditions>
9259 <actions>
9260 <include_actions ref="MM__Standard_GM_Event"/>
9261 </actions>
9262 </cue>
9263 </cues>
9264 </cue>
9265 </cues>
9266 </cue>
9267
9268
9269 <cue name="DestroyRarelyOnSight__Standard" instantiate="true" namespace="this">
9270 <conditions>
9271 <event_cue_signalled/>
9272 <!--Signal the static cue to trigger a new instance of this mission.
9273 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
9274 </conditions>
9275 <actions>
9276 <set_value name="$Definition" exact="event.param"/>
9277 <set_value name="$Page" exact="$Definition.$Page"/>
9278 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
9279 <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."/>
9280 <set_value name="$SuccessfullyGenerated" exact="false"/>
9281 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
9282
9283 <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]'"/>
9284
9285 <!--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.
9286 $Valid:
9287 0: Page/TextOffset not handled
9288 1: Correct Page/TextOffset but unable to setup mission
9289 2: Mission can attempt to be spawned -->
9290 <set_value name="$Valid" exact="0"/>
9291
9292 <!--### ARGON VS XENON ###-->
9293 <do_if value="$Page == 30210">
9294 <do_if value="$TextOffset == 140000" comment="undermine enemy variation">
9295 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9296 <!-- 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]]"/-->
9297 <set_value name="$TargetSpec" exact="[macro.ship_xen_m_fighter_01_a_macro, [], [], []]"/>
9298 <set_value name="$TargetCount" exact="1"/>
9299 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
9300 </do_if>
9301 </do_if>
9302
9303 <!--### ARGON VS HOLY ORDER-->
9304 <do_if value="$Page == 30211">
9305 <do_if value="$TextOffset == 140000" comment="undermine enemy variation">
9306 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9307 <set_value name="$TargetSpec" exact="[macro.ship_par_l_destroyer_01_b_macro, [], [], []]"/>
9308 <set_value name="$TargetCount" exact="1"/>
9309 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
9310 </do_if>
9311 </do_if>
9312
9313 <!--### PARANID VS HOLY ORDER ###-->
9314 <do_if value="$Page == 30212">
9315 <do_if value="$TextOffset == 140000" comment="undermine enemy variation">
9316 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9317 <set_value name="$TargetSpec" exact="[macro.ship_par_m_frigate_01_b_macro, [], [], []]"/>
9318 <set_value name="$TargetCount" exact="[1,2].random"/>
9319 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
9320 </do_if>
9321 </do_if>
9322
9323 <!--### HOLY ORDER VS ARGON ###-->
9324 <do_if value="$Page == 30213">
9325 <do_if value="$TextOffset == 140000" comment="undermine enemy variation">
9326 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9327 <set_value name="$TargetSpec" exact="[macro.ship_arg_m_frigate_01_a_macro, [], [], []]"/>
9328 <set_value name="$TargetCount" exact="[1,2].random"/>
9329 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
9330 </do_if>
9331 </do_if>
9332
9333 <!--### HOLY ORDER VS PARANID ###-->
9334 <do_if value="$Page == 30214">
9335 <do_if value="$TextOffset == 140000" comment="undermine enemy variation">
9336 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9337 <set_value name="$TargetSpec" exact="[macro.ship_par_m_frigate_01_a_macro, [], [], []]"/>
9338 <set_value name="$TargetCount" exact="[1,2].random"/>
9339 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
9340 </do_if>
9341 </do_if>
9342
9343 <do_if value="$Valid == 2">
9344 <do_if value="$FollowUp">
9345 <!--Followup missions use the namespace as the mission cue-->
9346 <set_value name="$MissionCue" exact="namespace"/>
9347 </do_if>
9348 <do_else>
9349 <set_value name="$MissionCue" exact="null"/>
9350 </do_else>
9351 </do_if>
9352 <do_else>
9353 <do_if value="$Valid == 1">
9354 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
9355 </do_if>
9356 <do_else>
9357 <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]'"/>
9358 </do_else>
9359 <signal_cue cue="$Definition.$SpawnFailedCue"/>
9360 <cancel_cue cue="this"/>
9361 </do_else>
9362 </actions>
9363 <cues>
9364 <cue name="DestroyRarelyOnSight__Standard_FollowUp_Manager" onfail="cancel">
9365 <conditions>
9366 <check_value value="$FollowUp"/>
9367 </conditions>
9368 <actions>
9369 <!--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.-->
9370 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
9371 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
9372 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
9373 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
9374 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
9375 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
9376 </actions>
9377 <cues>
9378 <cue name="DestroyRarelyOnSight__Standard_FollowUp_Offer_Accepted">
9379 <conditions>
9380 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
9381 <check_value value="event.param == $MissionCue"/>
9382 </conditions>
9383 <actions>
9384 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
9385 TODO @Owen Move this to a library in the GM file?-->
9386 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
9387 <briefing>
9388 <!--TODO @Owen Better objective?-->
9389 <objective step="1" action="objective.destroy"/>
9390 </briefing>
9391 </create_mission>
9392 </actions>
9393 </cue>
9394
9395 <cue name="DestroyRarelyOnSight__Standard_Aborted">
9396 <conditions>
9397 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
9398 </conditions>
9399 <actions>
9400 <cancel_cue cue="namespace"/>
9401 </actions>
9402 </cue>
9403
9404 <!--namespace signalled to activate followup mission
9405 event.param = Station to supply-->
9406 <cue name="DestroyRarelyOnSight__Standard_Activate_FollowUp">
9407 <conditions>
9408 <event_cue_signalled cue="namespace"/>
9409 </conditions>
9410 <actions>
9411 <!--Check that the correct parameters have been passed-->
9412 <do_if value="false">
9413 <!--Currently no followup case for this type of mission-->
9414 <signal_cue cue="DestroyRarelyOnSight__Standard_Create_GM"/>
9415 <cancel_cue cue="parent"/>
9416 </do_if>
9417 <do_else>
9418 <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.'"/>
9419 <!--TODO @Owen what if there is another followup mission?-->
9420 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
9421 <cancel_cue cue="namespace"/>
9422 </do_else>
9423 </actions>
9424 </cue>
9425 </cues>
9426 </cue>
9427
9428 <cue name="DestroyRarelyOnSight__Standard_Not_FollowUp" onfail="cancel">
9429 <conditions>
9430 <check_value value="not $FollowUp"/>
9431 </conditions>
9432 <actions>
9433 <signal_cue cue="DestroyRarelyOnSight__Standard_Create_GM"/>
9434 </actions>
9435 </cue>
9436
9437 <cue name="DestroyRarelyOnSight__Standard_Create_GM">
9438 <conditions>
9439 <event_cue_signalled/>
9440 </conditions>
9441 <cues>
9442 <!-- Trigger actual GM, passing the specified parameters -->
9443 <cue name="DestroyRarelyOnSight__Standard_Ref" ref="md.GM_Destroy_RarelyOnSight.Start">
9444 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
9445 <param name="MissionCue" value="$MissionCue"/>
9446 <param name="MissionThread" value="$Definition.$ThreadCue"/>
9447 <param name="ReportSignalCue" value="DestroyRarelyOnSight__Standard_GM_Event"/>
9448 <param name="WithoutOffer" value="true"/>
9449 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
9450 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
9451
9452 <param name="Page" value="$Page"/>
9453 <param name="TextOffset" value="$TextOffset"/>
9454 <param name="MissionLevel" value="3"/>
9455 <param name="Difficulty" value="level.veryhard"/>
9456
9457 <param name="Faction" value="$Definition.$ThreadData.$Faction"/>
9458 <param name="TargetSpec" value="$TargetSpec"/>
9459 <param name="TargetCount" value="$TargetCount"/>
9460
9461 <param name="DebugChance" value="$DebugChance"/>
9462 </cue>
9463
9464 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
9465 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
9466 <cue name="DestroyRarelyOnSight__Standard_GM_Event" instantiate="true">
9467 <conditions>
9468 <event_cue_signalled/>
9469 </conditions>
9470 <actions>
9471 <include_actions ref="MM__Standard_GM_Event"/>
9472 </actions>
9473 </cue>
9474 </cues>
9475 </cue>
9476 </cues>
9477 </cue>
9478
9479 <!-- Input: $EnemyFaction
9480 Returns: $TargetShip, and on success also $Difficulty -->
9481 <library name="BoardShip__Standard_FindMilitaryTarget">
9482 <actions>
9483 <set_value name="$Spaces" exact="null"/>
9484 <do_if value="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.count">
9485 <set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.list"/>
9486 </do_if>
9487 <do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
9488 <set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.clone"/>
9489 </do_elseif>
9490 <do_if value="$Spaces">
9491 <shuffle_list list="$Spaces"/>
9492 <!--TODO @Owen further balancing to find easy enough boarding targets-->
9493 <!--TODO @Owen a variant to help NPCs board targets?-->
9494 <set_value name="$TargetShip" exact="null"/>
9495 <do_all exact="$Spaces.count" counter="$i">
9496 <find_ship name="$TargetShip" class="class.ship_l" primarypurpose="purpose.fight" space="$Spaces.{$i}" owner="$EnemyFaction" hascommander="false" capturable="true" docked="false"/>
9497 <do_if value="$TargetShip">
9498 <break/>
9499 </do_if>
9500 </do_all>
9501
9502 <do_if value="$TargetShip">
9503 <set_value name="$Difficulty" exact="level.hard"/>
9504 </do_if>
9505 </do_if>
9506 </actions>
9507 </library>
9508
9509
9510
9511 <cue name="BoardShip__Standard" instantiate="true" namespace="this">
9512 <conditions>
9513 <event_cue_signalled/>
9514 <!--Signal the static cue to trigger a new instance of this mission.
9515 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
9516 </conditions>
9517 <actions>
9518 <set_value name="$Definition" exact="event.param"/>
9519 <set_value name="$Page" exact="$Definition.$Page"/>
9520 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
9521 <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."/>
9522 <set_value name="$SuccessfullyGenerated" exact="false"/>
9523 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
9524
9525 <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]'"/>
9526
9527 <!--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.
9528 $Valid:
9529 0: Page/TextOffset not handled
9530 1: Correct Page/TextOffset but unable to setup mission
9531 2: Mission can attempt to be spawned -->
9532 <set_value name="$Valid" exact="0"/>
9533 <set_value name="$EnemyFaction" exact="$Definition.$ThreadData.$EnemyFaction"/>
9534 <set_value name="$TargetSpec" exact="null"/>
9535 <set_value name="$TargetShip" exact="null"/>
9536
9537 <!--### ARGON VS XENON ###-->
9538 <do_if value="$Page == 30210">
9539 <do_if value="$TextOffset == 108000" comment="GM_Board (specified ship)">
9540 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9541 <!-- TODO @Owen - Boarding variant to not board a Xenon ship but some other. Rogue scientists heading into Xenon space -->
9542 <!-- TODO: Bulletproof find_ship not returning anything -->
9543 <set_value name="$EnemyFaction" exact="faction.argon"/>
9544 <include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
9545 </do_if>
9546 <do_elseif value="$TextOffset == 5600" comment="HL_BoardRare (ship matching specifications)">
9547 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9548 <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]]"/>
9549 <set_value name="$Difficulty" exact="level.veryhard"/>
9550 </do_elseif>
9551 </do_if>
9552
9553 <!--### ARGON VS HOLY ORDER ###-->
9554 <do_elseif value="$Page == 30211">
9555 <do_if value="$TextOffset == 108000">
9556 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9557 <include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
9558 </do_if>
9559 </do_elseif>
9560
9561 <!--### PARANID VS HOLY ORDER ###-->
9562 <do_elseif value="$Page == 30212">
9563 <do_if value="$TextOffset == 108000">
9564 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9565 <include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
9566 </do_if>
9567 </do_elseif>
9568
9569 <!--### HOLY ORDER VS ARGON ###-->
9570 <do_elseif value="$Page == 30213">
9571 <do_if value="$TextOffset == 108000">
9572 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9573 <include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
9574 </do_if>
9575 </do_elseif>
9576
9577 <!--### HOLY ORDER VS PARANID ###-->
9578 <do_elseif value="$Page == 30214">
9579 <do_if value="$TextOffset == 108000">
9580 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9581 <include_actions ref="BoardShip__Standard_FindMilitaryTarget" comment="returns $Valid = 2, if a ship was found"/>
9582 </do_if>
9583 </do_elseif>
9584
9585 <do_if value="$TargetShip or $TargetSpec">
9586 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
9587 </do_if>
9588
9589 <do_if value="$Valid == 2">
9590 <do_any>
9591 <set_value name="$MissionDuration" exact="2h"/>
9592 <set_value name="$MissionDuration" exact="3h"/>
9593 </do_any>
9594 <do_if value="$FollowUp">
9595 <!--Followup missions use the namespace as the mission cue-->
9596 <set_value name="$MissionCue" exact="namespace"/>
9597 </do_if>
9598 <do_else>
9599 <set_value name="$MissionCue" exact="null"/>
9600 </do_else>
9601 </do_if>
9602 <do_else>
9603 <do_if value="$Valid == 1">
9604 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
9605 </do_if>
9606 <do_else>
9607 <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]'"/>
9608 </do_else>
9609 <signal_cue cue="$Definition.$SpawnFailedCue"/>
9610 <cancel_cue cue="this"/>
9611 </do_else>
9612 </actions>
9613 <cues>
9614 <cue name="BoardShip__Standard_FollowUp_Manager" onfail="cancel">
9615 <conditions>
9616 <check_value value="$FollowUp"/>
9617 </conditions>
9618 <actions>
9619 <!--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.-->
9620 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
9621 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
9622 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
9623 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
9624 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
9625 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
9626 </actions>
9627 <cues>
9628 <cue name="BoardShip__Standard_FollowUp_Offer_Accepted">
9629 <conditions>
9630 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
9631 <check_value value="event.param == $MissionCue"/>
9632 </conditions>
9633 <actions>
9634 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
9635 TODO @Owen Move this to a library in the GM file?-->
9636 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
9637 <briefing>
9638 <!--TODO @Owen Better objective?-->
9639 <objective step="1" action="objective.board"/>
9640 </briefing>
9641 </create_mission>
9642 </actions>
9643 </cue>
9644
9645 <cue name="BoardShip__Standard_Aborted">
9646 <conditions>
9647 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
9648 </conditions>
9649 <actions>
9650 <cancel_cue cue="namespace"/>
9651 </actions>
9652 </cue>
9653
9654 <!--namespace signalled to activate followup mission
9655 event.param = Station to supply-->
9656 <cue name="BoardShip__Standard_Activate_FollowUp">
9657 <conditions>
9658 <event_cue_signalled cue="namespace"/>
9659 </conditions>
9660 <actions>
9661 <!--Check that the correct parameters have been passed-->
9662 <do_if value="false">
9663 <!--Currently no followup case for this type of mission-->
9664 <signal_cue cue="BoardShip__Standard_Create_GM"/>
9665 <cancel_cue cue="parent"/>
9666 </do_if>
9667 <do_else>
9668 <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.'"/>
9669 <!--TODO @Owen what if there is another followup mission?-->
9670 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
9671 <cancel_cue cue="namespace"/>
9672 </do_else>
9673 </actions>
9674 </cue>
9675 </cues>
9676 </cue>
9677
9678 <cue name="BoardShip__Standard_Not_FollowUp" onfail="cancel">
9679 <conditions>
9680 <check_value value="not $FollowUp"/>
9681 </conditions>
9682 <actions>
9683 <signal_cue cue="BoardShip__Standard_Create_GM"/>
9684 </actions>
9685 </cue>
9686
9687 <cue name="BoardShip__Standard_Create_GM">
9688 <conditions>
9689 <event_cue_signalled/>
9690 </conditions>
9691 <cues>
9692 <!-- Trigger actual GM, passing the specified parameters -->
9693 <cue name="BoardShip__Standard_Ref" ref="md.GM_BoardShip.Start">
9694 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
9695 <param name="MissionCue" value="$MissionCue"/>
9696 <param name="MissionThread" value="$Definition.$ThreadCue"/>
9697 <param name="ReportSignalCue" value="BoardShip__Standard_GM_Event"/>
9698 <param name="WithoutOffer" value="true"/>
9699 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
9700 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
9701
9702 <param name="Page" value="$Page"/>
9703 <param name="TextOffset" value="$TextOffset"/>
9704 <param name="MissionLevel" value="3"/>
9705 <param name="Difficulty" value="$Difficulty"/>
9706 <param name="MissionDuration" value="$MissionDuration"/>
9707
9708 <param name="Faction" value="$Definition.$ThreadData.$Faction"/>
9709 <param name="TargetShip" value="$TargetShip" comment="pass either TargetShip or TargetSpecs!"/>
9710 <param name="TargetSpec" value="$TargetSpec"/>
9711
9712 <param name="DebugChance" value="$DebugChance"/>
9713 </cue>
9714
9715 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
9716 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
9717 <cue name="BoardShip__Standard_GM_Event" instantiate="true">
9718 <conditions>
9719 <event_cue_signalled/>
9720 </conditions>
9721 <actions>
9722 <include_actions ref="MM__Standard_GM_Event"/>
9723 </actions>
9724 </cue>
9725 </cues>
9726 </cue>
9727 </cues>
9728 </cue>
9729
9730 <!--Variant Helper Libraries
9731 Helper libraries to be call from different threads but want to have the same basic variant rules
9732 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-->
9733
9734 <cue name="Scan__Standard" instantiate="true" namespace="this">
9735 <conditions>
9736 <event_cue_signalled/>
9737 <!--Signal the static cue to trigger a new instance of this mission.
9738 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
9739 </conditions>
9740 <actions>
9741 <set_value name="$Definition" exact="event.param"/>
9742 <set_value name="$Page" exact="$Definition.$Page"/>
9743 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
9744 <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."/>
9745 <set_value name="$SuccessfullyGenerated" exact="false"/>
9746 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
9747 <set_value name="$Difficulty" exact="level.medium"/>
9748 <set_value name="$EnemyFaction" exact="$Definition.$ThreadData.$EnemyFaction"/>
9749 <set_value name="$TargetShip" exact="null"/>
9750 <set_value name="$TargetStation" exact="null"/>
9751 <set_value name="$TargetModule" exact="null"/>
9752 <set_value name="$TargetWare" exact="null"/>
9753 <set_value name="$TargetItem" exact="null"/>
9754 <set_value name="$TargetPerson" exact="null"/>
9755 <set_value name="$TargetPersonName" exact="null"/>
9756 <set_value name="$TargetIDCode" exact="null"/>
9757 <set_value name="$ScanPercentage" exact="null"/>
9758 <set_value name="$ScanShip" exact="null"/>
9759
9760 <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]'"/>
9761
9762 <!--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.
9763 $Valid:
9764 0: Page/TextOffset not handled
9765 1: Correct Page/TextOffset but unable to setup mission
9766 2: Mission can attempt to be spawned -->
9767 <set_value name="$Valid" exact="0"/>
9768
9769 <!--### ARGON VS XENON ###-->
9770 <do_if value="$Page == 30210">
9771 <do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
9772 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9773 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
9774 </do_if>
9775 <do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
9776 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9777 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
9778 </do_elseif>
9779 <do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
9780 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9781 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
9782 </do_elseif>
9783 <do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
9784 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9785 <set_value name="$TargetWare" exact="ware.spaceweed"/>
9786 <set_value name="$Difficulty" exact="level.impossible"/>
9787 <set_value name="$ScanType" exact="1"/>
9788 </do_elseif>
9789 <do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
9790 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9791 <include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
9792 </do_elseif>
9793 </do_if>
9794
9795 <!--### ARGON VS HOLY ORDER ###-->
9796 <do_elseif value="$Page == 30211">
9797 <do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
9798 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9799 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
9800 </do_if>
9801 <do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
9802 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9803 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
9804 </do_elseif>
9805 <do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
9806 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9807 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
9808 </do_elseif>
9809 <do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
9810 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9811 <set_value name="$TargetWare" exact="ware.spaceweed"/>
9812 <set_value name="$Difficulty" exact="level.hard"/>
9813 <set_value name="$ScanType" exact="1"/>
9814 </do_elseif>
9815 <do_elseif value="$TextOffset == 150400" comment="GM_Scan5 (deepscan ships for specified item)">
9816 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9817 <set_value name="$TargetItem" exact="ware.inv_decryptionmodule"/>
9818 <set_value name="$Difficulty" exact="level.hard"/>
9819 <set_value name="$ScanType" exact="1"/>
9820 </do_elseif>
9821 <do_elseif value="$TextOffset == 150500" comment="GM_Scan6 (deepscan ships for specified person)">
9822 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9823 <include_actions ref="md.GM_Scan.Scan__Random_NPC"/>
9824 </do_elseif>
9825 <do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
9826 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9827 <include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
9828 </do_elseif>
9829 </do_elseif>
9830
9831 <!--### PARANID VS HOLY ORDER ###-->
9832 <do_elseif value="$Page == 30212">
9833 <do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
9834 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9835 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
9836 </do_if>
9837 <do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
9838 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9839 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
9840 </do_elseif>
9841 <do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
9842 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9843 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
9844 </do_elseif>
9845 <do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
9846 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9847 <set_value name="$TargetWare" exact="ware.spaceweed"/>
9848 <set_value name="$Difficulty" exact="level.hard"/>
9849 <set_value name="$ScanType" exact="1"/>
9850 </do_elseif>
9851 <do_elseif value="$TextOffset == 150400" comment="GM_Scan5 (deepscan ships for specified item)">
9852 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9853 <set_value name="$TargetItem" exact="ware.inv_decryptionmodule"/>
9854 <set_value name="$Difficulty" exact="level.hard"/>
9855 <set_value name="$ScanType" exact="1"/>
9856 </do_elseif>
9857 <do_elseif value="$TextOffset == 150500" comment="GM_Scan6 (deepscan ships for specified person)">
9858 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9859 <include_actions ref="md.GM_Scan.Scan__Random_NPC"/>
9860 </do_elseif>
9861 <do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
9862 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9863 <include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
9864 </do_elseif>
9865 </do_elseif>
9866
9867 <!--### HOLY ORDER VS ARGON ###-->
9868 <do_elseif value="$Page == 30213">
9869 <do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
9870 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9871 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
9872 </do_if>
9873 <do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
9874 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9875 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
9876 </do_elseif>
9877 <do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
9878 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9879 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
9880 </do_elseif>
9881 <do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
9882 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9883 <set_value name="$TargetWare" exact="ware.spaceweed"/>
9884 <set_value name="$Difficulty" exact="level.hard"/>
9885 <set_value name="$ScanType" exact="1"/>
9886 </do_elseif>
9887 <do_elseif value="$TextOffset == 150400" comment="GM_Scan5 (deepscan ships for specified item)">
9888 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9889 <set_value name="$TargetItem" exact="ware.inv_decryptionmodule"/>
9890 <set_value name="$Difficulty" exact="level.hard"/>
9891 <set_value name="$ScanType" exact="1"/>
9892 </do_elseif>
9893 <do_elseif value="$TextOffset == 150500" comment="GM_Scan6 (deepscan ships for specified person)">
9894 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9895 <include_actions ref="md.GM_Scan.Scan__Random_NPC"/>
9896 </do_elseif>
9897 <do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
9898 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9899 <include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
9900 </do_elseif>
9901 </do_elseif>
9902
9903 <!--### HOLY ORDER VS PARANID ###-->
9904 <do_elseif value="$Page == 30214">
9905 <do_if value="$TextOffset == 150000" comment="GM_Scan1 (specified ship)">
9906 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9907 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Ship"/>
9908 </do_if>
9909 <do_elseif value="$TextOffset == 150100" comment="GM_Scan2 (specified station)">
9910 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9911 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Station"/>
9912 </do_elseif>
9913 <do_elseif value="$TextOffset == 150200" comment="GM_Scan3 (specified module)">
9914 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9915 <include_actions ref="md.GM_Scan.Scan__High_Security_Enemy_Module"/>
9916 </do_elseif>
9917 <do_elseif value="$TextOffset == 150300" comment="GM_Scan4 (deepscan ships for specified ware)">
9918 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9919 <set_value name="$TargetWare" exact="ware.spaceweed"/>
9920 <set_value name="$Difficulty" exact="level.hard"/>
9921 <set_value name="$ScanType" exact="1"/>
9922 </do_elseif>
9923 <do_elseif value="$TextOffset == 150400" comment="GM_Scan5 (deepscan ships for specified item)">
9924 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9925 <set_value name="$TargetItem" exact="ware.inv_decryptionmodule"/>
9926 <set_value name="$Difficulty" exact="level.hard"/>
9927 <set_value name="$ScanType" exact="1"/>
9928 </do_elseif>
9929 <do_elseif value="$TextOffset == 150500" comment="GM_Scan6 (deepscan ships for specified person)">
9930 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9931 <include_actions ref="md.GM_Scan.Scan__Random_NPC"/>
9932 </do_elseif>
9933 <do_elseif value="$TextOffset == 150600" comment="GM_Scan7 (ship with idcode)">
9934 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
9935 <include_actions ref="md.GM_Scan.Scan__Enemy_Ship_ID_Code"/>
9936 </do_elseif>
9937 </do_elseif>
9938
9939 <do_if value="$TargetShip or $TargetStation or $TargetModule or $TargetPerson or $ScanShip or $TargetItem or $TargetWare">
9940 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
9941 </do_if>
9942
9943 <do_if value="$Valid == 2">
9944 <do_if value="$FollowUp">
9945 <!--Followup missions use the namespace as the mission cue-->
9946 <set_value name="$MissionCue" exact="namespace"/>
9947 </do_if>
9948 <do_else>
9949 <set_value name="$MissionCue" exact="null"/>
9950 </do_else>
9951 </do_if>
9952 <do_else>
9953 <do_if value="$Valid == 1">
9954 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
9955 </do_if>
9956 <do_else>
9957 <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]'"/>
9958 </do_else>
9959 <signal_cue cue="$Definition.$SpawnFailedCue"/>
9960 <cancel_cue cue="this"/>
9961 </do_else>
9962 </actions>
9963 <cues>
9964 <cue name="Scan__Standard_FollowUp_Manager" onfail="cancel">
9965 <conditions>
9966 <check_value value="$FollowUp"/>
9967 </conditions>
9968 <actions>
9969 <!--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.-->
9970 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
9971 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
9972 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
9973 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
9974 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
9975 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
9976 </actions>
9977 <cues>
9978 <cue name="Scan__Standard_FollowUp_Offer_Accepted">
9979 <conditions>
9980 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
9981 <check_value value="event.param == $MissionCue"/>
9982 </conditions>
9983 <actions>
9984 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
9985 TODO @Owen Move this to a library in the GM file?-->
9986 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
9987 <briefing>
9988 <!--TODO @Owen Better objective?-->
9989 <objective step="1" action="objective.scan"/>
9990 </briefing>
9991 </create_mission>
9992 </actions>
9993 </cue>
9994
9995 <cue name="Scan__Standard_Aborted">
9996 <conditions>
9997 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
9998 </conditions>
9999 <actions>
10000 <cancel_cue cue="namespace"/>
10001 </actions>
10002 </cue>
10003
10004 <!--namespace signalled to activate followup mission
10005 event.param = Station to supply-->
10006 <cue name="Scan__Standard_Activate_FollowUp">
10007 <conditions>
10008 <event_cue_signalled cue="namespace"/>
10009 </conditions>
10010 <actions>
10011 <!--Check that the correct parameters have been passed-->
10012 <do_if value="false">
10013 <!--Currently no followup case for this type of mission-->
10014 <signal_cue cue="Scan__Standard_Create_GM"/>
10015 <cancel_cue cue="parent"/>
10016 </do_if>
10017 <do_else>
10018 <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.'"/>
10019 <!--TODO @Owen what if there is another followup mission?-->
10020 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
10021 <cancel_cue cue="namespace"/>
10022 </do_else>
10023 </actions>
10024 </cue>
10025 </cues>
10026 </cue>
10027
10028 <cue name="Scan__Standard_Not_FollowUp" onfail="cancel">
10029 <conditions>
10030 <check_value value="not $FollowUp"/>
10031 </conditions>
10032 <actions>
10033 <signal_cue cue="Scan__Standard_Create_GM"/>
10034 </actions>
10035 </cue>
10036
10037 <cue name="Scan__Standard_Create_GM">
10038 <conditions>
10039 <event_cue_signalled/>
10040 </conditions>
10041 <cues>
10042 <!-- Trigger actual GM, passing the specified parameters -->
10043 <cue name="Scan__Standard_Ref" ref="md.GM_Scan.Start">
10044 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
10045 <param name="MissionCue" value="$MissionCue"/>
10046 <param name="MissionThread" value="$Definition.$ThreadCue"/>
10047 <param name="ReportSignalCue" value="Scan__Standard_GM_Event"/>
10048 <param name="WithoutOffer" value="true"/>
10049 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
10050 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
10051
10052 <param name="Page" value="$Page"/>
10053 <param name="TextOffset" value="$TextOffset"/>
10054 <param name="MissionLevel" value="3"/>
10055 <param name="Difficulty" value="$Difficulty"/>
10056
10057 <param name="TargetShip" value="$TargetShip"/>
10058 <param name="TargetStation" value="$TargetStation"/>
10059 <param name="TargetModule" value="$TargetModule"/>
10060 <param name="TargetWare" value="$TargetWare"/>
10061 <param name="TargetItem" value="$TargetItem"/>
10062 <param name="TargetPersonName" value="$TargetPersonName"/>
10063 <param name="TargetIDCode" value="$TargetIDCode"/>
10064 <param name="ScanType" value="$ScanType"/>
10065 <param name="ScanPercentage" value="$ScanPercentage"/>
10066 <param name="ScanShip" value="$ScanShip"/>
10067
10068 <param name="DebugChance" value="$DebugChance"/>
10069 </cue>
10070
10071 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
10072 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
10073 <cue name="Scan__Standard_GM_Event" instantiate="true">
10074 <conditions>
10075 <event_cue_signalled/>
10076 </conditions>
10077 <actions>
10078 <include_actions ref="MM__Standard_GM_Event"/>
10079 </actions>
10080 </cue>
10081 </cues>
10082 </cue>
10083 </cues>
10084 </cue>
10085
10086 <!--Variant Helper Libraries
10087 Helper libraries to be call from different threads but want to have the same basic variant rules
10088 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-->
10089
10090 <library name="Passenger_Transport__To_Frontline">
10091 <actions>
10092 <set_value name="$TargetStation" exact="null"/>
10093 <set_value name="$PotentialTargetSpaces" exact="null"/>
10094 <do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
10095 <set_value name="$PotentialTargetSpaces" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.list"/>
10096 </do_if>
10097 <do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
10098 <set_value name="$PotentialTargetSpaces" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors"/>
10099 </do_elseif>
10100
10101 <do_while value="$PotentialTargetSpaces.count and not $TargetStation">
10102 <!-- TODO: Would be nice if the target could be a ship, instead of a station -->
10103 <find_station name="$TargetStation" space="$PotentialTargetSpaces.{$PotentialTargetSpaces.count}" owner="$Definition.$ThreadData.$Faction" multiple="false" comment="Station to deliver the passenger"/>
10104 <remove_value name="$PotentialTargetSpaces.{$PotentialTargetSpaces.count}"/>
10105 </do_while>
10106
10107 <do_if value="$TargetStation">
10108 <find_cluster_in_range name="$SourceStationClusters" object="$TargetStation" mindistance="3" maxdistance="4" multiple="true"/>
10109 <do_all exact="$SourceStationClusters.count" counter="$i">
10110 <find_sector name="$SourceStationSectors" space="$SourceStationClusters.{$i}" multiple="true" append="true">
10111 <match_any>
10112 <match owner="$Definition.$ThreadData.$Faction"/>
10113 <match contestedby="$Definition.$ThreadData.$Faction"/>
10114 </match_any>
10115 </find_sector>
10116 </do_all>
10117
10118 <shuffle_list list="$SourceStationClusters"/>
10119 <do_all exact="$SourceStationSectors.count" counter="$i">
10120 <find_station name="$SourceStation" space="$SourceStationSectors.{$i}" owner="$Definition.$ThreadData.$Faction" multiple="false" comment="Station to fetch the passenger"/>
10121 <do_if value="$SourceStation">
10122 <!-- TODO: Make sure we aren't claiming some super-important npc -->
10123
10124 <!--TODO @Owen - this doesn't look right. Improve passenger generation and cleanup-->
10125 <find_object_component name="$TargetPassenger" class="class.npc" object="$SourceStation" multiple="false"/>
10126 <create_cue_actor cue="Passenger_Transport__Standard" name="$TargetPassenger">
10127 <select faction="$SourceStation.owner"/>
10128 <owner exact="$SourceStation.owner"/>
10129 </create_cue_actor>
10130
10131 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
10132 </do_if>
10133 </do_all>
10134 </do_if>
10135 </actions>
10136 </library>
10137
10138 <cue name="Passenger_Transport__Standard" instantiate="true" namespace="this">
10139 <conditions>
10140 <event_cue_signalled/>
10141 <!--Signal the static cue to trigger a new instance of this mission.
10142 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
10143 </conditions>
10144 <actions>
10145 <set_value name="$Definition" exact="event.param"/>
10146 <set_value name="$Page" exact="$Definition.$Page"/>
10147 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
10148 <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."/>
10149 <set_value name="$SuccessfullyGenerated" exact="false"/>
10150 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
10151 <set_value name="$Difficulty" exact="level.medium"/>
10152
10153 <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]'"/>
10154
10155 <!--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.
10156 $Valid:
10157 0: Page/TextOffset not handled
10158 1: Correct Page/TextOffset but unable to setup mission
10159 2: Mission can attempt to be spawned -->
10160 <set_value name="$Valid" exact="0"/>
10161
10162 <!--### ARGON VS XENON ###-->
10163 <do_if value="$Page == 30210">
10164 <do_if value="$TextOffset == 104000" comment="Transport specialist on Xenon to front">
10165 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10166 <include_actions ref="Passenger_Transport__To_Frontline"/>
10167 </do_if>
10168 </do_if>
10169
10170 <!--### ARGON VS HOLY ORDER ###-->
10171 <do_elseif value="$Page == 30211">
10172 <do_if value="$TextOffset == 104000" comment="Transport specialist on Holy Order to front">
10173 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10174 <include_actions ref="Passenger_Transport__To_Frontline"/>
10175 </do_if>
10176 </do_elseif>
10177
10178 <!--### PARANID VS HOLY ORDER ###-->
10179 <do_elseif value="$Page == 30212">
10180 <do_if value="$TextOffset == 104000" comment="Transport specialist on Holy Order to front">
10181 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10182 <include_actions ref="Passenger_Transport__To_Frontline"/>
10183 </do_if>
10184 </do_elseif>
10185
10186 <!--### HOLY ORDER VS ARGON ###-->
10187 <do_elseif value="$Page == 30213">
10188 <do_if value="$TextOffset == 104000" comment="Transport specialist on Holy Order to front">
10189 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10190 <include_actions ref="Passenger_Transport__To_Frontline"/>
10191 </do_if>
10192 </do_elseif>
10193
10194 <!--### HOLY ORDER VS PARANID ###-->
10195 <do_elseif value="$Page == 30214">
10196 <do_if value="$TextOffset == 104000" comment="Transport specialist on Holy Order to front">
10197 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10198 <include_actions ref="Passenger_Transport__To_Frontline"/>
10199 </do_if>
10200 </do_elseif>
10201
10202 <do_if value="$Valid == 2">
10203 <do_if value="$FollowUp">
10204 <!--Followup missions use the namespace as the mission cue-->
10205 <set_value name="$MissionCue" exact="namespace"/>
10206 </do_if>
10207 <do_else>
10208 <set_value name="$MissionCue" exact="null"/>
10209 </do_else>
10210 </do_if>
10211 <do_else>
10212 <do_if value="$Valid == 1">
10213 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
10214 </do_if>
10215 <do_else>
10216 <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]'"/>
10217 </do_else>
10218 <signal_cue cue="$Definition.$SpawnFailedCue"/>
10219 <cancel_cue cue="this"/>
10220 </do_else>
10221 </actions>
10222 <cues>
10223 <cue name="Passenger_Transport__Standard_FollowUp_Manager" onfail="cancel">
10224 <conditions>
10225 <check_value value="$FollowUp"/>
10226 </conditions>
10227 <actions>
10228 <!--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.-->
10229 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
10230 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
10231 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
10232 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
10233 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
10234 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
10235 </actions>
10236 <cues>
10237 <cue name="Passenger_Transport__Standard_FollowUp_Offer_Accepted">
10238 <conditions>
10239 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
10240 <check_value value="event.param == $MissionCue"/>
10241 </conditions>
10242 <actions>
10243 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
10244 TODO @Owen Move this to a library in the GM file?-->
10245 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
10246 <briefing>
10247 <!--TODO @Owen Better objective?-->
10248 <objective step="1" action="objective.transport"/>
10249 </briefing>
10250 </create_mission>
10251 </actions>
10252 </cue>
10253
10254 <cue name="Passenger_Transport__Standard_Aborted">
10255 <conditions>
10256 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
10257 </conditions>
10258 <actions>
10259 <cancel_cue cue="namespace"/>
10260 </actions>
10261 </cue>
10262
10263 <!--namespace signalled to activate followup mission
10264 event.param = Station to supply-->
10265 <cue name="Passenger_Transport__Standard_Activate_FollowUp">
10266 <conditions>
10267 <event_cue_signalled cue="namespace"/>
10268 </conditions>
10269 <actions>
10270 <!--Check that the correct parameters have been passed-->
10271 <do_if value="false">
10272 <!--Currently no followup case for this type of mission-->
10273 <signal_cue cue="Passenger_Transport__Standard_Create_GM"/>
10274 <cancel_cue cue="parent"/>
10275 </do_if>
10276 <do_else>
10277 <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.'"/>
10278 <!--TODO @Owen what if there is another followup mission?-->
10279 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
10280 <cancel_cue cue="namespace"/>
10281 </do_else>
10282 </actions>
10283 </cue>
10284 </cues>
10285 </cue>
10286
10287 <cue name="Passenger_Transport__Standard_Not_FollowUp" onfail="cancel">
10288 <conditions>
10289 <check_value value="not $FollowUp"/>
10290 </conditions>
10291 <actions>
10292 <signal_cue cue="Passenger_Transport__Standard_Create_GM"/>
10293 </actions>
10294 </cue>
10295
10296 <cue name="Passenger_Transport__Standard_Create_GM">
10297 <conditions>
10298 <event_cue_signalled/>
10299 </conditions>
10300 <cues>
10301 <!-- Trigger actual GM, passing the specified parameters -->
10302 <cue name="Passenger_Transport__Standard_Ref" ref="md.GM_Transport_Passengers.Start">
10303 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
10304 <param name="MissionCue" value="$MissionCue"/>
10305 <param name="MissionThread" value="$Definition.$ThreadCue"/>
10306 <param name="ReportSignalCue" value="Passenger_Transport__Standard_GM_Event"/>
10307 <param name="WithoutOffer" value="true"/>
10308 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
10309 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
10310 <param name="Page" value="$Page"/>
10311 <param name="TextOffset" value="$TextOffset"/>
10312 <param name="MissionLevel" value="3"/>
10313 <param name="Difficulty" value="$Difficulty"/>
10314 <param name="ExistingActors" value="[$TargetPassenger]"/>
10315 <param name="UseClient" value="false"/>
10316 <param name="StartContainer" value="$SourceStation"/>
10317 <param name="TargetContainer" value="$TargetStation"/>
10318 <param name="TargetDockArea" value="null"/>
10319 <param name="DebugChance" value="$DebugChance"/>
10320 </cue>
10321
10322 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
10323 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
10324 <cue name="Passenger_Transport__Standard_GM_Event" instantiate="true">
10325 <conditions>
10326 <event_cue_signalled/>
10327 </conditions>
10328 <actions>
10329 <include_actions ref="MM__Standard_GM_Event"/>
10330 </actions>
10331 </cue>
10332 </cues>
10333 </cue>
10334 </cues>
10335 </cue>
10336
10337 <cue name="Sabotage__Standard" instantiate="true" namespace="this">
10338 <conditions>
10339 <event_cue_signalled/>
10340 <!--Signal the static cue to trigger a new instance of this mission.
10341 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
10342 </conditions>
10343 <actions>
10344 <set_value name="$Definition" exact="event.param"/>
10345 <set_value name="$Page" exact="$Definition.$Page"/>
10346 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
10347 <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."/>
10348 <set_value name="$SuccessfullyGenerated" exact="false"/>
10349 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
10350
10351 <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]'"/>
10352
10353 <!--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.
10354 $Valid:
10355 0: Page/TextOffset not handled
10356 1: Correct Page/TextOffset but unable to setup mission
10357 2: Mission can attempt to be spawned -->
10358 <set_value name="$Valid" exact="0"/>
10359 <set_value name="$EnemyFaction" exact="$Definition.$ThreadData.$EnemyFaction"/>
10360
10361 <!--### ARGON VS XENON ###-->
10362 <do_if value="$Page == 30210">
10363 <do_if value="$TextOffset == 14000" comment="sabotage station">
10364 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10365 <set_value name="$TargetClass" exact="[class.turret]"/>
10366 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
10367 </do_if>
10368 <do_elseif value="$TextOffset == 14100" comment="sabotage ship">
10369 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10370 <set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
10371 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
10372 </do_elseif>
10373 </do_if>
10374
10375 <!--### ARGON VS HOLY ORDER -->
10376 <do_elseif value="$Page == 30211">
10377 <do_if value="$TextOffset == 14000" comment="sabotage station">
10378 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10379 <set_value name="$TargetClass" exact="[class.turret]"/>
10380 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
10381 </do_if>
10382 <do_elseif value="$TextOffset == 14100" comment="sabotage ship">
10383 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10384 <set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
10385 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
10386 </do_elseif>
10387 </do_elseif>
10388
10389 <!--### PARANID VS HOLY ORDER ###-->
10390 <do_elseif value="$Page == 30212">
10391 <do_if value="$TextOffset == 14000" comment="sabotage station">
10392 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10393 <set_value name="$TargetClass" exact="[class.turret]"/>
10394 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
10395 </do_if>
10396 <do_elseif value="$TextOffset == 14100" comment="sabotage ship">
10397 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10398 <set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
10399 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
10400 </do_elseif>
10401 </do_elseif>
10402
10403 <!--### HOLY ORDER VS ARGON ###-->
10404 <do_elseif value="$Page == 30213">
10405 <do_if value="$TextOffset == 14000" comment="sabotage station">
10406 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10407 <set_value name="$TargetClass" exact="[class.turret]"/>
10408 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
10409 </do_if>
10410 <do_elseif value="$TextOffset == 14100" comment="sabotage ship">
10411 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10412 <set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
10413 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
10414 </do_elseif>
10415 </do_elseif>
10416
10417 <!--### HOLY ORDER VS PARANID ###-->
10418 <do_elseif value="$Page == 30214">
10419 <do_if value="$TextOffset == 14000" comment="sabotage station">
10420 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10421 <set_value name="$TargetClass" exact="[class.turret]"/>
10422 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Station_Lib"/>
10423 </do_if>
10424 <do_elseif value="$TextOffset == 14100" comment="sabotage ship">
10425 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10426 <set_value name="$TargetClass" exact="[class.engine, class.shieldgenerator]"/>
10427 <include_actions ref="md.GM_Sabotage.Sabotage__Standard_Ship_Lib"/>
10428 </do_elseif>
10429 </do_elseif>
10430
10431 <do_if value="$TargetObject.exists and $TargetComponents.count">
10432 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
10433 </do_if>
10434
10435 <do_if value="$Valid == 2">
10436 <do_if value="$FollowUp">
10437 <!--Followup missions use the namespace as the mission cue-->
10438 <set_value name="$MissionCue" exact="namespace"/>
10439 </do_if>
10440 <do_else>
10441 <set_value name="$MissionCue" exact="null"/>
10442 </do_else>
10443 </do_if>
10444 <do_else>
10445 <do_if value="$Valid == 1">
10446 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
10447 </do_if>
10448 <do_else>
10449 <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]'"/>
10450 </do_else>
10451 <signal_cue cue="$Definition.$SpawnFailedCue"/>
10452 <cancel_cue cue="this"/>
10453 </do_else>
10454 </actions>
10455 <cues>
10456 <cue name="Sabotage__Standard_FollowUp_Manager" onfail="cancel">
10457 <conditions>
10458 <check_value value="$FollowUp"/>
10459 </conditions>
10460 <actions>
10461 <!--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.-->
10462 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
10463 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
10464 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
10465 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
10466 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
10467 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
10468 </actions>
10469 <cues>
10470 <cue name="Sabotage__Standard_FollowUp_Offer_Accepted">
10471 <conditions>
10472 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
10473 <check_value value="event.param == $MissionCue"/>
10474 </conditions>
10475 <actions>
10476 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
10477 TODO @Owen Move this to a library in the GM file?-->
10478 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
10479 <briefing>
10480 <!--TODO @Owen Better objective?-->
10481 <objective step="1" action="objective.destroy"/>
10482 </briefing>
10483 </create_mission>
10484 </actions>
10485 </cue>
10486
10487 <cue name="Sabotage__Standard_Aborted">
10488 <conditions>
10489 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
10490 </conditions>
10491 <actions>
10492 <cancel_cue cue="namespace"/>
10493 </actions>
10494 </cue>
10495
10496 <!--namespace signalled to activate followup mission
10497 event.param = Station to supply-->
10498 <cue name="Sabotage__Standard_Activate_FollowUp">
10499 <conditions>
10500 <event_cue_signalled cue="namespace"/>
10501 </conditions>
10502 <actions>
10503 <!--Check that the correct parameters have been passed-->
10504 <do_if value="false">
10505 <!--Currently no followup case for this type of mission-->
10506 <signal_cue cue="Sabotage__Standard_Create_GM"/>
10507 <cancel_cue cue="parent"/>
10508 </do_if>
10509 <do_else>
10510 <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.'"/>
10511 <!--TODO @Owen what if there is another followup mission?-->
10512 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
10513 <cancel_cue cue="namespace"/>
10514 </do_else>
10515 </actions>
10516 </cue>
10517 </cues>
10518 </cue>
10519
10520 <cue name="Sabotage__Standard_Not_FollowUp" onfail="cancel">
10521 <conditions>
10522 <check_value value="not $FollowUp"/>
10523 </conditions>
10524 <actions>
10525 <signal_cue cue="Sabotage__Standard_Create_GM"/>
10526 </actions>
10527 </cue>
10528
10529 <cue name="Sabotage__Standard_Create_GM">
10530 <conditions>
10531 <event_cue_signalled/>
10532 </conditions>
10533 <actions>
10534 </actions>
10535 <cues>
10536 <cue name="Sabotage__Standard_ChangeOwner" comment="TODO: @Owen, Roger - For demo-purpose">
10537 <conditions>
10538 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
10539 </conditions>
10540 <actions>
10541 <set_owner object="$TargetObject" faction="faction.player"/>
10542 </actions>
10543 </cue>
10544
10545 <cue name="Sabotage__Standard_Ref" ref="md.GM_Sabotage.Start">
10546 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
10547 <param name="MissionCue" value="$MissionCue"/>
10548 <param name="MissionThread" value="$Definition.$ThreadCue"/>
10549 <param name="ReportSignalCue" value="Sabotage__Standard_GM_Event"/>
10550 <param name="WithoutOffer" value="true"/>
10551 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
10552 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
10553 <param name="Page" value="$Page"/>
10554 <param name="TextOffset" value="$TextOffset"/>
10555 <param name="MissionLevel" value="3"/>
10556 <param name="Difficulty" value="level.medium"/>
10557 <param name="EnemyFaction" value="$EnemyFaction"/>
10558 <param name="PrimaryTarget" value="$TargetObject"/>
10559 <param name="TargetComponents" value="$TargetComponents"/>
10560 <param name="DebugChance" value="$DebugChance"/>
10561 </cue>
10562
10563 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
10564 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
10565 <cue name="Sabotage__Standard_GM_Event" instantiate="true">
10566 <conditions>
10567 <event_cue_signalled/>
10568 </conditions>
10569 <actions>
10570 <include_actions ref="MM__Standard_GM_Event"/>
10571 </actions>
10572 </cue>
10573 </cues>
10574 </cue>
10575 </cues>
10576 </cue>
10577
10578 <!--TODO @Owen unused!-->
10579 <cue name="Destroy_Objects__Clear_Explosives" instantiate="true" namespace="this">
10580 <conditions>
10581 <event_cue_signalled/>
10582 <!--Signal the static cue to trigger a new instance of this mission.
10583 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
10584 </conditions>
10585 <actions>
10586 <set_value name="$Definition" exact="event.param"/>
10587 <set_value name="$Page" exact="$Definition.$Page"/>
10588 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
10589 <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."/>
10590 <set_value name="$SuccessfullyGenerated" exact="false"/>
10591 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
10592
10593 <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]'"/>
10594
10595 <!--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.
10596 Could also be done for finding an existing object as a target-->
10597 <!--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.
10598 $Valid:
10599 0: Page/TextOffset not handled
10600 1: Correct Page/TextOffset but unable to setup mission
10601 2: Mission can attempt to be spawned -->
10602 <set_value name="$Valid" exact="0"/>
10603
10604 <!--### ARGON VS XENON ###-->
10605 <do_if value="$Page == 30210">
10606 <do_if value="$TextOffset == 9000">
10607 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10608 <set_value name="$ExplosiveOwner" exact="[faction.scaleplate, faction.hatikvah]" comment="Pirates"/>
10609 <include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
10610 <do_if value="$Explosives.count">
10611 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
10612 </do_if>
10613 </do_if>
10614 </do_if>
10615
10616 <!--### ARGON VS HOLY ORDER###-->
10617 <do_elseif value="$Page == 30211">
10618 <do_if value="$TextOffset == 9000">
10619 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10620 <set_value name="$ExplosiveOwner" exact="[faction.holyorder]" comment="Pirates"/>
10621 <include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
10622 <do_if value="$Explosives.count">
10623 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
10624 </do_if>
10625 </do_if>
10626 </do_elseif>
10627
10628 <!--### PARANID VS HOLY ORDER###-->
10629 <do_elseif value="$Page == 30212">
10630 <do_if value="$TextOffset == 9000">
10631 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10632 <set_value name="$ExplosiveOwner" exact="[faction.holyorder]" comment=""/>
10633 <include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
10634 <do_if value="$Explosives.count">
10635 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
10636 </do_if>
10637 </do_if>
10638 </do_elseif>
10639
10640 <!--### HOLY ORDER VS ARGON ###-->
10641 <do_elseif value="$Page == 30213">
10642 <do_if value="$TextOffset == 9000">
10643 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10644 <set_value name="$Sector" exact="player.sector"/>
10645 <set_value name="$ExplosiveOwner" exact="[faction.scaleplate, faction.hatikvah]" comment="Pirates"/>
10646 <include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
10647 <do_if value="$Explosives.count">
10648 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
10649 </do_if>
10650 </do_if>
10651 </do_elseif>
10652
10653 <!--### HOLY ORDER VS PARANID ###-->
10654 <do_elseif value="$Page == 30214">
10655 <do_if value="$TextOffset == 9000">
10656 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10657 <set_value name="$Sector" exact="player.sector"/>
10658 <set_value name="$ExplosiveOwner" exact="[faction.scaleplate, faction.hatikvah]" comment="Pirates"/>
10659 <include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
10660 <do_if value="$Explosives.count">
10661 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
10662 </do_if>
10663 </do_if>
10664 </do_elseif>
10665
10666 <do_if value="$Valid == 2">
10667 <do_if value="$FollowUp">
10668 <!--Followup missions use the namespace as the mission cue-->
10669 <set_value name="$MissionCue" exact="namespace"/>
10670 </do_if>
10671 <do_else>
10672 <set_value name="$MissionCue" exact="null"/>
10673 </do_else>
10674 </do_if>
10675 <do_else>
10676 <do_if value="$Valid == 1">
10677 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
10678 </do_if>
10679 <do_else>
10680 <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]'"/>
10681 </do_else>
10682 <signal_cue cue="$Definition.$SpawnFailedCue"/>
10683 <cancel_cue cue="this"/>
10684 </do_else>
10685 </actions>
10686 <cues>
10687 <cue name="Destroy_Objects__Clear_Explosives_FollowUp_Manager" onfail="cancel">
10688 <conditions>
10689 <check_value value="$FollowUp"/>
10690 </conditions>
10691 <actions>
10692 <!--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.-->
10693 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
10694 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
10695 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
10696 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
10697 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
10698 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
10699 </actions>
10700 <cues>
10701 <cue name="Destroy_Objects__Clear_Explosives_FollowUp_Offer_Accepted">
10702 <conditions>
10703 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
10704 <check_value value="event.param == $MissionCue"/>
10705 </conditions>
10706 <actions>
10707 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
10708 TODO @Owen Move this to a library in the GM file?-->
10709 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
10710 <briefing>
10711 <!--TODO @Owen Better objective?-->
10712 <objective step="1" action="objective.destroy"/>
10713 </briefing>
10714 </create_mission>
10715 </actions>
10716 </cue>
10717
10718 <cue name="Destroy_Objects__Clear_Explosives_Aborted">
10719 <conditions>
10720 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
10721 </conditions>
10722 <actions>
10723 <cancel_cue cue="namespace"/>
10724 </actions>
10725 </cue>
10726
10727 <!--namespace signalled to activate followup mission
10728 event.param = Station to supply-->
10729 <cue name="Destroy_Objects__Clear_Explosives_Activate_FollowUp">
10730 <conditions>
10731 <event_cue_signalled cue="namespace"/>
10732 </conditions>
10733 <actions>
10734 <!--Check that the correct parameters have been passed-->
10735 <do_if value="false">
10736 <!--Currently no followup case for this type of mission-->
10737 <signal_cue cue="Destroy_Objects__Clear_Explosives_Create_GM"/>
10738 <cancel_cue cue="parent"/>
10739 </do_if>
10740 <do_else>
10741 <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.'"/>
10742 <!--TODO @Owen what if there is another followup mission?-->
10743 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
10744 <cancel_cue cue="namespace"/>
10745 </do_else>
10746 </actions>
10747 </cue>
10748 </cues>
10749 </cue>
10750
10751 <cue name="Destroy_Objects__Clear_Explosives_Not_FollowUp" onfail="cancel">
10752 <conditions>
10753 <check_value value="not $FollowUp"/>
10754 </conditions>
10755 <actions>
10756 <signal_cue cue="Destroy_Objects__Clear_Explosives_Create_GM"/>
10757 </actions>
10758 </cue>
10759
10760 <cue name="Destroy_Objects__Clear_Explosives_Create_GM">
10761 <conditions>
10762 <event_cue_signalled/>
10763 </conditions>
10764 <cues>
10765 <!--event.param == result cue, result saved to event.param.$Targets-->
10766 <cue name="Destroy_Objects__Clear_Explosives__New_Targets" instantiate="true">
10767 <conditions>
10768 <event_cue_signalled/>
10769 </conditions>
10770 <actions>
10771 <include_actions ref="md.GM_Destroy_Objects.FindMinefieldOrRiggedAsteroids" comment="input: $Sector, output: $Explosives"/>
10772 <add_to_group groupname="event.param.$Targets" group="$Explosives"/>
10773 <debug_text text="'Finding new targets as the previous group was invalid. Found: ' + $Explosives.count" chance="$DebugChance"/>
10774 </actions>
10775 </cue>
10776
10777 <!-- Trigger actual GM, passing the specified parameters -->
10778 <cue name="Destroy_Objects__Clear_Explosives_Ref" ref="md.GM_Destroy_Objects.Start">
10779 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
10780 <param name="MissionCue" value="$MissionCue"/>
10781 <param name="MissionThread" value="$Definition.$ThreadCue"/>
10782 <param name="ReportSignalCue" value="Destroy_Objects__Clear_Explosives_GM_Event"/>
10783 <param name="WithoutOffer" value="true"/>
10784 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
10785 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
10786 <param name="Page" value="$Page"/>
10787 <param name="TextOffset" value="$TextOffset"/>
10788 <param name="MissionLevel" value="3"/>
10789 <param name="Difficulty" value="level.medium"/>
10790 <param name="DebugChance" value="$DebugChance"/>
10791
10792 <param name="TargetSector" value="$Explosives.{1}.sector.knownname"/>
10793 <param name="Targets" value="$Explosives"/>
10794 <param name="TargetRequestCue" value="Destroy_Objects__Clear_Explosives__New_Targets"/>
10795 </cue>
10796
10797 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
10798 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
10799 <cue name="Destroy_Objects__Clear_Explosives_GM_Event" instantiate="true">
10800 <conditions>
10801 <event_cue_signalled/>
10802 </conditions>
10803 <actions>
10804 <include_actions ref="MM__Standard_GM_Event"/>
10805 </actions>
10806 </cue>
10807 </cues>
10808 </cue>
10809 </cues>
10810 </cue>
10811
10812 <library name="KillShip__Standard_Lib">
10813 <actions>
10814 <set_value name="$EnemyFaction" exact="$Definition.$ThreadData.$Faction"/>
10815 <!--get_ship_definition reference="$ShipReference" faction="$EnemyFaction" size="class.ship_s" tags="[tag.mission, tag.military]"/-->
10816 <find_ship name="$TargetShip" space="player.galaxy" masstraffic="false" class="[class.ship_s, class.ship_m]" owner="$EnemyFaction"/>
10817 <do_if value="$TargetShip">
10818 <add_to_group groupname="$Targets" object="$TargetShip"/>
10819 <!-- TODO: Set the ship behaviour, see <create_order> -->
10820 <set_value name="$Valid" exact="2" comment="all fine"/>
10821 </do_if>
10822 <do_else>
10823 </do_else>
10824 </actions>
10825 </library>
10826
10827 <cue name="KillShip__Standard" instantiate="true" namespace="this">
10828 <conditions>
10829 <event_cue_signalled/>
10830 <!--Signal the static cue to trigger a new instance of this mission.
10831 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
10832 </conditions>
10833 <actions>
10834 <set_value name="$Definition" exact="event.param"/>
10835 <set_value name="$Page" exact="$Definition.$Page"/>
10836 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
10837 <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."/>
10838 <set_value name="$SuccessfullyGenerated" exact="false"/>
10839 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
10840 <set_value name="$Valid" exact="0"/>
10841 <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]'"/>
10842
10843 <create_group groupname="$Targets"/>
10844
10845 <!--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.
10846 $Valid:
10847 0: Page/TextOffset not handled
10848 1: Correct Page/TextOffset but unable to setup mission
10849 2: Mission can attempt to be spawned -->
10850 <set_value name="$Valid" exact="0"/>
10851
10852 <!--### ARGON VS XENON ###-->
10853 <do_if value="$Page == 30210">
10854 <do_if value="$TextOffset == 11000">
10855 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
10856 <include_actions ref="KillShip__Standard_Lib"/>
10857 </do_if>
10858 </do_if>
10859
10860 <!--### ARGON VS HOLY ORDER ###-->
10861 <do_if value="$Page == 30211">
10862 <do_if value="$TextOffset == 11000">
10863 <include_actions ref="KillShip__Standard_Lib"/>
10864 </do_if>
10865 </do_if>
10866
10867 <!--### PARANID VS HOLY ORDER ###-->
10868 <do_if value="$Page == 30212">
10869 <do_if value="$TextOffset == 11000">
10870 <include_actions ref="KillShip__Standard_Lib"/>
10871 </do_if>
10872 </do_if>
10873
10874 <!--### HOLY ORDER VS ARGON ###-->
10875 <do_if value="$Page == 30213">
10876 <do_if value="$TextOffset == 11000">
10877 <include_actions ref="KillShip__Standard_Lib"/>
10878 </do_if>
10879 </do_if>
10880
10881 <!--### HOLY ORDER VS PARANID ###-->
10882 <do_if value="$Page == 30214">
10883 <do_if value="$TextOffset == 11000">
10884 <include_actions ref="KillShip__Standard_Lib"/>
10885 </do_if>
10886 </do_if>
10887
10888 <do_if value="$Valid == 2">
10889 <do_if value="$FollowUp">
10890 <!--Followup missions use the namespace as the mission cue-->
10891 <set_value name="$MissionCue" exact="namespace"/>
10892 </do_if>
10893 <do_else>
10894 <set_value name="$MissionCue" exact="null"/>
10895 </do_else>
10896 </do_if>
10897 <do_else>
10898 <do_if value="$Valid == 1">
10899 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
10900 </do_if>
10901 <do_else>
10902 <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]'"/>
10903 </do_else>
10904 <signal_cue cue="$Definition.$SpawnFailedCue"/>
10905 <cancel_cue cue="this"/>
10906 </do_else>
10907
10908 </actions>
10909 <cues>
10910 <cue name="KillShip__Standard_FollowUp_Manager" onfail="cancel">
10911 <conditions>
10912 <check_value value="$FollowUp"/>
10913 </conditions>
10914 <actions>
10915 <!--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.-->
10916 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
10917 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
10918 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
10919 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
10920 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
10921 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
10922 </actions>
10923 <cues>
10924 <cue name="KillShip__Standard_FollowUp_Offer_Accepted">
10925 <conditions>
10926 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
10927 <check_value value="event.param == $MissionCue"/>
10928 </conditions>
10929 <actions>
10930 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
10931 TODO @Owen Move this to a library in the GM file?-->
10932 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.destroy">
10933 <briefing>
10934 <!--TODO @Owen Better objective?-->
10935 <objective step="1" action="objective.destroy"/>
10936 </briefing>
10937 </create_mission>
10938 </actions>
10939 </cue>
10940
10941 <cue name="KillShip__Standard_Aborted">
10942 <conditions>
10943 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
10944 </conditions>
10945 <actions>
10946 <cancel_cue cue="namespace"/>
10947 </actions>
10948 </cue>
10949
10950 <!--namespace signalled to activate followup mission
10951 event.param = Station to supply-->
10952 <cue name="KillShip__Standard_Activate_FollowUp">
10953 <conditions>
10954 <event_cue_signalled cue="namespace"/>
10955 </conditions>
10956 <actions>
10957 <!--Check that the correct parameters have been passed-->
10958 <do_if value="false">
10959 <!--Currently no followup case for this type of mission-->
10960 <signal_cue cue="KillShip__Standard_Create_GM"/>
10961 <cancel_cue cue="parent"/>
10962 </do_if>
10963 <do_else>
10964 <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.'"/>
10965 <!--TODO @Owen what if there is another followup mission?-->
10966 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
10967 <cancel_cue cue="namespace"/>
10968 </do_else>
10969 </actions>
10970 </cue>
10971 </cues>
10972 </cue>
10973
10974 <cue name="KillShip__Standard_Not_FollowUp" onfail="cancel">
10975 <conditions>
10976 <check_value value="not $FollowUp"/>
10977 </conditions>
10978 <actions>
10979 <signal_cue cue="KillShip__Standard_Create_GM"/>
10980 </actions>
10981 </cue>
10982
10983 <cue name="KillShip__Standard_Create_GM">
10984 <conditions>
10985 <event_cue_signalled/>
10986 </conditions>
10987 <cues>
10988 <!-- Trigger actual GM, passing the specified parameters -->
10989 <cue name="KillShip__Standard_Ref" ref="md.GM_Destroy_Objects.Start">
10990 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
10991 <param name="MissionCue" value="$MissionCue"/>
10992 <param name="MissionThread" value="$Definition.$ThreadCue"/>
10993 <param name="ReportSignalCue" value="KillShip__Standard_Event"/>
10994 <param name="WithoutOffer" value="true"/>
10995 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
10996 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
10997
10998 <param name="Page" value="$Page"/>
10999 <param name="TextOffset" value="$TextOffset"/>
11000 <param name="MissionLevel" value="3"/>
11001 <param name="Difficulty" value="level.medium"/>
11002
11003 <param name="TargetSector" value="$Explosives.{1}.sector.knownname"/>
11004 <param name="Targets" value="$Targets"/>
11005
11006 <param name="DebugChance" value="$DebugChance"/>
11007 </cue>
11008
11009 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
11010 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
11011 <cue name="KillShip__Standard_Event" instantiate="true">
11012 <conditions>
11013 <event_cue_signalled/>
11014 </conditions>
11015 <actions>
11016 <include_actions ref="MM__Standard_GM_Event"/>
11017 </actions>
11018 </cue>
11019 </cues>
11020 </cue>
11021 </cues>
11022 </cue>
11023
11024 <!--Variant Helper Libraries
11025 Helper libraries to be call from different threads but want to have the same basic variant rules
11026 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-->
11027
11028 <library name="Find_Resources__Allied_Space_1">
11029 <!--TODO @Owen @Roger - better list of resources?-->
11030 <!--Ore, Silicon, Hydrogen-->
11031 <actions>
11032 <set_value name="$Spaces" exact="[]"/>
11033 <do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
11034 <set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted"/>
11035 <shuffle_list list="$Spaces" chance="40"/>
11036 </do_if>
11037 <do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
11038 <set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors"/>
11039 </do_elseif>
11040
11041 <do_if value="$Spaces.count">
11042 <set_value name="$ResourceTryList" exact="[ware.ore, ware.silicon, ware.hydrogen]"/>
11043
11044 <do_all exact="$Spaces.count" counter="$i">
11045 <set_value name="$Space" exact="$Spaces.{$i}"/>
11046 <include_actions ref="md.GM_Find_Resources.Check_Space"/>
11047
11048 <!-- Check that at least something was found - abort otherwise-->
11049 <do_if value="$ResourceList.count == 0">
11050 <debug_text text="'No matching resources found, aborting'" chance="$DebugChance"/>
11051 </do_if>
11052 <do_else>
11053 <set_value name="$Valid" exact="2"/>
11054 <break/>
11055 </do_else>
11056 </do_all>
11057 </do_if>
11058 </actions>
11059 </library>
11060
11061 <library name="Find_Resources__Enemy_Space_1">
11062 <!--TODO @Owen @Roger - better list of resources?-->
11063 <!--Ore, Silicon, Hydrogen-->
11064 <actions>
11065 <set_value name="$Spaces" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.sorted"/>
11066 <shuffle_list list="$Spaces" chance="40"/>
11067
11068 <set_value name="$ResourceTryList" exact="[ware.ore, ware.silicon, ware.hydrogen]"/>
11069
11070 <do_all exact="$Spaces.count" counter="$i">
11071 <set_value name="$Space" exact="$Spaces.{$i}"/>
11072 <include_actions ref="md.GM_Find_Resources.Check_Space"/>
11073
11074 <!-- Check that at least something was found - abort otherwise-->
11075 <do_if value="$ResourceList.count == 0">
11076 <debug_text text="'No matching resources found, aborting'" chance="$DebugChance"/>
11077 </do_if>
11078 <do_else>
11079 <set_value name="$Valid" exact="2"/>
11080 <break/>
11081 </do_else>
11082 </do_all>
11083 </actions>
11084 </library>
11085
11086 <cue name="Find_Resources__Standard" instantiate="true" namespace="this">
11087 <conditions>
11088 <event_cue_signalled/>
11089 <!--Signal the static cue to trigger a new instance of this mission.
11090 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
11091 </conditions>
11092 <actions>
11093 <set_value name="$Definition" exact="event.param"/>
11094 <set_value name="$Page" exact="$Definition.$Page"/>
11095 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
11096 <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."/>
11097 <set_value name="$SuccessfullyGenerated" exact="false"/>
11098 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
11099
11100 <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]'"/>
11101
11102 <!--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.
11103 $Valid:
11104 0: Page/TextOffset not handled
11105 1: Correct Page/TextOffset but unable to setup mission
11106 2: Mission can attempt to be spawned -->
11107 <set_value name="$Valid" exact="0"/>
11108
11109 <!--### ARGON VS XENON ###-->
11110 <do_if value="$Page == 30210">
11111 <!-- Setup what resources we suggest to look for depending on the mission-variation/text -->
11112 <do_if value="$TextOffset == 106000">
11113 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11114 <include_actions ref="Find_Resources__Allied_Space_1"/>
11115 </do_if>
11116 <do_elseif value="$TextOffset == 106100">
11117 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11118 <include_actions ref="Find_Resources__Enemy_Space_1"/>
11119 </do_elseif>
11120 </do_if>
11121
11122 <!--### ARGON VS HOLY ORDER ###-->
11123 <do_elseif value="$Page == 30211">
11124 <do_if value="$TextOffset == 106000">
11125 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11126 <include_actions ref="Find_Resources__Allied_Space_1"/>
11127 </do_if>
11128 <do_elseif value="$TextOffset == 106100">
11129 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11130 <include_actions ref="Find_Resources__Enemy_Space_1"/>
11131 </do_elseif>
11132 </do_elseif>
11133
11134 <!--### PARANID VS HOLY ORDER ###-->
11135 <do_elseif value="$Page == 30212">
11136 <do_if value="$TextOffset == 106000">
11137 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11138 <include_actions ref="Find_Resources__Allied_Space_1"/>
11139 </do_if>
11140 <do_elseif value="$TextOffset == 106100">
11141 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11142 <include_actions ref="Find_Resources__Enemy_Space_1"/>
11143 </do_elseif>
11144 </do_elseif>
11145
11146 <!--### HOLY ORDER VS ARGON ###-->
11147 <do_elseif value="$Page == 30213">
11148 <do_if value="$TextOffset == 106000">
11149 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11150 <include_actions ref="Find_Resources__Allied_Space_1"/>
11151 </do_if>
11152 <do_elseif value="$TextOffset == 106100">
11153 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11154 <include_actions ref="Find_Resources__Enemy_Space_1"/>
11155 </do_elseif>
11156 </do_elseif>
11157
11158 <!--### HOLY ORDER VS PARANID ###-->
11159 <do_elseif value="$Page == 30214">
11160 <do_if value="$TextOffset == 106000">
11161 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11162 <include_actions ref="Find_Resources__Allied_Space_1"/>
11163 </do_if>
11164 <do_elseif value="$TextOffset == 106100">
11165 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11166 <include_actions ref="Find_Resources__Enemy_Space_1"/>
11167 </do_elseif>
11168 </do_elseif>
11169
11170 <do_if value="$Valid == 2">
11171 <do_if value="$FollowUp">
11172 <!--Followup missions use the namespace as the mission cue-->
11173 <set_value name="$MissionCue" exact="namespace"/>
11174 </do_if>
11175 <do_else>
11176 <set_value name="$MissionCue" exact="null"/>
11177 </do_else>
11178 </do_if>
11179 <do_else>
11180 <do_if value="$Valid == 1">
11181 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
11182 </do_if>
11183 <do_else>
11184 <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]'"/>
11185 </do_else>
11186 <signal_cue cue="$Definition.$SpawnFailedCue"/>
11187 <cancel_cue cue="this"/>
11188 </do_else>
11189 </actions>
11190 <cues>
11191 <cue name="Find_Resources__Standard_FollowUp_Manager" onfail="cancel">
11192 <conditions>
11193 <check_value value="$FollowUp"/>
11194 </conditions>
11195 <actions>
11196 <!--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.-->
11197 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
11198 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
11199 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
11200 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
11201 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
11202 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
11203 </actions>
11204 <cues>
11205 <cue name="Find_Resources__Standard_FollowUp_Offer_Accepted">
11206 <conditions>
11207 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
11208 <check_value value="event.param == $MissionCue"/>
11209 </conditions>
11210 <actions>
11211 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
11212 TODO @Owen Move this to a library in the GM file?-->
11213 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
11214 <briefing>
11215 <!--TODO @Owen Better objective?-->
11216 <objective step="1" action="objective.find"/>
11217 </briefing>
11218 </create_mission>
11219 </actions>
11220 </cue>
11221
11222 <cue name="Find_Resources__Standard_Aborted">
11223 <conditions>
11224 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
11225 </conditions>
11226 <actions>
11227 <cancel_cue cue="namespace"/>
11228 </actions>
11229 </cue>
11230
11231 <!--namespace signalled to activate followup mission
11232 event.param = Station to supply-->
11233 <cue name="Find_Resources__Standard_Activate_FollowUp">
11234 <conditions>
11235 <event_cue_signalled cue="namespace"/>
11236 </conditions>
11237 <actions>
11238 <!--Check that the correct parameters have been passed-->
11239 <do_if value="false">
11240 <!--Currently no followup case for this type of mission-->
11241 <signal_cue cue="Find_Resources__Standard_Create_GM"/>
11242 <cancel_cue cue="parent"/>
11243 </do_if>
11244 <do_else>
11245 <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.'"/>
11246 <!--TODO @Owen what if there is another followup mission?-->
11247 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
11248 <cancel_cue cue="namespace"/>
11249 </do_else>
11250 </actions>
11251 </cue>
11252 </cues>
11253 </cue>
11254
11255 <cue name="Find_Resources__Standard_Not_FollowUp" onfail="cancel">
11256 <conditions>
11257 <check_value value="not $FollowUp"/>
11258 </conditions>
11259 <actions>
11260 <signal_cue cue="Find_Resources__Standard_Create_GM"/>
11261 </actions>
11262 </cue>
11263
11264 <cue name="Find_Resources__Standard_Create_GM">
11265 <conditions>
11266 <event_cue_signalled/>
11267 </conditions>
11268 <cues>
11269 <!-- Trigger actual GM, passing the specified parameters -->
11270 <cue name="Find_Resources__Standard_Ref" ref="md.GM_Find_Resources.Start">
11271 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
11272 <param name="MissionCue" value="$MissionCue"/>
11273 <param name="MissionThread" value="$Definition.$ThreadCue"/>
11274 <param name="ReportSignalCue" value="Find_Resources__Standard_GM_Event" comment="tell GM to call this cue when done"/>
11275 <param name="WithoutOffer" value="true"/>
11276 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
11277 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
11278
11279 <param name="Page" value="$Page"/>
11280 <param name="TextOffset" value="$TextOffset"/>
11281
11282 <param name="MissionLevel" value="3"/>
11283 <param name="Difficulty" value="$Difficulty"/>
11284
11285 <param name="FindArea" value="$Space"/>
11286 <param name="ResourceList" value="$ResourceList"/>
11287 <param name="ResourceYieldList" value="$ResourceYieldList"/>
11288
11289 <param name="DebugChance" value="$DebugChance"/>
11290 </cue>
11291
11292 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
11293 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
11294 <cue name="Find_Resources__Standard_GM_Event" instantiate="true">
11295 <conditions>
11296 <event_cue_signalled/>
11297 </conditions>
11298 <actions>
11299 <include_actions ref="MM__Standard_GM_Event"/>
11300 </actions>
11301 </cue>
11302 </cues>
11303 </cue>
11304 </cues>
11305 </cue>
11306
11307 <!--Variant Helper Libraries
11308 Helper libraries to be call from different threads but want to have the same basic variant rules
11309 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-->
11310
11311 <library name="RepairObject__Allied_Job_Ship">
11312 <actions>
11313 <create_group groupname="$TargetObjects"/>
11314 <set_value name="$DamagedShips" exact="[]"/>
11315 <do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
11316 <set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$HostSectors.keys.sorted"/>
11317 <do_while value="$PotentialLocations.count and not $DamagedShips.count">
11318 <do_any>
11319 <set_value name="$PotentialLocation" exact="$PotentialLocations.{1}" weight="50"/>
11320 <set_value name="$PotentialLocation" exact="$PotentialLocations.random" weight="20"/>
11321 </do_any>
11322
11323 <!--<find_ship name="$TestDamageShips" commandeerable="true" primarypurpose="purpose.fight" owner="$Definition.$ThreadData.$Faction" space="$PotentialLocation" multiple="true"/>
11324 <do_all exact="$TestDamageShips.count" counter="$i">
11325 <set_object_hull object="$TestDamageShips.{$i}" min="87" max="88"/>
11326 </do_all>-->
11327
11328 <!--Find a damaged ship which could be commandeered-->
11329 <find_ship name="$PotentialDamagedShips" commandeerable="true" primarypurpose="purpose.fight" owner="$Definition.$ThreadData.$Faction" space="$PotentialLocation" multiple="true">
11330 <match_hull max="89"/>
11331 </find_ship>
11332 <do_if value="$PotentialDamagedShips.count">
11333 <set_value name="$DamagedShips" exact="$PotentialDamagedShips"/>
11334 <break/>
11335 </do_if>
11336 <do_else>
11337 <remove_value name="$PotentialLocations.{$PotentialLocations.indexof.{$PotentialLocation}}"/>
11338 </do_else>
11339 </do_while>
11340 </do_if>
11341 <do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
11342 <set_value name="$PotentialLocations" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.clone"/>
11343 <do_while value="$PotentialLocations.count and not $DamagedShips.count">
11344 <set_value name="$PotentialLocation" exact="$PotentialLocations.random"/>
11345
11346 <!--<find_ship name="$TestDamageShips" commandeerable="true" primarypurpose="purpose.fight" owner="$Definition.$ThreadData.$Faction" space="$PotentialLocation" multiple="true"/>
11347 <do_all exact="$TestDamageShips.count" counter="$i">
11348 <set_object_hull object="$TestDamageShips.{$i}" min="87" max="88"/>
11349 </do_all>-->
11350
11351 <!--Find a damaged ship which could be commandeered-->
11352 <find_ship name="$PotentialDamagedShips" commandeerable="true" primarypurpose="purpose.fight" owner="$Definition.$ThreadData.$Faction" space="$PotentialLocation" multiple="true">
11353 <match_hull max="89"/>
11354 </find_ship>
11355 <do_if value="$PotentialDamagedShips.count">
11356 <set_value name="$DamagedShips" exact="$PotentialDamagedShips"/>
11357 <break/>
11358 </do_if>
11359 <do_else>
11360 <remove_value name="$PotentialLocations.{$PotentialLocations.indexof.{$PotentialLocation}}"/>
11361 </do_else>
11362 </do_while>
11363 </do_elseif>
11364
11365 <do_if value="$DamagedShips.count">
11366 <add_to_group groupname="$TargetObjects" object="$DamagedShips.random"/>
11367 <set_value name="$RepairPercentage" exact="90"/>
11368
11369 <!--TODO @Owen select sub-components-->
11370
11371 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
11372 </do_if>
11373 </actions>
11374 </library>
11375
11376 <cue name="RepairObject__Standard" instantiate="true" namespace="this">
11377 <conditions>
11378 <event_cue_signalled/>
11379 <!--Signal the static cue to trigger a new instance of this mission.
11380 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
11381 </conditions>
11382 <actions>
11383 <set_value name="$Definition" exact="event.param"/>
11384 <set_value name="$Page" exact="$Definition.$Page"/>
11385 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
11386 <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."/>
11387 <set_value name="$SuccessfullyGenerated" exact="false"/>
11388 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
11389
11390 <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]'"/>
11391
11392 <!--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.
11393 $Valid:
11394 0: Page/TextOffset not handled
11395 1: Correct Page/TextOffset but unable to setup mission
11396 2: Mission can attempt to be spawned -->
11397 <set_value name="$Valid" exact="0"/>
11398
11399 <!--### ARGON VS XENON ###-->
11400 <do_if value="$Page == 30210">
11401 <do_if value="$TextOffset == 103000">
11402 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11403 <include_actions ref="RepairObject__Allied_Job_Ship"/>
11404 </do_if>
11405 </do_if>
11406
11407 <!--### ARGON VS HOLY ORDER ###-->
11408 <do_elseif value="$Page == 30211">
11409 <do_if value="$TextOffset == 103000">
11410 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11411 <include_actions ref="RepairObject__Allied_Job_Ship"/>
11412 </do_if>
11413 </do_elseif>
11414
11415 <!--### PARANID VS HOLY ORDER ###-->
11416 <do_elseif value="$Page == 30212">
11417 <do_if value="$TextOffset == 103000">
11418 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11419 <include_actions ref="RepairObject__Allied_Job_Ship"/>
11420 </do_if>
11421 </do_elseif>
11422
11423 <!--### HOLY ORDER VS ARGON ###-->
11424 <do_elseif value="$Page == 30213">
11425 <do_if value="$TextOffset == 103000">
11426 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11427 <include_actions ref="RepairObject__Allied_Job_Ship"/>
11428 </do_if>
11429 </do_elseif>
11430
11431 <!--### HOLY ORDER VS PARANID ###-->
11432 <do_elseif value="$Page == 30214">
11433 <do_if value="$TextOffset == 103000">
11434 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11435 <include_actions ref="RepairObject__Allied_Job_Ship"/>
11436 </do_if>
11437 </do_elseif>
11438
11439 <do_if value="$Valid == 2">
11440 <do_if value="$FollowUp">
11441 <!--Followup missions use the namespace as the mission cue-->
11442 <set_value name="$MissionCue" exact="namespace"/>
11443 </do_if>
11444 <do_else>
11445 <set_value name="$MissionCue" exact="null"/>
11446 </do_else>
11447 </do_if>
11448 <do_else>
11449 <do_if value="$Valid == 1">
11450 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
11451 </do_if>
11452 <do_else>
11453 <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]'"/>
11454 </do_else>
11455 <signal_cue cue="$Definition.$SpawnFailedCue"/>
11456 <cancel_cue cue="this"/>
11457 </do_else>
11458 </actions>
11459 <cues>
11460 <cue name="RepairObject__Standard_FollowUp_Manager" onfail="cancel">
11461 <conditions>
11462 <check_value value="$FollowUp"/>
11463 </conditions>
11464 <actions>
11465 <!--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.-->
11466 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
11467 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
11468 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
11469 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
11470 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
11471 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
11472 </actions>
11473 <cues>
11474 <cue name="RepairObject__Standard_FollowUp_Offer_Accepted">
11475 <conditions>
11476 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
11477 <check_value value="event.param == $MissionCue"/>
11478 </conditions>
11479 <actions>
11480 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
11481 TODO @Owen Move this to a library in the GM file?-->
11482 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.repair">
11483 <briefing>
11484 <!--TODO @Owen Better objective?-->
11485 <objective step="1" action="objective.repair"/>
11486 </briefing>
11487 </create_mission>
11488 </actions>
11489 </cue>
11490
11491 <cue name="RepairObject__Standard_Aborted">
11492 <conditions>
11493 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
11494 </conditions>
11495 <actions>
11496 <cancel_cue cue="namespace"/>
11497 </actions>
11498 </cue>
11499
11500 <!--namespace signalled to activate followup mission
11501 event.param = Station to supply-->
11502 <cue name="RepairObject__Standard_Activate_FollowUp">
11503 <conditions>
11504 <event_cue_signalled cue="namespace"/>
11505 </conditions>
11506 <actions>
11507 <!--Check that the correct parameters have been passed-->
11508 <do_if value="false">
11509 <!--Currently no followup case for this type of mission-->
11510 <signal_cue cue="RepairObject__Standard_Create_GM"/>
11511 <cancel_cue cue="parent"/>
11512 </do_if>
11513 <do_else>
11514 <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.'"/>
11515 <!--TODO @Owen what if there is another followup mission?-->
11516 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
11517 <cancel_cue cue="namespace"/>
11518 </do_else>
11519 </actions>
11520 </cue>
11521 </cues>
11522 </cue>
11523
11524 <cue name="RepairObject__Standard_Not_FollowUp" onfail="cancel">
11525 <conditions>
11526 <check_value value="not $FollowUp"/>
11527 </conditions>
11528 <actions>
11529 <signal_cue cue="RepairObject__Standard_Create_GM"/>
11530 </actions>
11531 </cue>
11532
11533 <cue name="RepairObject__Standard_Create_GM">
11534 <conditions>
11535 <event_cue_signalled/>
11536 </conditions>
11537 <cues>
11538 <cue name="RepairObject__Standard_Ref" ref="md.GM_RepairObject.Start">
11539 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
11540 <param name="MissionCue" value="$MissionCue"/>
11541 <param name="MissionThread" value="$Definition.$ThreadCue"/>
11542 <param name="ReportSignalCue" value="RepairObject__Standard_GM_Event"/>
11543 <param name="WithoutOffer" value="true"/>
11544 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
11545 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
11546
11547 <param name="Page" value="$Page"/>
11548 <param name="TextOffset" value="$TextOffset"/>
11549 <param name="MissionLevel" value="3"/>
11550 <param name="Difficulty" value="level.medium"/>
11551
11552 <param name="Targets" value="$TargetObjects"/>
11553 <param name="RepairPercentage" value="$RepairPercentage"/>
11554
11555 <param name="DebugChance" value="$DebugChance"/>
11556 </cue>
11557
11558 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
11559 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
11560 <cue name="RepairObject__Standard_GM_Event" instantiate="true">
11561 <conditions>
11562 <event_cue_signalled/>
11563 </conditions>
11564 <actions>
11565 <do_if value="@static.$EndFeedbackValue" comment="Evaluate return-value of GM (success/failure)">
11566 <debug_text text="'Mission ended. feedback' + static.$EndFeedbackValue" chance="$DebugChance"/>
11567
11568 <do_if value="$SuccessfullyGenerated">
11569 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
11570 </do_if>
11571 <do_else>
11572 <signal_cue_instantly cue="$Definition.$SpawnFailedCue"/>
11573 </do_else>
11574
11575 <!-- handle EndFeedbackValue of the GM -->
11576 <do_if value="static.$EndFeedbackValue.$ID" exact="'$MISSION_SUCCEEDED'" comment="see the $FeedbackValues table in the Generic Mission">
11577 <do_if value="@$MissionDataTable.$NextMission">
11578 <do_if value="false" comment="Forced failure as there are no valid NextMission cases defined for this mission. Replace with valid case if needed.">
11579
11580 </do_if>
11581 <do_else>
11582 <!--If there is a followup mission, signal it with whatever parameters it needs-->
11583 <assert value="false" text="'Next mission ' + $MissionDataTable.$NextMission + ' is missing handling in ' + namespace + '. It should be explicitly signalled with whatever parameters it requires. [Owen]'"/>
11584 </do_else>
11585 </do_if>
11586 </do_if>
11587 <do_elseif value="static.$EndFeedbackValue.$ID" exact="'$MISSION_TIMEOUT'">
11588 </do_elseif>
11589 </do_if>
11590 <do_elseif value="@static.$FeedbackValue">
11591 <debug_text text="'Mission signalled with feedback' + static.$FeedbackValue" chance="$DebugChance"/>
11592 <do_if value="static.$FeedbackValue.$ID == '$MISSION_GENERATED'">
11593 <!--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-->
11594 <do_if value="not $FollowUp">
11595 <set_value name="$MissionDataTable" exact="event.param.clone"/>
11596 <set_value name="$MissionDataTable.$WrapperCue" exact="namespace"/>
11597 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
11598 </do_if>
11599 <set_value name="$SuccessfullyGenerated" exact="true"/>
11600 </do_if>
11601 </do_elseif>
11602 </actions>
11603 <cues>
11604 <cue name="RepairObject__Standard_GM_Event_Cleanup" onfail="cancel">
11605 <conditions>
11606 <check_value value="@static.$EndFeedbackValue"/>
11607 </conditions>
11608 <actions>
11609 <!--Delayed cleanup to allow other sections to perform their actions-->
11610 <cancel_cue cue="namespace"/>
11611 </actions>
11612 </cue>
11613 </cues>
11614 </cue>
11615
11616 <!--Specialised cue to handle the variant of damaged ships. Outside of the GM to reduce bloat.
11617 Ships will be commandeered, given an order to wait in a certain location. On the mission ending, it will be released.-->
11618 <cue name="RepairObject__Standard_Manage_Damaged_Ships">
11619 <conditions>
11620 <event_cue_signalled cue="RepairObject__Standard_GM_Event"/>
11621 <check_value value="$Page == 30211 and $TextOffset == 103000"/>
11622 <check_value value="not @RepairObject__Standard_GM_Event.$EndFeedbackValue" comment="GM has not ended"/>
11623 <check_value value="@RepairObject__Standard_GM_Event.$FeedbackValue and RepairObject__Standard_GM_Event.$FeedbackValue.$ID == '$mission_generated'" comment="GM has been successfully generated"/>
11624 </conditions>
11625 <actions>
11626 <create_group groupname="this.$Commandeered"/>
11627 <do_all exact="$TargetObjects.count" counter="$i">
11628 <do_if value="$TargetObjects.{$i}.isclass.ship">
11629 <assert value="$TargetObjects.{$i}.iscommandeerable" text="'Ship ' + $TargetObjects.{$i} + ' ' + $TargetObjects.{$i}.knownname + ' is not commandeerable and may wander off during the mission [Owen]'"/>
11630 <do_if value="$TargetObjects.{$i}.iscommandeerable">
11631 <debug_text text="'Commandeering ship ' + $TargetObjects.{$i} + ' ' + $TargetObjects.{$i}.knownname" chance="$DebugChance"/>
11632 <commandeer_object object="$TargetObjects.{$i}"/>
11633 <add_to_group groupname="this.$Commandeered" object="$TargetObjects.{$i}"/>
11634
11635 <cancel_all_orders object="$TargetObjects.{$i}"/>
11636 <create_order id="'Wait'" object="$TargetObjects.{$i}" default="true">
11637 <param name="debugchance" value="$DebugChance"/>
11638 </create_order>
11639 </do_if>
11640 </do_if>
11641 </do_all>
11642 </actions>
11643 <cues>
11644 <cue name="RepairObject__Standard_Manage_Damaged_Ships_GM_Ended">
11645 <conditions>
11646 <event_cue_signalled cue="RepairObject__Standard_GM_Event"/>
11647 <check_value value="@RepairObject__Standard_GM_Event.$EndFeedbackValue" comment="GM has ended"/>
11648 </conditions>
11649 <actions>
11650 <debug_text text="'meh ' + RepairObject__Standard_GM_Event.$EndFeedbackValue"/>
11651 <do_all exact="parent.$Commandeered.count" counter="$i">
11652 <debug_text text="'Releasing commandeered ship ' + parent.$Commandeered.{$i} + ' ' + parent.$Commandeered.{$i}.knownname" chance="$DebugChance"/>
11653 <release_commandeered_object object="parent.$Commandeered.{$i}"/>
11654 </do_all>
11655 </actions>
11656 </cue>
11657 </cues>
11658 </cue>
11659 </cues>
11660 </cue>
11661 </cues>
11662 </cue>
11663
11664 <!--Variant Helper Libraries
11665 Helper libraries to be call from different threads but want to have the same basic variant rules
11666 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-->
11667
11668 <library name="Assassinate__Enemy_S_M_Ship">
11669 <actions>
11670 <do_if value="$Definition.$ThreadData.$WarFront.$HostSectors.keys.count">
11671 <do_any>
11672 <set_value name="$Space" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.sorted.{1}"/>
11673 <set_value name="$Space" exact="$Definition.$ThreadData.$WarFront.$EnemySectors.keys.random"/>
11674 </do_any>
11675 </do_if>
11676 <do_elseif value="$Definition.$ThreadData.$WarFront.$ContestedSectors.count">
11677 <set_value name="$Space" exact="$Definition.$ThreadData.$WarFront.$ContestedSectors.random"/>
11678 </do_elseif>
11679
11680 <do_if value="$Space">
11681 <find_ship name="$TargetShip" owner="$Definition.$ThreadData.$EnemyFaction" class="[class.ship_s, class.ship_m]" hascommander="false" space="$Space"/>
11682
11683 <do_if value="$TargetShip">
11684 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
11685 </do_if>
11686 </do_if>
11687 </actions>
11688 </library>
11689
11690 <cue name="Assassinate__Standard" instantiate="true" namespace="this">
11691 <conditions>
11692 <event_cue_signalled/>
11693 <!--Signal the static cue to trigger a new instance of this mission.
11694 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
11695 </conditions>
11696 <actions>
11697 <set_value name="$Definition" exact="event.param"/>
11698 <set_value name="$Page" exact="$Definition.$Page"/>
11699 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
11700 <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."/>
11701 <set_value name="$SuccessfullyGenerated" exact="false"/>
11702 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
11703
11704 <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]'"/>
11705
11706 <!--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.
11707 $Valid:
11708 0: Page/TextOffset not handled
11709 1: Correct Page/TextOffset but unable to setup mission
11710 2: Mission can attempt to be spawned -->
11711 <set_value name="$Valid" exact="0"/>
11712
11713 <!--### ARGON VS XENON ###-->
11714 <do_if value="$Page == 30210">
11715 <do_if value="$TextOffset == 107000 or $TextOffset == 107100">
11716 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11717 <include_actions ref="Assassinate__Enemy_S_M_Ship"/>
11718 </do_if>
11719 </do_if>
11720
11721 <!--### ARGON VS HOLY ORDER ###-->
11722 <do_elseif value="$Page == 30211">
11723 <do_if value="$TextOffset == 107000 or $TextOffset == 107100">
11724 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11725 <include_actions ref="Assassinate__Enemy_S_M_Ship"/>
11726 </do_if>
11727 </do_elseif>
11728
11729 <!--### PARANID VS HOLY ORDER ###-->
11730 <do_elseif value="$Page == 30212">
11731 <do_if value="$TextOffset == 107000 or $TextOffset == 107100">
11732 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11733 <include_actions ref="Assassinate__Enemy_S_M_Ship"/>
11734 </do_if>
11735 </do_elseif>
11736
11737 <!--### HOLY ORDER VS ARGON ###-->
11738 <do_elseif value="$Page == 30213">
11739 <do_if value="$TextOffset == 107000 or $TextOffset == 107100">
11740 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11741 <include_actions ref="Assassinate__Enemy_S_M_Ship"/>
11742 </do_if>
11743 </do_elseif>
11744
11745 <!--### HOLY ORDER VS PARANID ###-->
11746 <do_elseif value="$Page == 30214">
11747 <do_if value="$TextOffset == 107000 or $TextOffset == 107100">
11748 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11749 <include_actions ref="Assassinate__Enemy_S_M_Ship"/>
11750 </do_if>
11751 </do_elseif>
11752
11753 <do_if value="$Valid == 2">
11754 <do_if value="$FollowUp">
11755 <!--Followup missions use the namespace as the mission cue-->
11756 <set_value name="$MissionCue" exact="namespace"/>
11757 </do_if>
11758 <do_else>
11759 <set_value name="$MissionCue" exact="null"/>
11760 </do_else>
11761 </do_if>
11762 <do_else>
11763 <do_if value="$Valid == 1">
11764 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
11765 </do_if>
11766 <do_else>
11767 <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]'"/>
11768 </do_else>
11769 <signal_cue cue="$Definition.$SpawnFailedCue"/>
11770 <cancel_cue cue="this"/>
11771 </do_else>
11772 </actions>
11773 <cues>
11774 <cue name="Assassinate__Standard_FollowUp_Manager" onfail="cancel">
11775 <conditions>
11776 <check_value value="$FollowUp"/>
11777 </conditions>
11778 <actions>
11779 <!--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.-->
11780 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
11781 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
11782 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
11783 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
11784 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
11785 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
11786 </actions>
11787 <cues>
11788 <cue name="Assassinate__Standard_FollowUp_Offer_Accepted">
11789 <conditions>
11790 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
11791 <check_value value="event.param == $MissionCue"/>
11792 </conditions>
11793 <actions>
11794 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
11795 TODO @Owen Move this to a library in the GM file?-->
11796 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.deliver">
11797 <briefing>
11798 <!--TODO @Owen Better objective?-->
11799 <objective step="1" action="objective.find"/>
11800 </briefing>
11801 </create_mission>
11802 </actions>
11803 </cue>
11804
11805 <cue name="Assassinate__Standard_Aborted">
11806 <conditions>
11807 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
11808 </conditions>
11809 <actions>
11810 <cancel_cue cue="namespace"/>
11811 </actions>
11812 </cue>
11813
11814 <!--namespace signalled to activate followup mission
11815 event.param = Station to supply-->
11816 <cue name="Assassinate__Standard_Activate_FollowUp">
11817 <conditions>
11818 <event_cue_signalled cue="namespace"/>
11819 </conditions>
11820 <actions>
11821 <!--Check that the correct parameters have been passed-->
11822 <do_if value="false">
11823 <!--Currently no followup case for this type of mission-->
11824 <signal_cue cue="Assassinate__Standard_Create_GM"/>
11825 <cancel_cue cue="parent"/>
11826 </do_if>
11827 <do_else>
11828 <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.'"/>
11829 <!--TODO @Owen what if there is another followup mission?-->
11830 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
11831 <cancel_cue cue="namespace"/>
11832 </do_else>
11833 </actions>
11834 </cue>
11835 </cues>
11836 </cue>
11837
11838 <cue name="Assassinate__Standard_Not_FollowUp" onfail="cancel">
11839 <conditions>
11840 <check_value value="not $FollowUp"/>
11841 </conditions>
11842 <actions>
11843 <signal_cue cue="Assassinate__Standard_Create_GM"/>
11844 </actions>
11845 </cue>
11846
11847 <cue name="Assassinate__Standard_Create_GM">
11848 <conditions>
11849 <event_cue_signalled/>
11850 </conditions>
11851 <cues>
11852 <!-- Trigger actual GM, passing the specified parameters -->
11853 <cue name="Assassinate__Standard_Ref" ref="md.GM_Assassinate.Start">
11854 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
11855 <param name="MissionCue" value="$MissionCue"/>
11856 <param name="MissionThread" value="$Definition.$ThreadCue"/>
11857 <param name="ReportSignalCue" value="Assassinate__Standard_GM_Event" comment="tell GM to call this cue when done"/>
11858 <param name="WithoutOffer" value="true"/>
11859 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
11860 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
11861
11862 <param name="Page" value="$Page"/>
11863 <param name="TextOffset" value="$TextOffset"/>
11864
11865 <param name="MissionLevel" value="3"/>
11866 <param name="Difficulty" value="level.medium"/>
11867
11868 <param name="AssassinationTarget" value="$TargetShip.pilot"/>
11869
11870 <param name="DebugChance" value="$DebugChance"/>
11871 </cue>
11872
11873 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
11874 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
11875 <cue name="Assassinate__Standard_GM_Event" instantiate="true">
11876 <conditions>
11877 <event_cue_signalled/>
11878 </conditions>
11879 <actions>
11880 <include_actions ref="MM__Standard_GM_Event"/>
11881 </actions>
11882 </cue>
11883 </cues>
11884 </cue>
11885 </cues>
11886 </cue>
11887
11888 <library name="Support_Invasion__Get_Invasion">
11889 <actions>
11890 <do_if value="$Definition.$ThreadData.$WarFront.$HostInvasions.count">
11891 <shuffle_list list="$Definition.$ThreadData.$WarFront.$HostInvasions"/>
11892 <do_all exact="$Definition.$ThreadData.$WarFront.$HostInvasions.count" counter="$i">
11893 <do_if value="$Definition.$ThreadData.$WarFront.$HostInvasions.{$i}.exists">
11894 <set_value name="$InvasionCue" exact="$Definition.$ThreadData.$WarFront.$HostInvasions.{$i}"/>
11895 <set_value name="$Valid" exact="2" comment="Valid mission variables"/>
11896 <break/>
11897 </do_if>
11898 </do_all>
11899 </do_if>
11900 </actions>
11901 </library>
11902
11903 <cue name="Support_Invasion__Standard" instantiate="true" namespace="this">
11904 <conditions>
11905 <event_cue_signalled/>
11906 <!--Signal the static cue to trigger a new instance of this mission.
11907 Signalling a running instance will trigger a followup mission to run its GM library. See XXX_Activate_FollowUp cue for parameters-->
11908 </conditions>
11909 <actions>
11910 <set_value name="$Definition" exact="event.param"/>
11911 <set_value name="$Page" exact="$Definition.$Page"/>
11912 <set_value name="$TextOffset" exact="$Definition.$TextOffset.random"/>
11913 <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."/>
11914 <set_value name="$SuccessfullyGenerated" exact="false"/>
11915 <set_value name="$DebugChance" exact="$Definition.$ThreadData.$DebugChance"/>
11916
11917 <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]'"/>
11918
11919 <!--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.
11920 $Valid:
11921 0: Page/TextOffset not handled
11922 1: Correct Page/TextOffset but unable to setup mission
11923 2: Mission can attempt to be spawned -->
11924 <set_value name="$Valid" exact="0"/>
11925
11926 <!--### ARGON VS XENON ###-->
11927 <do_if value="$Page == 30210">
11928 <do_if value="$TextOffset == 109000">
11929 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11930 <include_actions ref="Support_Invasion__Get_Invasion"/>
11931 </do_if>
11932 </do_if>
11933
11934 <!--### ARGON VS HOLY ORDER ###-->
11935 <do_elseif value="$Page == 30211">
11936 <do_if value="$TextOffset == 109000">
11937 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11938 <include_actions ref="Support_Invasion__Get_Invasion"/>
11939 </do_if>
11940 </do_elseif>
11941
11942 <!--### PARANID VS HOLY ORDER ###-->
11943 <do_elseif value="$Page == 30212">
11944 <do_if value="$TextOffset == 109000">
11945 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11946 <include_actions ref="Support_Invasion__Get_Invasion"/>
11947 </do_if>
11948 </do_elseif>
11949
11950 <!--### HOLY ORDER VS ARGON ###-->
11951 <do_elseif value="$Page == 30213">
11952 <do_if value="$TextOffset == 109000">
11953 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11954 <include_actions ref="Support_Invasion__Get_Invasion"/>
11955 </do_if>
11956 </do_elseif>
11957
11958 <!--### HOLY ORDER VS PARANID ###-->
11959 <do_elseif value="$Page == 30214">
11960 <do_if value="$TextOffset == 109000">
11961 <set_value name="$Valid" exact="1" comment="Valid text offset"/>
11962 <include_actions ref="Support_Invasion__Get_Invasion"/>
11963 </do_if>
11964 </do_elseif>
11965
11966 <do_if value="$Valid == 2">
11967 <do_if value="$FollowUp">
11968 <!--Followup missions use the namespace as the mission cue-->
11969 <set_value name="$MissionCue" exact="namespace"/>
11970 </do_if>
11971 <do_else>
11972 <set_value name="$MissionCue" exact="null"/>
11973 </do_else>
11974 </do_if>
11975 <do_else>
11976 <do_if value="$Valid == 1">
11977 <debug_text text="'Unable to find suitable variant variables for mission on ' + this + ' with combination of Page: ' + $Page + ' and TextOffset: ' + $TextOffset + '. [Owen]'" chance="$DebugChance"/>
11978 </do_if>
11979 <do_else>
11980 <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]'"/>
11981 </do_else>
11982 <signal_cue cue="$Definition.$SpawnFailedCue"/>
11983 <cancel_cue cue="this"/>
11984 </do_else>
11985 </actions>
11986 <cues>
11987 <cue name="Support_Invasion__Standard_FollowUp_Manager" onfail="cancel">
11988 <conditions>
11989 <check_value value="$FollowUp"/>
11990 </conditions>
11991 <actions>
11992 <!--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.-->
11993 <!--Currently means you need to find the mission name here, instead of relying on the GM itself finding it.-->
11994 <set_value name="$MissionName" exact="readtext.{$Page}.{$TextOffset + 1}"/>
11995 <set_value name="$MissionDescription" exact="readtext.{$Page}.{$TextOffset + 2}"/>
11996 <debug_text text="'Attempting to signal the mission thread that followup mission cue ' + $MissionCue + ' is ready to be added to the offer'" chance="$DebugChance"/>
11997 <set_value name="$MissionDataTable" exact="table[$Name = $MissionName, $Cue = $MissionCue, $WrapperCue = $MissionCue, $FollowUp = true]"/>
11998 <signal_cue_instantly cue="$Definition.$SpawnSuccessCue" param="$MissionDataTable"/>
11999 </actions>
12000 <cues>
12001 <cue name="Support_Invasion__Standard_FollowUp_Offer_Accepted">
12002 <conditions>
12003 <event_cue_signalled cue="$Definition.$OfferAcceptedCue"/>
12004 <check_value value="event.param == $MissionCue"/>
12005 </conditions>
12006 <actions>
12007 <!--We don't want to call the GM yet. Create the mission here and pass it into the GM when the previous mission ends
12008 TODO @Owen Move this to a library in the GM file?-->
12009 <create_mission cue="$MissionCue" missionthread="$Definition.$ThreadCue" name="$MissionName" description="$MissionDescription" faction="$Definition.$ThreadData.$Faction" type="missiontype.fight">
12010 <briefing>
12011 <!--TODO @Owen Better objective?-->
12012 <objective step="1" action="objective.secure" object="$InvasionCue.$Target"/>
12013 </briefing>
12014 </create_mission>
12015 </actions>
12016 </cue>
12017
12018 <cue name="Support_Invasion__Standard_Aborted">
12019 <conditions>
12020 <event_cue_signalled cue="$Definition.$ForceCleanupCue"/>
12021 </conditions>
12022 <actions>
12023 <cancel_cue cue="namespace"/>
12024 </actions>
12025 </cue>
12026
12027 <!--namespace signalled to activate followup mission
12028 event.param = Station to supply-->
12029 <cue name="Support_Invasion__Standard_Activate_FollowUp">
12030 <conditions>
12031 <event_cue_signalled cue="namespace"/>
12032 </conditions>
12033 <actions>
12034 <!--Check that the correct parameters have been passed-->
12035 <do_if value="false">
12036 <!--Currently no followup case for this type of mission-->
12037 <signal_cue cue="Support_Invasion__Standard_Create_GM"/>
12038 <cancel_cue cue="parent"/>
12039 </do_if>
12040 <do_else>
12041 <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.'"/>
12042 <!--TODO @Owen what if there is another followup mission?-->
12043 <signal_cue_instantly cue="$Definition.$EndedCue" param="namespace"/>
12044 <cancel_cue cue="namespace"/>
12045 </do_else>
12046 </actions>
12047 </cue>
12048 </cues>
12049 </cue>
12050
12051 <cue name="Support_Invasion__Standard_Not_FollowUp" onfail="cancel">
12052 <conditions>
12053 <check_value value="not $FollowUp"/>
12054 </conditions>
12055 <actions>
12056 <signal_cue cue="Support_Invasion__Standard_Create_GM"/>
12057 </actions>
12058 </cue>
12059
12060 <cue name="Support_Invasion__Standard_Create_GM">
12061 <conditions>
12062 <event_cue_signalled/>
12063 </conditions>
12064 <cues>
12065 <!-- Trigger actual GM, passing the specified parameters -->
12066 <cue name="Support_Invasion__Standard_Ref" ref="md.GM_Support_Invasion.Start">
12067 <param name="Client" value="$Definition.$ThreadData.$Contact"/>
12068 <param name="MissionCue" value="$MissionCue"/>
12069 <param name="MissionThread" value="$Definition.$ThreadCue"/>
12070 <param name="ReportSignalCue" value="Support_Invasion__Standard_GM_Event" comment="tell GM to call this cue when done"/>
12071 <param name="WithoutOffer" value="true"/>
12072 <param name="WithoutOfferWaitCue" value="if $FollowUp then null else $Definition.$OfferAcceptedCue"/>
12073 <param name="ForceCleanup" value="$Definition.$ForceCleanupCue"/>
12074
12075 <param name="Page" value="$Page"/>
12076 <param name="TextOffset" value="$TextOffset"/>
12077
12078 <param name="MissionLevel" value="4"/>
12079 <param name="Difficulty" value="level.hard"/>
12080
12081 <param name="InvasionCue" value="$InvasionCue"/>
12082
12083 <param name="DebugChance" value="$DebugChance"/>
12084 </cue>
12085
12086 <!--Signalled by GM when an event happens e.g. mission successfully generated or mission ended.
12087 Feedback values saved to the static of this cue: $FeedbackValue and $EndFeedbackValue-->
12088 <cue name="Support_Invasion__Standard_GM_Event" instantiate="true">
12089 <conditions>
12090 <event_cue_signalled/>
12091 </conditions>
12092 <actions>
12093 <include_actions ref="MM__Standard_GM_Event"/>
12094 </actions>
12095 </cue>
12096 </cues>
12097 </cue>
12098 </cues>
12099 </cue>
12100 </cues>
12101 </replace>
12102</diff>