[SOLVED]Need some help with ship setup for custom gamestart

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

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

Thorgorath
Posts: 16
Joined: Mon, 16. Nov 09, 20:50
x4

[SOLVED]Need some help with ship setup for custom gamestart

Post by Thorgorath »

I figured it out!
Turns out, not being drunk on mulled wine helps a lot... :roll:

First thing I did after work was follow up on the cerberus loadout I found yesterday. Took a look at a ship mod and - oh! - the relevant ship files aren't in \libraries, they are in \assets
From there on it was just a matter of scrolling through the courier miner's .xml files.
The solution is so effing simple: the weapon and shield slot of the courier miner aren't numbered.
While the elite, for example, has
con_weapon_01
con_shield_01

the courier miner has
con_weapon
con_shield

So I need to use

Code: Select all

              <weapon macro="weapon_gen_s_mining_01_mk1_macro" path="../con_weapon" optional="1" />
              <shield macro="shield_arg_s_standard_01_mk1" path="../con_shield" optional="1" />
and it works :D
Spoiler
Show
Inspired by the CAS gamestart "Bankrupt Miner" I decided to remake my first ever script I wrote for X3 from the ground up, which was a game start as completely broke miner.

I thought it would be quite easy. Take the "Bankrupt Miner" start

Code: Select all

<ship macro="ship_arg_m_miner_solid_01_a_macro">
          <loadout>
            <macros>
              <engine macro="engine_arg_m_allround_01_mk1_macro" path="../con_engine_01" />
              <weapon macro="weapon_gen_m_mining_01_mk1_macro" path="../con_primaryweapon_01" optional="1" />
              <shield macro="shield_arg_m_standard_01_mk1_macro" path="../con_shield_01" optional="1" />
              <turret macro="turret_arg_m_laser_01_mk1_macro" path="../con_turret_01" optional="1" />
              <turret macro="turret_arg_m_laser_01_mk1_macro" path="../con_turret_02" optional="1" />
            </macros>
and change the m's to s' and remove the turrets

Code: Select all

<ship macro="ship_arg_s_miner_solid_01_a_macro">
          <loadout>
            <macros>
              <engine macro="engine_arg_s_allround_01_mk1_macro" path="../con_engine_01" />
              <weapon macro="weapon_gen_s_mining_01_mk1_macro" path="../con_weapon_01" optional="1" />
              <shield macro="shield_arg_s_standard_01_mk1" path="../con_shield_01" optional="1" />
            </macros>
Fire up the game for a test; correct ship, but woops, only one engine.
Easy fix, add in con_engine_02 and con_engine_03

Code: Select all

<ship macro="ship_arg_s_miner_solid_01_a_macro">
          <loadout>
            <macros>
              <engine macro="engine_arg_s_allround_01_mk1_macro" path="../con_engine_01" />
              <engine macro="engine_arg_s_allround_01_mk1_macro" path="../con_engine_02" />
              <engine macro="engine_arg_s_allround_01_mk1_macro" path="../con_engine_03" />
              <weapon macro="weapon_gen_s_mining_01_mk1_macro" path="../con_weapon_01" optional="1" />
              <shield macro="shield_arg_s_standard_01_mk1" path="../con_shield_01" optional="1" />
            </macros>
Fire it up again, all three engines are there, but now I notice the ship has neither shield nor mining beam.
Frankly, I don't get what's wrong. I tried copy-pasting the weapon and shields from several other starts but it just doesn't work.

Code: Select all

<ship macro="ship_arg_s_miner_solid_01_a_macro">
          <loadout>
            <macros>
              <engine macro="engine_arg_s_allround_01_mk1_macro" path="../con_engine_01" />
              <engine macro="engine_arg_s_allround_01_mk1_macro" path="../con_engine_02" />
              <engine macro="engine_arg_s_allround_01_mk1_macro" path="../con_engine_03" />
              <weapon macro="weapon_gen_s_laser_01_mk1_macro" path="../con_weapon_01" optional="1" />
              <shield macro="shield_arg_s_standard_01_mk1_macro" path="../con_shield_01" optional="1" />
            </macros>
For example, taken from the Young Gun start, doesn't work either.

From the colours Notepad++ is showing me, nothing seems wrong either.
Am I missing something? Do I need to look at some other lines?

UPDATE
Spent my evening going through the game's xml files and found a loadout for a cerberus with oddly named shield slots(?)
Spoiler
Show

Code: Select all

<loadout id="battle_frigate" macro="ship_arg_m_frigate_01_a_macro">
    <macros>
      <engine macro="engine_par_m_combat_01_mk3_macro" path="../con_engine_01" />
      <engine macro="engine_par_m_combat_01_mk3_macro" path="../con_engine_03" />
      <shield macro="shield_tel_m_standard_01_mk2_macro" path="../con_shield_back_01" optional="1" />
      <shield macro="shield_tel_m_standard_01_mk2_macro" path="../con_shield_front_R" optional="1" />
      <shield macro="shield_tel_m_standard_01_mk2_macro" path="../con_shield_front_L" optional="1" />
      <weapon macro="weapon_gen_m_laser_01_mk2_macro" path="../con_primaryweapon_01"/>
      <weapon macro="weapon_gen_m_laser_01_mk2_macro" path="../con_primaryweapon_02"/>
    </macros>
And no, using /con_primaryweapon_01 doesn't work either

