Why do some new jobs just not work?

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

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

Post Reply
Treycore
Posts: 134
Joined: Mon, 12. Apr 21, 12:42

Why do some new jobs just not work?

Post by Treycore » Sat, 11. Sep 21, 00:58

So I wanted to add some carriers to the argon fleets

I copy pasted the default one and switched it around a bit so that it can patrol normally like any other job, and not be locked to argon prime

Quota = 4 Sector = 1

But seemingly I’ve yet to see other carriers spawn at gamestarts or I’ve yet too see them build a Carrier from that job

I tried adding a job for S class miners to Antigone as well and can’t seem to get them to spawn or be built

Same thing for S class Traders that don’t already have them

I can post the jobs later on, just not at my computer but I’m fairly certain everything looks right, I’ve successfully created other jobs and seen them added to the game just these few edge cases that I can’t seem to figure out

User avatar
Shuulo
Posts: 1629
Joined: Mon, 14. Apr 08, 17:03
x4

Re: Why do some new jobs just not work?

Post by Shuulo » Sat, 11. Sep 21, 02:04

its far from enough information to help you, without code and file structure nobody will give you answer

Treycore
Posts: 134
Joined: Mon, 12. Apr 21, 12:42

Re: Why do some new jobs just not work?

Post by Treycore » Sat, 11. Sep 21, 02:31

Shuulo wrote:
Sat, 11. Sep 21, 02:04
its far from enough information to help you, without code and file structure nobody will give you answer
I’m more or less thinking there’s some sort of hard limit on the carrier job/miner jobs/trader jobs that I’d have to tweak in the MD or factionlogic

I don’t think it’s the actual code itself

The carrier job is specifically a copy/paste of the vanilla job, with an altered job name by adding a _2

Location was just changed to the xu4_universe/Argon/Self

I mean, I’ll post it later but I don’t think that’s where the problem is

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: Why do some new jobs just not work?

Post by BlackRain » Sat, 11. Sep 21, 03:22

Treycore wrote:
Sat, 11. Sep 21, 02:31
Shuulo wrote:
Sat, 11. Sep 21, 02:04
its far from enough information to help you, without code and file structure nobody will give you answer
I’m more or less thinking there’s some sort of hard limit on the carrier job/miner jobs/trader jobs that I’d have to tweak in the MD or factionlogic

I don’t think it’s the actual code itself

The carrier job is specifically a copy/paste of the vanilla job, with an altered job name by adding a _2

Location was just changed to the xu4_universe/Argon/Self

I mean, I’ll post it later but I don’t think that’s where the problem is
More information is definitely required.

Is this a brand new game or did you add it to an existing game? How far in is your game?

Is the code itself correct or were there mistakes?

If you are putting this into an existing game that is far a long and the economy of your universe is bad, then the ships may never get built. They do get queued but I believe that the ships ordered by jobs may eventually be removed from queues if they can't get built for a period of time or some other similar situation going on (which is hardcoded). I noticed in the past when I was adding job ships and stuff that ships would dwindle in the universe as time went on instead of increasing even though I added many new ships. I think if they can't be built, they eventually are skipped or removed from the job queue or something. This is just conjecture on my part though.

Treycore
Posts: 134
Joined: Mon, 12. Apr 21, 12:42

Re: Why do some new jobs just not work?

Post by Treycore » Sat, 11. Sep 21, 03:53

BlackRain wrote:
Sat, 11. Sep 21, 03:22
Treycore wrote:
Sat, 11. Sep 21, 02:31
Shuulo wrote:
Sat, 11. Sep 21, 02:04
its far from enough information to help you, without code and file structure nobody will give you answer
I’m more or less thinking there’s some sort of hard limit on the carrier job/miner jobs/trader jobs that I’d have to tweak in the MD or factionlogic

I don’t think it’s the actual code itself

The carrier job is specifically a copy/paste of the vanilla job, with an altered job name by adding a _2

Location was just changed to the xu4_universe/Argon/Self

I mean, I’ll post it later but I don’t think that’s where the problem is
More information is definitely required.

Is this a brand new game or did you add it to an existing game? How far in is your game?

