Fishery Mod (RESOLVED)

SocialMechanic

Chieftain
Joined
May 11, 2019
Messages
97
Okay, so, I'm trying to make a mod that allows Fisheries to be a general improvement available to all cities regardless of whether or not Liang is present. The mod also changes her Aquaculture promotion to provide +2 production to Fisheries in the city and +1 Production to Fishing Boats in the city.

I'll provide the code for both the Gameplay.xml and the Text.xml, and then explain the problems
Code:
<GameData>
    <!-- Trait Removal -->
    <Improvements>
        <Replace ImprovementType="IMPROVEMENT_FISHERY" Name="LOC_IMPROVEMENT_FISHERY_NAME" Description="LOC_IMPROVEMENT_FISHERY_DESCRIPTION" Icon="ICON_IMPROVEMENT_FISHERY" PlunderType="PLUNDER_HEAL" PlunderAmount="50" Buildable="true" PrereqTech="TECH_SAILING" Domain="DOMAIN_SEA" Housing="1" TilesRequired="2"/>
    </Improvements>
    <!-- Adjacency moved to Naval Tradition Civic -->
    <Adjacency_YieldChanges>
        <Replace ID="Fishery_SeaResourceAdjacency" Description="Placeholder" YieldType="YIELD_FOOD" YieldChange="1" TilesRequired="1" AdjacentSeaResource="true" PrereqCivic="CIVIC_NAVAL_TRADITION"/>
    </Adjacency_YieldChanges>
    <!-- Apply Text to Naval Tradition Civic -->
    <Civics>
        <Update>
            <Where CivicType="CIVIC_NAVAL_TRADITION"/>
            <Set Description="LOC_CIVIC_NAVAL_TRADITION_DESCRIPTION"/>
        </Update>
    </Civics>
    <!-- Apply Aquaculture with bonus production to fishing boats -->
    <ImprovementModifiers>
        <Row ImprovementType="IMPROVEMENT_FISHING_BOATS" ModifierId="FISHING_BOAT_GOVERNOR_PRODUCTION"/>
    </ImprovementModifiers>
    <Modifiers>
        <Row ModifierId="FISHING_BOAT_GOVERNOR_PRODUCTION" ModifierType="MODIFIER_SINGLE_PLOT_ADJUST_PLOT_YIELDS" SubjectRequirementSetId="CITY_HAS_GOVERNOR_PROMOTION_AQUACULTURE"/>
    </Modifiers>
    <ModifierArguments>
        <Row ModifierId="FISHING_BOAT_GOVERNOR_PRODUCTION" Name="YieldType" Value="YIELD_PRODUCTION"/>
        <Row ModifierId="FISHING_BOAT_GOVERNOR_PRODUCTION" Name="Amount" Value="1"/>
    </ModifierArguments>
    <!-- Change existing Aquaculture production bonus -->
    <ModifierArguments>
        <Update>
            <Where ModifierId="FISHERY_GOVERNOR_PRODUCTION"/>
            <Set Value="2"/>
        </Update>
    </ModifierArguments>
</GameData>
Now the Text
Code:
<GameData>
    <BaseGameText>
        <Row Tag="LOC_CIVIC_NAVAL_TRADITION_DESCRIPTION">
            <Text>Fishery improvements now gain +1 [ICON_Food] Food from every adjacent sea resource.</Text>
        </Row>
        <Replace Tag="LOC_IMPROVEMENT_FISHERY_DESCRIPTION">
            <Text>The Fishery improvement can be built on coastal plots. Yields +1 [ICON_Food] Food and +0.5 [ICON_Housing] Housing.</Text>
        </Replace>
        <Replace Tag="LOC_GOVERNOR_PROMOTION_AQUACULTURE_DESCRIPTION">
            <Text>If Liang is in the city, Fisheries receive a +2 [ICON_PRODUCTION] Production bonus and Fishing Boats receive a +1 [ICON_PRODUCTION] Production bonus.</Text>
        </Replace>
    </BaseGameText>
