God products and create_factory are not the same?

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

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

Post Reply
teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

God products and create_factory are not the same?

Post by teleportationwars » Fri, 9. Aug 19, 01:50

This produces a station:

Code: Select all

 
 		<create_factory owner="faction.argon" sector="player.sector" groupname="$CreatedStation" race="faction.argon.primaryrace" modules="$CreatedStationModules">
                        <select ware="ware.antimattercells" tags="[tag.pasta]" race="faction.argon.primaryrace" />
                        <safepos max="40km" allowyaxis="false" includeplotbox="true" />
                </create_factory>
 
This does not:

Code: Select all

<product id="arg_testmultiwaregod" ware="antimattercells"  owner="player" type="factory">
      <quotas>
        <quota galaxy="2"  />
      </quotas>
      <location class="galaxy" macro="xu_ep2_universe_macro" faction="[argon, hatikvah]" relation="self" comparison="ge">
        <economy max="0.75" maxbound="false" />
      </location>
  
      <module macro="macro.prod_arg_refined_macro" >
        <select ware="antimattercells" race="argon" faction="argon" tags="[tag.pasta]" />
      </module>
    </product>
I have tried most of the combinations of <module>, removing the relation and faction properties from relation, setting the owner to argon(and looking for the module macro in the galaxy.)

Xenon_Slayer
EGOSOFT
EGOSOFT
Posts: 13088
Joined: Sat, 9. Nov 02, 11:45
x4

Re: God products and create_factory are not the same?

Post by Xenon_Slayer » Fri, 9. Aug 19, 12:24

God productions are the definitions of how many of what productions are needed when setting up the universe. They are not the definition of what modules produce what.

That is done in modules.xml

Code: Select all

<module id="prod_gen_claytronics" group="prod_gen_claytronics">
  <category ware="claytronics" tags="[production, module]" race="[argon, paranid, teladi]" faction="[argon, paranid, teladi, antigone, holyorder, ministry, hatikvah, alliance, scaleplate]" />
  <compatibilities>
    <production ware="claytronics" chance="65" />
  </compatibilities>
</module>
The <select> nodes in god.xml and create_factory actions will search for entries defined in modules.xml
Come watch me on Twitch where I occasionally play several of the X games

teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: God products and create_factory are not the same?

Post by teleportationwars » Fri, 9. Aug 19, 13:09

Xenon_Slayer wrote:
Fri, 9. Aug 19, 12:24
God productions are the definitions of how many of what productions are needed when setting up the universe. They are not the definition of what modules produce what.

That is done in modules.xml

Code: Select all

<module id="prod_gen_claytronics" group="prod_gen_claytronics">
  <category ware="claytronics" tags="[production, module]" race="[argon, paranid, teladi]" faction="[argon, paranid, teladi, antigone, holyorder, ministry, hatikvah, alliance, scaleplate]" />
  <compatibilities>
    <production ware="claytronics" chance="65" />
  </compatibilities>
</module>
The <select> nodes in god.xml and create_factory actions will search for entries defined in modules.xml
I should have expressed myself better in the op.
My create_factory correctly finds it and makes the factory. My god entry does not.

This is the production macro.

Code: Select all

    <macro name="prod_arg_refined_macro" class="production">
        <component ref="prod_arg_foodrations" />
        <properties>
            <identification name="{7345565,25}" shortname="{7345565,26}" makerrace="argon" description="{7345565,27}" />
            <build>
                <sets>
                    <set ref="factory" />
                    <set ref="headquarters_player" />
                </sets>
            </build>
            <explosiondamage value="10000" />
            <hull max="133000" />
            <secrecy level="2" />
            <production wares="antimattercells energycells graphene superfluidcoolant refinedmetals siliconwafers teladianium">
                <queue>
                    <item ware="antimattercells" />
                    <item ware="energycells" />
                    <item ware="graphene" />
                    <item ware="superfluidcoolant" />
                    <item ware="refinedmetals" />
                    <item ware="siliconwafers" />
                    <item ware="teladianium" />
                </queue>
            </production>
            <workforce max="90" />
        </properties>
    </macro>
