<?xml version="1.0" encoding="utf-8"?>
<Randomevents>
  <EventPrefabs>
    <!-- //////// MISSION-GIVING EVENTS aka missionevent_xxxxx //////// -->
    <!-- //////// MISSION-GIVING EVENTS aka missionevent_xxxxx //////// -->
    <!-- //////// MISSION-GIVING EVENTS aka missionevent_xxxxx //////// -->
    <!-- //////// MISSION-GIVING EVENTS aka missionevent_xxxxx //////// -->
    <!-- //////// MISSION-GIVING EVENTS aka missionevent_xxxxx //////// -->
    <!-- //////// MISSION-GIVING EVENTS aka missionevent_xxxxx //////// -->
    <ScriptedEvent identifier="missionevent_pirateany" commonness="100">
      <ConversationAction text="eventtext.missionevent_piratemission1.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missiontag="piratemission" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_pirateheavy" commonness="100">
      <ConversationAction text="eventtext.missionevent_piratemission1.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missiontag="heavypirate" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_pirateparty" commonness="100">
      <ConversationAction text="eventtext.missionevent_piratemission2.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missiontag="partypirate" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_piratestrange" commonness="100">
      <ConversationAction text="eventtext.missionevent_piratemission3.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missiontag="strangepirate" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_killmonster_thegreatsea" commonness="85">
      <ConversationAction text="eventtext.missionevent_killmonster_regional.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missiontag="killmonster_thegreatsea" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_vipnapping">
      <CheckDataAction identifier="vipnappingnorepeat" condition="eq 0">
        <Failure>
          <Goto name="end" />
        </Failure>
        <Success>
          <TagAction criteria="player" tag="player" />
          <Label name="talktonpc" />
          <ConversationAction speakertag="outpostmanagerpirate" invokertag="triggerer_player" text="eventtext.missionevent_vipnapping.bigscore" endeventifinterrupted="false" eventsprite="banditcaptain">
            <Option text="eventtext.missionevent_vipnapping.whatabout">
              <ConversationAction targettag="triggerer_player" text="eventtext.missionevent_vipnapping.ransomplan" endeventifinterrupted="false" eventsprite="banditcaptain">
                <Option text="eventtext.generic.continue">
                  <ConversationAction targettag="triggerer_player" text="eventtext.missionevent_vipnapping.briefing" endeventifinterrupted="false" eventsprite="ventinside">
                    <Option text="eventtext.missionevent_vipnapping.Imin">
                      <ConversationAction text="eventtext.missionevent_vipnapping.hereslocation" endeventifinterrupted="false" endconversation="true" eventsprite="HeartOfGold" />
                      <MissionAction missionidentifier="vipnapping" locationtype="City,colony,research,hospital,factory,shipyard" minlocationdistance="1" />
                      <SetDataAction identifier="vipnappingnorepeat" value="1" />
                    </Option>
                    <Option text="eventtext.missionevent_vipnapping.notmykink">
                      <ConversationAction text="eventtext.missionevent_vipnapping.yourloss" endeventifinterrupted="false" endconversation="true" eventsprite="banditcaptain" />
                      <Goto name="end" />
                    </Option>
                  </ConversationAction>
                </Option>
              </ConversationAction>
            </Option>
            <Option text="eventtext.generic.ignore" endconversation="true">
              <ClearTagAction tag="triggerer_player" />
              <Goto name="talktonpc" />
            </Option>
          </ConversationAction>
        </Success>
      </CheckDataAction>
      <Label name="end" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_silencewitness">
      <CheckDataAction identifier="silencewitnessnorepeat" condition="eq 0">
        <Failure>
          <Goto name="end" />
        </Failure>
        <Success>
          <TagAction criteria="player" tag="player" />
          <Label name="talktonpc" />
          <ConversationAction speakertag="outpostmanagerpirate" invokertag="triggerer_player" text="EventText.missionevent_silencewitness.gangbounty" endeventifinterrupted="false" eventsprite="banditcaptain">
            <Option text="EventText.missionevent_silencewitness.tellmemore">
              <ConversationAction targettag="triggerer_player" text="EventText.missionevent_silencewitness.missionbrief" endeventifinterrupted="false" eventsprite="banditcaptain">
                <Option text="EventText.missionevent_silencewitness.accept">
                  <ConversationAction targettag="triggerer_player" text="EventText.missionevent_silencewitness.hitlocation" endeventifinterrupted="false" eventsprite="banditcaptain" endconversation="true" />
                  <MissionAction missionidentifier="silencewitness" locationtype="City,Military,Base,Colony" requiredfaction="Coalition" minlocationdistance="1" />
                  <SetDataAction identifier="silencewitnessnorepeat" value="1" />
                </Option>
                <Option text="EventText.missionevent_silencewitness.seacario">
                  <ConversationAction targettag="triggerer_player" text="EventText.missionevent_silencewitness.dotdotdot" endeventifinterrupted="false" eventsprite="banditcaptain">
                    <Option text="EventText.missionevent_silencewitness.accept">
                      <ConversationAction targettag="triggerer_player" text="EventText.missionevent_silencewitness.hitlocation" endeventifinterrupted="false" eventsprite="banditcaptain" endconversation="true" />
                      <MissionAction missionidentifier="silencewitness" locationtype="City,Military,Base,Colony" requiredfaction="Coalition" minlocationdistance="1" />
                      <SetDataAction identifier="silencewitnessnorepeat" value="1" />
                    </Option>
                    <Option text="EventText.missionevent_silencewitness.nogangbusiness" endconversation="true">
                      <SetDataAction identifier="silencewitnessnorepeat" value="1" />
                    </Option>
                  </ConversationAction>
                </Option>
                <Option text="EventText.missionevent_silencewitness.nogangbusiness" endconversation="true">
                  <SetDataAction identifier="silencewitnessnorepeat" value="1" />
                </Option>
              </ConversationAction>
            </Option>
            <Option text="eventtext.generic.ignore" endconversation="true">
              <ClearTagAction tag="triggerer_player" />
              <Goto name="talktonpc" />
            </Option>
          </ConversationAction>
        </Success>
      </CheckDataAction>
      <Label name="end" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_hostagesituation">
      <CheckDataAction identifier="hostagesituationnorepeat" condition="eq 0">
        <Failure>
          <Goto name="end" />
        </Failure>
      </CheckDataAction>
      <CheckReputationAction targettype="faction" identifier="coalition" condition="gt 30">
        <Failure>
          <Goto name="end" />
        </Failure>
      </CheckReputationAction>
      <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="securitynpccoalition" targettag="hostagesecurity" spawnlocation="Outpost" spawnpointtag="admin" />
      <Label name="talktonpc" />
      <ConversationAction speakertag="hostagesecurity" invokertag="triggerer_player" text="eventtext.missionevent_hostagesituation.distressed" endeventifinterrupted="false" eventsprite="Infiltration1">
        <Option text="eventtext.generic.continue">
          <ConversationAction targettag="triggerer_player" text="eventtext.missionevent_hostagesituation.missionbrief" endeventifinterrupted="false" eventsprite="Infiltration1">
            <Option text="eventtext.missionevent_hostagesituation.ynomilitary">
              <ConversationAction text="eventtext.missionevent_hostagesituation.3rdparty" endeventifinterrupted="false" endconversation="true" eventsprite="Infiltration1">
                <Option text="eventtext.missionevent_hostagesituation.volunteer">
                  <ConversationAction text="eventtext.missionevent_hostagesituation.freehostages" endeventifinterrupted="false" eventsprite="Infiltration1" endconversation="true" />
                  <MissionAction missionidentifier="hostagesituation" locationtype="settlement,colony,research,hospital,hydroponics,factory,shipyard" requiredfaction="Coalition" minlocationdistance="1" />
                  <SetDataAction identifier="hostagesituationnorepeat" value="1" />
                </Option>
                <Option text="eventtext.missionevent_hostagesituation.canthelp" endconversation="true"></Option>
              </ConversationAction>
            </Option>
          </ConversationAction>
        </Option>
        <Option text="eventtext.generic.ignore" endconversation="true">
          <ClearTagAction tag="triggerer_player" />
          <Goto name="talktonpc" />
        </Option>
      </ConversationAction>
      <Label name="end" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_escortmedivac" commonness="20" requiredDestinationTypes="city,clinic,hospital,huskchurch">
      <CheckDataAction identifier="escortmedivacnorepeat" condition="eq 0">
        <Failure>
          <!-- does not spawn the event if already done -->
        </Failure>
        <Success>
          <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="securitynpc[faction]" targettag="securitychief" spawnlocation="Outpost" />
          <Label name="retry" />
          <ConversationAction text="EventText.missionevent_escortmedivac.needhelp" speakertag="securitychief" invokertag="medivac_player" endeventifinterrupted="false" eventsprite="doctor">
            <Option text="EventText.missionevent_escortmedivac.myship">
              <ConversationAction text="EventText.missionevent_escortmedivac.spaceflu" targettag="medivac_player" eventsprite="doctor">
                <Option text="eventtext.missionevent_escortmedivac.lupus">
                  <ConversationAction text="eventtext.missionevent_escortmedivac.missionbrief" targettag="medivac_player" eventsprite="doctor">
                    <Option text="eventtext.missionevent_escortmedivac.accept" endconversation="true">
                      <SetDataAction identifier="escortmedivacnorepeat" value="1" />
                      <MissionAction missionidentifier="escortmedivac" />
                      <SpawnAction itemidentifier="stabilozine" targetinventory="medivac_player" />
                    </Option>
                    <Option text="eventtext.missionevent_escortmedivac.refuse" endconversation="true" />
                  </ConversationAction>
                </Option>
              </ConversationAction>
            </Option>
            <Option text="eventtext.option.ignore" endconversation="true">
              <ClearTagAction tag="medivac_player" />
              <WaitAction time="2" />
              <GoTo name="retry" />
            </Option>
          </ConversationAction>
        </Success>
      </CheckDataAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_retrieveindustrialwaste" commonness="100">
      <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="commoner" targettag="wasteguy" spawnlocation="Outpost" />
      <ConversationAction text="eventtext.missionevent_retrieveindustrialwaste" speakertag="wasteguy" endeventifinterrupted="false" dialogtype="Small">
        <Option text="eventtext.missionevent_retrieveindustrialwaste.yuck" endconversation="true" />
      </ConversationAction>
      <MissionAction missionidentifier="retrieveindustrialwaste" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_retrievehammerheadmucus" commonness="100">
      <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="commoner" targettag="mucusguy" spawnlocation="Outpost" />
      <ConversationAction text="eventtext.missionevent_retrievehammerheadmucus" speakertag="mucusguy" endeventifinterrupted="false" dialogtype="Small">
        <Option text="eventtext.missionevent_retrievehammerheadmucus.disgusting" endconversation="true" />
      </ConversationAction>
      <MissionAction missionidentifier="retrievehammerheadmucus" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_industrialincident" requiredDestinationTypes="factory,shipyard">
      <CheckDataAction identifier="industrialincidentnorepeat" condition="eq 0">
        <Failure>
          <Goto name="end" />
        </Failure>
        <Success>
          <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="commoner" targettag="industrialguy" spawnlocation="Outpost" />
          <ConversationAction text="eventtext.missionevent_industrialincident" speakertag="industrialguy" endeventifinterrupted="false" dialogtype="Small" eventsprite="mechanic">
            <Option text="eventtext.missionevent_industrialincident.nopromises" endconversation="true" />
          </ConversationAction>
          <SetDataAction identifier="industrialincidentnorepeat" operation="set" value="1" />
          <MissionAction missionidentifier="industrialincident" locationtype="factory,shipyard" />
        </Success>
      </CheckDataAction>
      <Label name="end" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_alcoholcontraband">
      <TagAction criteria="player" tag="player" />
      <ConversationAction speakertag="outpostmanagerpirate" invokertag="triggerer_player" text="eventtext.missionevent_alcoholcontraband" endeventifinterrupted="false" eventsprite="banditcaptain">
        <Option text="eventtext.missionevent_alcoholcontraband.takejob">
          <ConversationAction targettag="triggerer_player" text="eventtext.missionevent_alcoholcontraband.dontdrink" endeventifinterrupted="false" eventsprite="banditcaptain" endconversation="true" />
          <MissionAction missionidentifier="alcoholcontraband" locationtype="settlement,colony,hospital,factory,shipyard,hydroponics" />
          <SpawnAction itemidentifier="metalcrate" targettag="contrabandcrate" targetinventory="triggerer_player" />
          <SpawnAction itemidentifier="contrabandrum" targetinventory="contrabandcrate" amount="10" />
        </Option>
        <Option text="EventText.generic.refuse" endconversation="true" />
      </ConversationAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_escortorangeboys" commonness="20" requiredDestinationTypes="Outpost,Settlement,Colony,City">
      <SetDataAction identifier="escortedorangeboys" operation="set" value="0" />
      <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="commoner" targettag="escortboysnpc" spawnlocation="Outpost" />
      <ConversationAction text="eventtext.missionevent_escortorangeboys" speakertag="escortboysnpc" invokertag="triggerer_player" endeventifinterrupted="false" eventsprite="instructor">
        <Option text="eventtext.missionevent_escortorangeboys.sure" endconversation="true">
          <MissionAction missionidentifier="escortorangeboys" />
        </Option>
        <Option text="eventtext.missionevent_escortorangeboys.refuse" endconversation="true"></Option>
      </ConversationAction>
    </ScriptedEvent>
    <!-- Also includes the defective bot variant -->
    <ScriptedEvent identifier="missionevent_cargodefensebots" commonness="20" requiredDestinationTypes="outpost,settlement,colony,clinic,hospital,study,research,hydroponics,factory,shipyard">
      <ConversationAction text="Eventtext.missionevent_cargodefensebots" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small">
        <Option text="EventText.missionevent_cargodefensebots.accept" endconversation="true">
          <MissionAction missiontag="cargodefensebots" />
        </Option>
        <Option text="EventText.generic.refuse" endconversation="true"></Option>
      </ConversationAction>
    </ScriptedEvent>
    <!--HUSK MANAGER MISSIONS-->
    <ScriptedEvent identifier="missionevent_huskmedicalcargo" commonness="125" requiredDestinationTypes="construction,outpost,settlement,colony,city,camp,base,military,blockade,survey,mine,study,research,clinic,hospital,hydroponics,factory,shipyard">
      <ConversationAction text="EventText.missionevent_huskmedicalcargo.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missionidentifier="huskmedicalcargo" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_huskeggsmuggling" commonness="125" requiredDestinationTypes="construction,outpost,settlement,colony,city,camp,base,military,blockade,survey,mine,study,research,clinic,hospital,hydroponics,factory,shipyard">
      <ConversationAction text="EventText.missionevent_huskeggsmuggling.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missionidentifier="huskeggsmuggling" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_escorthuskvip" commonness="50" requiredDestinationTypes="study,research,huskchurch,city">
      <ConversationAction text="EventText.missionevent_escorthuskvip.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missionidentifier="escorthuskvip" />
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_slimecollection" commonness="50" requiredDestinationTypes="huskchurch">
      <ConversationAction text="EventText.missionevent_slimecollection.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missionidentifier="slimecollection" />
    </ScriptedEvent>
    <!--CONDITIONAL MISSIONS-->
    <ScriptedEvent identifier="missionevent_huskcultinterception" commonness="20">
      <CheckDataAction identifier="huskinterceptionmissionnorepeat" condition="eq 0">
        <Failure>
          <!-- does not spawn the event if already done -->
        </Failure>
        <Success>
          <!-- only get this if separatist reputation is high enough -->
          <CheckReputationAction targettype="faction" identifier="separatists" condition="gte 30">
            <Failure></Failure>
            <Success>
              <TagAction criteria="player" tag="player" />
              <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="watchmanseparatist" targettag="missionnpc" spawnlocation="Outpost" targetmoduletags="adminmodule" />
              <TriggerAction target1tag="missionnpc" target2tag="player" applytotarget2="triggerer_player" waitforinteraction="true" />
              <ConversationAction text="EventText.missionevent_huskcultinterception.churchmakesmeds" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="Separatists">
                <Option text="EventText.missionevent_huskcultinterception.Whataboutit">
                  <ConversationAction text="EventText.missionevent_huskcultinterception.dependentonmeds" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="Separatists" endconversation="true">
                    <Option text="EventText.generic.continue">
                      <ConversationAction text="EventText.missionevent_huskcultinterception.takedowntransport" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="Separatists" endconversation="true">
                        <Option text="EventText.missionevent_huskcultinterception.Consideritdone" endconversation="true">
                          <MissionAction missionidentifier="huskcultinterception" />
                        </Option>
                        <Option text="EventText.missionevent_huskcultinterception.Notapirate" endconversation="true">
                          <ReputationAction targettype="Faction" identifier="separatists" increase="-1" />
                          <SetDataAction identifier="huskinterceptionmissionnorepeat" value="1" />
                        </Option>
                      </ConversationAction>
                    </Option>
                  </ConversationAction>
                </Option>
              </ConversationAction>
            </Success>
          </CheckReputationAction>
        </Success>
      </CheckDataAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_escorthuskterrorist" commonness="20" requiredDestinationTypes="construction,outpost,settlement,colony,city,camp,base,military,blockade,survey,mine,study,research,clinic,hospital,hydroponics,factory,shipyard">
      <!-- only get this if husk reputation is low -->
      <CheckReputationAction targettype="faction" identifier="huskcult" condition="lte -15">
        <Failure>
          <!-- do nothing if high rep -->
        </Failure>
        <Success>
          <ConversationAction text="Eventtext.missionevent_escorthuskterrorist.c1" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small" />
          <MissionAction missionidentifier="escorthuskterrorist" />
        </Success>
      </CheckReputationAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_jailbreak_husk" commonness="80">
      <CheckReputationAction targettype="faction" identifier="huskcult" condition="gte 30">
        <Failure>
          <!-- only get this if husk rep high -->
        </Failure>
        <Success>
          <ConversationAction text="EventText.missionevent_jailbreak_husk.c1" speakertag="outpostmanager" invokertag="triggerer_player" endeventifinterrupted="false" eventsprite="huskinvite" dialogtype="Small">
            <Option text="EventText.missionevent.pleasecontinue">
              <!-- "please continue" -->
              <ConversationAction text="EventText.missionevent_jailbreak_husk.o1.c1" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="huskinvite" endconversation="true" dialogtype="Small" />
              <MissionAction missionidentifier="jailbreak_husk" locationtype="City,Military,Base,Colony" requiredfaction="" minlocationdistance="1" />
            </Option>
          </ConversationAction>
        </Success>
      </CheckReputationAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_assassinatehuskresearcher" commonness="20">
      <CheckDataAction identifier="assassinatehuskresearchernorepeat" condition="eq 0">
        <Failure>
          <!-- does not spawn the event if already done -->
        </Failure>
        <Success>
          <CheckReputationAction targettype="faction" identifier="coalition" condition="gte 40">
            <Failure>
              <!-- needs high enough coalition rep -->
            </Failure>
            <Success>
              <ConversationAction text="EventText.missionevent_assassinatehuskresearcher.majorproblem" speakertag="outpostmanager" invokertag="triggerer_player" endeventifinterrupted="false" eventsprite="Coalition">
                <Option text="EventText.missionevent_assassinatehuskresearcher.whatkindofproblem">
                  <!-- "please continue" -->
                  <ConversationAction text="EventText.missionevent_assassinatehuskresearcher.huskpathogen" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="JacovSubra2" endconversation="true">
                    <Option text="EventText.missionevent_assassinatehuskresearcher.soundsbad">
                      <ConversationAction text="EventText.missionevent_assassinatehuskresearcher.missionbrief" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="JacovSubra2" endconversation="true">
                        <Option text="EventText.missionevent_assassinatehuskresearcher.Iwilldoit" endconversation="true">
                          <MissionAction missionidentifier="assassinatehuskresearcher" locationtype="huskchurch" faction="coalition" requiredfaction="" minlocationdistance="1" />
                          <SetDataAction identifier="assassinatehuskresearchernorepeat" value="1" />
                        </Option>
                        <Option text="EventText.missionevent_assassinatehuskresearcher.Noway" endconversation="true">
                          <ReputationAction targettype="Faction" identifier="coalition" increase="-2" />
                          <SetDataAction identifier="assassinatehuskresearchernorepeat" value="1" />
                        </Option>
                      </ConversationAction>
                    </Option>
                  </ConversationAction>
                </Option>
              </ConversationAction>
            </Success>
          </CheckReputationAction>
        </Success>
      </CheckDataAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_hiddenandclowngerous" commonness="10">
      <CheckDataAction identifier="findclownhuskoperativenorepeat" condition="true">
        <Success>
          <!-- no repeat -->
        </Success>
        <Failure>
          <CheckReputationAction targettype="faction" identifier="clowns" condition="gte 10">
            <Success>
              <TagAction criteria="player" tag="player" />
              <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="clown" targettag="clownquestgiver" targetmoduletags="clownmodule" spawnlocation="Outpost" />
              <Label name="worriedclown" />
              <TriggerAction target1tag="clownquestgiver" target2tag="player" applytotarget2="triggerer_player" waitforinteraction="true" />
              <ConversationAction text="EventText.missionevent_hiddenandclowngerous.worriedclown" targettag="triggerer_player" eventsprite="infiltration2">
                <Option text="EventText.missionevent_hiddenandclowngerous.steppedonrake">
                  <ConversationAction text="EventText.missionevent_hiddenandclowngerous.helpclowns" targettag="triggerer_player" eventsprite="infiltration2">
                    <Option text="eventtext.generic.continue">
                      <ConversationAction text="EventText.missionevent_hiddenandclowngerous.twodaysago" targettag="triggerer_player" eventsprite="infiltration2">
                        <Option text="EventText.missionevent_hiddenandclowngerous.huskdontlaugh">
                          <Label name="husksdontlaugh" />
                          <ConversationAction text="EventText.missionevent_hiddenandclowngerous.blasphemy" targettag="triggerer_player" eventsprite="infiltration2">
                            <Option text="EventText.missionevent_hiddenandclowngerous.clownspies">
                              <ConversationAction text="EventText.missionevent_hiddenandclowngerous.takethebikehorn" targettag="triggerer_player" eventsprite="infiltration2">
                                <Option text="EventText.missionevent_hiddenandclowngerous.acceptmission" endconversation="true">
                                  <!-- get mission, set norepeat -->
                                  <SetDataAction identifier="findclownhuskoperativenorepeat" value="true" />
                                  <SpawnAction itemidentifier="bikehorn" targetinventory="triggerer_player" />
                                  <MissionAction missionidentifier="gotohiddenandclowngerous" locationtype="huskchurch" unlockfurtheronmap="true" />
                                </Option>
                              </ConversationAction>
                            </Option>
                          </ConversationAction>
                        </Option>
                        <Option text="EventText.missionevent_hiddenandclowngerous.avoidchurches">
                          <Goto name="husksdontlaugh" />
                        </Option>
                      </ConversationAction>
                    </Option>
                  </ConversationAction>
                </Option>
                <Option text="EventText.missionevent_hiddenandclowngerous.refusemission" endconversation="true">
                  <Goto name="worriedclown" />
                </Option>
              </ConversationAction>
            </Success>
            <Failure>
              <!--Do nothing-->
            </Failure>
          </CheckReputationAction>
        </Failure>
      </CheckDataAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_keepwetcargo" commonness="20" requiredDestinationTypes="clinic,hospital,study,research,huskchurch,city">
      <ConversationAction text="Eventtext.missionevent_keepwetcargo" speakertag="outpostmanager" endeventifinterrupted="false" dialogtype="Small">
        <Option text="EventText.missionevent_keepwetcargo.accept" endconversation="true">
          <MissionAction missionidentifier="keepwetcargo" />
        </Option>
        <Option text="EventText.generic.refuse" endconversation="true"></Option>
      </ConversationAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_capturelivecrawler" commonness="20" requiredDestinationTypes="huskchurch">
      <CheckDataAction identifier="capturelivecrawlernorepeat" condition="eq 0">
        <Failure>
          <!-- does not spawn the event if already done -->
        </Failure>
        <Success>
          <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="huskcultist" targettag="cultist" spawnlocation="Outpost" />
          <ConversationAction text="EventText.missionevent_capturelivecrawler.periloustask" speakertag="cultist" invokertag="triggerer_player" endeventifinterrupted="false" eventsprite="cultist">
            <Option text="EventText.missionevent_capturelivecrawler.whattask">
              <ConversationAction text="EventText.missionevent_capturelivecrawler.experiments" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="cultist" endconversation="true">
                <Option text="EventText.missionevent_capturelivecrawler.incidents">
                  <ConversationAction text="EventText.missionevent_capturelivecrawler.missionbrief" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="cultist">
                    <Option text="EventText.missionevent_capturelivecrawler.Iwilldoit">
                      <MissionAction missionidentifier="capturelivecrawler" />
                      <ConversationAction text="EventText.missionevent_capturelivecrawler.takethis" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="cultist" endconversation="true" />
                      <SpawnAction itemidentifier="chloralhydrate" amount="8" targettag="sedative" targetinventory="triggerer_player" />
                    </Option>
                    <Option text="EventText.missionevent_capturelivecrawler.Noway" endconversation="true">
                      <ReputationAction targettype="Faction" identifier="huskcult" increase="-2" />
                      <SetDataAction identifier="capturelivecrawlernorepeat" value="1" />
                    </Option>
                  </ConversationAction>
                </Option>
              </ConversationAction>
            </Option>
          </ConversationAction>
        </Success>
      </CheckDataAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="missionevent_chimerasamples" commonness="20">
      <CheckDataAction identifier="chimerasamplesnorepeat" condition="eq 0">
        <Failure>
          <!-- does not spawn the event if already done -->
        </Failure>
        <Success>
          <ConversationAction text="EventText.missionevent_chimerasamples.request" speakertag="huskresearcher" invokertag="triggerer_player" endeventifinterrupted="false" eventsprite="cultist">
            <Option text="EventText.missionevent_chimerasamples.whatisit">
              <ConversationAction text="EventText.missionevent_chimerasamples.newlifeform" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="cultist" endconversation="true">
                <Option text="EventText.missionevent_chimerasamples.interesting">
                  <Label name="next" />
                  <ConversationAction text="EventText.missionevent_chimerasamples.givevial" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="cultist">
                    <Option text="EventText.missionevent_chimerasamples.Iwilldoit" endconversation="true">
                      <MissionAction missionidentifier="chimerasamples" />
                      <SpawnAction itemidentifier="husksamplevial" amount="1" targettag="vial" targetinventory="triggerer_player" />
                    </Option>
                    <Option text="EventText.missionevent_chimerasamples.Noway" endconversation="true">
                      <ReputationAction targettype="Faction" identifier="huskcult" increase="-2" />
                      <SetDataAction identifier="chimerasamplesnorepeat" value="1" />
                    </Option>
                  </ConversationAction>
                </Option>
                <Option text="EventText.missionevent_chimerasamples.worse">
                  <Goto name="next" />
                </Option>
              </ConversationAction>
            </Option>
          </ConversationAction>
        </Success>
      </CheckDataAction>
    </ScriptedEvent>
    <!-- Unused TODO: custom husk beacon/probe, still no way to spawn specific beacons/wrecks in missions... -->
    <!-- <ScriptedEvent identifier="missionevent_beaconhusk" commonness="0">
        <CheckDataAction identifier="beaconhusknorepeat" condition="true">
          <Success>
          </Success>
          <Failure>
            <NPCWaitAction npctag="huskresearcher" wait="true" />
            <ConversationAction text="EventText.missionevent_beaconhusk.quest" speakertag="huskresearcher" endeventifinterrupted="false" dialogtype="Small" />
            <MissionAction missionidentifier="huskbeaconmission" />
            <SetDataAction identifier="beaconhusknorepeat" value="1"/>
          </Failure>
        </CheckDataAction>
      </ScriptedEvent> -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- ////// EVENTS TRIGGERED BY MISSIONS OR USED AS PART OF MISSIONS THEMSELVES ////// -->
    <!-- Pirate Broadcast during pirate missions -->
    <ScriptedEvent identifier="piratemissionbroadcast">
      <TagAction criteria="humanprefabidentifier:piratecaptain" tag="transmitter" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:piratecaptainlord" tag="transmitter" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="player" tag="player" />
      <TriggerAction target1tag="player" target2tag="transmitter" applytotarget1="listener" radius="25000" disableincombat="false" disableiftargetincapacitated="true" waitforinteraction="false" allowmultipletargets="true" />
      <StatusEffectAction targettag="listener">
        <StatusEffect target="NearbyItems" tags="commsrelay" duration="10.2">
          <Sound file="%ModDir:2532991202%/Sounds/Events/PirateBroadcast.ogg" volume="1" loop="true" />
        </StatusEffect>
      </StatusEffectAction>
      <ConversationAction text="eventtext.piratemissionbroadcast.receive" targettag="listener" waitforinteraction="false" dialogtype="small" />
      <ClearTagAction tag="listener" />
    </ScriptedEvent>
    <!-- Randomize the music of a raving pirate vessel | Only randomizes between the first 4 songs on a CD -->
    <ScriptedEvent identifier="randomizepiratemusic">
      <WaitAction time="10" />
      <TagAction criteria="itemidentifier:raverplayer" tag="targetmusicplayer" submarinetype="Enemy" />
      <RNGAction chance="0.5">
        <Success>
          <RNGAction chance="0.5">
            <Success>
              <StatusEffectAction targettag="targetmusicplayer">
                <StatusEffect target="This" ManuallySelectedSound="0" tags="long_range" setvalue="true" disabledeltatime="true" />
              </StatusEffectAction>
            </Success>
            <Failure>
              <StatusEffectAction targettag="targetmusicplayer">
                <StatusEffect target="This" ManuallySelectedSound="1" tags="long_range" setvalue="true" disabledeltatime="true" />
              </StatusEffectAction>
            </Failure>
          </RNGAction>
        </Success>
        <Failure>
          <RNGAction chance="0.5">
            <Success>
              <StatusEffectAction targettag="targetmusicplayer">
                <StatusEffect target="This" ManuallySelectedSound="2" tags="long_range" setvalue="true" disabledeltatime="true" />
              </StatusEffectAction>
            </Success>
            <Failure>
              <StatusEffectAction targettag="targetmusicplayer">
                <StatusEffect target="This" ManuallySelectedSound="3" tags="long_range" setvalue="true" disabledeltatime="true" />
              </StatusEffectAction>
            </Failure>
          </RNGAction>
        </Failure>
      </RNGAction>
    </ScriptedEvent>
    <!-- Coalition Cargo Vessel -->
    <ScriptedEvent identifier="cocargobroadcast">
      <TagAction criteria="humanprefabidentifier:coalitioncaptain" tag="transmitter" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitioncaptainlord" tag="transmitter" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitioncaptain" tag="coalitionnpc" />
      <TagAction criteria="humanprefabidentifier:coalitioncaptainlord" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitionsecurityrecruit" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitionsecuritygunner" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitionsecuritybrute" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitionsecurityelite" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitionmechanicrecruit" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitionmechanicveteran" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitionengineerrecruit" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitionengineerveteran" tag="coalitionnpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:navterminal" tag="receiver" submarinetype="player" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="player" tag="player" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:coalitioncargo" tag="coalitioncargo" ContinueIfNoTargetsFound="true" />
      <StatusEffectAction targettag="coalitioncargo">
        <StatusEffect target="This" SpawnedInCurrentOutpost="true" AllowStealing="false" setvalue="true" />
      </StatusEffectAction>
      <TriggerAction target1tag="receiver" target2tag="transmitter" radius="25000" disableincombat="false" disableiftargetincapacitated="true" waitforinteraction="false" allowmultipletargets="true" />
      <TriggerAction target1tag="player" target2tag="receiver" applytotarget1="listener_player" radius="300" disableincombat="false" disableiftargetincapacitated="true" waitforinteraction="true" allowmultipletargets="false" />
      <ConversationAction text="eventtext.cocargobroadcast.receive" targettag="listener_player" waitforinteraction="true" dialogtype="small">
        <Option text="eventtext.option.listen">
          <NPCChangeTeamAction npctag="coalitionnpc" teamtag="FriendlyNPC" />
          <StatusEffectAction targettag="listener_player">
            <StatusEffect target="NearbyItems" tags="commsrelay" duration="10.2">
              <Sound file="%ModDir:2532991202%/Sounds/Events/CoalitionBroadcast.ogg" volume="1" loop="true" />
            </StatusEffect>
          </StatusEffectAction>
          <ConversationAction text="eventtext.cocargobroadcast.receive.accept.answer" targettag="listener_player" dialogtype="small">
            <Option text="eventtext.cocargobroadcast.receive.accept.answer.truth">
              <NPCChangeTeamAction npctag="coalitionnpc" teamtag="Team2" />
              <ConversationAction text="eventtext.cocargobroadcast.receive.accept.answer.truth.answer" targettag="listener_player" dialogtype="small" />
              <ClearTagAction tag="listener_player" />
            </Option>
            <Option text="eventtext.cocargobroadcast.receive.accept.answer.lie">
              <SkillCheckAction requiredskill="helm" requiredlevel="80" probabilitybased="false" targettag="listener_player">
                <Success>
                  <RNGAction chance="0.75">
                    <Success>
                      <ConversationAction text="eventtext.cocargobroadcast.receive.accept.answer.lie.success" targettag="listener_player" dialogtype="small" />
                      <ClearTagAction tag="listener_player" />
                      <MissionStateAction missionidentifier="coalition_cargo2" operation="Set" value="2" />
                    </Success>
                    <Failure>
                      <NPCChangeTeamAction npctag="coalitionnpc" teamtag="Team2" />
                      <ConversationAction text="eventtext.cocargobroadcast.receive.accept.answer.lie.failure" targettag="listener_player" dialogtype="small" />
                      <ClearTagAction tag="listener_player" />
                    </Failure>
                  </RNGAction>
                </Success>
                <Failure>
                  <RNGAction chance="0.2">
                    <Success>
                      <ConversationAction text="eventtext.cocargobroadcast.receive.accept.answer.lie.success" targettag="listener_player" dialogtype="small" />
                      <ClearTagAction tag="listener_player" />
                      <MissionStateAction missionidentifier="coalition_cargo2" operation="Set" value="2" />
                    </Success>
                    <Failure>
                      <NPCChangeTeamAction npctag="coalitionnpc" teamtag="Team2" />
                      <ConversationAction text="eventtext.cocargobroadcast.receive.accept.answer.lie.failure" targettag="listener_player" dialogtype="small" />
                      <ClearTagAction tag="listener_player" />
                    </Failure>
                  </RNGAction>
                </Failure>
              </SkillCheckAction>
            </Option>
          </ConversationAction>
        </Option>
        <Option text="eventtext.option.ignore" endconversation="true">
          <NPCChangeTeamAction npctag="coalitionnpc" teamtag="Team2" />
          <ClearTagAction tag="listener_player" />
        </Option>
      </ConversationAction>
      <!-- experimental: checks if player has crate, adds 1 to crewsuspicious if seen, repeat every second. After X crewsuspicious, enemy team turns hostile again  -->
      <Label name="checkforstolencrate" />
      <WaitAction time="1" />
      <CheckDataAction identifier="crewsuspicious" condition="gt 10">
        <Success>
          <NPCChangeTeamAction npctag="coalitionnpc" teamtag="Team2" />
          <Goto name="end" />
        </Success>
        <Failure>
          <!-- proceed -->
        </Failure>
      </CheckDataAction>
      <CheckItemAction targettag="player" itemtags="coalitioncargo" RequireEquipped="true">
        <Success>
          <CheckVisibilityAction EntityTag="player" TargetTag="coalitionnpc" MaxDistance="500" AllowSameEntity="false">
            <Success>
              <SetDataAction identifier="crewsuspicious" operation="Add" value="1" />
              <GoTo name="checkforstolencrate" />
            </Success>
            <Failure>
              <GoTo name="checkforstolencrate" />
            </Failure>
          </CheckVisibilityAction>
        </Success>
        <Failure>
          <GoTo name="checkforstolencrate" />
        </Failure>
      </CheckItemAction>
      <Label name="end" />
    </ScriptedEvent>
    <!-- TODO test: jettison cargo -->
    <ScriptedEvent identifier="cocargojettison">
      <SpawnAction NPCSetIdentifier="combatmissioncoalitionnpcs" NPCIdentifier="coalitioncaptain" TeamID="FriendlyNPC" />
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="humanprefabidentifier:coalitioncaptain" tag="transmitter" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitioncaptainlord" tag="transmitter" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalitioncaptain" tag="coalitioncaptain" />
      <TagAction criteria="humanprefabidentifier:coalitioncaptainlord" tag="coalitioncaptain" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:jettisonnavterminal" tag="jettisonnavterminal" />
      <TagAction criteria="itemtag:cargodockingport" tag="cargodockingport" />
      <TagAction criteria="itemtag:cargohatch" tag="cargohatch" />
      <WaitAction time="5" />
      <NPCOperateItemAction npctag="coalitioncaptain" targettag="jettisonnavterminal" ItemComponentName="Steering" OrderOption="navigatetodestination" operate="true" />
      <WaitAction time="5" />
      <ConversationAction text="Engage reverse maneuver! Jettison Cargo!" targettag="player" dialogtype="small" eventsprite="mediator" ContinueAutomatically="true" endconversation="true" />
      <WaitAction time="5" />
      <StatusEffectAction targettag="cargohatch">
        <StatusEffect target="This" condition="0" setvalue="true" />
      </StatusEffectAction>
      <StatusEffectAction targettag="cargodockingport">
        <StatusEffect target="This" docked="false" setvalue="true" />
      </StatusEffectAction>
      <Label name="end" />
    </ScriptedEvent>
    <!-- Coalition Civilian Transport -->
    <ScriptedEvent identifier="cocivtransport">
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="humanprefabidentifier:coalition_civilian_medic" tag="civilian" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalition_civilian_assist" tag="civilian" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalition_civilian_eng" tag="civilian" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:coalition_civilian_mech" tag="civilian" ContinueIfNoTargetsFound="true" />
      <Label name="restart_cocivtransport" />
      <TriggerAction target1tag="player" target2tag="civilian" applytotarget1="triggerer_player" applytotarget2="triggered_civilian" radius="200" disableincombat="false" disableiftargetincapacitated="true" waitforinteraction="true" allowmultipletargets="true" />
      <NPCChangeTeamAction npctag="triggered_civilian" teamtag="FriendlyNPC" />
      <NPCWaitAction npctag="triggered_civilian" wait="true" />
      <!-- Approach civilian -->
      <ConversationAction text="eventtext.cocivtransport.interact" targettag="triggerer_player" waitforinteraction="true" dialogtype="small">
        <!-- Ask for money -->
        <Option text="eventtext.cocivtransport.option.rob">
          <RNGAction chance="0.5">
            <Success>
              <ConversationAction text="eventtext.cocivtransport.option.rob.answer" targettag="triggerer_player" />
              <MoneyAction amount="238" targettag="triggerer_player" />
              <NPCWaitAction npctag="triggered_civilian" wait="false" />
              <ClearTagAction tag="triggerer_player" />
              <GoTo name="restart_cocivtransport" />
            </Success>
            <Failure>
              <RNGAction chance="0.5">
                <Success>
                  <ConversationAction text="eventtext.cocivtransport.option.rob.answer" targettag="triggerer_player" dialogtype="small" />
                  <MoneyAction amount="397" targettag="triggerer_player" />
                  <NPCWaitAction npctag="triggered_civilian" wait="false" />
                  <ClearTagAction tag="triggerer_player" />
                  <GoTo name="restart_cocivtransport" />
                </Success>
                <Failure>
                  <RNGAction chance="0.5">
                    <Success>
                      <ConversationAction text="eventtext.cocivtransport.option.rob.answer" targettag="triggerer_player" dialogtype="small" />
                      <MoneyAction amount="521" targettag="triggerer_player" />
                      <NPCWaitAction npctag="triggered_civilian" wait="false" />
                      <ClearTagAction tag="triggerer_player" />
                      <GoTo name="restart_cocivtransport" />
                    </Success>
                    <Failure>
                      <RNGAction chance="0.5">
                        <Success>
                          <ConversationAction text="eventtext.cocivtransport.option.rob.answer" targettag="triggerer_player" dialogtype="small" />
                          <MoneyAction amount="873" targettag="triggerer_player" />
                          <NPCWaitAction npctag="triggered_civilian" wait="false" />
                          <ClearTagAction tag="triggerer_player" />
                          <GoTo name="restart_cocivtransport" />
                        </Success>
                        <Failure>
                          <RNGAction chance="0.5">
                            <Success>
                              <ConversationAction text="eventtext.cocivtransport.option.rob.answer" targettag="triggerer_player" dialogtype="small" />
                              <MoneyAction amount="1061" targettag="triggerer_player" />
                              <NPCWaitAction npctag="triggered_civilian" wait="false" />
                              <ClearTagAction tag="triggerer_player" />
                              <GoTo name="restart_cocivtransport" />
                            </Success>
                            <Failure>
                              <ConversationAction text="eventtext.cocivtransport.option.rob.answer" targettag="triggerer_player" dialogtype="small" />
                              <MoneyAction amount="1546" targettag="triggerer_player" />
                              <NPCWaitAction npctag="triggered_civilian" wait="false" />
                              <ClearTagAction tag="triggerer_player" />
                              <GoTo name="restart_cocivtransport" />
                            </Failure>
                          </RNGAction>
                        </Failure>
                      </RNGAction>
                    </Failure>
                  </RNGAction>
                </Failure>
              </RNGAction>
            </Failure>
          </RNGAction>
        </Option>
        <!-- Execute civilian -->
        <Option text="eventtext.cocivtransport.option.execute">
          <ConversationAction text="eventtext.cocivtransport.option.execute.answer" targettag="triggerer_player" dialogtype="small" />
          <AfflictionAction affliction="gunshotwound" strength="100" limbtype="Head" targettag="triggered_civilian" />
          <AfflictionAction affliction="bloodloss" strength="100" limbtype="Torso" targettag="triggered_civilian" />
          <ReputationAction increase="-1" identifier="coalition" targettype="Faction" />
          <NPCWaitAction npctag="triggered_civilian" wait="false" />
          <ClearTagAction tag="triggerer_player" />
          <GoTo name="restart_cocivtransport" />
        </Option>
        <!-- Try to hire -->
        <Option text="eventtext.cocivtransport.option.hire">
          <SkillCheckAction requiredskill="helm" requiredlevel="80" probabilitybased="true" targettag="triggerer_player">
            <Success>
              <RNGAction chance="0.6">
                <Success>
                  <ConversationAction text="eventtext.cocivtransport.option.hire.success" targettag="triggerer_player" dialogtype="small" />
                  <NPCChangeTeamAction npctag="triggered_civilian" teamtag="Team1" addtocrew="true" />
                  <NPCWaitAction npctag="triggered_civilian" wait="false" />
                  <NPCFollowAction npctag="triggered_civilian" targettag="triggerer_player" follow="true" />
                  <ClearTagAction tag="triggerer_player" />
                  <GoTo name="restart_cocivtransport" />
                </Success>
                <Failure>
                  <ConversationAction text="eventtext.cocivtransport.option.hire.failure" speakertag="triggered_civilian" targettag="triggerer_player" dialogtype="small" />
                  <NPCChangeTeamAction npctag="triggered_civilian" teamtag="Team2" />
                  <NPCWaitAction npctag="triggered_civilian" wait="false" />
                  <ClearTagAction tag="triggerer_player" />
                  <GoTo name="restart_cocivtransport" />
                </Failure>
              </RNGAction>
            </Success>
            <Failure>
              <RNGAction chance="0.3">
                <Success>
                  <ConversationAction text="eventtext.cocivtransport.option.hire.success" targettag="triggerer_player" dialogtype="small" />
                  <NPCChangeTeamAction npctag="triggered_civilian" teamtag="Team1" addtocrew="true" />
                  <NPCWaitAction npctag="triggered_civilian" wait="false" />
                  <NPCFollowAction npctag="triggered_civilian" targettag="triggerer_player" follow="true" />
                  <ClearTagAction tag="triggerer_player" />
                  <GoTo name="restart_cocivtransport" />
                </Success>
                <Failure>
                  <ConversationAction text="eventtext.cocivtransport.option.hire.failure" dialogtype="Small" />
                  <NPCChangeTeamAction npctag="triggered_civilian" teamtag="Team2" />
                  <NPCWaitAction npctag="triggered_civilian" wait="false" />
                  <ClearTagAction tag="triggerer_player" />
                  <GoTo name="restart_cocivtransport" />
                </Failure>
              </RNGAction>
            </Failure>
          </SkillCheckAction>
        </Option>
      </ConversationAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="lairbombspawn">
      <SpawnAction itemidentifier="de_nuclearbomb" spawnlocation="Mainsub" SpawnPointType="Cargo" TargetTag="lairbomb" offset="0" />
      <TagAction criteria="player" tag="player" />
      <EventObjectiveAction targettag="player" type="add" identifier="eventtext.destroylair.reachheart" />
      <EventObjectiveAction targettag="player" type="add" identifier="eventtext.destroylair.plantbomb" />
      <OnRoundEndAction>
        <RemoveItemAction targettag="lairbomb" Amount="100" />
      </OnRoundEndAction>
      <TriggerAction target1tag="lairbomb" target2tag="laircore" radius="500" />
      <EventObjectiveAction targettag="player" type="completeandremove" identifier="eventtext.destroylair.reachheart" />
      <Label name="checkarming" />
      <WaitAction time="1" />
      <CheckConditionalAction targettag="lairbomb" targetitemcomponent="LightComponent" IsOn="true">
        <Success>
          <EventObjectiveAction targettag="player" type="completeandremove" identifier="eventtext.destroylair.plantbomb" />
        </Success>
        <Failure>
          <Goto name="checkarming" />
        </Failure>
      </CheckConditionalAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="vipnappingevent">
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="hull" tag="submarinehull" submarinetype="Player" />
      <TagAction criteria="itemtag:admincabinet" tag="admincabinet" submarinetype="Outpost" />
      <CheckItemAction targettag="ransomtarget" itemidentifiers="idcard" ApplyTagToItem="vipidcard" />
      <!-- allow the npc to open the sub doors and flee back to outpost -->
      <StatusEffectAction targettag="vipidcard">
        <StatusEffect target="this" SubmarineSpecificID="0" setvalue="true" />
      </StatusEffectAction>
      <NPCFollowAction npctag="ransomtarget" targettag="admincabinet" follow="true" />
      <TriggerAction target1tag="player" target2tag="ransomtarget" applytotarget1="foundvipplayer" radius="200" waitforinteraction="false" />
      <ConversationAction targettag="foundvipplayer" text="eventtext.vipnapping.thatstarget" endeventifinterrupted="false" endconversation="true" dialogtype="small" eventsprite="captain" />
      <TriggerAction target1tag="ransomtarget" target2tag="submarinehull" radius="100" />
      <!-- <OnRoundEndAction>
        <CheckConditionalAction targettag="ransomtarget" InPlayerSubmarine="true" IsDead="False">
          <Success>
          </Success>
          <Failure>
          </Failure>
        </CheckConditionalAction>
      </OnRoundEndAction> -->
      <Label name="end" />
    </ScriptedEvent>
    <!-- hostage situation-->
    <ScriptedEvent identifier="hostagesituationevent">
      <TagAction criteria="player" tag="player" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:banditleader" submarinetype="Outpost" tag="leader" />
      <TagAction criteria="speciesname:Human" submarinetype="Outpost" team="Team2" tag="bandit" />
      <TagAction criteria="itemidentifier:dockinghatch" tag="eventstart" submarinetype="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="hull" tag="eventstart" submarinetype="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:securitynpc" tag="security" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:securitynpccoalition" tag="security" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:sergeantcoalition" tag="removenpc" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="humanprefabidentifier:outpostmanagercoalition" tag="removenpc" ContinueIfNoTargetsFound="true" />
      <!-- remove manager NPCs -->
      <StatusEffectAction targettag="removenpc">
        <StatusEffect type="Always" target="Character" interval="1" stackable="false">
          <RemoveCharacter />
        </StatusEffect>
      </StatusEffectAction>
      <!-- kill security -->
      <AfflictionAction affliction="gunshotwound" strength="200" limbtype="torso" targettag="security" />
      <AfflictionAction affliction="bleeding" strength="200" limbtype="torso" targettag="security" />
      <AfflictionAction affliction="bloodloss" strength="200" limbtype="torso" targettag="security" />
      <!-- handcuff other npcs with a delay so it also targets NPCs spawned by outposts -->
      <WaitAction time="5" />
      <TagAction criteria="speciesname:Human" submarinetype="Outpost" team="FriendlyNPC" tag="hostage" IgnoreIncapacitatedCharacters="true" />
      <TriggerEventAction identifier="checkhostagesdead" />
      <StatusEffectAction targettag="hostage">
        <StatusEffect target="this">
          <SpawnItem identifier="handcuffs" spawnposition="ThisInventory" Equip="true" />
        </StatusEffect>
      </StatusEffectAction>
      <TagAction criteria="itemidentifier:handcuffs" tag="hostagecuffs" submarinetype="Outpost" />
      <StatusEffectAction targettag="hostagecuffs">
        <StatusEffect target="This" SpawnedInCurrentOutpost="true" AllowStealing="false" setvalue="true" />
      </StatusEffectAction>
      <!-- trigger radio message on reaching outpost -->
      <TriggerAction target1tag="player" target2tag="eventstart" applytotarget1="triggerer_player" radius="100" disableincombat="false" disableiftargetincapacitated="false" waitforinteraction="false" allowmultipletargets="true" />
      <WaitAction time="1" />
      <StatusEffectAction targettag="leader">
        <StatusEffect target="this" duration="3">
          <Sound file="Content/Sounds/Radiostatic.ogg" range="10000" volume="2" loop="true" dontmuffle="true" />
        </StatusEffect>
      </StatusEffectAction>
      <ConversationAction text="EventText.hostagesituation.radiocall" dialogtype="Small" targettag="triggerer_player" eventsprite="radiocall" ContinueAutomatically="true">
        <Option text="EventText.hostagesituation.negociate">
          <ConversationAction targettag="triggerer_player" text="EventText.hostagesituation.sendnegociator" endeventifinterrupted="True" eventsprite="radiocall" endconversation="true" />
          <NPCChangeTeamAction npctag="leader" teamtag="FriendlyNPC" RemoveFromCrew="true" />
          <NPCChangeTeamAction npctag="bandit" teamtag="FriendlyNPC" RemoveFromCrew="true" />
        </Option>
        <Option text="EventText.hostagesituation.nonegociate" endconversation="true">
          <Goto name="end" />
        </Option>
      </ConversationAction>
      <!-- wait for player to get near leader, make sure alarm hasnt been triggered by weapon -->
      <Label name="isleaderalive" />
      <CheckConditionalAction targettag="leader" IsDead="False">
        <Success>
          <CheckVisibilityAction EntityTag="leader" TargetTag="player" maxdistance="300" CheckFacing="false">
            <Success>
              <!-- proceed to talk to leader if player gets near, otherwise keep checking if alive -->
            </Success>
            <Failure>
              <GoTo name="isleaderalive" />
            </Failure>
          </CheckVisibilityAction>
        </Success>
        <Failure>
          <Goto name="end" />
        </Failure>
      </CheckConditionalAction>
      <CheckDataAction identifier="hostagesituationweaponspotted" condition="eq 0">
        <Failure>
          <Goto name="end" />
        </Failure>
      </CheckDataAction>
      <ConversationAction speakertag="leader" invokertag="negociator" text="EventText.hostagesituation.gangleader" endeventifinterrupted="True" eventsprite="banditcaptain">
        <Option text="EventText.hostagesituation.payransom">
          <!-- paying off the bandits -->
          <Label name="paidoff" />
          <CheckMoneyAction Amount="5000">
            <Success>
              <MoneyAction amount="-5000" />
              <ConversationAction targettag="negociator" text="EventText.hostagesituation.happybandit" endeventifinterrupted="True" eventsprite="banditcaptain" endconversation="true" />
              <SetDataAction identifier="hostagesituationresolved" value="1" />
              <MissionStateAction missionidentifier="hostagesituation" operation="Set" value="2" />
              <WaitAction time="2" />
              <StatusEffectAction targettag="negociator">
                <StatusEffect target="this" duration="1">
                  <Sound file="Content/Sounds/Radiostatic.ogg" range="500" volume="2" loop="true" />
                </StatusEffect>
              </StatusEffectAction>
              <ConversationAction targettag="negociator" text="EventText.hostagesituation.paidransom" endeventifinterrupted="True" eventsprite="radiocall" endconversation="true" />
              <MissionStateAction missionidentifier="hostagesituation" operation="Set" value="1" />
              <Goto name="end" />
            </Success>
            <Failure>
              <ConversationAction targettag="negociator" text="EventText.hostagesituation.nomoney" eventsprite="mediator" endconversation="true" />
              <Goto name="dealoff" />
            </Failure>
          </CheckMoneyAction>
        </Option>
        <Option text="EventText.hostagesituation.intimidate">
          <CheckReputationAction targettype="faction" identifier="bandits" condition="gte 15">
            <Success>
              <ConversationAction targettag="negociator" text="EventText.hostagesituation.infamous" endeventifinterrupted="True" eventsprite="banditcaptain">
                <Option text="EventText.hostagesituation.badforbusiness">
                  <ConversationAction targettag="negociator" text="EventText.hostagesituation.packitup" endeventifinterrupted="True" eventsprite="banditcaptain" />
                  <!-- bandits are scared and leave -->
                  <Label name="banditsleave" />
                  <WaitAction time="2" />
                  <TagAction criteria="hullname:airlock" tag="airlock" submarinetype="Outpost" />
                  <NPCFollowAction npctag="bandit" targettag="airlock" follow="true" />
                  <ReputationAction increase="2" identifier="coalition" targettype="Faction" />
                  <StatusEffectAction targettag="negociator">
                    <StatusEffect target="this" duration="1">
                      <Sound file="Content/Sounds/Radiostatic.ogg" range="500" volume="2" loop="true" />
                    </StatusEffect>
                  </StatusEffectAction>
                  <MissionStateAction missionidentifier="hostagesituation" operation="Set" value="1" />
                  <ConversationAction targettag="negociator" text="EventText.hostagesituation.banditsleave" endeventifinterrupted="True" eventsprite="radiocall" endconversation="true" />
                  <SetDataAction identifier="hostagesituationresolved" value="1" />
                  <MissionStateAction missionidentifier="hostagesituation" operation="Set" value="2" />
                  <TriggerAction target1tag="bandit" target2tag="airlock" radius="300" />
                  <WaitAction time="10" />
                  <NPCFollowAction npctag="bandit" targettag="airlock" follow="false" />
                  <Goto name="end" />
                </Option>
                <Option text="EventText.hostagesituation.extorsion">
                  <StatusEffectAction targettag="negociator">
                    <StatusEffect target="this" duration="1">
                      <Sound file="Content/Sounds/Radiostatic.ogg" range="500" volume="2" loop="true" />
                    </StatusEffect>
                  </StatusEffectAction>
                  <ConversationAction targettag="negociator" text="EventText.hostagesituation.callcoalition" endeventifinterrupted="True" eventsprite="radiocall">
                    <Option text="EventText.hostagesituation.10000mk">
                      <ConversationAction targettag="negociator" text="EventText.hostagesituation.moneysent" endeventifinterrupted="True" eventsprite="coalition" />
                      <MoneyAction amount="10000" />
                      <ReputationAction increase="-15" identifier="coalition" targettype="Faction" />
                      <!-- <MissionAction missionidentifier="coalitionattack1" /> -->
                      <ConversationAction targettag="negociator" text="EventText.hostagesituation.artfulrobbery" endeventifinterrupted="True" eventsprite="banditcaptain" endconversation="true">
                        <Option text="EventText.hostagesituation.splitmoney">
                          <CheckMoneyAction Amount="5000">
                            <Success>
                              <MoneyAction amount="-5000" />
                              <ReputationAction increase="5" identifier="bandits" targettype="Faction" />
                              <ConversationAction targettag="negociator" text="EventText.hostagesituation.telltheguys" endeventifinterrupted="True" eventsprite="banditcaptain" />
                              <Goto name="end" />
                            </Success>
                            <Failure>
                              <ConversationAction targettag="negociator" text="EventText.hostagesituation.nomoney" endconversation="true" />
                              <Goto name="dealoff" />
                            </Failure>
                          </CheckMoneyAction>
                        </Option>
                        <Option text="EventText.hostagesituation.keepmoney" endconversation="true">
                          <Goto name="dealoff" />
                        </Option>
                      </ConversationAction>
                    </Option>
                    <Option text="EventText.hostagesituation.backoff">
                      <ConversationAction targettag="negociator" text="EventText.hostagesituation.backedoff" endeventifinterrupted="True" eventsprite="banditcaptain">
                        <Option text="EventText.hostagesituation.payanyway">
                          <Goto name="paidoff" endconversation="false" />
                        </Option>
                        <Option text="EventText.hostagesituation.dealsoff" endconversation="true">
                          <Goto name="dealoff" />
                        </Option>
                      </ConversationAction>
                    </Option>
                  </ConversationAction>
                </Option>
              </ConversationAction>
            </Success>
            <Failure></Failure>
          </CheckReputationAction>
          <SkillCheckAction requiredskill="weapons" requiredlevel="85" targettag="negociator">
            <Success>
              <GiveSkillEXPAction skill="weapons" amount="2" targettag="negociator" />
              <ConversationAction targettag="negociator" text="EventText.hostagesituation.scaredbandits" endeventifinterrupted="True" eventsprite="piratehaven">
                <Option text="EventText.hostagesituation.2hours">
                  <SkillCheckAction requiredskill="helm" requiredlevel="40" targettag="negociator">
                    <GiveSkillEXPAction skill="helm" amount="2" targettag="negociator" />
                    <Success>
                      <ConversationAction targettag="negociator" text="EventText.hostagesituation.webounce" endeventifinterrupted="True" eventsprite="banditcaptain" />
                      <Goto name="banditsleave" />
                    </Success>
                    <Failure>
                      <ConversationAction targettag="negociator" text="EventText.hostagesituation.bullshit" endeventifinterrupted="True" eventsprite="banditcaptain" ContinueAutomatically="true" />
                      <Goto name="shotsoff" endconversation="false" />
                    </Failure>
                  </SkillCheckAction>
                </Option>
                <Option text="EventText.hostagesituation.dealsoff" endconversation="true">
                  <Goto name="dealoff" />
                </Option>
              </ConversationAction>
            </Success>
            <Failure>
              <ConversationAction targettag="negociator" text="EventText.hostagesituation.snapfingers" endeventifinterrupted="True" eventsprite="banditcaptain" ContinueAutomatically="true" />
              <Label name="shotsoff" />
              <WaitAction time="2" />
              <StatusEffectAction targettag="negociator">
                <StatusEffect target="this">
                  <Sound file="Content/Items/Weapons/SMGsingleShot1.ogg" type="OnUse" range="3000" volume="2" />
                </StatusEffect>
                <StatusEffect target="this" delay="0.2">
                  <Sound file="Content/Items/Weapons/SMGsingleShot2.ogg" type="OnUse" range="3000" volume="2" />
                </StatusEffect>
                <StatusEffect target="this" delay="0.4">
                  <Sound file="Content/Items/Weapons/SMGsingleShot3.ogg" type="OnUse" range="3000" volume="2" />
                </StatusEffect>
              </StatusEffectAction>
              <WaitAction time="2" />
              <ConversationAction targettag="negociator" text="EventText.hostagesituation.shothostage" endeventifinterrupted="True" eventsprite="unconscious">
                <Option text="EventText.hostagesituation.ceasebloodshed">
                  <Goto name="paidoff" endconversation="false" />
                </Option>
                <Option text="EventText.hostagesituation.dealsoff" endconversation="true">
                  <Goto name="dealoff" />
                </Option>
              </ConversationAction>
            </Failure>
          </SkillCheckAction>
        </Option>
        <Option text="EventText.hostagesituation.dealsoff" endconversation="true">
          <Label name="dealoff" />
          <SetDataAction identifier="hostagesituationdealoff" value="1" />
          <WaitAction time="2" />
          <NPCChangeTeamAction npctag="bandit" teamtag="Team2" />
          <NPCChangeTeamAction npctag="leader" teamtag="Team2" />
          <TriggerEventAction identifier="killhostages" />
          <Goto name="end" />
        </Option>
      </ConversationAction>
      <Label name="end" />
      <!-- check if >50% of hostages are alive -->
      <OnRoundEndAction>
        <CountTargetsAction targettag="hostage" CompareToTarget="hostage" MinPercentageRelativeToTarget="50">
          <Conditional IsDead="false" />
          <Success>
            <SetDataAction identifier="hostagesalive" operation="set" value="1" />
            <!-- check if bandits are dead if you went the killing route -->
            <CountTargetsAction targettag="bandit" CompareToTarget="bandit" MinPercentageRelativeToTarget="100">
              <Conditional IsDead="true" />
              <Success>
                <SetDataAction identifier="hostagesituationresolved" operation="set" value="1" />
              </Success>
            </CountTargetsAction>
          </Success>
          <Failure>
            <SetDataAction identifier="hostagesalive" operation="set" value="0" />
          </Failure>
        </CountTargetsAction>
      </OnRoundEndAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="hostagesituationalarm">
      <TagAction criteria="player" tag="player" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="speciesname:Human" submarinetype="Outpost" team="FriendlyNPC" tag="hostage" />
      <TagAction criteria="speciesname:Human" submarinetype="Outpost" team="Team2" tag="bandit" />
      <TagAction criteria="humanprefabidentifier:banditleader" tag="leader" />
      <Label name="checkforweapon" />
      <WaitAction time="1" />
      <CheckItemAction targettag="player" itemtags="weapon" RequireEquipped="true" ApplyTagToTarget="weaponwearer">
        <Failure>
          <GoTo name="checkforweapon" />
        </Failure>
      </CheckItemAction>
      <CheckDataAction identifier="hostagesituationdealoff" condition="eq 0">
        <Failure>
          <Goto name="end" />
        </Failure>
      </CheckDataAction>
      <CheckVisibilityAction EntityTag="bandit" TargetTag="weaponwearer" maxdistance="400" CheckFacing="true">
        <Failure>
          <GoTo name="checkforweapon" />
        </Failure>
        <Success>
          <SetDataAction identifier="hostagesituationweaponspotted" value="1" />
          <ConversationAction targettag="player" text="EventText.hostagesituationalarm.gunspotted" dialogtype="small" endeventifinterrupted="True" eventsprite="mediator" ContinueAutomatically="true" endconversation="true" />
          <WaitAction time="2" />
          <NPCChangeTeamAction npctag="bandit" teamtag="Team2" />
          <NPCChangeTeamAction npctag="leader" teamtag="Team2" />
          <TriggerEventAction identifier="killhostages" />
        </Success>
      </CheckVisibilityAction>
      <Label name="end" />
    </ScriptedEvent>
    <ScriptedEvent identifier="checkhostagesdead"> /&gt;
      <TagAction criteria="speciesname:Human" submarinetype="Outpost" team="FriendlyNPC" tag="hostage" IgnoreIncapacitatedCharacters="true" /><Label name="hostagesdeadloop" /><CountTargetsAction targettag="hostage" CompareToTarget="hostage" MinPercentageRelativeToTarget="50"><Conditional IsDead="false" /><Success><SetDataAction identifier="hostagesalive" operation="set" value="1" /><WaitAction time="1" /><Goto name="hostagesdeadloop" /></Success><Failure><SetDataAction identifier="hostagesalive" operation="set" value="0" /><MissionStateAction missionidentifier="hostagesituation" operation="Set" value="5" /><!-- <ConversationAction targettag="player" text="EventText.hostagesituation.toomanydead" dialogtype="mission" eventsprite="unconscious" /> --></Failure></CountTargetsAction></ScriptedEvent>
    <ScriptedEvent identifier="killhostages">
      <WaitAction time="2" />
      <TagAction criteria="speciesname:Human" submarinetype="Outpost" team="Team2" tag="bandit" />
      <Label name="killhostagesloop" />
      <ClearTagAction tag="hostage" />
      <TagAction criteria="speciesname:Human" submarinetype="Outpost" team="FriendlyNPC" tag="hostage" IgnoreIncapacitatedCharacters="true" />
      <CombatAction combatmode="Offensive" npctag="bandit" enemytag="hostage" isinstigator="true" witnessreaction="retreat" />
      <WaitAction time="10" />
      <Goto name="killhostagesloop" />
    </ScriptedEvent>
    <!-- Prototype of an event that spawns enemies outside in lair levels
    TODO - figure out an outpostlevel configuration that doesnt make enemies spawn inside big subs... -->
    <ScriptedEvent identifier="laircrawlersoutside">
      <WaitAction time="5" />
      <Label name="loop" />
      <CheckDataAction identifier="spawnwaves" condition="lt 5">
        <Success>
          <RNGAction chance="0.50">
            <Success>
              <CheckDataAction identifier="waveinprogress" condition="neq 1">
                <Success>
                  <SpawnAction speciesname="crawler" amount="3" SpawnLocation="nearmainsub" offset="500" />
                  <SetDataAction identifier="waveinprogress" operation="Set" value="1" />
                  <SetDataAction identifier="spawnwaves" operation="Add" value="1" />
                  <WaitAction time="60" />
                  <Goto name="loop" />
                </Success>
                <Failure>
                  <WaitAction time="20" />
                  <SetDataAction identifier="waveinprogress" operation="Set" value="0" />
                  <Goto name="loop" />
                </Failure>
              </CheckDataAction>
            </Success>
            <Failure>
              <WaitAction time="5" />
              <Goto name="loop" />
            </Failure>
          </RNGAction>
        </Success>
        <Failure>
          <!-- end event -->
        </Failure>
      </CheckDataAction>
      <OnRoundEndAction>
        <SetDataAction identifier="waveinprogress" operation="Set" value="0" />
        <SetDataAction identifier="spawnwaves" operation="Set" value="0" />
      </OnRoundEndAction>
    </ScriptedEvent>
    <!-- <ScriptedEvent identifier="laircrawlersoutsideTEST">
      <SpawnAction speciesname="crawler" amount="3" SpawnLocation="MainPath" offset="500" />
    </ScriptedEvent> -->
    <ScriptedEvent identifier="capturelivecrawlerevent">
      <SetDataAction identifier="capturedlivetarget" operation="set" value="0" />
      <SpawnAction speciesname="Crawler_capture" TargetTag="capturetarget" amount="3" SpawnLocation="MainPath" offset="500" />
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="hull" tag="playerhull" submarinetype="Player" />
      <TriggerAction target1tag="capturetarget" target2tag="playerhull" radius="50" waitforinteraction="false" />
      <!-- jank way of making a message popup when crawler gets inside -->
      <MissionStateAction missionidentifier="capturelivecrawler" operation="set" value="1" />
      <OnRoundEndAction>
        <CountTargetsAction targettag="capturetarget" hulltag="playerhull" CompareToTarget="capturetarget" MinPercentageRelativeToTarget="1">
          <Conditional IsDead="false" />
          <Success>
            <SetDataAction identifier="capturedlivetarget" operation="set" value="1" />
          </Success>
          <Failure>
            <SetDataAction identifier="capturedlivetarget" operation="set" value="0" />
          </Failure>
        </CountTargetsAction>
      </OnRoundEndAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="industrialincidentevent" commonness="50">
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="itemtag:junctionbox" tag="breakthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" chooserandom="true" ChoosePercentage="66" />
      <TagAction criteria="itemtag:fabricator" tag="breakthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:deconstructor" tag="breakthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:reactor" tag="damagethis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:oxygengenerator" tag="outpostoxygenerator" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:oxygengenerator" tag="ventthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:vent" tag="ventthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:wire" tag="lockthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="eventtag:breakthis" tag="repairthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="eventtag:damagethis" tag="repairthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="eventtag:repairthis" tag="burnthis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" chooserandom="true" ChoosePercentage="50" />
      <TagAction criteria="itemtag:fireextinguisher" tag="removethis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:mechanicalrepairtool" tag="removethis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <TagAction criteria="itemtag:electricalrepairtool" tag="removethis" SubmarineType="Outpost" ContinueIfNoTargetsFound="true" />
      <!-- keep O2 gen running, destroy JBs/Decon/Fabricator, damage O2 generator and reactor, start fires, lock wires, remove extinguishers and repair tools -->
      <StatusEffectAction targettag="breakthis">
        <StatusEffect target="This" indestructible="false" condition="0" setvalue="true" />
      </StatusEffectAction>
      <StatusEffectAction targettag="damagethis">
        <StatusEffect target="This" indestructible="false" condition="20" setvalue="true" />
      </StatusEffectAction>
      <StatusEffectAction targettag="repairthis">
        <StatusEffect target="This" indestructible="false" NonInteractable="false" NonPlayerTeamInteractable="false" setvalue="true" />
      </StatusEffectAction>
      <StatusEffectAction targettag="outpostoxygenerator">
        <StatusEffect target="This" indestructible="false" NonInteractable="false" NonPlayerTeamInteractable="false" setvalue="true" />
      </StatusEffectAction>
      <StatusEffectAction targettag="burnthis">
        <StatusEffect target="This">
          <Fire size="10" />
        </StatusEffect>
      </StatusEffectAction>
      <StatusEffectAction targettag="lockthis">
        <StatusEffect target="This" NonInteractable="true" setvalue="true" />
      </StatusEffectAction>
      <StatusEffectAction targettag="removethis">
        <StatusEffect target="This">
          <Remove />
        </StatusEffect>
      </StatusEffectAction>
      <!-- check for all damaged items repaired -->
      <Waitaction time="1" />
      <Label name="checkforrepaired" />
      <CountTargetsAction targettag="repairthis" CompareToTarget="repairthis" MinPercentageRelativeToTarget="100">
        <Conditional condition="gte 80" />
        <Failure>
          <!-- keep the vents going for the fire if o2 generator isnt broken, repair O2 gen slightly so it doesnt die to fire -->
          <CheckConditionalAction targettag="outpostoxygenerator" condition="gt 0">
            <Success>
              <StatusEffectAction targettag="outpostoxygenerator">
                <StatusEffect target="This" condition="1" disabledeltatime="true">
                  <Conditional condition="gt 90" />
                </StatusEffect>
              </StatusEffectAction>
              <StatusEffectAction targettag="ventthis">
                <StatusEffect target="This" duration="2" OxygenFlow="500000" disabledeltatime="true" setvalue="true" />
                <StatusEffect target="This" duration="2" targetitemcomponent="oxygengenerator" GeneratedAmount="10000" setvalue="true" />
              </StatusEffectAction>
              <Waitaction time="1" />
              <GoTo name="checkforrepaired" />
            </Success>
            <Failure>
              <StatusEffectAction targettag="ventthis">
                <StatusEffect target="This" duration="2" OxygenFlow="0" disabledeltatime="true" setvalue="true" />
              </StatusEffectAction>
              <Waitaction time="1" />
              <GoTo name="checkforrepaired" />
            </Failure>
          </CheckConditionalAction>
        </Failure>
        <Success>
          <SetDataAction identifier="outpostfixed" operation="set" value="1" />
          <MissionStateAction missionidentifier="industrialincident" operation="Set" value="2" />
          <ReputationAction targettype="Location" increase="3" />
          <ConversationAction text="eventtext.industrialincidentevent.success" dialogtype="Mission" targettag="player" eventsprite="officeinside" />
        </Success>
      </CountTargetsAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="escortorangeboysevent">
      <SetDataAction identifier="escortedorangeboys" operation="set" value="0" />
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="hull" tag="playerhull" submarinetype="Player" />
      <SpawnAction speciesname="orangeboy_escort" TargetTag="escortboy" amount="5" SpawnLocation="MainSub" spawnpointtype="cargo" offset="100" />
      <!-- check if 75% of orangeboys not dead, otherwise fail -->
      <Waitaction time="1" />
      <Label name="checkfordeadescortboys" />
      <CountTargetsAction targettag="escortboy" CompareToTarget="escortboy" MinPercentageRelativeToTarget="75">
        <Conditional isdead="false" />
        <Success>
          <Waitaction time="1" />
          <GoTo name="checkfordeadescortboys" />
        </Success>
        <Failure>
          <SetDataAction identifier="escortedorangeboys" operation="set" value="0" />
          <MissionStateAction missionidentifier="escortorangeboys" operation="Set" value="1" />
        </Failure>
      </CountTargetsAction>
      <OnRoundEndAction>
        <CountTargetsAction targettag="escortboy" hulltag="playerhull" CompareToTarget="escortboy" MinPercentageRelativeToTarget="75">
          <Conditional isdead="false" />
          <Success>
            <SetDataAction identifier="escortedorangeboys" operation="set" value="1" />
            <SetDataAction identifier="orangePETAcounter" operation="add" value="1" />
            <StatusEffectAction targettag="escortboy">
              <StatusEffect type="Always" target="Character">
                <RemoveCharacter />
              </StatusEffect>
            </StatusEffectAction>
          </Success>
          <Failure>
            <SetDataAction identifier="escortedorangeboys" operation="set" value="0" />
            <StatusEffectAction targettag="escortboy">
              <StatusEffect type="Always" target="Character">
                <RemoveCharacter />
              </StatusEffect>
            </StatusEffectAction>
          </Failure>
        </CountTargetsAction>
      </OnRoundEndAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="hiddenandclowngerous" commonness="10">
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="hull" tag="anyhull" submarinetype="outpost" />
      <TagAction criteria="itemtag:hornitem" tag="bikehorn" />
      <SpawnAction npcsetidentifier="husknpcs" npcidentifier="huskcultistsecurity" targettag="headofsecurity" targetmoduletags="adminmodule" offset="150" />
      <ConversationAction text="EventText.hiddenandclowngerous.thisistheplace" targettag="player" eventsprite="infiltration2" dialogtype="Small" />
      <Label name="waitforhonks" />
      <WaitAction time="1" />
      <WaitForItemUsedAction itemtag="bikehorn" targetitemcomponent="RangedWeapon" ApplyTagToLinkedHulls="honkedhull" />
      <CountTargetsAction targettag="honkedhull" CompareToTarget="anyhull" MinPercentageRelativeToTarget="25">
        <Success>
          <TagAction criteria="itemidentifier:opdeco_trashcan" tag="clowntrashcan" submarinetype="outpost" chooserandom="true" />
          <TriggerAction target1tag="clowntrashcan" target2tag="player" applytotarget2="triggerer_player" radius="100" />
          <ConversationAction targettag="triggerer_player" text="EventText.hiddenandclowngerous.psstoverhere" eventsprite="Infiltration2" />
          <TriggerAction target1tag="clowntrashcan" target2tag="player" applytotarget2="triggerer_player" waitforinteraction="true" />
          <ConversationAction targettag="triggerer_player" text="EventText.hiddenandclowngerous.trashfound" eventsprite="Infiltration2">
            <Option text="EventText.hiddenandclowngerous.whyintrash">
              <ConversationAction text="EventText.hiddenandclowngerous.hidingobivously" targettag="triggerer_player" eventsprite="infiltration2">
                <Option text="EventText.hiddenandclowngerous.whatdidyouexpect">
                  <Label name="studiedhusks" />
                  <ConversationAction text="EventText.hiddenandclowngerous.studiedhusks" targettag="triggerer_player" eventsprite="infiltration2">
                    <Option text="EventText.hiddenandclowngerous.timetoleave">
                      <Label name="cantgetout" />
                      <ConversationAction text="EventText.hiddenandclowngerous.cantgetout">
                        <Option text="EventText.hiddenandclowngerous.gotosecurity">
                          <ConversationAction text="EventText.hiddenandclowngerous.timetonegociate" />
                          <Goto name="talktohusksecurity" />
                        </Option>
                      </ConversationAction>
                    </Option>
                    <Option text="EventText.hiddenandclowngerous.pullnose">
                      <Goto name="cantgetout" />
                    </Option>
                  </ConversationAction>
                </Option>
                <Option text="EventText.hiddenandclowngerous.unbelievable">
                  <Goto name="studiedhusks" />
                </Option>
              </ConversationAction>
            </Option>
          </ConversationAction>
        </Success>
        <Failure>
          <Goto name="waitforhonks" />
        </Failure>
      </CountTargetsAction>
      <!-- Talk to security. -->
      <Label name="talktohusksecurity" />
      <TriggerAction target1tag="player" target2tag="headofsecurity" applytotarget1="playernegociator" waitforinteraction="true" />
      <NPCFollowAction npctag="headofsecurity" targettag="playernegociator" follow="true" />
      <ConversationAction text="EventText.hiddenandclowngerous.sternsecurity" targettag="playernegociator" eventsprite="BombScare1">
        <Option text="EventText.hiddenandclowngerous.heardanysqueaks">
          <ConversationAction text="EventText.hiddenandclowngerous.lookingforclown" targettag="playernegociator" eventsprite="infiltration2">
            <Option text="EventText.hiddenandclowngerous.nofanofclowns">
              <ConversationAction text="EventText.hiddenandclowngerous.clownsnottolerated" targettag="playernegociator" eventsprite="infiltration2">
                <!-- tell clown to leave -->
                <Option text="EventText.hiddenandclowngerous.allowclowntoleave">
                  <ConversationAction text="EventText.hiddenandclowngerous.fineclowncanleave" endconversation="true" />
                  <!-- go back to the clown -->
                  <TriggerAction target1tag="clowntrashcan" target2tag="playernegociator" waitforinteraction="true" />
                  <ConversationAction text="EventText.hiddenandclowngerous.didtheylikejoke">
                    <Option text="EventText.hiddenandclowngerous.youcango">
                      <ConversationAction text="EventText.hiddenandclowngerous.clownleavestrash" endconversation="true" />
                      <SpawnAction npcsetidentifier="husknpcsmission" npcidentifier="clownfiltrator" targettag="clownfiltrator" SpawnPointTag="clowntrashcan" />
                      <SpawnAction itemidentifier="bananapeel" SpawnPointTag="clowntrashcan" Amount="3" ignorebyai="true" offset="150" />
                      <ReputationAction targettype="Faction" identifier="clowns" increase="3" />
                      <ReputationAction targettype="Faction" identifier="huskcult" increase="3" />
                      <TriggerAction target1tag="clownfiltrator" target2tag="playernegociator" waitforinteraction="true" />
                      <ConversationAction text="EventText.hiddenandclowngerous.smellyclown" targettag="playernegociator" eventsprite="infiltration2">
                        <Option text="EventText.hiddenandclowngerous.joinmycrew" endconversation="true">
                          <ConversationAction text="EventText.hiddenandclowngerous.joinsthecrew" endconversation="true" />
                          <NPCChangeTeamAction npctag="clownfiltrator" teamid="Team1" addtocrew="true" />
                        </Option>
                        <Option text="EventText.hiddenandclowngerous.laughatyourself" endconversation="true">
                          <ConversationAction text="EventText.hiddenandclowngerous.clowngrateful" endconversation="true" />
                          <ReputationAction targettype="Faction" identifier="clowns" increase="3" />
                        </Option>
                      </ConversationAction>
                    </Option>
                  </ConversationAction>
                </Option>
                <!-- path of the pranks -->
                <Option text="EventText.hiddenandclowngerous.seennoclown">
                  <ConversationAction text="EventText.hiddenandclowngerous.dontbotherme" endconversation="true" />
                  <!-- go back to the clown -->
                  <TriggerAction target1tag="clowntrashcan" target2tag="playernegociator" waitforinteraction="true" />
                  <ConversationAction text="EventText.hiddenandclowngerous.didtheylikejoke">
                    <Option text="EventText.hiddenandclowngerous.nonegociation">
                      <ConversationAction text="EventText.hiddenandclowngerous.escapeplan">
                        <Option text="EventText.hiddenandclowngerous.whatprank">
                          <ConversationAction text="EventText.hiddenandclowngerous.givesgrenade" endconversation="true" />
                          <SpawnAction itemidentifier="stungrenade" targetinventory="triggerer_player" targettag="prankgrenade" />
                          <WaitAction time="2" />
                          <TagAction criteria="itemidentifier:suppliescabinet" tag="prankcabinet" submarinetype="outpost" />
                          <HighlightAction targettag="prankcabinet" state="true" />
                          <label name="waitforprank" />
                          <CheckItemAction targettag="prankcabinet" itemtags="prankgrenade">
                            <Success>
                              <HighlightAction targettag="prankcabinet" state="false" />
                              <NPCFollowAction npctag="headofsecurity" targettag="prankgrenade" follow="true" />
                              <StatusEffectAction targettag="prankgrenade">
                                <StatusEffect duration="30" noninteractable="true" checkconditionalalways="true" setvalue="true">
                                  <Conditional condition="gt 0" />
                                  <Sound file="Content/Items/Misc/AccordionLoop.ogg" range="1000" volume="2" frequencymultiplier="1.5" loop="true" />
                                  <ParticleEmitter particle="shockwavesmall" particlespersecond="5" scalemin="1" scalemax="2" />
                                </StatusEffect>
                              </StatusEffectAction>
                              <TriggerAction target1tag="headofsecurity" target2tag="prankgrenade" radius="250" />
                              <ConversationAction text="EventText.hiddenandclowngerous.honkit" targettag="triggerer_player" endconversation="true" dialogtype="Small" />
                              <WaitForItemUsedAction itemtag="bikehorn" targetitemcomponent="RangedWeapon" />
                              <StatusEffectAction targettag="prankgrenade">
                                <StatusEffect delay="1">
                                  <Use />
                                  <Remove />
                                </StatusEffect>
                              </StatusEffectAction>
                              <ReputationAction targettype="Faction" identifier="huskcult" increase="-5" />
                              <TagAction criteria="itemtag:navterminal" tag="navterminal" submarinetype="player" />
                              <SpawnAction npcsetidentifier="husknpcsmission" npcidentifier="clownfiltrator" targettag="clownfiltrator" SpawnPointTag="clowntrashcan" teamid="Team1" />
                              <NPCChangeTeamAction npctag="clownfiltrator" teamid="Team1" addtocrew="false" />
                              <SpawnAction itemidentifier="bananapeel" SpawnPointTag="clowntrashcan" Amount="3" ignorebyai="true" offset="150" />
                              <NPCFollowAction npctag="clownfiltrator" targettag="navterminal" follow="true" />
                              <ConversationAction text="EventText.hiddenandclowngerous.pathoftrickster">
                                <Option text="EventText.hiddenandclowngerous.clowncanjoin" endconversation="true">
                                  <NPCChangeTeamAction npctag="clownfiltrator" teamid="Team1" addtocrew="false" />
                                  <ReputationAction targettype="Faction" identifier="clowns" increase="10" />
                                  <!-- end -->
                                </Option>
                              </ConversationAction>
                            </Success>
                            <Failure>
                              <Waitaction time="2" />
                              <Goto name="waitforprank" />
                            </Failure>
                          </CheckItemAction>
                        </Option>
                      </ConversationAction>
                    </Option>
                  </ConversationAction>
                </Option>
                <!-- sell out the clown -->
                <Option text="EventText.hiddenandclowngerous.snitchonclown">
                  <ConversationAction text="EventText.hiddenandclowngerous.luretheclown" endconversation="true" />
                  <!-- go back to the clown -->
                  <TriggerAction target1tag="clowntrashcan" target2tag="playernegociator" waitforinteraction="true" />
                  <ConversationAction text="EventText.hiddenandclowngerous.didtheylikejoke">
                    <Option text="EventText.hiddenandclowngerous.lietoclown">
                      <ConversationAction text="EventText.hiddenandclowngerous.clownleavestrash" endconversation="true" />
                    </Option>
                  </ConversationAction>
                  <SpawnAction npcsetidentifier="husknpcsmission" npcidentifier="clownfiltrator" targettag="clownfiltrator" SpawnPointTag="clowntrashcan" />
                  <SpawnAction itemidentifier="bananapeel" SpawnPointTag="clowntrashcan" Amount="3" ignorebyai="true" offset="150" />
                  <Label name="waitforhandcuffedclown" />
                  <CombatAction combatmode="arrest" npctag="headofsecurity" enemytag="clownfiltrator" isinstigator="false" guardreaction="arrest" witnessreaction="none" />
                  <WaitAction time="2" />
                  <CombatAction combatmode="retreat" npctag="clownfiltrator" enemytag="headofsecurity" isinstigator="true" guardreaction="arrest" witnessreaction="none" />
                  <CheckItemAction targettag="clownfiltrator" itemidentifiers="handcuffs" requireequipped="true">
                    <Success>
                      <ConversationAction text="EventText.hiddenandclowngerous.clownarrested" targettag="triggerer_player" eventsprite="infiltration2" endconversation="true" />
                      <ReputationAction targettype="Faction" identifier="clowns" increase="-5" />
                      <ReputationAction targettype="Faction" identifier="huskcult" increase="10" />
                      <MoneyAction amount="500" />
                    </Success>
                    <Failure>
                      <Waitaction time="2" />
                      <Goto name="waitforhandcuffedclown" />
                    </Failure>
                  </CheckItemAction>
                </Option>
              </ConversationAction>
            </Option>
          </ConversationAction>
        </Option>
      </ConversationAction>
      <Label name="end" />
    </ScriptedEvent>
    <ScriptedEvent identifier="chimerasamplesmissionevent" commonness="50">
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="hull" tag="playerhull" submarinetype="Player" />
      <TagAction criteria="itemidentifier:husksamplevial" tag="vial" />
      <SetDataAction identifier="chimerasamplesretrieved" operation="set" value="0" />
      <SpawnAction speciesname="husk_chimera" TargetTag="chimera" amount="1" SpawnLocation="MainPath" offset="100" />
      <SpawnAction itemidentifier="monsterlocatoritem" targettag="locator" targetinventory="chimera" ignorebyai="true" />
      <Label name="checkforvial" />
      <CheckConditionalAction targettag="vial" condition="gte 100">
        <Success>
          <SetDataAction identifier="chimerasamplesretrieved" operation="set" value="1" />
          <MissionStateAction missionidentifier="chimerasamples" operation="set" value="1" />
        </Success>
        <Failure>
          <Waitaction time="1" />
          <GoTo name="checkforvial" />
        </Failure>
      </CheckConditionalAction>
      <OnRoundEndAction>
        <CountTargetsAction targettag="vial" hulltag="playerhull" CompareToTarget="vial" MinPercentageRelativeToTarget="1">
          <Conditional condition="gte 100" />
          <Success>
            <MissionStateAction missionidentifier="chimerasamples" operation="set" value="1" />
            <SetDataAction identifier="chimerasamplesretrieved" operation="set" value="1" />
            <RemoveItemAction targettag="vial" Amount="100" />
          </Success>
          <Failure>
            <SetDataAction identifier="chimerasamplesretrieved" operation="set" value="0" />
            <MissionStateAction missionidentifier="chimerasamples" operation="set" value="0" />
            <RemoveItemAction targettag="vial" Amount="100" />
          </Failure>
        </CountTargetsAction>
      </OnRoundEndAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="silencewitnessevent">
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="hullname:airlock" tag="airlock" submarinetype="Outpost" />
      <TagAction criteria="humanprefabtag:securitynpc" tag="arrestplayer" ChoosePercentage="1" chooserandom="true" />
      <TagAction criteria="humanprefabidentifier:prisonerbanditfake" tag="potentialprisoner" SubmarineType="Outpost" />
      <TagAction criteria="humanprefabidentifier:prisonerbanditsnitch" tag="potentialprisoner" SubmarineType="Outpost" />
      <TagAction criteria="humanprefabidentifier:prisonerbanditsnitch" tag="snitch" SubmarineType="Outpost" />
      <AfflictionAction affliction="nastyscar" strength="1" targettag="snitch" />
      <TriggerAction target1tag="potentialprisoner" target2tag="player" applytotarget2="spotter_player" disableiftargetincapacitated="false" radius="200" waitforinteraction="false" />
      <ConversationAction text="EventText.silencewitnessevent.whichone" targettag="spotter_player" dialogtype="Small" eventsprite="group" endconversation="true" />
      <Label name="pickaprisoner" />
      <ClearTagAction tag="chosen_prisoner" />
      <ClearTagAction tag="speaker_player" />
      <WaitAction time="1" />
      <TriggerAction target1tag="potentialprisoner" target2tag="player" applytotarget1="chosen_prisoner" applytotarget2="speaker_player" disableiftargetincapacitated="false" radius="50" waitforinteraction="true" AllowMultipleTargets="true" />
      <ConversationAction text="EventText.silencewitnessevent.whoareyou" targettag="speaker_player" dialogtype="Small" eventsprite="silhouette">
        <Option text="EventText.silencewitnessevent.regards">
          <CheckConditionalAction targettag="chosen_prisoner" nastyscar="gt 0">
            <Success>
              <ConversationAction text="EventText.silencewitnessevent.righttarget" targettag="speaker_player" dialogtype="Small" eventsprite="mediator" ContinueAutomatically="true" endconversation="true" />
              <TagAction criteria="itemtag:securityalarm" submarinetype="Outpost" tag="alarmbutton" />
              <StatusEffectAction targettag="alarmbutton">
                <StatusEffect State="true" target="This" />
              </StatusEffectAction>
              <WaitAction time="2" />
              <CombatAction combatmode="Offensive" npctag="snitch" enemytag="speaker_player" isinstigator="false" witnessreaction="none" />
              <CombatAction combatmode="Offensive" npctag="securitynpc" enemytag="speaker_player" isinstigator="false" witnessreaction="none" />
            </Success>
            <Failure>
              <ConversationAction text="EventText.silencewitnessevent.wrongtarget" targettag="speaker_player" dialogtype="Small" eventsprite="silhouette" endconversation="true" />
              <TagAction criteria="itemtag:securityalarm" submarinetype="Outpost" tag="alarmbutton" />
              <StatusEffectAction targettag="alarmbutton">
                <StatusEffect State="true" target="This" />
              </StatusEffectAction>
              <CombatAction combatmode="Arrest" npctag="securitynpc" enemytag="speaker_player" isinstigator="false" witnessreaction="none" />
            </Failure>
          </CheckConditionalAction>
        </Option>
        <Option text="EventText.silencewitnessevent.nevermind">
          <SkillCheckAction requiredskill="weapons" requiredlevel="60" targettag="speaker_player">
            <Success>
              <ConversationAction text="EventText.silencewitnessevent.whatever" targettag="speaker_player" dialogtype="small" />
              <Goto name="pickaprisoner" />
            </Success>
            <Failure>
              <!-- failed check, prisoners try to escape -->
              <ConversationAction text="EventText.silencewitnessevent.outtahere" targettag="speaker_player" dialogtype="small" eventsprite="mediator" />
              <AfflictionAction affliction="slow" strength="60" targettag="potentialprisoner" />
              <NPCFollowAction npctag="potentialprisoner" targettag="airlock" follow="true" />
              <TagAction criteria="itemtag:securityalarm" submarinetype="Outpost" tag="alarmbutton" />
              <StatusEffectAction targettag="alarmbutton">
                <StatusEffect State="true" target="This" />
              </StatusEffectAction>
              <TagAction criteria="eventtag:speaker_player" tag="potentialprisoner" />
              <CombatAction combatmode="Arrest" npctag="securitynpc" enemytag="potentialprisoner" isinstigator="false" witnessreaction="retreat" />
              <CombatAction combatmode="Arrest" npctag="arrestplayer" enemytag="speaker_player" isinstigator="false" witnessreaction="retreat" />
              <WaitAction time="10" />
              <NPCFollowAction npctag="potentialprisoner" targettag="airlock" follow="false" />
            </Failure>
          </SkillCheckAction>
        </Option>
      </ConversationAction>
    </ScriptedEvent>
    <!-- BARTENDER -->
    <ScriptedEvent identifier="alcoholcontrabandevent" commonness="100">
      <SetDataAction identifier="alcoholdelivered" operation="set" value="0" />
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="itemidentifier:contrabandrum" tag="contrabandrum" submarinetype="Player" />
      <TagAction criteria="itemidentifier:bartenderchair" tag="bar" />
      <TagAction criteria="humanprefabidentifier:bartender" tag="bartenderchair" />
      <TagAction criteria="itemtag:crate" tag="targetcrate" submarinetype="Player" />
      <StatusEffectAction targettag="contrabandrum">
        <StatusEffect target="This" SpawnedInCurrentOutpost="true" AllowStealing="false" setvalue="true" />
      </StatusEffectAction>
      <StatusEffectAction targettag="targetcrate">
        <StatusEffect target="This" SpawnedInCurrentOutpost="true" AllowStealing="false" setvalue="true">
          <RequiredItems identifier="contrabandrum" type="contained" />
        </StatusEffect>
      </StatusEffectAction>
      <TriggerEventAction identifier="alcoholcontrabandeventloop" />
      <SpawnAction npcsetidentifier="outpostnpcs1" npcidentifier="securitynpc[faction]" targettag="contrabandsecurity" spawnlocation="Outpost" />
      <NPCOperateItemAction npctag="bartender" targettag="bar" operate="true" />
      <ClearTagAction tag="triggerer_player" />
      <Label name="waitforinput" />
      <TriggerAction target1tag="bartender" target2tag="player" applytotarget2="triggerer_player" waitforinteraction="true" />
      <ConversationAction text="eventtext.alcoholcontrabandevent.bartender" targettag="triggerer_player" dialogtype="Small" eventsprite="oldman">
        <Option text="eventtext.alcoholcontrabandevent.delivery">
          <CheckItemAction targettag="triggerer_player" itemidentifiers="contrabandrum" amount="10" recursive="true">
            <Success>
              <RemoveItemAction targettag="triggerer_player" ItemIdentifiers="contrabandrum" Amount="10" />
              <SetDataAction identifier="alcoholdelivered" operation="set" value="1" />
              <MissionStateAction missionidentifier="alcoholcontraband" operation="Set" value="2" />
              <MoneyAction amount="500" />
              <ConversationAction text="eventtext.alcoholcontrabandevent.thirsty" targettag="triggerer_player" dialogtype="Small" eventsprite="oldman" endconversation="true" />
            </Success>
            <Failure>
              <ConversationAction text="eventtext.alcoholcontrabandevent.nogoods" targettag="triggerer_player" dialogtype="Small" eventsprite="oldman" endconversation="true" />
              <GoTo name="waitforinput" />
            </Failure>
          </CheckItemAction>
        </Option>
        <Option text="eventtext.generic.ignore" endconversation="true">
          <Goto name="waitforinput" />
        </Option>
      </ConversationAction>
    </ScriptedEvent>
    <ScriptedEvent identifier="alcoholcontrabandeventloop" commonness="100">
      <TagAction criteria="itemidentifier:contrabandrum" tag="contrabandrum" submarinetype="Player" />
      <Label name="recheck" />
      <WaitAction time="1" />
      <TagAction criteria="itemtag:crate" tag="targetcontainer" />
      <TagAction criteria="itemtag:mobilecontainer" tag="targetcontainer" />
      <StatusEffectAction targettag="contrabandrum">
        <StatusEffect target="This" SpawnedInCurrentOutpost="true" AllowStealing="false" setvalue="true" />
      </StatusEffectAction>
      <StatusEffectAction targettag="targetcontainer">
        <StatusEffect target="This" SpawnedInCurrentOutpost="true" AllowStealing="false" setvalue="true">
          <RequiredItems identifier="contrabandrum" type="contained" />
        </StatusEffect>
      </StatusEffectAction>
      <GoTo name="recheck" />
    </ScriptedEvent>
    <!--       <ScriptedEvent identifier="jailbreak_alarm">
        <TriggerAction target1tag="prisoner" target2tag="securitynpc" applytotarget1="triggerer_prisoner" applytotarget2="triggerer_securitynpc" disableiftargetincapacitated="false" radius="200" waitforinteraction="false" />
        <NPCFollowAction npctag="triggerer_prisoner" targettag="triggerer_securitynpc" follow="true" />
        <WaitAction time="3" />
        <TagAction criteria="itemtag:securityalarm" submarinetype="Outpost" tag="alarmbutton" />
        <StatusEffectAction targettag="alarmbutton">
          <StatusEffect State="true" target="This" />
        </StatusEffectAction>
        <ConversationAction text="EventText.jailbreak_alarm.c1" eventsprite="NoticeBoard" ContinueAutomatically="true" />
        <NPCFollowAction npctag="triggerer_prisoner" targettag="triggerer_securitynpc" follow="false" />
        <NPCChangeTeamAction npctag="securitynpc" teamid="Team2" />
      </ScriptedEvent>
 -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- ///////////////////  UNUSED, BROKEN, OR WIP /////////////////// -->
    <!-- UNUSED. TODO: bugged, the issue was documents spawning in completely random places, including player submarine and sometimes in the same cabinet twice -->
    <!-- <ScriptedEvent identifier="finddocuments" commonness="50">
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="itemidentifier:mediumsteelcabinet" tag="potentialcabinet" SubmarineType="Outpost" ContinueIfNoTargetsFound="true"  />
      <TagAction criteria="itemidentifier:steelcabinet" tag="potentialcabinet" SubmarineType="Outpost" ContinueIfNoTargetsFound="true"  />
      
      <StatusEffectAction targettag="potentialcabinet">
        <StatusEffect target="This" spritecolor="255,0,255,255" setvalue="true" />
      </StatusEffectAction>      
      <Label name="finddocuments1" />
      <TagAction criteria="eventtag:potentialcabinet" tag="documentcabinet1" SubmarineType="Outpost" chooserandom="true" ContinueIfNoTargetsFound="false"  />
      <SpawnAction itemidentifier="documents" targettag="documents1" targetinventory="documentcabinet1" ignorebyai="true" />

      <TriggerAction target1tag="player" target2tag="documents1" applytotarget1="documents1finder" waitforinteraction="true" />
      <ConversationAction text="You've found documents, but nothing interesting." targettag="documents1finder" eventsprite="BombScare2">
        <Option text="Search elsewhere." endconversation="true"/> 
        <Goto name="finddocuments2" />
      </ConversationAction>      
      <Label name="finddocuments2" />
      <TagAction criteria="eventtag:potentialcabinet" tag="documentcabinet2" SubmarineType="Outpost" chooserandom="true" ContinueIfNoTargetsFound="false"  />
      <SpawnAction itemidentifier="documents" targettag="documents2" targetinventory="documentcabinet2" ignorebyai="true" />
      
      <TriggerAction target1tag="player" target2tag="documents2" applytotarget1="documents2finder" waitforinteraction="true" />
      <ConversationAction text="You've found documents, but nothing interesting." targettag="documents2finder" eventsprite="BombScare2">
        <Option text="Search elsewhere." endconversation="true"/> 
        <Goto name="finddocuments3" />
      </ConversationAction>      
      <Label name="finddocuments3" />
      <TagAction criteria="eventtag:potentialcabinet" tag="documentcabinet3" SubmarineType="Outpost" chooserandom="true" ContinueIfNoTargetsFound="false"  />
      <SpawnAction itemidentifier="documents" targettag="documents3" targetinventory="documentcabinet3" ignorebyai="true" />
      
      <TriggerAction target1tag="player" target2tag="documents3" applytotarget1="documents3finder" waitforinteraction="true" />
      <ConversationAction text="You've found documents, but nothing interesting." targettag="documents3finder" eventsprite="BombScare2">
        <Option text="Search elsewhere." endconversation="true"/> 
        <Goto name="finddocuments4" />
      </ConversationAction>      
      <Label name="finddocuments4" />
      <TagAction criteria="eventtag:potentialcabinet" tag="documentcabinet4" SubmarineType="Outpost" chooserandom="true" ContinueIfNoTargetsFound="false"  />
      <SpawnAction itemidentifier="classifieddocuments" targettag="documents4" targetinventory="documentcabinet4" ignorebyai="true" />
      
      <TriggerAction target1tag="player" target2tag="documents4" applytotarget1="documents4finder" waitforinteraction="true" />
      <ConversationAction text="Those are the documents." targettag="documents4finder" eventsprite="BombScare2">
        <Option text="Back to the ship." endconversation="true"/> 
        <Goto name="finddocuments4" />       
      </ConversationAction>
    </ScriptedEvent> -->
    <!-- UNUSED. More complex version of ransom, not working currently -->
    <!--     <ScriptedEvent identifier="escortransomTEST">    
      <SpawnAction npcsetidentifier="customnpcs" npcidentifier="ransomtarget" spawnlocation="MainSub" />
      <OnRoundEndAction>
        <CheckConditionalAction targettag="ransomtarget" InPlayerSubmarine="true" IsDead="False">
          <Success>
            <SetDataAction identifier="vipnappingnorepeat" value="1" />
            <NPCChangeTeamAction npctag="ransomtarget" teamtag="Team1" addtocrew="true" />
            <TriggerEventAction identifier="escortransom" nextround="true" />
          </Success>
          <Failure>
            <SetDataAction identifier="vipnappingnorepeat" value="1" />
          </Failure>
        </CheckConditionalAction>
      </OnRoundEndAction>
    </ScriptedEvent>
   
    <ScriptedEvent identifier="escortransom">
      <TagAction criteria="jobidentifier:vip" tag="ransomtarget" />
      <NPCChangeTeamAction npctag="ransomtarget" teamtag="Team2" removefromcrew="true" />
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="hull" tag="beaconhull" submarinetype="BeaconStation" />      
      <EventObjectiveAction type="add" identifier="eventtext.escortransom.findbeacon" />
      <TriggerAction target1tag="ransomtarget" target2tag="beaconhull" radius="200" waitforinteraction="false" />
      <EventObjectiveAction type="completeandremove" identifier="eventtext.escortransom.findbeacon" />
      <OnRoundEndAction>        
        <CheckConditionalAction targettag="ransomtarget" InBeaconStation="true" IsDead="False">
          <Success>               
            <MoneyAction amount="2000" />
            <ReputationAction increase="2" identifier="bandits" targettype="Faction" />
          </Success>
          <Failure>
            <NPCChangeTeamAction npctag="ransomtarget" teamtag="Team1" addtocrew="true" />
            <TriggerEventAction identifier="escortransom" nextround="true" />
          </Failure>
        </CheckConditionalAction>
      </OnRoundEndAction>
    </ScriptedEvent>-->
    <!-- UNUSED -->
    <!--     <ScriptedEvent identifier="missionevent_piratevscoalition" commonness="200">
      <NPCWaitAction npctag="managerpirate" wait="true" />
      <ConversationAction text="EventText.missionevent.piratevscoalition.c1" speakertag="managerpirate" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missiontag="piratevscoalition" />
      <NPCWaitAction npctag="managerpirate" wait="false" />
    </ScriptedEvent> -->
    <!--     <ScriptedEvent identifier="missionevent_piratevsseparatists" commonness="200">
      <NPCWaitAction npctag="managerpirate" wait="true" />
      <ConversationAction text="EventText.missionevent.piratevsseparatists.c1" speakertag="managerpirate" endeventifinterrupted="false" dialogtype="Small" />
      <MissionAction missiontag="piratevsseparatists" />
      <NPCWaitAction npctag="managerpirate" wait="false" />
    </ScriptedEvent> -->
    <!-- Unused. TODO: should be used as part of assassinatehuskresearcher mission if NPCOperateItemAction ever allows NPCs using items -->
    <!-- <ScriptedEvent identifier="missionevent_poisonchalice" commonness="0">
        <CheckDataAction identifier="poisonchalicemissionnorepeat" condition="eq 0" >
          <Failure>
          </Failure>
          <Success>
            <CheckReputationAction targettype="faction" identifier="coalition" condition="gte 30">
              <Failure>
              </Failure>
              <Success>
                <ConversationAction text="EventText.missionevent_assassinatehuskresearcher.majorproblem" speakertag="outpostmanager" invokertag="triggerer_player" endeventifinterrupted="false" eventsprite="Coalition" >
                  <Option text="EventText.missionevent_assassinatehuskresearcher.whatkindofproblem">
                    <ConversationAction text="EventText.missionevent_assassinatehuskresearcher.huskpathogen" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="JacovSubra2" endconversation="true" >
                      <Option text="EventText.missionevent_assassinatehuskresearcher.soundsbad">
                        <ConversationAction text="EventText.missionevent_assassinatehuskresearcher.missionbrief" targettag="triggerer_player" endeventifinterrupted="false" eventsprite="JacovSubra2" endconversation="true" >
                          <Option text="EventText.missionevent_assassinatehuskresearcher.Iwilldoit" endconversation="true">
                            <MissionAction missionidentifier="poisonchalice" locationtype="huskchurch" faction="coalition" requiredfaction="" minlocationdistance="1" />
                          </Option>
                          <Option text="EventText.missionevent_assassinatehuskresearcher.Noway" endconversation="true">   
                            <ReputationAction targettype="Faction" identifier="coalition" increase="-1" />
                            <SetDataAction identifier="poisonchalicemissionnorepeat" value="1"/> 
                          </Option>                    
                        </ConversationAction> 
                      </Option>
                    </ConversationAction>
                  </Option>
                </ConversationAction>
              </Success>
            </CheckReputationAction>  
          </Success>
        </CheckDataAction>
      </ScriptedEvent> -->
    <!-- Unused -->
    <!--     <ScriptedEvent identifier="poisonchaliceevent">
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="itemidentifier:huskchalice" tag="ritualchalice" SubmarineType="Outpost" />
      <SpawnAction npcsetidentifier="husknpcsmission" npcidentifier="huskassassinationtarget" targettag="chalicedrinker" spawnlocation="Outpost" targetmoduletags="adminchurch" />
      <TriggerAction target1tag="player" target2tag="ritualchalice" applytotarget1="triggerer_player" applytotarget2="selectedchalice" radius="150" waitforinteraction="true" /> 
      <ConversationAction targettag="triggerer_player" text="This must be the chalice used for rituals..." eventsprite="vent">
        <Option text="Pull out the dose out of your pocket." endconversation="true">
          <SpawnAction itemidentifier="calyxanide" targettag="calyxanide" targetinventory="triggerer_player" />
        </Option>
      </ConversationAction>
      <Label name="waitforcompletion" />
      <CheckItemAction targettag="ritualchalice" >
        <Conditional TargetContainedItem="true" HasTag="chem" />
        <Success>
          <WaitAction time="1" />
          <ConversationAction targettag="triggerer_player" text="The Chalice has been filled with the right dose of calyxanide: bitter for humans, and lethal for... monsters." eventsprite="Ecclesiast" />
          <SetDataAction identifier="poisonedchalicecomplete" value="1" />
          <WaitAction time="1" />
          <NPCOperateItemAction npctag="chalicedrinker" targettag="ritualchalice" RequireEquip="true" Operate="true" />  
        </Success>
        <Failure>
          <GoTo name="waitforcompletion" />
        </Failure>
      </CheckItemAction>
    </ScriptedEvent>

    <ScriptedEvent identifier="calyxanide_alarm">
      <TriggerAction target1tag="triggerer_player" target2tag="securitynpc" applytotarget2="triggerer_securitynpc" disableiftargetincapacitated="false" radius="200" waitforinteraction="false" />
      <NPCFollowAction npctag="triggerer_player" targettag="triggerer_securitynpc" follow="true" />
      <WaitAction time="3" />
      <ConversationAction text="EventText.jailbreak_alarm.c1" eventsprite="NoticeBoard" />
      <NPCChangeTeamAction npctag="securitynpc" teamid="Team2" />
    </ScriptedEvent> -->
    <!-- UNUSED, can't get the mission to accept the state as completed and succeed-->
    <!--     <ScriptedEvent identifier="findhiddenpylonsevent" commonness="50">
      <SetDataAction identifier="pylonsdestroyed" operation="set" value="0" />
      <TagAction criteria="player" tag="player" />
      <TagAction criteria="itemidentifier:hiddenalienpylon" tag="breakthis" />
      <Waitaction time="1" />
      <Label name="checkfordestroyed" />
      <CountTargetsAction targettag="breakthis" CompareToTarget="breakthis" MinPercentageRelativeToTarget="100">
        <Conditional condition="lte 0" />
        <Failure>
          <Waitaction time="1" />
          <GoTo name="checkfordestroyed" />
        </Failure>
        <Success>
          <SetDataAction identifier="pylonsdestroyed" operation="set" value="1" />
          <MissionStateAction missionidentifier="findhiddenpylons" operation="Set" value="1" />
          <ConversationAction text="eventtext.industrialincidentevent.success" dialogtype="Mission" targettag="player" eventsprite="officeinside" />
        </Success>
      </CountTargetsAction>
    </ScriptedEvent>  -->
    <!-- TODO: stranded divers mission, still doesnt spawn the divers on the proper spawnlocation + it's jank + bots are stupid (they refuse waitaction so I'm stunning them in a loop) also needs a proper NPC not just pirate divers -->
    <!-- <ScriptedEvent identifier="rescuestrandeddiversevent">
      <SetDataAction identifier="rescueddivers" operation="set" value="0" />
      <SpawnAction npcsetidentifier="pirate_npcs" npcidentifier="piratediver" targettag="strandeddiver" SpawnPointTag="cave" amount="2" teamid="Team1" />
      <TagAction criteria="player" tag="player" />
      <Label name="makediverimmortal" />
      <NPCWaitAction npctag="strandeddiver" wait="true" />
      <AfflictionAction affliction="pressurestabilized" strength="1" targettag="piratediver" />
      <AfflictionAction affliction="stun" strength="1" targettag="piratediver" />
      <CheckVisibilityAction EntityTag="player" TargetTag="strandeddiver" MaxDistance="1500" AllowSameEntity="false">
        <Success>
          <NPCWaitAction npctag="strandeddiver" wait="false" />
          <AfflictionAction affliction="pressurestabilized" strength="10" targettag="piratediver" />
        </Success>
        <Failure>
          <WaitAction time="1" />
          <GoTo name="makediverimmortal" />
        </Failure>
      </CheckVisibilityAction>
      <Label name="checkfordeaddivers" />
      <CountTargetsAction targettag="piratediver" CompareToTarget="piratediver" MinPercentageRelativeToTarget="100">
        <Conditional isdead="false" />
        <Success>         
          <Waitaction time="1" />
          <GoTo name="checkfordeaddivers" />
        </Success>
        <Failure>
          <SetDataAction identifier="rescueddivers" operation="set" value="0" />
          <MissionStateAction missionidentifier="escortorangeboys" operation="Set" value="1" />
        </Failure>
      </CountTargetsAction>
      <OnRoundEndAction>
        <CountTargetsAction targettag="piratediver" hulltag="playerhull" CompareToTarget="piratediver" MinPercentageRelativeToTarget="100">
          <Conditional isdead="false" />
          <Success>
            <SetDataAction identifier="rescueddivers" operation="set" value="1" />
            <StatusEffectAction targettag="piratediver">
              <StatusEffect type="Always" target="Character" >
                <RemoveCharacter />
              </StatusEffect>
            </StatusEffectAction>
          </Success>
          <Failure>
            <SetDataAction identifier="rescueddivers" operation="set" value="0" />
            <StatusEffectAction targettag="strandeddiver">
              <StatusEffect type="Always" target="Character" >
                <RemoveCharacter />
              </StatusEffect>
            </StatusEffectAction>
          </Failure>
        </CountTargetsAction>
      </OnRoundEndAction>
    </ScriptedEvent> -->
  </EventPrefabs>
</Randomevents>