[ settled ] Encountered problems to add a turret...

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

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

Post Reply
hxsgame
Posts: 210
Joined: Thu, 4. Oct 18, 16:54
x4

[ settled ] Encountered problems to add a turret...

Post by hxsgame » Wed, 1. Feb 23, 17:39

The problem was that I didn't buy the blueprints in the game… adding new weapons in wares.xml, game will generated the blueprints by default, Instead of adding a turret directly, I ignored that step...

I was actually delayed for more than ten hours on this basic problem... I hope no one will do this again...


I want to add a laser turret on VRO mod. For the convenience of testing, I unpacked the dat file of VRO directly and modified it directly.
But the turret I added doesn't work. It appears in the encyclopedia, but only part of the data is displayed.
I will describe the specific problem in detail in the code section.

1. I just added the following code in libraries\wares.xml:

Code: Select all

	<ware id="turret_amr_xl_ionprojector" name="{6699,110101}" description="{6699,11011}" group="turrets" transport="equipment" volume="1" tags="equipment turret">
		<price min="15000000" average="16000000" max="17000000" />
		<production time="70" amount="1" method="default" name="{20206,101}">
			<primary>
				<ware ware="advancedelectronics" amount="1200" />
				<ware ware="energycells" amount="7500" />
				<ware ware="turretcomponents" amount="2800" />
			</primary>
		</production>
		<!-- <component ref="turret_arg_l_ionprojector_macro" amount="1" /> -->
		<component ref="turret_amr_xl_ionprojector_macro" amount="1" />
		<restriction licence="capitalequipment" />
		<use threshold="0.9" />
		<owner faction="alliance" />
		<owner faction="antigone" />
		<owner faction="argon" />
	</ware>
This code is copied from vro. The original code is as follows:

Code: Select all

    <ware id="turret_arg_l_ionprojector" name="{6699,110101}" description="{6699,11011}" group="turrets" transport="equipment" volume="1" tags="equipment turret">
      <price min="1207200" average="1357200" max="1447200" />
      <production time="20" amount="1" method="default" name="{20206,101}">
        <primary>
          <ware ware="advancedelectronics" amount="90" />
          <ware ware="energycells" amount="350" />
          <ware ware="turretcomponents" amount="280" />
        </primary>
      </production>
      <component ref="turret_arg_l_ionprojector_macro" amount="1" />
      <restriction licence="capitalequipment" />
      <use threshold="0.9" />
      <owner faction="alliance" />
      <owner faction="antigone" />
      <owner faction="argon" />
    </ware>
2. I added the _macro file: assets\props\WeaponSystems\energy\macros\turret_amr_xl_ionprojector_macro.xml like:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: Michael (192.168.3.81) at 09.08.2018_12-46-02-->
<macros>
  <macro name="turret_amr_xl_ionprojector_macro" class="turret">
    <component ref="turret_arg_l_beam_powered" />
    <properties>
      <identification name="{6699,110101}" basename="{6699,110101}" shortname="{6699,110102}" makerrace="argon" description="{6699,11011}" unique="0"  />
      <bullet class="bullet_gen_l_ionproj_turret_macro" />
      <rotationspeed max="9" />
      <reload rate="0.5" time="1" />
      <hull max="35000" threshold="0.2" />
    </properties>
  </macro>
</macros>
This file is used for replace the file:bullet_gen_l_ionproj_turret_macro.xml. The two are exactly the same except for the name.
bullet_gen_l_ionproj_turret_macro.xml:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: Michael (192.168.3.81) at 09.08.2018_12-46-02-->
<macros>
  <macro name="turret_arg_l_ionprojector_macro" class="turret">
    <component ref="turret_arg_l_beam_powered" />
    <properties>
      <identification name="{6699,110101}" basename="{6699,110101}" shortname="{6699,110102}" makerrace="argon" description="{6699,11011}" unique="0"  />
      <bullet class="bullet_gen_l_ionproj_turret_macro" />
      <rotationspeed max="9" />
      <reload rate="0.5" time="1" />
      <hull max="35000" threshold="0.2" />
    </properties>
  </macro>
</macros>
3. Add the macro path in index\macros.xml :

Code: Select all

	<add sel="/index">
		<entry name="turret_amr_xl_ionprojector_macro" value="extensions\vro\assets\props\WeaponSystems\energy\macros\turret_amr_xl_ionprojector_macro"/>
	</add>
I just used my own macro file in <ware <component ref=", then the mod is invalid...
I really don't know what the problem is. Thank you for any help.

Post Reply

Return to “X4: Foundations - Scripts and Modding”