Is the code itself correct or were there mistakes?

If you are putting this into an existing game that is far a long and the economy of your universe is bad, then the ships may never get built. They do get queued but I believe that the ships ordered by jobs may eventually be removed from queues if they can't get built for a period of time or some other similar situation going on (which is hardcoded). I noticed in the past when I was adding job ships and stuff that ships would dwindle in the universe as time went on instead of increasing even though I added many new ships. I think if they can't be built, they eventually are skipped or removed from the job queue or something. This is just conjecture on my part though.
Yeah that makes complete sense with the job queue, I’m simultaneously working on like 3 mods, so I have no active running games other then letting the game run to check for imbalances between the factions, and I’ve started maybe 20-30 new games over the past week itself

I’m 99% sure the code is fine, I’ve ran it over and compared it several times over, I can post it when I’m at my PC to be sure

Just the one thing that’s catching my eye is that they are not spawning on a new game start, usually a small percentage of the jobs will spawn at gamestart

So I guess I need reword my thread to be... how does the job queue work? And what determines spawns on gamestarts?

Do jobs need to be immediately filled completely? HOP has a beefy destroyer fleet they can build consisting of 10 destroyers, if they have resources for 3, will they start constructing that particular job and add onto it as time passes? Or is the job too big that it gets skipped over consistently

Edit: I’m simultaneously adding new sectors to the game for the empires, while rebalancing the vanilla economic start and trying to give the empires a bit more bite with larger fleets (within reason that doesn’t fry my CPU)

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: Why do some new jobs just not work?

Post by BlackRain » Sat, 11. Sep 21, 04:01

Treycore wrote:
Sat, 11. Sep 21, 03:53
BlackRain wrote:
Sat, 11. Sep 21, 03:22
Treycore wrote:
Sat, 11. Sep 21, 02:31


I’m more or less thinking there’s some sort of hard limit on the carrier job/miner jobs/trader jobs that I’d have to tweak in the MD or factionlogic

I don’t think it’s the actual code itself

The carrier job is specifically a copy/paste of the vanilla job, with an altered job name by adding a _2

Location was just changed to the xu4_universe/Argon/Self

I mean, I’ll post it later but I don’t think that’s where the problem is
More information is definitely required.

Is this a brand new game or did you add it to an existing game? How far in is your game?

Is the code itself correct or were there mistakes?

If you are putting this into an existing game that is far a long and the economy of your universe is bad, then the ships may never get built. They do get queued but I believe that the ships ordered by jobs may eventually be removed from queues if they can't get built for a period of time or some other similar situation going on (which is hardcoded). I noticed in the past when I was adding job ships and stuff that ships would dwindle in the universe as time went on instead of increasing even though I added many new ships. I think if they can't be built, they eventually are skipped or removed from the job queue or something. This is just conjecture on my part though.
Yeah that makes complete sense with the job queue, I’m simultaneously working on like 3 mods, so I have no active running games other then letting the game run to check for imbalances between the factions, and I’ve started maybe 20-30 new games over the past week itself

I’m 99% sure the code is fine, I’ve ran it over and compared it several times over, I can post it when I’m at my PC to be sure

Just the one thing that’s catching my eye is that they are not spawning on a new game start, usually a small percentage of the jobs will spawn at gamestart

So I guess I need reword my thread to be... how does the job queue work? And what determines spawns on gamestarts?

Do jobs need to be immediately filled completely? HOP has a beefy destroyer fleet they can build consisting of 10 destroyers, if they have resources for 3, will they start constructing that particular job and add onto it as time passes? Or is the job too big that it gets skipped over consistently

Edit: I’m simultaneously adding new sectors to the game for the empires, while rebalancing the vanilla economic start and trying to give the empires a bit more bite with larger fleets (within reason that doesn’t fry my CPU)
In a new game, every ship that is in jobs will spawn every time. There should never be an issue here unless there is a problem with the code.

Jobs works on a timer basically, every certain amount of time passes, it checks the quota of ships and builds one of them. This is for the jobs file, however, there are scripts throughout that order ships when needed (md scripts). If the scripts determine ships are needed, they will order job ships to be built. This is different from the jobs.xml file (although they may order ships specified here, but this ultimately works a bit different).

