scripting. how to make khaak ship alive?

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
aurumgallente
Posts: 121
Joined: Sun, 14. Jun 20, 14:45
x4

scripting. how to make khaak ship alive?

Post by aurumgallente » Thu, 11. Feb 21, 11:33

I work on khaak capital ship. I managed to spawn it by script with loadout but I can't add command to it and its turrets to "attack all enemies".
As final result I want to spawn this ship once per hour in random sector and send it to kill everything or to add it to some of khaak patrol squads. I use in ship macro file invisible cockpit (I copied xenon cockpit), I'm not sure should I use invisible one or argon ordinary cockpit.
I would like to get some help with 2 thigs:
1 - make it alive and angry
2 - spawn it in random sector, right now it spawns in zone="player.zone"
right now my script looks like this
Spoiler
Show

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<mdscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="UT_Navscript_Test" xsi:noNamespaceSchemaLocation="http://utnas/~unitrader/XRebirthxsds/md.xsd">
  <cues>
    <cue name="Init">
      <actions>
        <create_group groupname="$Testship"/>
      </actions>
      <cues>
        <cue name="SpawnTestShips" checktime="10s" checkinterval="5s">
          <conditions>
            <cue_is_complete cue="md.Setup.Start"/>
          </conditions>
          <actions>
            <do_all exact="5" counter="$i"> <!-- exact= defines the amount of ships -->
              <set_value name="$level" exact="$i"/>
              <do_while value="$level gt 3">
                <set_value name="$level" exact="3" operation="subtract"/>
              </do_while>
			  <generate_loadout
					macro="macro.x2bustertest_macro" faction="faction.khaak"
					wares="[ware.software_flightassistmk1, ware.software_dockmk2, ware.software_scannerlongrangemk1, ware.software_scannerobjectmk1, ware.software_targetmk1, ware.engine_kha_s_combat_01_mk1, ware.turret_kha_m_beam_01_mk1, ware.thruster_gen_l_allround_01_mk1]"
					level="1" result="$loadout"
			  />
			  <create_ship name="$Testship" zone="player.zone" macro="macro.x2bustertest_macro"> <!-- macro= defines the ship macro -->
                <owner exact="faction.khaak" />
				<loadout loadout="$loadout.{1}" />
                    <pilot>
                      <select faction="faction.khaak" tags="tag.aipilot"/>
                    </pilot>
                <safepos object="player.container" radius="5km"/>
              </create_ship>
			  <create_order object="$Testship" id="'Patrol'" default="true">
				<param name="range" value="class.zone" />
				<param name="pursuetargets" value="true" />
			  </create_order>			  
            </do_all>
          </actions>
        </cue>
      </cues>
    </cue>
  </cues>
</mdscript>

Post Reply

Return to “X4: Foundations - Scripts and Modding”