modulegroups.xml

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<diff>
    <add sel="/groups">
        <group name="prod_arg_refined_group">
            <select macro="prod_arg_refined_macro" />
        </group>
    </add>
</diff>
modules.xml

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<diff>
  <add sel="/modules">
    <module id="prod_arg_refined_group" group="prod_arg_refined_group">
      <category ware="antimattercells" tags="[pasta]" race="[argon, paranid, teladi]" faction="[argon, paranid, teladi, antigone, holyorder, ministry, hatikvah, alliance, scaleplate, player]" />
      <compatibilities>
        <limits production="1" />
        <production ware="antimattercells" chance="100" />
      </compatibilities>
    </module>
  </add>
</diff>

Xenon_Slayer
EGOSOFT
EGOSOFT
Posts: 13088
Joined: Sat, 9. Nov 02, 11:45
x4

Re: God products and create_factory are not the same?

Post by Xenon_Slayer » Fri, 9. Aug 19, 13:49

In library files like god.xml, things like tags and factions don't use the datatype prefix, so tags="[tag.pasta]" should just be tags="[pasta]". I think everything else looks alright.
Come watch me on Twitch where I occasionally play several of the X games

teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: God products and create_factory are not the same?

Post by teleportationwars » Fri, 9. Aug 19, 14:04

Xenon_Slayer wrote:
Fri, 9. Aug 19, 13:49
In library files like god.xml, things like tags and factions don't use the datatype prefix, so tags="[tag.pasta]" should just be tags="[pasta]". I think everything else looks alright.
I thought the datatype prefix was optional in god.
It doesn't work if I fix that.

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<god xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:/x4_extract_2.5/libraries/libraries.xsd">
  <products>
    <product id="arg_testmultiwaregod" ware="antimattercells" owner="argon" type="factory">
      <quotas>
        <quota galaxy="10" />
      </quotas>
      <location class="galaxy" macro="xu_ep2_universe_macro">
        <economy max="0.75" maxbound="false" />
      </location>
      <module>
        <select ware="antimattercells" tags="pasta" race="argon" />
      </module>
    </product>
  </products>
</god>

Im verifying my tests with this:

Code: Select all

<do_all exact="global.$X4_All_Stations.count" counter="$i">
                            <find_object_component module="true"  groupname="$Allofthem" object="global.$X4_All_Stations.{$i}" multiple="true" recursive="true"></find_object_component>
                        </do_all>
                        <find_object groupname="$ThingImLookingFor" space="player.galaxy" multiple="true">
                           <match macro="macro.prod_arg_refined_macro"></match>
                        </find_object>
                        <debug_to_file text="$ThingImLookingFor" name="'looking.log'" append="false" directory="'stupidtest'" />
                        <debug_to_file text="'start'" name="'stupidtest.log'" append="false" directory="'stupidtest'" />
                        <do_all exact="$Allofthem.count" counter="$i">
                            <debug_to_file text="$Allofthem.{$i}.macro + $Allofthem.{$i}.knownname + $Allofthem.{$i}" name="'stupidtest.log'" directory="'stupidtest'" />
                        </do_all>

Xenon_Slayer
EGOSOFT
EGOSOFT
Posts: 13088
Joined: Sat, 9. Nov 02, 11:45
x4

Re: God products and create_factory are not the same?

Post by Xenon_Slayer » Fri, 9. Aug 19, 14:21

Yeah, I think you're right about the prefix being optional.

If you are defining a second entry for Argon Antimatter Cells, that may be the issue. I don't think God handles these cases.

Mega hack - Try using one of the many visitor factions and find and change the owner with a script.
Come watch me on Twitch where I occasionally play several of the X games

teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: God products and create_factory are not the same?