Treycore
Posts: 134
Joined: Mon, 12. Apr 21, 12:42

Re: Why do some new jobs just not work?

Post by Treycore » Sat, 11. Sep 21, 05:26

BlackRain wrote:
Sat, 11. Sep 21, 04:01
Treycore wrote:
Sat, 11. Sep 21, 03:53
BlackRain wrote:
Sat, 11. Sep 21, 03:22


More information is definitely required.

Is this a brand new game or did you add it to an existing game? How far in is your game?

Is the code itself correct or were there mistakes?

If you are putting this into an existing game that is far a long and the economy of your universe is bad, then the ships may never get built. They do get queued but I believe that the ships ordered by jobs may eventually be removed from queues if they can't get built for a period of time or some other similar situation going on (which is hardcoded). I noticed in the past when I was adding job ships and stuff that ships would dwindle in the universe as time went on instead of increasing even though I added many new ships. I think if they can't be built, they eventually are skipped or removed from the job queue or something. This is just conjecture on my part though.
Yeah that makes complete sense with the job queue, I’m simultaneously working on like 3 mods, so I have no active running games other then letting the game run to check for imbalances between the factions, and I’ve started maybe 20-30 new games over the past week itself

I’m 99% sure the code is fine, I’ve ran it over and compared it several times over, I can post it when I’m at my PC to be sure

Just the one thing that’s catching my eye is that they are not spawning on a new game start, usually a small percentage of the jobs will spawn at gamestart

So I guess I need reword my thread to be... how does the job queue work? And what determines spawns on gamestarts?

Do jobs need to be immediately filled completely? HOP has a beefy destroyer fleet they can build consisting of 10 destroyers, if they have resources for 3, will they start constructing that particular job and add onto it as time passes? Or is the job too big that it gets skipped over consistently

Edit: I’m simultaneously adding new sectors to the game for the empires, while rebalancing the vanilla economic start and trying to give the empires a bit more bite with larger fleets (within reason that doesn’t fry my CPU)
In a new game, every ship that is in jobs will spawn every time. There should never be an issue here unless there is a problem with the code.

Jobs works on a timer basically, every certain amount of time passes, it checks the quota of ships and builds one of them. This is for the jobs file, however, there are scripts throughout that order ships when needed (md scripts). If the scripts determine ships are needed, they will order job ships to be built. This is different from the jobs.xml file (although they may order ships specified here, but this ultimately works a bit different).
Here's the code for the Carrier

<job id="argon_carrier_patrol_xl_bef" name="{20204,3201}" comment="each sector, expansion">
<modifiers commandeerable="true"/>
<orders>
<order order="Patrol" default="true">
<param name="range" value="class.sector"/>
</order>
</orders>
<category faction="argon" tags="[factionlogic, military, carrier]" size="ship_xl"/>
<quota galaxy="4" sector="1"/>
<location class="galaxy" macro="xu_ep2_universe_macro" faction="argon" relation="self" comparison="exact"/>
<environment buildatshipyard="true"/>
<ship>
<select faction="argon" tags="[military, carrier]" size="ship_xl"/>
<loadout>
<level min="0.8" max="1.0" />
</loadout>
<owner exact="argon" overridenpc="true"/>
</ship>
<subordinates>
<subordinate job="argon_fighter_escort_s_carrier_bef"/>
<subordinate job="argon_destroyer_escort_l"/>
</subordinates>
</job>

And this is the subordinate that I created for the fighters

<job id="argon_fighter_escort_s_carrier_bef" name="{20204,2901}" startactive="false">
<orders>
<order order="Escort" default="true">
<param name="formation" value="formationshape.pointguard"/>
<param name="overrideformationskill" value="true"/>
</order>
</orders>
<quota wing="30"/>
<category faction="argon" tags="[military, fighter]" size="ship_s"/>
<location class="galaxy" macro="xu_ep2_universe_macro"/>
<environment buildatshipyard="true"/>
<modifiers subordinate="true"/>
<ship>
<select faction="argon" tags="[military, fighter, selection]" size="ship_s"/>
<loadout>
<level min="0.1" max="0.9"/>
</loadout>
<owner exact="argon" overridenpc="true"/>
</ship>
</job>

