(proposal) Create a hybrid Spying system

This 30% value is also an absolute worst-case scenario, where you have built no anti-spying buildings, aren’t defending with your own spies, and aren’t offsetting the losses with your own spies in other cities. It’s a pure hypothetical.
 
Last edited:
. It’s a pure hypothetical.

Lets get real then. If your the number 1 civ, it’s highly likely that all of the other 7 civs will drop at least one spy in your capital, based on behavior I see today.

so is 5% steal the number? That’s 35% right there.

and if the steal is lower than that, I don’t think it’s going to be enough to be competitive, 5% of the capitals science is not going to compensate for the loss of the old tech steals.

I think at a minimum, if your going for steals than their can be NO overlap in spies, as the scaling becomes too harsh.
 
A level 3 counterspy plus three counterspy buildings looks like -60% to all spies in the city for a max of -12%. This is assuming the constabulary and police station work like the bookkeeper.

Or does the -12% mean that more does can be added to reduce the yield some more?


Note that Hinin's proposal says that each spy gains a specific amount of yields, which suggest that it's not reduced by counterspying, and it's not based on the output of the targeted city.
 
Last edited:
A level 3 counterspy plus three counterspy buildings looks like -60% to all spies in the city for a max of -12%. This is assuming the constabulary and police station work like the bookkeeper.

Or does the -12% mean that more does can be added to reduce the yield some more?


Note that Hinin's proposal says that each spy gains a specific amount of yields, which suggest that it's not reduced by counterspying, and it's not based on the output of the targeted city.

In what I had in mind, the effect reducing the effectiveness of spies didn't affect the malus cap. Thus, it would stay at -30% maximum, and would also count the possible effect of a Assassinate City Official Advanced Action from a Great Spy.

On the other hand, and to keep the system rewarding, the yields you gain from a spy operation are locked in value (with the value scaling with the spy level and the era + the city pop ?). The goal was to have the best of both worlds : a predictable reward that stays relevant no matter what, and a scaling malus that doesn't asphyxiate the opponent. This idea has its own problems and thus must be fine-tuned, but I think I had something interesting there.
 
And so we return to the issue how much much, if at all, should spies hurt the host city. Stalker has repeatedly stated his opinion that they should hurt the host civ not at all, or so little it is ignorable outside of punctuated advanced actions. In this system that means only great spies hurt.

I disagree with Stalker’s premise. I think spies should hurt other civs. I think they should hurt other civs more than they benefit their own civ, in all cases and situations, as a rule.
  • Espionage does not scale with empire, so it’s one of a few mechanics that a smaller empire can deploy as well as a large one
  • Espionage, in my mind is a rubber band mechanic. It is about trying to level out the leaders from the players that are behind
  • There are two ways a rubber band mechanic can work: boost losers, or hinder winners.
  • Boosting losers speeds the game up more. It accelerates all civs to send spies to the leader with the most of any specific yield or bonus they want. Send a gold-steal spy with the civ with the most gold, send a science spy to the tech leader, send a culture spy to the culture leader. The result is more and more yields for everyone. And there is no strong incentive for any of these leader civs to stop the steal, because something that helps 7 other civs a little is not worth the expense of trying to counter, and the benefit of helping other civs slightly less is abstract.
  • Whereas if the spies mainly hurt civs, they don’t contribute to yield inflation, they don’t accelerate the game, hindering or stopping enemy spies is more of a material concern that directly benefits a host civ.
So I don’t know what “feels bad man” more? The spy system being a toothless yields piñata, or a sharp weapon that really can hurt people without declaring war? We have few tools outside the WC to hinder other players besides just murdering them; maybe espionage could be one?
 
Last edited:
I think some of the difference is that you can actively counteract WC by getting more votes, or hurting the leaders' ability to have votes, whereas you can do nothing to stop being attacked by spies short of deleting the opposing civ from existence.

Even using a Great Spy to kill all the spies in a city nets you a 5-6 turn reprieve before everyone has shifted their spies back to that city and you're back at the maximum -30% on the yield they care about.

That said, I'm all about slowing the game down.
 
Last edited:
I do worry about sky level referring when the mission changes, but I wonder if the result will actually just be to leave.

It's going to be very hard to swallow a loss of X Science in order to gain X/3 Culture and the same in hurting the opponent, only making it up after 60 turns.
 
Stalker has repeatedly stated his opinion that they should hurt the host civ not at all, or so little it is ignorable outside of punctuated advanced actions. In this system that means only great spies hurt.

I feel like this is the best compromise between the positions. I can accept that great spies are going to knock my cities around and hurt, that seems fair. But I don't want to just have my main cities constantly drained all the time.

Consider how many people don't like citadels and their non-war impact, and those are tame in comparison to some of the actions considered here.
 
I feel like this is the best compromise between the positions. I can accept that great spies are going to knock my cities around and hurt, that seems fair. But I don't want to just have my main cities constantly drained all the time.

Consider how many people don't like citadels and their non-war impact, and those are tame in comparison to some of the actions considered here.
then what are buildings and wonders like police stations and NIA supposed to do? Just slightly slow down enemy spies’ Great Spy generation, which you might not even use against them? Do they make my spies steal more? If regular spies aren’t “sharp” somehow, why in blazes do we have all these abilities to counter them? Do you want us to just remove them?
 
Instead of a percentage, it could be the exact amount that the spy's civ is gaining. That will make the lost yields purely a function of population, and hurt the core cities less at the expense of the satellites.
 
So I don’t know what “feels bad man” more? The spy system being a toothless yields piñata, or a sharp weapon that really can hurt people without declaring war? We have few tools outside the WC to hinder other players besides just murdering them; maybe espionage could be one?

My main concern is that the sharp spy weapon seems great for messing up tall civs and mediocre in the extreme for messing up super wide civs. Wide civs are already better at bullying through war, draining individual cities also makes tall civs worse at being bullied through spying. If spies are going to drain I would be in support of a more civ-wide model instead of a city only model.
 
Whatever the final proposal is, we need to have a clearer system.
Adding city security somewhere in the city UI when you hover over it would be nice. Especially if we do end using a spy Unit that goes around the map, I don't want to have to open the spy menu, scroll through all the cities to find the one with the least, and then remember it's name and then find it on the map. Also no fractional security.
And have no/always constant travel times.
Another thing is the different outcomes, like 5% killed, 20% identified, 50% escape, etc.
Should just be two or one outcomes.

Those are the simplest changes that would make the system more digestible.
 