</GameData>
First thing: There is a mod out there that makes Fisheries universal (as I want to do) and all the mod does is remove the "TraitType" from the Fishery improvement (but I want my own mod because I want Aquaculture to be different). I'm hoping my "Replace" code will do just that. The "Replace" action in the "Improvements" table is the same in every way other than the fact that it doesn't include the "TraitType" (BTW, I don't know how to use the "Update" code if I'm trying to "Set" something to not exist in xml. I know you can do the "NULL" thing in SQL).
Now, when I start the game, a few things have changed. Enough for me to know that it is at least reading part of the Gameplay file. The Fishery icon is displayed in the Sailing technology, but the text isn't what I indicate in the Text.xml. The "Star" icon is in the Naval Tradition Civic, but the text just repeats the "+1 Envoy", and not what the Text.xml file says. Liangs Aquaculture promotion also isn't updating (at least the text isn't).
Now, when I get Sailing, despite the fact that the Fishery icon is there, I can't build a Fishery. Also, when I do get Liang with Aquaculture, I still can't build Fisheries.
I have both files loaded as In-Game Actions with a LoadOrder of 1006. The Gameplay file is an UpdateDatabase action and the Text file is an UpdateText action.
I've also checked the Database.log and found nothing.
All in all, I have no idea why this isn't working.

EDIT: Also, I've tried this and it doesn't work either:
Code:
    <Improvements>
        <Delete ImprovementType="IMPROVEMENT_FISHERY"/>
        <Row ImprovementType="IMPROVEMENT_FISHERY" Name="LOC_IMPROVEMENT_FISHERY_NAME" Description="LOC_IMPROVEMENT_FISHERY_DESCRIPTION" Icon="ICON_IMPROVEMENT_FISHERY" PlunderType="PLUNDER_HEAL" PlunderAmount="50" Buildable="true" PrereqTech="TECH_SAILING" Domain="DOMAIN_SEA" Housing="1" TilesRequired="2"/>
    </Improvements>
 
Last edited:
I don't think you can delete and add the same thing (like the same improvement) in the same mod file. I also don't thing you can use replace to change anything but text.

I think something like this should work:

Code:
<Improvements>
<Update>

<Where ImprovementType="IMPROVEMENT_FISHERY"/>
<Set TraitType=""/>

</Update>
</Improvements>

This should set TraitType to NULL, which basically deletes the entry.
 
I don't think you can delete and add the same thing (like the same improvement) in the same mod file. I also don't think you can use replace to change anything but text.

I think something like this should work:

Code:
<Improvements>
<Update>

<Where ImprovementType="IMPROVEMENT_FISHERY"/>
<Set TraitType=""/>

</Update>
</Improvements>

This should set TraitType to NULL, which basically deletes the entry.
I'm positive that "Replace" does work because I have other mods that use it and they work fine.
I'll see what happens when I use <Set TraitType=""/>.

EDIT: Okay, well, it worked to the point where I can place it in the water. However, the rest of the code doesn't seem to work still because Liang isn't providing production to those tiles.
 
Code:
<ModifierArguments>
        <Update>
            <Where ModifierId="FISHERY_GOVERNOR_PRODUCTION"/>
            <Set Value="2"/>
        </Update>
    </ModifierArguments>

In the where-statement you have to specify that Name="Amount", otherwise the YIELD_PRODUCTION will also be changed to 2:

Code:
<Row>
            <ModifierId>FISHERY_GOVERNOR_PRODUCTION</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_PRODUCTION</Value>
        </Row>
 
Actually, I got it to work in another way. I decided to not touch the original production bonus and to just make another.

So, that problem was two things:
1) Pretty much what you alluded to. The "Update" was looking at the first instance of "FISHERY_GOVERNOR_PRODUCTION", rather than the second one, which was the one with the "Value" syntax.
2) Even though Naval Tradition doesn't specifically have a "LOC_CIVIC_NAVAL_TRADITION_DESCRIPTION", tell the game to add it just made it reference the envoy detail, and since my text addition was "Row" and not "Replace", it ignored it (and thus all the other text in the xml". Once I made it a "Replace" line, it changed the envoy detail and worked fine.
Thanks for your help!
 
Actually your update was working on both the rows, both the one with amount and the one with yieldtype. This because you specified to update the rows where ModifierId was FISHERY_GOVERNOR_PRODUCTION, and both rows meet this criterion, therefore both rows are updated. Every row that meets the criterion will be updated, not just the first one.

Anyway good that you got it working.
 
Top Bottom