Tomorrow I'll see if I can figure out how the game saves the loadouts of the player owned ships and if that information can help me.



Minor side question: How do you set the players character model? Like, what would I have to do for the player to be a caped teladi, for example?
I also figured out a partial answer to my side question.
The line that contains the starting money and player name contains the player model. Using the models from the other base game starts is easy, but using other models will require more digging
Last edited by Thorgorath on Wed, 12. Dec 18, 19:41, edited 2 times in total.
User avatar
Frstwlfz
Posts: 34
Joined: Thu, 26. May 11, 12:47
x4

Re: Need some help with ship setup for custom gamestart

Post by Frstwlfz »

I'm not familiar with gamestarts, but have you tried setting the 'optional="1"' attribute to 0? Or even just removing it?
Thorgorath
Posts: 16
Joined: Mon, 16. Nov 09, 20:50
x4

Re: Need some help with ship setup for custom gamestart

Post by Thorgorath »

Frstwlfz wrote: Mon, 10. Dec 18, 21:46 I'm not familiar with gamestarts, but have you tried setting the 'optional="1"' attribute to 0? Or even just removing it?
Just tried both, doesn't work either.

Hadn't occurred to me, because all the other gamestarts, including the base game ones have optional="1" or optional="true" behind the weapons and shields. Tried both already.
u571x15
Posts: 17
Joined: Fri, 28. Feb 14, 11:00
x4

Re: Need some help with ship setup for custom gamestart

Post by u571x15 »

Me too, I was trying.
I modded a custom argon destroyer with custom weapons...
First I tried using the
<loadout id="default">
in the ship macro....it worked but the ship won't be able to be be refitted afterwards...
u571x15
Posts: 17
Joined: Fri, 28. Feb 14, 11:00
x4

Re: Need some help with ship setup for custom gamestart

Post by u571x15 »

Wait I think I know the problem
first, remove the

Code: Select all

 "option=1"
and replace it with

Code: Select all

exact="1"
then, since the weapons and the shields are groups, I think they shouldn't be put in the macro part.
Here's an example of my custom ship...I copied these and modified from an Xeon ship's macro which has a default weapon/shield loadout

Code: Select all

<macros>
          <engine macro="engine_arg_l_allround_01_mk1_macro" path="../con_engine_01" />
          <engine macro="engine_arg_l_allround_01_mk1_macro" path="../con_engine_02" />
          <engine macro="engine_arg_l_allround_01_mk1_macro" path="../con_engine_03" />
          <shield macro="shield_arg_l_standard_01_mk2_macro" path="../con_shieldgenerator_l_02" />
          <shield macro="shield_arg_l_standard_01_mk2_macro" path="../con_shieldgenerator_l_01"  />
          <shield macro="shield_arg_l_standard_01_mk2_macro" path="../con_shieldgenerator_l_003"  />
          <weapon macro="weapon_super_capital_macro" path="../con_weapon_01"  />
          <weapon macro="weapon_super_capital_macro" path="../con_weapon_02"  />
        </macros>
        <groups>
          <!--shields-->          
          <shields macro="shield_arg_m_standard_02_mk2_macro" path=".." group="group_mid_down_left" exact="1"   />
          <shields macro="shield_arg_m_standard_02_mk2_macro" path=".." group="group_front_up_left" exact="2"  />
          <shields macro="shield_arg_m_standard_02_mk2_macro" path=".." group="group_front_up_right" exact="2"  />
          <shields macro="shield_arg_m_standard_02_mk2_macro" path=".." group="group_mid_down_right" exact="1"  />
          <shields macro="shield_arg_m_standard_02_mk2_macro" path=".." group="group_back_up_mid" exact="1"  />
          <shields macro="shield_arg_m_standard_02_mk2_macro" path=".." group="group_front_mid_mid" exact="1"  />
          <shields macro="shield_arg_m_standard_02_mk2_macro" path=".." group="group_back_side" exact="2"  />
          <shields macro="shield_arg_m_standard_02_mk2_macro" path=".." group="group_front_up_mid" exact="2"  />
          <!--Large-->
          <turrets macro="turret_l_heavy_plasma_macro" path=".." group="group_back_up_mid" exact="1"  />
          <turrets macro="turret_l_heavy_plasma_macro" path=".." group="group_front_mid_mid" exact="1"  />
          <turrets macro="turret_l_heavy_plasma_macro" path=".." group="group_back_side" exact="2"  />
          <!--Medium-->
          <turrets macro="turret_m_gau8_macro" path=".." group="group_front_up_left" exact="10" />
          <turrets macro="turret_m_beam_long_macro" path=".." group="group_mid_down_left" exact="4"  />
          <turrets macro="turret_m_beam_long_macro" path=".." group="group_front_up_mid" exact="6"  />
          <turrets macro="turret_m_gau8_macro" path=".." group="group_front_up_right" exact="10"  />
          <turrets macro="turret_m_beam_long_macro" path=".." group="group_mid_down_right" exact="4"  />
        </groups>
alistair3149
Posts: 21
Joined: Fri, 10. Oct 14, 07:03
x4

Re: Need some help with ship setup for custom gamestart

Post by alistair3149 »

Not sure if this will help but you can just let the game fill the loadout for you so you don't have to do it manually:

Code: Select all

<loadout>
	<level exact="1.0"/>
</loadout>
But if you want to do it manually, you can find the connection points in the xml file for your ship.

Return to “X4: Foundations - Scripts and Modding”