We have had a long discussion on Discord. Here is a proposal (still being formed) that is being discussed right now just to catch forum goers up.

  • Spies generate "Spy Points", similar to how great general and great admiral points are accumulated.
  • The big missions (hindering a wonder, creating a revolt, disrupting city defenses, etc) consume spy points.
  • Spy defenses (constabularies, security, counterspies, maybe influence levels) adjust the spy point cost of various missions. So maybe a mission that costs me 500 spy points normally could cost me 2000 points in a city with a constabulary, counterspy, and you have no influence (purely as example don't take the numbers to heart).
  • Spies may (or maybe no, under debate) still do some minor yield steals (or copies) while accumulating spy points.

This is similar to Hinin's proposal except we replace the great spy unit with the point spend. The advantages are: Points are very scalable, we can tweak mission costs to whatever makes sense, as opposed to great spy charges that are harder to divide. We also don't have to create a new unit or anything, we can keep everything right within the existing UI for spies.
 
We have had a long discussion on Discord. Here is a proposal (still being formed) that is being discussed right now just to catch forum goers up.

  • Spies generate "Spy Points", similar to how great general and great admiral points are accumulated.
  • The big missions (hindering a wonder, creating a revolt, disrupting city defenses, etc) consume spy points.
  • Spy defenses (constabularies, security, counterspies, maybe influence levels) adjust the spy point cost of various missions. So maybe a mission that costs me 500 spy points normally could cost me 2000 points in a city with a constabulary, counterspy, and you have no influence (purely as example don't take the numbers to heart).
  • Spies may (or maybe no, under debate) still do some minor yield steals (or copies) while accumulating spy points.

This is similar to Hinin's proposal except we replace the great spy unit with the point spend. The advantages are: Points are very scalable, we can tweak mission costs to whatever makes sense, as opposed to great spy charges that are harder to divide. We also don't have to create a new unit or anything, we can keep everything right within the existing UI for spies.
I like this more than Super Spies. Still, I'm very interested in the 4th point.
 
Here's the current proposal after another productive discussion on discord, as we have taken a lot of Hinin's proposal and shifted the concept into a point system rather than a GP. This is NOT an end proposal, merely a summary of what we got to, to help with future discussions.

Spy Point "Intelligence" Proposal
Summary: Spies generate spy points (Intelligence) that are utilized for "big missions". The goal here is to return spies to "big but more infrequent" missions, but allows for the variety of missions of the current system. Another big goal here is to make these missions more responsive, they should happen immediately (or very close) to when the user activates them, instead of waiting a long time for them to kick in.

TBD =
To be discussed. Element that was brought up but not really discussed, so its noted for future discussion.

Gaining and Using Spies
  • Spies are gained as normal today.
  • Spies are used in 4 main ways:
    • Agent: Spy goes into a city and provides city vision. Spy produces Intelligence based on its level (placeholder value: 1/2/3 intelligence).
      • TBD: Agents may provide some passive yields (or steals) while stationed.
      • TBD: Should there be other ways to gain intelligence other than spies directly?
    • Diplomat: Main bonuses unchanged. TBD: May provide Intelligence as well.
    • CS Operative: Goes into a city state and performs election rigging (see CS Operative section). Does not produce Intelligence while stationed this way.
    • Operative: Spends Intelligence to perform missions (see Operatives section below).
Spy Levels and Death
  • TBD: Should Spies die (from actions that kill them), retire (after X turns spy retires and becomes a level 1 spy again), or just remain immortal?
  • Spies gain experience as they are stationed. The question becomes, should there be mechanics for spies to lose experience in any way? There are three primary proposals right now:
    • No level loss: Spy levels serve as the normal way that Intelligence income grows as the game goes on. Spies natural gain levels and max out over time, creating a slowly rising income curve.
    • Spy Death: Spies level and then die (through some mechanic), replaced with level 1 spies that then level again.
    • Movement Level Loss: Spies levels as they remain in single place, and lose experience when they are moved to a different city.
Operatives and Missions
  • Only 1 Operative exists at a given time (replaces the thief, but can be placed in the capital).
  • When an Operative is placed in a city, a mission window immediately comes up (which is the same UI we have today). The various missions require a certain amount of Intelligence, which is spent when the mission is undertaken.
    • City specific missions would occur in the city the Operative is assigned.
    • More civ wide missions (ala steal tech) would be available in the capital city only.
  • Mission Intelligence cost is affected by the following:
    • Base Cost: Each mission can have a different base cost
    • Security Buildings: Constabulary/Police Station
    • Security Level: Cities security increases when hit by missions, and would go down over time.
      • TBD: How should security go up/down
    • TBD: Influence Level: Would reduce the cost of missions.
    • TBD: Other ways to affect cost.
    • Example (numbers completely made up): A poison well mission costs 100 intelligence. However, the target city has a constabulary (+25%). You are popular with the civ (-15%). The actual cost is 110 intelligence.
  • When the Operative is given a mission, it works in the city immediately (or with as low a setup time as is possible in the code). If you have enough Intelligence for the mission, it happens immediately. If you do not yet have enough, the Operative remains in the city until the needed Intelligence is reached, then the mission occurs.
    • Intelligence requirements can change while the Operative is stationed. In this case, the Operative continues to wait until the needed intelligence is reached, or the user decides to change the operative to a different city/mission.
      • TBD: Should Operatives gain intelligence while they are waiting to do missions?
    • The mission is guaranteed, the intelligence is spent, and then the Operative is returned to the spy pool (or killed if that is desired).

Mission List (TBD)

CS Operative

  • TBD: Should election rigging be adjusted at all in the new system?
  • TBD: Should coups remain as is, or cost intelligence in some way?
 
Last edited:
CliffsNotes version:
  • Diplomats and Spies in CS stay the same
  • Spies in your own cities basically do the same thing they do now: defend from other spies
  • Spies in foreign civ's cities can be given two rolls: Gain points or Spend points
  • You can only have 1 point-spending spy at a time that you move around wherever you want something to happen
  • The rest of your spies in other cities gather enough points to let him do more, bigger actions
  • Different actions cost different amounts of points, and can be done as soon as you are set up in the city and have the points to spend
  • Cities can make it more expensive to spend points in certain cities with buildings, their own spies, etc.
Key differences from the current system:
  • Spy actions happen as soon as the points-spending spy is in the right place with enough points, instead of having to set a spy to bake in a city for many turns
  • There are no chances to fail, and no chances for spies to be killed. If you can do an action it is done.
  • Security ratings in cities only impact 1 thing. Only the frequency of actions is affected, without an additional failure or capture chance
 
Additions from me (suggestions):
  • Spies can be put into your own city as counter spies. They generate low/no points, but increases point costs of enemy spy missions by X% (based on spy level), or increases security level if that stays. They also cause all enemy spies to lose their cover upon action (triggers the current "spy discovered" dialogue - hopefully fair to humans soon with some @Recursive tweaks)
  • A new spy action that costs spy points and kills ALL other spies in the city (agents and operatives, not diplomats), including counter spies (cover is still blown). This can be used by counter spies too, triggering the above dialogue for each spy killed.
  • Dead spies respawn after X turns (X > 1), if travel/setup times are removed.
 
We have had a long discussion on Discord. Here is a proposal (still being formed) that is being discussed right now just to catch forum goers up.

  • Spies generate "Spy Points", similar to how great general and great admiral points are accumulated.
  • The big missions (hindering a wonder, creating a revolt, disrupting city defenses, etc) consume spy points.
  • Spy defenses (constabularies, security, counterspies, maybe influence levels) adjust the spy point cost of various missions. So maybe a mission that costs me 500 spy points normally could cost me 2000 points in a city with a constabulary, counterspy, and you have no influence (purely as example don't take the numbers to heart).
  • Spies may (or maybe no, under debate) still do some minor yield steals (or copies) while accumulating spy points.

This is similar to Hinin's proposal except we replace the great spy unit with the point spend. The advantages are: Points are very scalable, we can tweak mission costs to whatever makes sense, as opposed to great spy charges that are harder to divide. We also don't have to create a new unit or anything, we can keep everything right within the existing UI for spies.

Right now, this is not really all that different from the quest system from a programming standpoint. Spies currently earn spy points based on their level, and cities have a 'spy point threshold' that is based on its espionage rating. These values are factored into the duration of quests, which can be tweaked on a quest-by-quest basis.

I've pretty much rewritten the entire espionage DLL code, so I'm confident when I say this: instead of flipping the table on the current system, I strongly recommend a balance pass on the spy quests.
For example, if you want spies to earn yields per turn instead of instant yields, you can do this in the current quest system (see counterspies for this).
 
I've pretty much rewritten the entire espionage DLL code, so I'm confident when I say this: instead of flipping the table on the current system, I strongly recommend a balance pass on the spy quests.
For example, if you want spies to earn yields per turn instead of instant yields, you can do this in the current quest system (see counterspies for this).

The key thing that the current system does is it gives us no way to make some quests quick (but rare).

I want to be able to disrupt defenses for example near immediately, not have the spy take 10 turns to do it. BUT....I don't want to allow disruption again and again and again . The spy point concept allows us to control the rarity of missions, not just how long they take to accomplish.
 
The key thing that the current system does is it gives us no way to make some quests quick (but rare).

I want to be able to disrupt defenses for example near immediately, not have the spy take 10 turns to do it. BUT....I don't want to allow disruption again and again and again . The spy point concept allows us to control the rarity of missions, not just how long they take to accomplish.

You can set cooldowns for quests, so they'd have a quick turnaround but be unavailable for x turns afterwards.

Again, I'l reiterate that if you haven't looked at all the things the quest system can do, you owe it to yourselves to take a look:
Spoiler :

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 3/24/2016 10:05:41 PM -->

<!-- CP EVENT SYSTEM -->

<GameData>
    <!--
                    MODDERS: READ CAREFULLY!
    There are four major tables here, and then sub-tables below that:
    1.) Events - this is the main table for Player-level events.
        This handles the prerequsities and limiters of all events you create.
    2.) EventChoices - this is the main table for Player-level event choices.
        All choices must have a parent event, and all choices alter player-level things only.
    3.) CityEvents - this is the main table for City-level events.
        This handles the prerequisites and limites of all city events you create.
    4.) CityEventChoices - this is the main table for City-level event choices.
        All choices must have a parent city event, and all choices alter city-level things only.
    
    Rules:
    
    1.) Do NOT mix Player and City level events in the XML. They don't interact. The exception to this rule is with linked events, which are discussed in (9) below.
    2.) Make sure that every event choice has a parent event.
    3.) All event choices have a 'duration' - this is required to create cooldowns between the same event firing a second+ time.
        If you want the effects of an event to wear off after the event's duration, set 'Expires' to true.
    4.) The only choice elements that can expire are as follows:
        Player-level:
            Promotions
            BuildingClasses
            Policies
            Resources
            Happiness
            City Yield Changes
            BuildingClass Yield Changes
        City-level:
            BuildingClasses
            Happiness
            City Yield Changes
            BuildingClass Yield Changes
    5.) If you are creating a multi-choice event, make sure that all Events and Event Choices have both Help and Description elements set.
    6.) If you are creating a single-choice (i.e. a pure event), you only need to set Help and Description for the Choice (not the base Event).
    7.) Make sure to set the NumChoices element for each event - 1 for single-choice events, 2+ for multi-choice events.
    8.) Player and City level events can interact, though only through a 'chaining' system using the EventLinkertables below.
        If you assign a City Event, for example, a linker value, the event will only fire if the player has had the player level event (i.e. the event's duration cooldown is still active).
        Using this, you can chain events and event choices off of each other, though (for the sake of performance) you can only assign one of each of these values to each event/choice.
        There are also options for 'no' event (i.e. two events can't be active at the same time) and 'otherplayer' (i.e. an event can only fire if another player has an event/choice active).
    9.) Events and choices can be given the 'one-shot' status, meaning that, once the event/choice has fired or is taken by the player/city, it will never happen again for the player or that city.
        Duration can still be used to affect expiration of effects, but the event will never happen again (or the choice will never appear in a choice list again).
        
    -->
    
    <!-- Note on Era and Gamespeed Scaling:
    
        Era scaling of values works off of the following function:
            Value x Era # = Scaled value.
            Ancient = 0 (raised to 1 a minimum), Classical = 1, Medieval = 2, Reniassance = 3, Industrial = 4, Modern = 5, Atomic = 6, Information = 7
            Example: 10 gold scaled in Medieval = 30 gold.
        Gamespeed uses a set value in the GameSpeeds table. Normally they are as follows:
            Epic = 2x
            Marathon = 3x
            Example: 10 Gold on Standard = 30 Gold on Marathon
        
        CRITICAL: Notification and Event Choice Help text are capable of scaling along with the game's era and speed automatically, if you use the following variables:

        Player Choice Help Text:
            {1_YieldCost}
            {2_InstantYield}
            {3_CityYieldGlobal}
            {4_Turns}
    
        City Choice Help Text:
            {1_YieldCost}
            {2_InstantYield}
            {3_CityYield}
            {4_GPChange}
            {5_Turns}
            {6_SpyEventDuration} USE ONLY IF AN ESPIONAGE EVENT!
            {7_PlayerEventEffect}
    
        EventChoiceNotifications (see two tables below) also have access to this:
            Player Choices:
                {4_EventChoiceScalingHelper}
            City Choices:
                {5_EventChoiceScalingHelper}
        
                These Notification Helpers grab the following scaling core information about the event:
                    Player:
                        Event Cost
                        Event Instant Yield
                        City Yield Change
                        Event Duration
        
                    Cities:
                        Event Cost
                        Event Instant Yield
                        City Yield Change
                        GPP Change
                        Event Duration
        
        These elements are grabbed because they scale with era or gamespeed, and are thus variable.
        ALL Help files are funneled through this, and Yields that can scale will be handled as they are above.
        
        See the text files for my events to give you an idea of how this works!
        
        !!!! NOTE: You can ignore all of this and write them manually, but using the variables above scales costs/yields/durations. !!!!
        
    -->
    
    <!-- LUA Support -->
    <!-- Events System -->

    <!-- Note: the following two game events fire when an event starts. -->
        <!-- GameEvents.EventActivated(iPlayer, iEvent)-->
        <!-- GameEvents.CityEventActivated(iPlayer, iCityID, iEvent)-->
    <!-- Note: the following two game events fire when an event choice starts. -->
        <!-- GameEvents.EventChoiceActivated(iPlayer, iChoice)-->
        <!-- GameEvents.CityEventChoiceActivated(iPlayer, iCityID, iChoice)-->
    <!-- Note: the following two game events fire when an event choice's duration value ends. -->
        <!-- GameEvents.EventChoiceEnded(iPlayer, iChoice)-->
        <!-- GameEvents.CityEventChoiceEnded(iPlayer, iCityID, iChoice)-->
    <!-- Note: the following four game events need to return a bool of true/false - true will end the function, false will let it continue normally. -->
        <!-- GameEvents.OverrideAIEvent(iPlayer, iEvent)-->
        <!-- GameEvents.OverrideAICityEvent(iPlayer, iCityID, iEvent)-->
        <!-- GameEvents.OverrideAIEventChoice(iPlayer, iChoice) -->
        <!-- GameEvents.OverrideAICityEventChoice(iPlayer, iCityID, iChoice)-->
    <!-- Note: the following two game events need to return a bool of true/false - false will count as a continue, true will let it continue normally. -->
        <!-- GameEvents.EventCanTake(iPlayer, iEvent)-->
        <!-- GameEvents.CityEventCanTake(iPlayer, iCityID, iEvent)-->
        <!-- GameEvents.EventChoiceCanTake(iPlayer, iChoice)-->
        <!-- GameEvents.CityEventChoiceCanTake(iPlayer, iCityID, iChoice)-->
    <!-- Note: the following lua hook fires if a unit is created via the (city)eventchoice_freeunits or (city)eventchoice_freeunitclasses player and city event tables -->
        <!-- GameEvents.EventUnitCreated(iPlayer, iEventChoice, CvUnit* pUnit)-->
    
    <!-- Lua Functions
        PLAYER EVENTS:
        
        Player:DoStartEvent(EventTypes eEvent);
            Fires a specific event, ignoring requirements/filters.
        Player:GetEventCooldown(EventTypes eEvent);
            Gets the integer value of the cooldown for an event
        Player:SetEventCooldown(EventTypes eEvent, int iNewCooldown);
            Sets the integer value of the cooldown for an event
    
        PLAYER CHOICES:
        
        Player:IsEventChoiceActive(EventChoiceTypes eEventChoice);
            Gets whether or not a player event choice's cooldown is active or if it is a one-shot that has fired.
        Player:DoEventChoice(EventChoiceTypes eEventChoice);
            Fires a specific event choice. Used by UI.
        Player:DoCancelEventChoice(EventChoiceTypes eEventChoice);
            Cancels a specific choice, ignoring requirements/filters.
        Player:GetEventChoiceCooldown(EventChoiceTypes eEventChoice);
            Gets the integer value of the cooldown for an event choice
        Player:SetEventChoiceCooldown(EventChoiceTypes eEventChoice, int iNewCooldown);
            Sets the integer value of the cooldown for an event choice
        Player:IsEventChoiceValid(EventChoiceTypes eEventChoice);
            Let's you check to see if an event choice is valid. Used by UI.
        
        CITY EVENTS:
    
        City:DoCityStartEvent(CityEventTypes eEvent);
            Fires a specific event, ignoring requirements/filters
        Player:GetCityEventCooldown(CityEventTypes eEvent);
            Gets the integer value of the cooldown for a city event
        Player:SetCityEventCooldown(CityEventTypes eEvent, int iNewCooldown);
            Sets the integer value of the cooldown for a city event
            
        CITY CHOICES:
        City:IsCityEventChoiceActive(CityEventChoiceTypes eEventChoice);
            Gets whether or not a city event choice's cooldown is active or if it is a one-shot that has fired.
        City:DoCityEventChoice(CityEventChoiceTypes eEventChoice);
            Fires a specific event choice. Used by UI.
        City:DoCancelCityEventChoice(CityEventChoiceTypes eEventChoice);
            Cancels a specific event choice, ignoring requirements/filters.
        Player:GetCityEventChoiceCooldown(CityEventChoiceTypes eEventChoice);
            Gets the integer value of the cooldown for a city event choice
        Player:SetCityEventChoiceCooldown(CityEventChoiceTypes eEventChoice, int iNewCooldown);
            Sets the integer value of the cooldown for a city event choice
        City:IsCityEventChoiceValid(CityEventChoiceTypes eEventChoice);
            Let's you check to see if an event choice is valid. Used by UI.
    -->

    <Defines>
        <!-- Minimum amount of time between any two events for Players/Cities. Scales with Gamespeed. Does not affect counters (i.e. cooldowns will still reduce),
            but prevents events from firing during this time. If you set IgnoresGlobalCooldown true for an event, it will ignore this. -->
        <Row Name="EVENT_MIN_DURATION_BETWEEN">
            <Value>10</Value>
        </Row>
        <Row Name="CITY_EVENT_MIN_DURATION_BETWEEN">
            <Value>25</Value>
        </Row>
    </Defines>
    <!-- Table definitions -->

    <!--== PLAYER LEVEL EVENTS == -->

    <Table name="Events">
        <Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
        <Column name="Type" type="text" notnull="true" unique="true"/>
        <!-- Event Class - You don't have to set this, however you can use the follow categories to give players the options to enable/disable certain types of Events:
            EVENT_CLASS_GOOD
            EVENT_CLASS_BAD
            EVENT_CLASS_NEUTRAL
            EVENT_CLASS_TRADE
            EVENT_CLASS_CIV_SPECIFIC
        -->
        <Column name="EventClass" type="text" reference="EventClassTypes(Type)" default="NULL"/>
        <Column name="Description" type="text" reference="Language_en_US(Tag)"/>
        <Column name="Help" type="text" reference="Language_en_US(Tag)"/>
        <Column name="EventArt" type="text"/>
        <Column name="EventAudio" type="text"/>
        <!-- 0 = always fires, -1 = diabled, 1-100 = % chance of success. -->
        <Column name="RandomChance" type="integer" default="0"/>
        <!-- If an event fails its randomchance roll, this value is added to the next random chance roll. Happens every time it fails (until it succeeds, at which point it is reset) -->
        <Column name="RandomChanceDelta" type="integer" default="0"/>
        <!-- If set to true, this event can only fire once, ever, for the player -->
        <Column name="IsOneShot" type="boolean" default="false"/>
        <!-- This value determines whether or not an event, once fired for one player, immediately fires for all players. -->
        <Column name="Global" type="boolean" default="false"/>
        <!-- Era Scaling: boosts yield required for minimumstartyield table below. -->
        <Column name="EraScaling" type="boolean" default="false"/>
        <!-- Event Cooldown: sets distance in time between this event and next event of this type. Defaults to 30 turns. Means that the minimum time between any two events of this type is 30 turns. -->
        <Column name="EventCooldown" type="integer" default="30"/>
        <!-- Set NumChoices to 2+ if you are adding more than one choice to the event!! -->
        <Column name="NumChoices" type="integer" default="1"/>
        <!-- Allows the event to ignore the global cooldown defined above. Use sparingly! -->
        <Column name="IgnoresGlobalCooldown" type="boolean" default="false"/>

        <!-- Filters
        
        Determine whether or not an Event can occur for the player.
        
        -->
        <Column name="MinimumNationalPopulation" type="integer" default="0"/>
        <Column name="MinimumNumberCities" type="integer" default="0"/>
        <Column name="RequiredCiv" type="text" reference="Civilizations(Type)" default="NULL"/>
        <Column name="RequiredEra" type="text" reference="Eras(Type)" default="NULL"/>
        <Column name="HasMetAMajorCiv" type="boolean" default="false"/>
        <!-- Looks for negative gold or negative GPT, respectively. -->
        <Column name="InDebt" type="boolean" default="false"/>
        <Column name="LosingMoney" type="boolean" default="false"/>
        <!-- Require x number of coastal cities to be available as a choice. -->
        <Column name="MinimumNumCoastalCities" type="integer" default="0"/>
        <!-- Only valid if you are under your trade route cap -->
        <Column name="LessThanMaximumTradeRoutes" type="boolean" default="false"/>

        
        <!-- Checks if empire is unhappy -->
        <Column name="IsUnhappy" type="boolean" default="false"/>
        <Column name="IsSuperUnhappy" type="boolean" default="false"/>
        <!-- Note: obsoletes at this era, not after it -->
        <Column name="ObsoleteEra" type="text" reference="Eras(Type)" default="NULL"/>
        <Column name="ImprovementAnywhereRequired" type="text" reference="Improvements(Type)" default="NULL"/>
        <Column name="RequiredPolicy" type="text" reference="Policies(Type)" default="NULL"/>
        <Column name="RequiredIdeology" type="text" reference="PolicyBranchTypes(Type)" default="NULL"/>
        <Column name="UnitClassRequired" type="text" reference="UnitClasses(Type)" default="NULL"/>
        <Column name="PrereqTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <Column name="ObsoleteTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <!-- Checks to see if player's current religion is a Pantheon -->
        <Column name="RequiresPantheon" type="boolean" default="false"/>
        <!-- Checks for Official or Majority Religion of player -->
        <Column name="RequiredReligion" type="text" reference="Religions(Type)" default="NULL"/>
        <!-- JFD check - looks at player's state religion -->
        <Column name="RequiredStateReligion" type="text" reference="Religions(Type)" default="NULL"/>
        <Column name="RequiresAnyStateReligion" type="boolean" default="false"/>
        <!-- Other -->
        <Column name="RequiredAnywhereBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <Column name="RequiredNowhereBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <Column name="RequiresHolyCity" type="boolean" default="false"/>
        <Column name="RequiresIdeology" type="boolean" default="false"/>
        <Column name="RequiresWar" type="boolean" default="false"/>
        <Column name="RequiresWarMinor" type="boolean" default="false"/>
        <!-- C4DF Only -->
        <Column name="IsVassalOfSomeone" type="boolean" default="false"/>
        <Column name="IsMasterOfSomeone" type="boolean" default="false"/>
    </Table>
    
    <!-- Filters: -->
    
    <!-- Note: this only checks national yields (Faith, Culture, Gold, Science, Golden Age Points). -->
    <Table name="Event_MinimumStartYield">
        <Column name="EventType" type="text" reference="Events(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- Checks for ownership of resource type and number. Does not include trades. -->
    <Table name="Event_MinimumResourceRequired">
        <Column name="EventType" type="text" reference="Events(Type)"/>
        <Column name="ResourceType" type="text" reference="Resources(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    <!-- Checks for number of cities with a nearby feature. Quantity = minimum number of cities required before event can fire. -->
    <Table name="Event_MinimumFeatureRequired">
        <Column name="EventType" type="text" reference="Events(Type)"/>
        <Column name="FeatureType" type="text" reference="Features(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>

    <!-- This is the linker table for connecting events to one another. MAKE SURE THAT THIS TABLE APPEARS AFTER ALL EVENTS/CHOICES INCLUDED IN IT. You can have multiple of rows of these with the same event type to make specific events that need a specific setup to function (a la parent events above)-->
    <Table name="Event_EventLinks">
        <!-- This is the parent. This is the event/choice that will or will not fire based on your data below. -->
        <Column name="EventType" type="text" reference="Events(Type)"/>
        <!-- These four elements: set the event/event choice/city event/city event choice you want to link this event to.
            You can add elements to each of these so that an event requires another event, event choice, city event, AND a city event choice if you want.
            You'll notice one has the word 'linker' after it - this is to distinguish this event/choice from the event/choice defined above (i.e. the parent)
        -->
        <Column name="EventLinker" type="text" reference="Events(Type)"/>
        <Column name="EventChoice" type="text" reference="EventChoices(Type)"/>
        <Column name="CityEvent" type="text" reference="CityEvents(Type)"/>
        <Column name="CityEventChoice" type="text" reference="CityEventChoices(Type)"/>
        <!-- This makes the event link span all known players and all known player cities looking for the four elements above. Be sparing with this, can be expensive! -->
        <Column name="CheckKnownPlayers" type="boolean" default="false"/>
        <!-- Defaults to TRUE, meaning that any event/choice defined above must be active for the event to fire. Setting it to false makes it so that any event/choice defined above that is NOT active is the trigger.
        Think of this as a boolean switch - if the state of the event(s) above are hoped to be inactive, make this false. If you want it active, leave it true.
        -->
        <Column name="CheckForActive" type="boolean" default="true"/>
    </Table>
    
    <!-- == PLAYER EVENT CHOICES == -->
    <Table name="EventChoices">
        <!-- You can make as many choices as you want - the window show expand (with a scroll bar) to acommodate them. But be reasonable! :) -->
        <!-- Note - if NOT a multiple-choice event, only make one of these! -->
        <Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
        <Column name="Type" type="text" notnull="true" unique="true"/>
        <Column name="Description" type="text" reference="Language_en_US(Tag)"/>
        <!-- Help is used for Tooltips, Description for button text -->
        <Column name="Help" type="text" reference="Language_en_US(Tag)"/>
        <!-- DisabledTooltip is used for Tooltips for choices that are not active but appear in choice list.
        The DLL automatically explains to players WHY an event choice is unavailable, however you can use it you want to override the DLL. -->
        <Column name="DisabledTooltip" type="text" reference="Language_en_US(Tag)"/>
        <!-- Audio for when event window pops up. -->
        <Column name="EventChoiceAudio" type="text" default="AS2D_EVENT_CHOICE"/>
        <!-- If set to true, this event choice can only be chosen once, ever, by the player -->
        <Column name="IsOneShot" type="boolean" default="false"/>
        <!-- Defaults to 30. Set a different duration if the expiration timer matters. Otherwise, leave it at 30, as it is used by the Recent Events overview. -->
        <Column name="EventDuration" type="integer" default="30"/>
        <!-- Event Chance: Higher value = higher chance of success. Notification will spawn if an event fails. Default is always successful. -->
        <Column name="EventChance" type="integer" default="0"/>
        <!-- Era Scaling: boosts yield value on instant yield, GP Points, and yield costs tables (See below) based on Era. -->
        <Column name="EraScaling" type="boolean" default="false"/>
        <!-- Expires: set to true if you want policies/buildings/promotions/resources granted to disappear after the duration. -->
        <Column name="Expires" type="boolean" default="false"/>

        <!-- Variables
        
        Attriutes granted by Event Choices. Unless noted, city-related choices affect all cities.
        -->
        <!-- EXCEPTION: Set this to true to make event choice elements that affect cities ONLY affect coastal cities. -->
        <Column name="CoastalOnly" type="boolean" default="false"/>
        <!-- EXCEPTION: Set this to true to make event choice elements that affect cities ONLY affect your Capital. -->
        <Column name="CapitalEffectOnly" type="boolean" default="false"/>
        <!-- ADDITION: Set this to true to make event_instantyield choice elements below that normally only affect your Capital affect ALL cities. -->
        <Column name="YieldBonusAllCities" type="boolean" default="false"/>
        
        <!-- Grants a Policy. -->
        <Column name="EventPolicy" type="text" reference="Policies(Type)" default="NULL"/>
        <!-- Grants a specified tech for free. -->
        <Column name="EventTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <!-- Grants all owned units, and all units created while this is active a promotion. Only affects valid units. -->
        <Column name="EventPromotion" type="text" reference="UnitPromotions(Type)" default="NULL"/>
        <!-- Adds a building to all cities. -->
        <Column name="EventBuildingClassGlobal" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <Column name="EventFreePolicies" type="integer" default="0"/>
        <Column name="EventFreeTechs" type="integer" default="0"/>
        <Column name="FreeGreatPeople" type="integer" default="0"/>
        <Column name="GoldenAgeTurns" type="integer" default="0"/>
        <!-- Affects all cities -->
        <Column name="WLTKDTurns" type="integer" default="0"/>
        <Column name="ResistanceTurns" type="integer" default="0"/>
        <!-- Happiness Boosts. Can be set to expire. PlayerHappiness applies to capital, HappinessPerCity applies to all cities. -->
        <Column name="PlayerHappiness" type="integer" default="0"/>
        <Column name="HappinessPerCity" type="integer" default="0"/>
        <!-- Spawns X number of barbs near EVERY City. Unit type scales with player tech. -->
        <Column name="RandomBarbarianSpawn" type="integer" default="0"/>
        <!-- Spawns X number of owned units near EVERY City. Unit type scales with player tech. -->
        <Column name="FreeUnitsTechAppropriate" type="integer" default="0"/>

        <!-- Filters
        
        Determines whether or not Event Choices appear in list of choices.
        
        -->
        <Column name="MinimumNationalPopulation" type="integer" default="0"/>
        <Column name="MinimumNumberCities" type="integer" default="0"/>
        <Column name="HasMetAMajorCiv" type="boolean" default="false"/>
        <!-- Looks for negative gold or negative GPT, respectively. -->
        <Column name="InDebt" type="boolean" default="false"/>
        <Column name="LosingMoney" type="boolean" default="false"/>
        <!-- Require x number of coastal cities to be available as a choice. -->
        <Column name="MinimumNumCoastalCities" type="integer" default="0"/>
        <!-- Only affects coastal cities-->
        <Column name="AffectsCoastalCitiesOnly" type="boolean" default="false"/>
        <!-- Only valid if you are under your trade route cap -->
        <Column name="LessThanMaximumTradeRoutes" type="boolean" default="false"/>
        <!-- Checks if empire is unhappy -->
        <Column name="IsUnhappy" type="boolean" default="false"/>
        <Column name="IsSuperUnhappy" type="boolean" default="false"/>
        <Column name="RequiredCiv" type="text" reference="Civilizations(Type)" default="NULL"/>
        <Column name="RequiredEra" type="text" reference="Eras(Type)" default="NULL"/>
        <!-- Note: obsoletes at this era, not after it -->
        <Column name="ObsoleteEra" type="text" reference="Eras(Type)" default="NULL"/>
        <Column name="ImprovementAnywhereRequired" type="text" reference="Improvements(Type)" default="NULL"/>
        <Column name="RequiredPolicy" type="text" reference="Policies(Type)" default="NULL"/>
        <Column name="RequiredIdeology" type="text" reference="PolicyBranchTypes(Type)" default="NULL"/>
        <Column name="UnitClassRequired" type="text" reference="UnitClasses(Type)" default="NULL"/>
        <Column name="PrereqTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <Column name="ObsoleteTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <!-- Checks to see if player's current religion is a Pantheon -->
        <Column name="RequiresPantheon" type="boolean" default="false"/>
        <!-- Checks for Official or Majority Religion -->
        <Column name="RequiredReligion" type="text" reference="Religions(Type)" default="NULL"/>
        <!-- JFD check - looks at player's state religion -->
        <Column name="RequiredStateReligion" type="text" reference="Religions(Type)" default="NULL"/>
        <Column name="RequiresAnyStateReligion" type="boolean" default="false"/>
        <!-- Other -->
        <Column name="RequiredAnywhereBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <Column name="RequiredNowhereBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <Column name="RequiresHolyCity" type="boolean" default="false"/>
        <!-- Requires any Ideology -->
        <Column name="RequiresIdeology" type="boolean" default="false"/>
        <Column name="RequiresWar" type="boolean" default="false"/>
        <Column name="RequiresWarMinor" type="boolean" default="false"/>
        <!-- C4DF Only -->
        <Column name="IsVassalOfSomeone" type="boolean" default="false"/>
        <Column name="IsMasterOfSomeone" type="boolean" default="false"/>
    </Table>
    <!-- Parent Event is ESSENTIAL - this table assigns choices to events. Make sure the EventType matches the name of an EventType from above! Must be BELOW the above tables. -->
    <Table name="Event_ParentEvents">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="EventType" type="text" reference="Events(Type)"/>
    </Table>   
    <!-- Note: This table fires BEFORE an event choice is checked to see if it succeeds. Use this to have an event that costs something, but may not actually succeed. -->
    <!-- Use positive values here to make it a 'cost' -->
    <Table name="EventChoice_EventCostYield">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- The tables below fire AFTER an event has been found to succeed. Can use negative values here. -->
    <!-- Note: these values all pass through your Capital. -->
    <Table name="EventChoice_InstantYield">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- Grants all cities a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. Can scale with era. Can also use coastal/capital valuation above to enable/disable certain cities from gaining the bonus. -->
    <Table name="EventChoice_CityYield">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- Grants all city buildings of a class (existing and future) a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. Can also use coastal/capital valuation above to enable/disable certain cities from gaining the bonus. -->
    <Table name="EventChoice_BuildingClassYieldChange">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants all city buildings of a class (existing and future) a certain X yield modifier. Can be turned off via the 'expires' tag and a set duration. Can also use coastal/capital valuation above to enable/disable certain cities from gaining the bonus. -->
    <Table name="EventChoice_BuildingClassYieldModifier">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Modifier" type="integer"/>
    </Table>
    <!-- Grants a free resource. Can be set to expire. -->
    <Table name="EventChoice_ResourceQuantity">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="ResourceType" type="text" reference="Resources(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    <!-- Grants features in all cities of a type a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. Can also use coastal/capital valuation above to enable/disable certain cities from gaining the bonus. -->
    <Table name="EventChoice_FeatureYieldChange">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="FeatureType" type="text" reference="Features(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants improvements in all cities of a type a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. Can also use coastal/capital valuation above to enable/disable certain cities from gaining the bonus. -->
    <Table name="EventChoice_ImprovementYieldChange">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants resources in all cities of a type a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. Can also use coastal/capital valuation above to enable/disable certain cities from gaining the bonus. -->
    <Table name="EventChoice_ResourceYieldChange">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="ResourceType" type="text" reference="Resources(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants terrains in all cities of a type a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. Can also use coastal/capital valuation above to enable/disable certain cities from gaining the bonus. -->
    <Table name="EventChoice_TerrainYieldChange">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="TerrainType" type="text" reference="Terrains(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants specialists of a type in all cities a certain bonus X yield. Can be turned off via the 'expires' tag and a set duration. Can also use coastal/capital valuation above to enable/disable certain cities from gaining the bonus. -->
    <Table name="EventChoice_SpecialistYieldChange">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="SpecialistType" type="text" reference="Specialists(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Creates Units in all cities (unless controlled for above) -->
    <Table name="EventChoice_FreeUnitClasses">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="UnitClassType" type="text" reference="UnitClasses(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    <!-- Creates specific unit type in all cities (unless controlled for above) -->
    <Table name="EventChoice_FreeUnits">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="UnitType" type="text" reference="Units(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    <!-- Convert Set Pop/Percent Pop to Religion-->
    <Table name="EventChoice_ConvertNumPopToReligion">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="ReligionType" type="text" reference="Religions(Type)"/>
        <Column name="Population" type="integer"/>
    </Table>
    <Table name="EventChoice_ConvertPercentPopToReligion">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="ReligionType" type="text" reference="Religions(Type)"/>
        <Column name="Percent" type="integer"/>
    </Table>
    <!-- Unhappiness Modifier for CBP Happiness system. Affects ALL cities.
        Yield match: YIELD_GOLD = Poverty, YIELD_SCIENCE = Illiteracy, YIELD_PRODUCTION = Safety, YIELD_CULTURE = illiteracy, YIELD_FAITH = Religious Minorities
        Note that negative values reduce needs, while positive values increase them!
    -->
    <Table name="EventChoice_CityUnhappinessNeedMod">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>

    <!-- Filters -->
    
    <!-- Determines if a choice will appear in list. This only checks national yields (Faith, Culture, Gold, Science, Golden Age Points). -->
    <Table name="EventChoice_MinimumStartYield">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- Checks for ownership of resource type and number. Does not include trades. -->
    <Table name="EventChoice_MinimumResourceRequired">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="ResourceType" type="text" reference="Resources(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    <!-- Checks for number of cities with a nearby feature. Quantity = minimum number of cities required before event can fire. -->
    <Table name="EventChoice_MinimumFeatureRequired">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="FeatureType" type="text" reference="Features(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    
    <!-- AI Stuff -->
    
    <!-- Note: if you don't set flavors for your choices, the AI will make a random choice (or will only choose from those with flavors). -->
    <Table name="EventChoiceFlavors">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="FlavorType" type="text" reference="Flavors(Type)"/>
        <Column name="Flavor" type="integer"/>
    </Table>

    <!-- This is the linker table for connecting events to one another. MAKE SURE THAT THIS TABLE APPEARS AFTER ALL EVENTS/CHOICES INCLUDED IN IT. You can have multiple of rows of these with the same event type to make specific events that need a specific setup to function (a la parent events above)-->
    <Table name="EventChoice_EventLinks">
        <!-- This is the parent. This is the event/choice that will or will not fire based on your data below. -->
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <!-- These four elements: set the event/event choice/city event/city event choice you want to link this event to.
            You can add elements to each of these so that an event requires another event, event choice, city event, AND a city event choice if you want.
            You'll notice one has the word 'linker' after it - this is to distinguish this event/choice from the event/choice defined above (i.e. the parent)
        -->
        <Column name="Event" type="text" reference="Events(Type)"/>
        <Column name="EventChoiceLinker" type="text" reference="EventChoices(Type)"/>
        <Column name="CityEvent" type="text" reference="CityEvents(Type)"/>
        <Column name="CityEventChoice" type="text" reference="CityEventChoices(Type)"/>
        <!-- This makes the event link span all known players and all known player cities looking for the four elements above. Be sparing with this, can be expensive! -->
        <Column name="CheckKnownPlayers" type="boolean" default="false"/>
        <!-- Defaults to TRUE, meaning that any event/choice defined above must be active for the event to fire. Setting it to false makes it so that any event/choice defined above that is NOT active is the trigger.
        Think of this as a boolean switch - if the state of the event(s) above are hoped to be inactive, make this false. If you want it active, leave it true.
        -->
        <Column name="CheckForActive" type="boolean" default="true"/>
    </Table>
    
    <!-- Notifications -->
    
    <!-- Note: this table is not required, however if you want to seed a notification to the player (or to all known players in the world) you need to use this -->
    <!-- Make sure that NotificationType corresponds to a real NotificationType! -->
    <!-- Also, note that player notifications seeds the following values:
        {1_CivShortDescription}
        {2_CivDescription}
        {3_PlayerName}
        {4_EventChoiceHelpText}
        You can use any or all of these.
     -->
    <Table name="EventChoice_Notification">
        <Column name="EventChoiceType" type="text" reference="EventChoices(Type)"/>
        <Column name="NotificationType" type="text"/>
        <Column name="Description" type="text" reference="Language_en_US(Tag)"/>
        <Column name="ShortDescription" type="text" reference="Language_en_US(Tag)"/>
        <Column name="IsWorldEvent" type="boolean" default="false"/>
        <!-- These values are required by some times of notifications and pass into the gamedata/extravariable slots after the X/Y spots for a notification. -->
        <Column name="NeedPlayerID" type="boolean" default="false"/>
        <!-- Note that if you set NeedPlayerID to true, it takes over the slot where Variable1 goes, so Variable1 is inactive! -->
        <Column name="Variable1" type="int" default="-1"/>
        <Column name="Variable2" type="int" default="-1"/>
    </Table>
    
    <!--== CITY LEVEL EVENTS == -->

    <Table name="CityEvents">
        <Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
        <Column name="Type" type="text" notnull="true" unique="true"/>
        <!-- Event Class - You don't have to set this, however you can use the follow categories to give players the options to enable/disable certain types of Events:
            EVENT_CLASS_GOOD
            EVENT_CLASS_BAD
            EVENT_CLASS_NEUTRAL
            EVENT_CLASS_TRADE
            EVENT_CLASS_CIV_SPECIFIC
        -->
        <Column name="EventClass" type="text" reference="EventClassTypes(Type)" default="NULL"/>
        <Column name="Description" type="text" reference="Language_en_US(Tag)"/>
        <Column name="Help" type="text" reference="Language_en_US(Tag)"/>
        <Column name="CityEventAudio" type="text"/>
        <Column name="CityEventArt" type="text"/>
        <!-- 0 = always fires, -1 = diabled, 1-100 = % chance of success. -->
        <Column name="RandomChance" type="integer" default="0"/>
        <!-- If an event fails its randomchance roll, this value is added to the next random chance roll. Happens every time it fails (until it succeeds, at which point it is reset) -->
        <Column name="RandomChanceDelta" type="integer" default="0"/>
        <!-- If set to true, this city event can only fire once, ever, for the city -->
        <Column name="IsOneShot" type="boolean" default="false"/>
        <!-- Event Cooldown: sets distance in time between this event and next. Defaults to 30 turns. Means that the minimum time between any two events of ANY type is 30 turns. -->
        <Column name="EventCooldown" type="integer" default="30"/>
        <!-- Set NumChoices to 2+ if adding 2 or more choices below!! -->
        <Column name="NumChoices" type="integer" default="1"/>
        <!-- Era Scaling: boosts yield required for minimumstartyield table below. -->
        <Column name="EraScaling" type="boolean" default="false"/>
        <!-- Allows the event to ignore the global cooldown defined above. Use sparingly! -->
        <Column name="IgnoresGlobalCooldown" type="boolean" default="false"/>
        <!-- Filters
        
        Determine whether or not an Event can occur for the player.
        
        -->
        <Column name="MinimumCityPopulation" type="integer" default="0"/>
        <Column name="MaximumCityPopulation" type="integer" default="0"/>
        <Column name="RequiredCiv" type="text" reference="Civilizations(Type)" default="NULL"/>
        <Column name="RequiredEra" type="text" reference="Eras(Type)" default="NULL"/>
        <!-- Note: obsoletes at this era, not after it -->
        <Column name="ObsoleteEra" type="text" reference="Eras(Type)" default="NULL"/>
        <!-- Only Checks for local Improvements worked by City. -->
        <Column name="ImprovementRequired" type="text" reference="Improvements(Type)" default="NULL"/>
        <!-- Checks for nearby features/terrain. Can use natural wonders for features. -->
        <Column name="NearbyFeature" type="text" reference="Features(Type)" default="NULL"/>
        <Column name="NearbyTerrain" type="text" reference="Terrains(Type)" default="NULL"/>
        <Column name="LocalResourceRequired" type="text" reference="Resources(Type)" default="NULL"/>
        <Column name="RequiredPolicy" type="text" reference="Policies(Type)" default="NULL"/>
        <Column name="RequiredIdeology" type="text" reference="PolicyBranchTypes(Type)" default="NULL"/>
        <Column name="PrereqTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <Column name="ObsoleteTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <!-- Only Checks for local status. -->
        <Column name="RequiredReligion" type="text" reference="Religions(Type)" default="NULL"/>
        <!-- JFD Check - local only -->
        <Column name="RequiredStateReligion" type="text" reference="Religions(Type)" default="NULL"/>
        <Column name="RequiresAnyStateReligion" type="boolean" default="false"/>
        <!-- Only Checks for local Buildings in City. -->
        <Column name="RequiredBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <Column name="CannotHaveBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <!-- Only Checks for local status. -->
        <Column name="HasTradeConnection" type="boolean" default="false"/>
        <Column name="HasCityConnection" type="boolean" default="false"/>
        <Column name="RequiresGarrison" type="boolean" default="false"/>
        <Column name="RequiresHolyCity" type="boolean" default="false"/>
        <Column name="RequiresIdeology" type="boolean" default="false"/>
        <Column name="CapitalOnly" type="boolean" default="false"/>
        <Column name="CoastalOnly" type="boolean" default="false"/>
        <Column name="RiverOnly" type="boolean" default="false"/>
        <Column name="RequiresWar" type="boolean" default="false"/>
        <Column name="RequiresWarMinor" type="boolean" default="false"/>
        <Column name="RequiresResistance" type="boolean" default="false"/>
        <Column name="RequiresWLTKD" type="boolean" default="false"/>
        <Column name="RequiresOccupied" type="boolean" default="false"/>
        <Column name="RequiresRazing" type="boolean" default="false"/>
        <Column name="HasAnyReligion" type="boolean" default="false"/>
        <Column name="RequiresPuppet" type="boolean" default="false"/>
        <Column name="HasMetAMajorCiv" type="boolean" default="false"/>
        <!-- Looks for official (i.e. founded/holy city owned) religion, not majority! -->
        <Column name="CityHasPlayerReligion" type="boolean" default="false"/>
        <Column name="CityLacksPlayerReligion" type="boolean" default="false"/>
        <!-- Looks for majority religion, not official (i.e. founded/holy city owned)! -->
        <Column name="CityHasPlayerMajorityReligion" type="boolean" default="false"/>
        <Column name="CityLacksPlayerMajorityReligion" type="boolean" default="false"/>
        <!-- C4DF Only -->
        <Column name="IsVassalOfSomeone" type="boolean" default="false"/>
        <Column name="IsMasterOfSomeone" type="boolean" default="false"/>
        <!-- Checks if city majority is a Pantheon -->
        <Column name="RequiresPantheon" type="boolean" default="false"/>
        <!-- Looks for negative gold or negative GPT, respectively. -->
        <Column name="InDebt" type="boolean" default="false"/>
        <Column name="LosingMoney" type="boolean" default="false"/>
        <!-- Checks if empire is unhappy -->
        <Column name="IsUnhappy" type="boolean" default="false"/>
        <Column name="IsSuperUnhappy" type="boolean" default="false"/>
        <Column name="RequiresNearbyNaturalWonder" type="boolean" default="false"/>
        <Column name="RequiresNearbyMountain" type="boolean" default="false"/>
        <!-- Allows the event to fire as a random event for a spy. City Choice Effects AFFECT CITY SPY IS IN. Uses a special table for getting event data, see below -->
        <Column name="IsEspionage" type="boolean" default="false"/>
        <!-- Espionage Setup Event for Spy Event Filter. Only need one per database, please.-->
        <Column name="EspionageSetup" type="boolean" default="false"/>
        <!-- Espionage Setup Event for Counterspy Spy Event Filter. Only need one per database, please.-->
        <Column name="IsCounterSpy" type="boolean" default="false"/>
    </Table>
    
    <!-- Filter -->
    
    <!-- Note: this only checks local yields (Food and Production). -->
    <Table name="CityEvent_MinimumStartYield">
        <Column name="CityEventType" type="text" reference="CityEvents(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>

    <!-- This is the linker table for connecting events to one another. MAKE SURE THAT THIS TABLE APPEARS AFTER ALL EVENTS/CHOICES INCLUDED IN IT. You can have multiple of rows of these with the same event type to make specific events that need a specific setup to function (a la parent events above)-->
    <Table name="CityEvent_EventLinks">
        <!-- This is the parent. This is the event/choice that will or will not fire based on your data below. -->
        <Column name="CityEventType" type="text" reference="CityEvents(Type)"/>
        <!-- These four elements: set the event/event choice/city event/city event choice you want to link this event to.
            You can add elements to each of these so that an event requires another event, event choice, city event, AND a city event choice if you want.
            You'll notice one has the word 'linker' after it - this is to distinguish this event/choice from the event/choice defined above (i.e. the parent)
        -->
        <Column name="Event" type="text" reference="Events(Type)"/>
        <Column name="EventChoice" type="text" reference="EventChoices(Type)"/>
        <Column name="CityEventLinker" type="text" reference="CityEvents(Type)"/>
        <Column name="CityEventChoice" type="text" reference="CityEventChoices(Type)"/>
        <!-- This makes the event link span all known players and all known player cities looking for the four elements above. Be sparing with this, can be expensive! -->
        <Column name="CheckKnownPlayers" type="boolean" default="false"/>
        <!-- This looks only at the event city. Only works if you have a CityEvent or CityEventChoice defined above. Also does not work with CheckKnownPlayers-->
        <Column name="CheckOnlyEventCity" type="boolean" default="false"/>
        <!-- Defaults to TRUE, meaning that any event/choice defined above must be active for the event to fire. Setting it to false makes it so that any event/choice defined above that is NOT active is the trigger.
        Think of this as a boolean switch - if the state of the event(s) above are hoped to be inactive, make this false. If you want it active, leave it true.
        -->
        <Column name="CheckForActive" type="boolean" default="true"/>
    </Table>
    
    <Table name="CityEventChoices">
        <!-- You can make as many choices as you want - the window show expand (with a scroll bar) to acommodate them. But be reasonable! :) -->
        <!-- Note - if NOT a multiple-choice event, only make one of these! -->
        <Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
        <Column name="Type" type="text" notnull="true" unique="true"/>
        <Column name="Description" type="text" reference="Language_en_US(Tag)"/>
        <!-- Help is used for Tooltips, Description for button text -->
        <Column name="Help" type="text" reference="Language_en_US(Tag)"/>
        <!-- DisabledTooltip is used for Tooltips for choices that are not active but appear in choice list.
        The DLL automatically explains to players WHY an event choice is unavailable, however you can use it you want to override the DLL. -->
        <Column name="DisabledTooltip" type="text" reference="Language_en_US(Tag)"/>
        <!-- Audio for when event popup activates . -->
        <Column name="EventChoiceAudio" type="text" default="AS2D_EVENT_CHOICE"/>
        <!-- If set to true, this city event choice can only be chosen once, ever, by the city -->
        <Column name="IsOneShot" type="boolean" default="false"/>
        <!-- Defaults to 30. Set a different duration if the expiration timer matters. Otherwise, leave it at 30, as it is used by the Recent Events overview. -->
        <Column name="EventDuration" type="integer" default="30"/>
        <!-- Event Chance: Higher value = higher chance of success. Notification will spawn if an event fails. Default is always successful. -->
        <Column name="EventChance" type="integer" default="0"/>
        <!-- Era Scaling: boosts yield value on instant yield, GP Points, and yield costs tables (See below) based on Era. -->
        <Column name="EraScaling" type="boolean" default="false"/>
        <!-- Expires: set to true if you want policies/buildings/promotions/resources granted to disappear after the duration. -->
        <Column name="Expires" type="boolean" default="false"/>
        
        <!-- VARIABLES
        
        Attributes granted by City Event Choices
        
        -->
        
        <!-- Appplies chosen player event - useful for espionage. Note: due to coding, if you use this AND IsSpyBenefit, the player-level event will apply to spy owner but not the city event. This lets you give the spy owner a bonus and penalize the city owner in the same event-->
        <Column name="TriggerPlayerEventChoice" type="text" reference="EventChoices(Type)" default="NULL"/>

        <!-- Only affects local city. Destroys or adds a building type. -->
        <Column name="EventBuildingClassDestruction" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <Column name="EventBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <!-- Checks all buildings in city for destruction. Mass disaster event. Integer is % chance of destruction. Note that this and CityEventChoice_BuildingClassDestructionChance use the same function, and the higher chance % trumps. -->
        <Column name="CityWideBuildingDestructionChance" type="integer" default="0"/>
        <!-- Local WLTKD Turns -->
        <Column name="WLTKDTurns" type="integer" default="0"/>
        <!-- Local Growth Mod %-->
        <Column name="GrowthMod" type="integer" default="0"/>
        <!-- Local Resistance Turns -->
        <Column name="ResistanceTurns" type="integer" default="0"/>
        <!-- Local Happiness Boost. Can be set to expire. -->
        <Column name="CityHappiness" type="integer" default="0"/>
        <!-- Pillage x number of SR around city. Resource chosen is random, but will be strategic. -->
        <Column name="PillageCityStrategicNum" type="integer" default="0"/>

        <!-- Chance of destruction for all buildings in city - use as a baseline for horrible disasters, etc. -->
        <!-- Spawns X number of barbs near the City. Unit type scales with player tech. -->
        <Column name="RandomBarbarianSpawn" type="integer" default="0"/>
        <!-- Spawns X number of owned units near the City. Unit type scales with player tech. -->
        <Column name="FreeUnitsTechAppropriate" type="integer" default="0"/>
        <!-- Grants all units created by this city while this is active a promotion. Only affects valid units. -->
        <Column name="EventPromotion" type="text" reference="UnitPromotions(Type)" default="NULL"/>
        <!-- Converts City to Player Official (i.e. founded/holy city owned) Religion by x%.-->
        <Column name="ConvertToPlayerReligionPercent" type="integer" default="0"/>
        <!-- Converts City to Player Majority Religion by x% (can be official religion, but not necessarily so).-->
        <Column name="ConvertToPlayerMajorityReligionPercent" type="integer" default="0"/>

        <!-- Associates a Choice with an espionage outcome. Only used with Espionage actions. False means spy stuff won't trigger in post-event figuring. -->
        <Column name="IsEspionageEffect" type="boolean" default="false"/>
        <!-- Set to true for any mission that's part of the 'setup' phase for a Spy -->
        <Column name="MissionSetup" type="boolean" default="false"/>
        <!-- Effect applies to spy owner capital instead! Note: if you use  -->
        <Column name="IsSpyBenefit" type="boolean" default="false"/>
        <!-- Bonus and/or cost etc. scale based on the potential of the city - higher potential = slower, but more reward! -->
        <Column name="PotentialScaling" type="boolean" default="false"/>
        <!-- Bonus and/or cost etc. scale based on the difference in techs with target player! Scales the potential value by a % amount-->
        <Column name="ScienceScaling" type="integer" default="0"/>
        <!-- Modifier to chance to be identified on a spy mission-->
        <Column name="IDModifier" type="integer" default="0"/>
        <!-- Modifier to chance to be killed on a spy mission-->
        <Column name="DeathModifier" type="integer" default="0"/>
        <!-- Minimum Spy Level -->
        <Column name="SpyLevelRequired" type="integer" default="0"/>
        <Column name="RequiresCounterSpy" type="boolean" default="false"/>
        <Column name="ExpiresOnCounterSpyExit" type="boolean" default="false"/>
        <!-- Affects duration of mission -->
        <Column name="EspionageDifficultyMod" type="integer" default="0"/>
        <!-- Damages city -->
        <Column name="DamageCity" type="integer" default="0"/>
        <!-- Damages garrison unit -->
        <Column name="DamageGarrison" type="integer" default="0"/>
        <!-- Prevents city healing for x turns -->
        <Column name="SapCityTurns" type="integer" default="0"/>
        <!-- Speeds up an espionage action if the city has a wonder under construction! -->
        <Column name="WonderConstructionSpeedMod" type="integer" default="0"/>
        <!-- Counterspy can affect city ranged strength %-->
        <Column name="CityDefenseModifier" type="integer" default="0"/>
        <!-- Increases spy city vision -->
        <Column name="SpyVisionRange" type="integer" default="0"/>
        <!-- Spies won't level up from this mission. -->
        <Column name="NoLevelUp" type="boolean" default="false"/>
        <!-- Mission ignores other local spies. -->
        <Column name="IgnoreLocalForeignSpies" type="boolean" default="false"/>

        <!-- Spy copies num techs; if it fails at end, it converts amount to GA turns -->
        <Column name="StealNumTechs" type="integer" default="0"/>
        <!-- Spy copies num GWs; if it fails at end, it converts amount to GA turns-->
        <Column name="ForgeNumGW" type="integer" default="0"/>
        <!-- FILTERS:
        
        Values below determine whether or not a City Event Choice appears in the City list
        
        -->
        
        <Column name="MinimumCityPopulation" type="integer" default="0"/>
        <Column name="MaximumCityPopulation" type="integer" default="0"/>
        <Column name="RequiredCiv" type="text" reference="Civilizations(Type)" default="NULL"/>
        <Column name="RequiredEra" type="text" reference="Eras(Type)" default="NULL"/>
        <!-- Note: obsoletes at this era, not after it -->
        <Column name="ObsoleteEra" type="text" reference="Eras(Type)" default="NULL"/>
        <!-- Only Checks for local Improvements worked by City. -->
        <Column name="ImprovementRequired" type="text" reference="Improvements(Type)" default="NULL"/>
        <!-- Checks for nearby features/terrain. Can use natural wonders for features. -->
        <Column name="NearbyFeature" type="text" reference="Features(Type)" default="NULL"/>
        <Column name="NearbyTerrain" type="text" reference="Terrains(Type)" default="NULL"/>
        <Column name="RequiredPolicy" type="text" reference="Policies(Type)" default="NULL"/>
        <Column name="RequiredIdeology" type="text" reference="PolicyBranchTypes(Type)" default="NULL"/>
        <Column name="LocalResourceRequired" type="text" reference="Resources(Type)" default="NULL"/>
        <Column name="PrereqTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <Column name="ObsoleteTech" type="text" reference="Technologies(Type)" default="NULL"/>
        <!-- Only Checks for local status. -->
        <Column name="RequiredReligion" type="text" reference="Religions(Type)" default="NULL"/>
        <!-- JFD Check - local only -->
        <Column name="RequiredStateReligion" type="text" reference="Religions(Type)" default="NULL"/>
        <Column name="RequiresAnyStateReligion" type="boolean" default="false"/>
        <!-- Only Checks for local Buildings in City. -->
        <Column name="RequiredBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <Column name="CannotHaveBuildingClass" type="text" reference="BuildingClasses(Type)" default="NULL"/>
        <!-- C4DF Only -->
        <Column name="IsVassalOfSomeone" type="boolean" default="false"/>
        <Column name="IsMasterOfSomeone" type="boolean" default="false"/>
        <!-- Only Checks for local status. -->
        <!-- Looks for official (i.e. founded/holy city owned) religion, not majority! -->
        <Column name="CityHasPlayerReligion" type="boolean" default="false"/>
        <Column name="CityLacksPlayerReligion" type="boolean" default="false"/>
        <!-- Looks for majority religion, not official (i.e. founded/holy city owned)! -->
        <Column name="CityHasPlayerMajorityReligion" type="boolean" default="false"/>
        <Column name="CityLacksPlayerMajorityReligion" type="boolean" default="false"/>
        <Column name="HasTradeConnection" type="boolean" default="false"/>
        <Column name="HasCityConnection" type="boolean" default="false"/>
        <Column name="RequiresGarrison" type="boolean" default="false"/>
        <Column name="RequiresHolyCity" type="boolean" default="false"/>
        <Column name="RequiresIdeology" type="boolean" default="false"/>
        <Column name="CapitalOnly" type="boolean" default="false"/>
        <Column name="CoastalOnly" type="boolean" default="false"/>
        <Column name="RiverOnly" type="boolean" default="false"/>
        <Column name="RequiresWar" type="boolean" default="false"/>
        <Column name="RequiresWarMinor" type="boolean" default="false"/>
        <Column name="RequiresResistance" type="boolean" default="false"/>
        <Column name="RequiresWLTKD" type="boolean" default="false"/>
        <Column name="RequiresOccupied" type="boolean" default="false"/>
        <Column name="RequiresRazing" type="boolean" default="false"/>
        <Column name="HasAnyReligion" type="boolean" default="false"/>
        <Column name="RequiresPuppet" type="boolean" default="false"/>
        <Column name="HasMetAMajorCiv" type="boolean" default="false"/>
        <!-- Checks if city majority is a Pantheon -->
        <Column name="RequiresPantheon" type="boolean" default="false"/>
        <!-- Looks for negative gold or negative GPT, respectively. -->
        <Column name="InDebt" type="boolean" default="false"/>
        <Column name="LosingMoney" type="boolean" default="false"/>
        <!-- Checks if empire is unhappy -->
        <Column name="IsUnhappy" type="boolean" default="false"/>
        <Column name="IsSuperUnhappy" type="boolean" default="false"/>
        <Column name="RequiresNearbyNaturalWonder" type="boolean" default="false"/>
        <Column name="RequiresNearbyMountain" type="boolean" default="false"/>
    </Table>
    <!-- Parent Event is essential - this table assigns choices to events. Make sure the CityEventType matches the name of an CityEventType from above! Must be BELOW the above tables. -->
    <Table name="CityEvent_ParentEvents">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="CityEventType" type="text" reference="CityEvents(Type)"/>
    </Table>
    <!-- Note: This table fires BEFORE an event is checked to see if it succeeds. Use this to have an event that costs something, but may not actually succeed. -->
    <!-- Use positive values here to make it a 'cost' -->
    <Table name="CityEventChoice_EventCostYield">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- The tables below fire AFTER an event has been found to succeed. Can use negative values here. -->
    <Table name="CityEventChoice_InstantYield">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- Grants this city a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. Can scale with era. -->
    <Table name="CityEventChoice_CityYield">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- Grants this city's buildings of a class (existing and future) a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. -->
    <Table name="CityEventChoice_BuildingClassYieldChange">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants this city's buildings of a class (existing and future) a certain X yield modifier. Can be turned off via the 'expires' tag and a set duration. -->
    <Table name="CityEventChoice_BuildingClassYieldModifier">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Modifier" type="integer"/>
    </Table>
    <!-- Grants player a free resource. Can be set to expire. -->
    <Table name="CityEventChoice_ResourceQuantity">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="ResourceType" type="text" reference="Resources(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    <!-- Grants this city's features of a type a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. -->
    <Table name="CityEventChoice_FeatureYieldChange">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="FeatureType" type="text" reference="Features(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants this city's improvements of a type a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. -->
    <Table name="CityEventChoice_ImprovementYieldChange">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants this city's resources of a type a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. -->
    <Table name="CityEventChoice_ResourceYieldChange">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="ResourceType" type="text" reference="Resources(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants this city's terrains of a type a certain X yield per turn. Can be turned off via the 'expires' tag and a set duration. -->
    <Table name="CityEventChoice_TerrainYieldChange">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="TerrainType" type="text" reference="Terrains(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Grants this city's specialists of a type a certain bonus X yield. Can be turned off via the 'expires' tag and a set duration. -->
    <Table name="CityEventChoice_SpecialistYieldChange">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="SpecialistType" type="text" reference="Specialists(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="YieldChange" type="integer"/>
    </Table>
    <!-- Note: make sure that the specialist you use here can make a Great Person! Can use negative values here if you want. -->
    <Table name="CityEventChoice_GreatPersonPoints">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="SpecialistType" type="text" reference="Specialists(Type)"/>
        <Column name="Points" type="integer"/>
    </Table>
    <!-- Note: Pillages up to the number indicated. Is random. Useful for storms, etc. -->
    <Table name="CityEventChoice_ImprovementDestructionRandom">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
        <Column name="Number" type="integer"/>
    </Table>
    <!-- Note: Chance indicates % chance of a building being destroyed in the City by an event. Useful for disasters, or if you want to give the player some control over a destruction event's outcome. -->
    <Table name="CityEventChoice_BuildingClassDestructionChance">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
        <Column name="Chance" type="integer"/>
    </Table>
    <!-- Note: Destroys up to the number indicated. Is random. Useful for storms, etc. -->
    <Table name="CityEventChoice_FreeUnitClasses">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="UnitClassType" type="text" reference="UnitClasses(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    <!-- Creates specific unit type in the City -->
    <Table name="CityEventChoice_FreeUnits">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="UnitType" type="text" reference="Units(Type)"/>
        <Column name="Quantity" type="integer"/>
    </Table>
    <!-- Convert Set Pop/Percent Pop to Religion-->
    <Table name="CityEventChoice_ConvertNumPopToReligion">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="ReligionType" type="text" reference="Religions(Type)"/>
        <Column name="Population" type="integer"/>
    </Table>
    <Table name="CityEventChoice_ConvertPercentPopToReligion">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="ReligionType" type="text" reference="Religions(Type)"/>
        <Column name="Percent" type="integer"/>
    </Table>
    <!-- Unhappiness Modifier for CBP Happiness system.
        Yield match: YIELD_GOLD = Poverty, YIELD_SCIENCE = Illiteracy, YIELD_PRODUCTION = Safety, YIELD_CULTURE = illiteracy, YIELD_FAITH = Religious Minorities
        Note that negative values reduce needs, while positive values increase them!
    -->
    <Table name="CityEventChoice_CityUnhappinessNeedMod">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    <!-- Filters -->
    
    <!-- Checks local yields as well (Food and Production). -->
    <Table name="CityEventChoice_MinimumStartYield">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="YieldType" type="text" reference="Yields(Type)"/>
        <Column name="Yield" type="integer"/>
    </Table>
    
    <!-- AI Stuff -->
    
    <!-- Note: if you don't set flavors for your choices, the AI will make a random choice (or will only choose from those with flavors). -->
    <Table name="CityEventChoiceFlavors">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="FlavorType" type="text" reference="Flavors(Type)"/>
        <Column name="Flavor" type="integer"/>
    </Table>

    <!-- This is the linker table for connecting events to one another. MAKE SURE THAT THIS TABLE APPEARS AFTER ALL EVENTS/CHOICES INCLUDED IN IT. You can have multiple of rows of these with the same event type to make specific events that need a specific setup to function (a la parent events above)-->
    <Table name="CityEventChoice_EventLinks">
        <!-- This is the parent. This is the event/choice that will or will not fire based on your data below. -->
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <!-- These four elements: set the event/event choice/city event/city event choice you want to link this event to.
            You can add elements to each of these so that an event requires another event, event choice, city event, AND a city event choice if you want.
            You'll notice one has the word 'linker' after it - this is to distinguish this event/choice from the event/choice defined above (i.e. the parent)
        -->
        <Column name="Event" type="text" reference="Events(Type)"/>
        <Column name="EventChoice" type="text" reference="EventChoices(Type)"/>
        <Column name="CityEvent" type="text" reference="CityEvents(Type)"/>
        <Column name="CityEventChoiceLinker" type="text" reference="CityEventChoices(Type)"/>
        <!-- This makes the event link span all known players and all known player cities looking for the four elements above. Be sparing with this, can be expensive! -->
        <Column name="CheckKnownPlayers" type="boolean" default="false"/>
        <!-- This looks only at the event city. Only works if you have a CityEvent or CityEventChoice defined above. Also does not work with CheckKnownPlayers-->
        <Column name="CheckOnlyEventCity" type="boolean" default="false"/>
        <!-- Defaults to TRUE, meaning that any event/choice defined above must be active for the event to fire. Setting it to false makes it so that any event/choice defined above that is NOT active is the trigger.
        Think of this as a boolean switch - if the state of the event(s) above are hoped to be inactive, make this false. If you want it active, leave it true.
        -->
        <Column name="CheckForActive" type="boolean" default="true"/>
    </Table>
    
    <!-- Notifications -->
    
    <!-- Note: this table is not required, however if you want to seed a notification to the player (or to all known players in the world) you need to use this -->
    <!-- Make sure that NotificationType corresponds to a real NotificationType! -->
    <!-- Also, note that player notifications seeds the following values:
        {1_CivShortDescription}
        {2_CityName}
        {3_CivDescription}
        {4_PlayerName}
        {5_EventChoiceHelpText}
        You can use any or all of these.
     -->
    <Table name="CityEventChoice_Notification">
        <Column name="CityEventChoiceType" type="text" reference="CityEventChoices(Type)"/>
        <Column name="NotificationType" type="text"/>
        <Column name="Description" type="text" reference="Language_en_US(Tag)"/>
        <Column name="ShortDescription" type="text" reference="Language_en_US(Tag)"/>
        <Column name="IsWorldEvent" type="boolean" default="false"/>
        <Column name="EspionageEvent" type="boolean" default="false"/>
        <!-- Grabs the coordinates for the city where the event fires - if left false, it returns -1/-1, so the camera won't move if the button is selected. -->
        <Column name="NeedCityCoordinates" type="boolean" default="false"/>
        <!-- Note that if you set NeedPlayerID to true, it takes over the slot where ExtraVariable goes, so ExtraVariable is inactive! -->
        <Column name="NeedPlayerID" type="boolean" default="false"/>
        <Column name="ExtraVariable" type="int" default="-1"/>
    </Table>
    
    <Table name="EventClassTypes">
        <Column name="ID" type="integer" primarykey="true" autoincrement="true" />
        <Column name="Type" type="text" notnull="true" unique="true" />
    </Table>

    <!-- Table data -->
    <EventClassTypes>
        <Row>
            <ID>0</ID>
            <Type>EVENT_CLASS_GOOD</Type>
        </Row>
        <Row>
            <Type>EVENT_CLASS_NEUTRAL</Type>
        </Row>
        <Row>
            <Type>EVENT_CLASS_BAD</Type>
        </Row>
        <Row>
            <Type>EVENT_CLASS_TRADE</Type>
        </Row>
        <Row>
            <Type>EVENT_CLASS_CIV_SPECIFIC</Type>
        </Row>
    </EventClassTypes>
    <Audio_Sounds>
        <Row>
            <SoundID>SND_EVENT_CHOICE</SoundID>
            <Filename>EventChoice</Filename>
            <LoadType>DynamicResident</LoadType>
        </Row>
    </Audio_Sounds>
    <Audio_2DSounds>
        <Row>
            <ScriptID>AS2D_EVENT_CHOICE</ScriptID>
            <SoundID>SND_EVENT_CHOICE</SoundID>
            <SoundType>GAME_SFX</SoundType>
            <DontTriggerDuplicates>1</DontTriggerDuplicates>
            <DontPlayMoreThan>1</DontPlayMoreThan>
            <TaperSoundtrackVolume>-1.0</TaperSoundtrackVolume>
            <MinVolume>100</MinVolume>
            <MaxVolume>100</MaxVolume>
        </Row>
    </Audio_2DSounds>
</GameData>

<!-- ESPIONAGE TEXT FORMAT FOR DESCRIPTIONS
These values allow you to have spy names, city names, risk of death, etc. as values in your description for the event. Purely flavor.
    {1_SpyRank}
    {2_SpyName}
    {3_CityName}
    {4_ChanceToDie}
    {5_ChanceToBeIdentified} -->
 
Back
Top Bottom