I badly need help for SQL table creation

NerCafel42

Chieftain
Joined
Jul 20, 2014
Messages
13
in SQL:
CREATE TABLE Policy_TerrainYieldChanges ('PolicyType' TEXT, 'TerrainType' TEXT, 'YieldType' TEXT, 'Yield' INTEGER);

in XML:
<Table name="Policy_TerrainYieldChanges">
<Column name="PolicyType" type="text" reference="Policies(Type)" />
<Column name="TerrainType" type="text" reference="Terrains(Type)" />
<Column name="YieldType" type="text" reference="Yields(Type)" />
<Column name="Yield" type="integer" /></Table>


I tried to add new table in SQL, in order to make a policy that grants Tundra a culture.

But as you can guess, it didn't work.

So I'm pretty sure that something must be wrong with my SQL,

because I have modded my dll already and there was no problem at all.

So, if I want to build and table written in 'in XML:' with SQL, how should I?
 
If all you did was create a new table then it won't work without supporting code that implements it. It's like a light switch that isn't wired to anything. You can flip it up and down but since it isn't connected to anything it won't turn any light on.

Your syntax for XML and SQL look correct. You can confirm by looking for the table in the database with sqlite manager after starting a game with your mod (or looking at the logs to see if they have errors).
 
So I'm pretty sure that something must be wrong with my SQL,

because I have modded my dll already and there was no problem at all.

- Nothing is wrong with your SQL/XML.

- You will need do 3 things (or "set of things") to make sure your new feature works:

  • Make sure the game engine reads/caches the data (I'd store it as an array), and an accessor function (if you want to follow the existing code template) to get the results
  • A conditional to check whether the player has policies that provides the effect.
  • Hook the returned values (if any) to the plot yield that is being worked by a city
    (i.e. if the owner of the working city has a policy bonus for yield X for this terrain type, add it to the sum to yield X for the plot)

Use this guide by Whoward69 if you need help doing so.
 
Back
Top Bottom