Antigone S Miners Code

<job id="antigone_free_miner_s_mineral_bef" name="{20204,5601}">
<modifiers rebuild="false" commandeerable="true"/>
<orders>
<order order="MiningRoutine" default="true">
<param name="minbuy" value="0"/>
<param name="maxbuy" value="5"/>
<param name="minsell" value="1"/>
<param name="maxsell" value="5"/>
</order>
</orders>
<basket basket="minerals"/>
<category faction="antigone" tags="[factionlogic, freighter, miner]" size="ship_s"/>
<quota galaxy="20"/>
<location class="galaxy" macro="xu_ep2_universe_macro" faction="antigone" relation="member" comparison="ge" regionbasket="minerals"/>
<environment buildatshipyard="true"/>
<ship>
<select faction="antigone" tags="[miner, solid]" size="ship_s"/>
<loadout>
<level min="0" max="0.7"/>
</loadout>
<owner exact="antigone" overridenpc="true"/>
<cargo>
<wares>
<fillpercent min="0" max="100" profile="inversebell"/>
</wares>
</cargo>
</ship>
</job>

User avatar
alexalsp
Posts: 1820
Joined: Fri, 18. Jul 14, 05:28
x4

Re: Why do some new jobs just not work?

Post by alexalsp » Sat, 11. Sep 21, 10:36

Treycore wrote:
Sat, 11. Sep 21, 05:26
There is a special CODE tag for these sheets of code.

Image

And it will look like this ... Compact and beautiful, not half a kilometer of scrolling messages ...
Spoiler
Show

Code: Select all

 <job id="argon_carrier_patrol_xl_bef" name="{20204,3201}" comment="each sector, expansion">
    <modifiers commandeerable="true"/>
    <orders>
      <order order="Patrol" default="true">
        <param name="range" value="class.sector"/>
      </order>
    </orders>
    <category faction="argon" tags="[factionlogic, military, carrier]" size="ship_xl"/>
    <quota galaxy="4" sector="1"/>
    <location class="galaxy" macro="xu_ep2_universe_macro" faction="argon" relation="self" comparison="exact"/>
    <environment buildatshipyard="true"/>
    <ship>
      <select faction="argon" tags="[military, carrier]" size="ship_xl"/>
      <loadout>
	<level min="0.8" max="1.0" />
      </loadout>
      <owner exact="argon" overridenpc="true"/>
    </ship>
    <subordinates>
      <subordinate job="argon_fighter_escort_s_carrier_bef"/>
      <subordinate job="argon_destroyer_escort_l"/>
    </subordinates>
  </job>
:wink:

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: Why do some new jobs just not work?

Post by BlackRain » Sat, 11. Sep 21, 14:58

Treycore wrote:
Sat, 11. Sep 21, 05:26
BlackRain wrote:
Sat, 11. Sep 21, 04:01
Treycore wrote:
Sat, 11. Sep 21, 03:53


Yeah that makes complete sense with the job queue, I’m simultaneously working on like 3 mods, so I have no active running games other then letting the game run to check for imbalances between the factions, and I’ve started maybe 20-30 new games over the past week itself

I’m 99% sure the code is fine, I’ve ran it over and compared it several times over, I can post it when I’m at my PC to be sure

Just the one thing that’s catching my eye is that they are not spawning on a new game start, usually a small percentage of the jobs will spawn at gamestart

So I guess I need reword my thread to be... how does the job queue work? And what determines spawns on gamestarts?

Do jobs need to be immediately filled completely? HOP has a beefy destroyer fleet they can build consisting of 10 destroyers, if they have resources for 3, will they start constructing that particular job and add onto it as time passes? Or is the job too big that it gets skipped over consistently

Edit: I’m simultaneously adding new sectors to the game for the empires, while rebalancing the vanilla economic start and trying to give the empires a bit more bite with larger fleets (within reason that doesn’t fry my CPU)
In a new game, every ship that is in jobs will spawn every time. There should never be an issue here unless there is a problem with the code.

