1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Modding Help

Discussion in 'CivBE - General Modding Discussion' started by ilikegoodfood, Mar 28, 2016.

  1. ilikegoodfood

    ilikegoodfood Chieftain

    Joined:
    Mar 28, 2016
    Messages:
    1
    Location:
    United Kingdom
    Hi all.
    I have just started modding CivBE, and am stuck already :).
    As a starting point, I decided to create a standalone mod that added the Tile Improvement Reclamation Project. This project returns the tile to an unimproved state.

    After much research I have discovered that this is firmly in the realm of Terraforming Mods, code wise, and have whipped up a very simple, 2 step process.

    First I have TileImprovements.xml, which contains all of, I think, the required material for a new Tile Improvement.
    Spoiler :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Created by ModBuddy on 3/28/2016 11:15:14 AM -->
    <GameData>
      <!-- TODO: Insert table creation example here. -->
    	
      <!-- TODO: Insert table data example here.-->
    	
      <!-- Enter your Game Data here. -->
    	<Builds>
    		<Row>
    			<Type>BUILD_RECLAMATION_PROJECT</Type>
    			<PrereqTech>TECH_TERRAFORMING</PrereqTech>
    			<Time>1000</Time>
    			<ImprovementType>IMPROVEMENT_RECLAMATION_PROJECT</ImprovementType>
    			<Description>TXT_KEY_BUILD_RECLAMATION_PROJECT</Description>
    			<Help>TXT_KEY_BUILD_RECLAMATION_PROJECT_HELP</Help>
    			<Recommendation>TXT_KEY_BUILD_RECLAMATION_PROJECT_HELP</Recommendation>
    			<CanBeEmbarked>true</CanBeEmbarked>
    			<HiddenUntilUnlocked>true</HiddenUntilUnlocked>
    			<EntityEvent>ENTITY_EVENT_BUILD</EntityEvent>
    			<IconIndex>38</IconIndex>
    			<IconAtlas>UNIT_ACTION_ATLAS</IconAtlas>
    		</Row>
    	</Builds>
    
    	<BuildsOnFeature>
    		<Row>
    			<BuildType>BUILD_RECLAMATION_PROJECT</BuildType>
    			<FeatureType>FEATURE_FOREST</FeatureType>
    			<Time>400</Time>
    			<Remove>true</Remove>
    			<ProductionRefundToCity>20</ProductionRefundToCity>
    		</Row>
    		<Row>
    			<BuildType>BUILD_RECLAMATION_PROJECT</BuildType>
    			<FeatureType>FEATURE_MARSH</FeatureType>
    			<Time>700</Time>
    			<Remove>true</Remove>
    		</Row>
    	</BuildsOnFeature>
    	
    	<Improvements>
    		<Row>
    			<Type>IMPROVEMENT_RECLAMATION_PROJECT</Type>
    			<Description>TXT_KEY_IMPROVEMENT_RECLAMATION_PROJECT</Description>
    			<Civilopedia>TXT_KEY_IMPROVEMENTS_RECLEMATION_PROJECT_PEDIA</Civilopedia>
    			<RequiresFlatlands>false</RequiresFlatlands>
    			<BuildableOnResources>true</BuildableOnResources>
    			<IconIndex>0</IconIndex>
    			<IconAtlas>TERRAIN_ATLAS</IconAtlas>
    		</Row>
    	</Improvements>
    
    	<Improvement_ValidTerrains>
    		<Row>
    			<ImprovementType>IMPROVEMENT_RECLAMATION_PROJECT</ImprovementType>
    			<TerrainType>TERRAIN_GRASS</TerrainType>
    		</Row>
    		<Row>
    			<ImprovementType>IMPROVEMENT_RECLAMATION_PROJECT</ImprovementType>
    			<TerrainType>TERRAIN_PLAINS</TerrainType>
    		</Row>
    		<Row>
    			<ImprovementType>IMPROVEMENT_RECLAMATION_PROJECT</ImprovementType>
    			<TerrainType>TERRAIN_DESERT</TerrainType>
    		</Row>
    		<Row>
    			<ImprovementType>IMPROVEMENT_RECLAMATION_PROJECT</ImprovementType>
    			<TerrainType>TERRAIN_TUNDRA</TerrainType>
    		</Row>
    		<Row>
    			<ImprovementType>IMPROVEMENT_RECLAMATION_PROJECT</ImprovementType>
    			<TerrainType>TERRAIN_SNOW</TerrainType>
    		</Row>
    	</Improvement_ValidTerrains>
    	
    	<Unit_Builds>
    		<Row>
    			<UnitType>UNIT_WORKER</UnitType>
    			<BuildType>BUILD_RECLAMATION_PROJECT</BuildType>
    		</Row>
    	</Unit_Builds>
    	
    	<Language_en_US>
    		<Row Tag="TXT_KEY_BUILD_RECLAMATION_PROJECT">
    			<Text>Construct a [LINK=IMPROVEMENT_RECLAMATION_PROJACT]Reclamation Project[\LINK]</Text>
    		</Row>
    		<Row Tag="TXT_KEY_BUILD_RECLEMATION_PROJECT_HELP">
    			<Text>Returns the tile to an unimproved state. This can be used to prepare a tile for resource genration.</Text>
    		</Row>
    		<Row Tag="TXT_KEY_IMPROVEMENT_RECLAMATION_PROJECT">
    			<Text>Construct a [LINK=IMPROVEMENT_RECLAMATION_PROJACT]Reclamation Project[\LINK]</Text>
    		</Row>
    		<Row Tag="TXT_KEY_IMPROVEMENTS_RECLEMATION_PROJECT_PEDIA">
    			<Text>Returns the tile to an unimproved state. This can be used to prepare a tile for resource genration.</Text>
    		</Row>
    	</Language_en_US>
    </GameData>

    I then have a simple bit of code which checks for a the Reclamation Project whenever a Tile Improvement is completed, it sets the tile to not possess any tile improvements (=-1).
    Spoiler :
    Code:
    -- Lua Script1
    -- Author: ilike_000
    -- DateCreated: 3/28/2016 12:02:07 PM
    --------------------------------------------------------------
    function onReclamationProject(playerID, plotX, plotY, improvementID)
    	local pPlot = Map.GetPlot(plotX, plotY)
    	local iImp = pPlot:GetImprovementType()
    	if (iImp == iReclamationProject) then
    		pPlot:SetImprovementType(-1)
    	end
    end
    GameEvents.BuildFinished.Add(onReclamationProject)

    For some reason it isn't showing up in game, and, as a total beginner with limited XML and LUA experience, I don't know why.

    I have no real clue what to do with the Project settings either, having just added TileImprovements.xml to the Actions list with a database update.

    I would very much appreciate some help,
    Thanks.
     
  2. Browd

    Browd Dilettante Administrator

    Joined:
    Aug 5, 2012
    Messages:
    10,832
    Gender:
    Male
    Location:
    Washington, DC
    Moderator Action: Moved to General Modding Discussion forum.
     

Share This Page

Ebates: Get Paid to Shop