Post by teleportationwars » Fri, 9. Aug 19, 20:02

Xenon_Slayer wrote:
Fri, 9. Aug 19, 14:21
Yeah, I think you're right about the prefix being optional.

If you are defining a second entry for Argon Antimatter Cells, that may be the issue. I don't think God handles these cases.

Mega hack - Try using one of the many visitor factions and find and change the owner with a script.
God did not work.
I only have one visitor faction, it did not work either. I tried xenon so that I could switch the race as well. This time to test, I set all the xenon stations to player.

Mysterial
Posts: 644
Joined: Wed, 6. Nov 02, 20:31
x4

Re: God products and create_factory are not the same?

Post by Mysterial » Mon, 19. Aug 19, 15:48

I don't think the tags field works when a ware is also selected in god.xml. In my mod, I tried to use a tag to redirect the HOP's Refined Metals entry to a different module definition that allows more modules on the same station and as far as I could tell the game would randomly select either it or the original Refined Metals definition - as if the tag had not been specified.

teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: God products and create_factory are not the same?

Post by teleportationwars » Mon, 19. Aug 19, 16:52

The ware is required in the product line. Having the select ware made no difference.

xedrian
Posts: 2
Joined: Mon, 7. Jan 19, 15:53
x4

Re: God products and create_factory are not the same?

Post by xedrian » Tue, 26. Apr 22, 21:32

Is there a problem when added >new< products to "god"?

This will work fine and let the station with the expected modules spawn around

Code: Select all

<diff>
    <replace sel="/god/products/product[@id='arg_refinedmetals']/@ware">warename</replace>
    <replace sel="/god/products/product[@id='arg_refinedmetals']/module">
        <module>
            <select ware="warename" race="argon"/>
        </module>
    </replace>
</diff>    
But adding a new product like below, god wont create any station for this product/ware:

Code: Select all

<diff>
     <add sel="/god/products">
        <product id="arg_warename" ware="warename" owner="argon" type="factory">
            <quotas>
                <quota galaxy="6" sector="4" />
            </quotas>
            <location class="galaxy" macro="xu_ep2_universe_macro" faction="[argon, hatikvah]" relation="self" comparison="ge">
                <region ware="ore" max="100000" />
            </location>
            <module>
                <select ware="warename" race="argon" />
            </module>
        </product>
    </add>
</diff>
Removing the "Original"-Product an re-adding it with a new id wont work too:

Code: Select all

<diff>
    <remove sel="/god/products/product[@id='arg_refinedmetals']" />
    <add sel="/god/products">
       <product id="arg_refinedmetals2" ware="refinedmetals" owner="argon" type="factory"><!-- added "2" to id -->
          <quotas>
             <quota galaxy="6" sector="4" />
          </quotas>
          <location class="galaxy" macro="xu_ep2_universe_macro" faction="[argon, hatikvah]" relation="self" comparison="ge">
             <region ware="ore" max="100000" />
             <economy max="0.5" maxbound="false" />
          </location>
          <module>
             <select ware="refinedmetals" race="argon"/>
         </module>
      </product>
    </add>
</diff>

so here comes the question:
  • Is there a hardcoded product-id-list ?
  • Do i have to "register" new "product-id" elsewhere?
  • Any ideas why adding new products wont work?

xedrian
Posts: 2
Joined: Mon, 7. Jan 19, 15:53
x4

Re: God products and create_factory are not the same?

Post by xedrian » Wed, 25. Oct 23, 20:53

I think the answer is simple:
at a point egosoft introduced the <location>-Attribute "matchextension" (which is true by default)
=> this means
<location class="galaxy" macro="xu_ep2_universe_macro" faction="[argon, hatikvah]" relation="self" comparison="ge" />
matches only "space" (Clusters/Sectors) which were added by YOUR extension/modification

use <location ... matchextension="false" /> will solve the problem.

Post Reply

Return to “X4: Foundations - Scripts and Modding”