Jobs works on a timer basically, every certain amount of time passes, it checks the quota of ships and builds one of them. This is for the jobs file, however, there are scripts throughout that order ships when needed (md scripts). If the scripts determine ships are needed, they will order job ships to be built. This is different from the jobs.xml file (although they may order ships specified here, but this ultimately works a bit different).
Here's the code for the Carrier

Code: Select all

<job id="argon_carrier_patrol_xl_bef" name="{20204,3201}" comment="each sector, expansion">
    <modifiers commandeerable="true"/>
    <orders>
      <order order="Patrol" default="true">
        <param name="range" value="class.sector"/>
      </order>
    </orders>
    <category faction="argon" tags="[factionlogic, military, carrier]" size="ship_xl"/>
    <quota galaxy="4" sector="1"/>
    <location class="galaxy" macro="xu_ep2_universe_macro" faction="argon" relation="self" comparison="exact"/>
    <environment buildatshipyard="true"/>
    <ship>
      <select faction="argon" tags="[military, carrier]" size="ship_xl"/>
      <loadout>
	<level min="0.8" max="1.0" />
      </loadout>
      <owner exact="argon" overridenpc="true"/>
    </ship>
    <subordinates>
      <subordinate job="argon_fighter_escort_s_carrier_bef"/>
      <subordinate job="argon_destroyer_escort_l"/>
    </subordinates>
  </job>

And this is the subordinate that I created for the fighters

  <job id="argon_fighter_escort_s_carrier_bef" name="{20204,2901}" startactive="false">
    <orders>
      <order order="Escort" default="true">
        <param name="formation" value="formationshape.pointguard"/>
        <param name="overrideformationskill" value="true"/>
      </order>
    </orders>
    <quota wing="30"/>
    <category faction="argon" tags="[military, fighter]" size="ship_s"/>
    <location class="galaxy" macro="xu_ep2_universe_macro"/>
    <environment buildatshipyard="true"/>
    <modifiers subordinate="true"/>
    <ship>
      <select faction="argon" tags="[military, fighter, selection]" size="ship_s"/>
      <loadout>
        <level min="0.1" max="0.9"/>
      </loadout>
      <owner exact="argon" overridenpc="true"/>
    </ship>
  </job>

Antigone S Miners Code

  <job id="antigone_free_miner_s_mineral_bef" name="{20204,5601}">
    <modifiers rebuild="false" commandeerable="true"/>
    <orders>
      <order order="MiningRoutine" default="true">
        <param name="minbuy" value="0"/>
        <param name="maxbuy" value="5"/>
        <param name="minsell" value="1"/>
        <param name="maxsell" value="5"/>
      </order>
    </orders>
    <basket basket="minerals"/>
    <category faction="antigone" tags="[factionlogic, freighter, miner]" size="ship_s"/>
    <quota galaxy="20"/>
    <location class="galaxy" macro="xu_ep2_universe_macro" faction="antigone" relation="member" comparison="ge" regionbasket="minerals"/>
    <environment buildatshipyard="true"/>
    <ship>
      <select faction="antigone" tags="[miner, solid]" size="ship_s"/>
      <loadout>
        <level min="0" max="0.7"/>
      </loadout>
      <owner exact="antigone" overridenpc="true"/>
      <cargo>
        <wares>
          <fillpercent min="0" max="100" profile="inversebell"/>
        </wares>
      </cargo>
    </ship>
  </job>
This still doesn't help. I need to see the whole file. Are you completely replacing the jobs.xml? Are you just editing the existing one? There is no way to know with just this.

Treycore
Posts: 134
Joined: Mon, 12. Apr 21, 12:42

Re: Why do some new jobs just not work?

Post by Treycore » Sun, 12. Sep 21, 10:49

I just copy/pasted the XR ship mods carrier job and that worked, I’ll just use that as a workaround

And no it’s a separate mod in extensions/Better_Economy_and_fleets

Post Reply

Return to “X4: Foundations - Scripts and Modding”