-
Notifications
You must be signed in to change notification settings - Fork 160
GameEvents
inkyant edited this page Nov 27, 2021
·
20 revisions
Category | Return | Event (parameters) | Description |
---|---|---|---|
Value | TechType | AiOverrideChooseNextTech(PlayerID iPlayer, bool bFreeTech) | Sent to allow Lua to override the AI's choice of tech. bFreeTech = true to override the choice of free tech. |
Value | int | AiFlatApproachChange(PlayerID iPlayer, ApproachType iApproach) | Sent to allow lua to add to the AI's approach by a flat amount. For iApproach, WAR=0, HOSTILE, DECEPTIVE, GUARDED, AFRAID, NEUTRAL, FRIENDLY=6 |
Value | int | AiPercentApproachMod(PlayerID iPlayer, ApproachType iApproach) | Sent to allow lua to modify the AI's approach by a percent modifier. Return 0 for no modifier, 100 for +100% (double), etc. For iApproach, WAR=0, HOSTILE, DECEPTIVE, GUARDED, AFRAID, NEUTRAL, FRIENDLY=6. |
TestAll | bool | AreaCanHaveAnyResource(PlayerID iPlayer, AreaID iArea) | Sent to ascertain if an area can have civ specific resources. Return false to prevent the area from having civ specific resources. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
TestAll | bool | BarbariansCanFoundCamp(int iPlotX, int iPlotY) | Sent when checking if a plot is a valid location to create a barbarian camp. Return false to make the check invalid. |
Hook | BarbariansCampFounded(int iPlotX, int iPlotY) | A barbarian camp has been founded. | |
Hook | BarbariansCampCleared(int iPlotX, int iPlotY) | A barbarian camp has been cleared. | |
TestAll | bool | BarbariansCampCanSpawnUnit(int iPlotX, int iPlotY) | Sent when checking if a barbarian camp can spawn units. Return false to prevent the camp at the plot from spawning units. |
Value | UnitType | BarbariansCampGetSpawnUnit(int iPlotX, int iPlotY) | Called when determining what unit to spawn for a barbarian camp. Return a unit type ID to force a unit type to be spawned. |
Hook | BarbariansSpawnedUnit(int iPlotX, int iPlotY, UnitType iUnitType) | A barbarian camp has spawned a unit. | |
Value | int | BattleDamageDelta(int iRole, int iBaseDamage) | Sent when battle damage is being calculated. Allows the modder to increase or decrease the amount of damage dealt. For iRole, 0 = attacker, 1 = defender, 2 = interceptor. |
Hook | BattleFinished() | ||
Hook | BattleJoined(PlayerID iOwner, UnitID/CityID iUnitOrCity, int iRole, bool bIsCity) | A unit or city has joined a battle. For iRole, 0 = attacker, 1 = defender, 2 = interceptor. | |
Hook | BattleStarted(int iType, int iPlotX, int iPlotY) | A battle has started. For iType, 0 = melee, 1 = ranged, 2 = air, 3 = sweep, 4 = paradrop, 5 = nuke. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
TestAny | bool | CanAirliftFrom(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY) | Sent when checking if a unit can airlift from a certain plot. iPlayer is the unit owner. Return true to enable airlifting from the plot. |
TestAny | bool | CanAirliftTo(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY) | Sent when checking if a unit can airlift to a certain plot. iPlayer is the unit owner. Return true to enable airlifting to the plot. |
TestAll | bool | CanDoCommand(PlayerID iUnitOwner, UnitID iUnit, int iCommand, int iData1, int iData2, int iPlotX, int iPlotY, bool bTestVisible) | Sent when checking if a unit can perform a command. For iCommand, 0 = promotion, 1 = upgrade, 2 = automate, 3 = wake, 4 = cancel, 5 = cancel all, 6 = stop automation, 7 = delete, 8 = gift, 9 = hotkey. iData1 and iData2 changes depending on the type of command. Return false to disable the command. |
TestAll | bool | CanHaveAnyUpgrade(PlayerID iUnitOwner, UnitID iUnit) | Checking if a unit can be upgraded. Return false to disable upgrading. Deprecated, use UnitCanHaveAnyUpgrade. |
TestAll | bool | CanHavePromotion(PlayerID iUnitOwner, UnitID iUnit, PromotionType iPromotion) | Checking if a unit can have a specific promotion. Return false to disable the promotion for the unit. Deprecated, use UnitCanHavePromotion. |
TestAll | bool | CanHaveUpgrade(PlayerID iUnitOwner, UnitID iUnit, UnitClassType iUnitClassType, UnitType iUnitType) | Checking if the unit can be upgraded to the specified unit class type and unit type. Return false to disable. Deprecated, use UnitCanHaveUpgrade. |
TestAny | bool | CanLoadAt(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY) | Sent to ascertain if a unit can be loaded at a certain plot. Load is a discontinued logic for loading units into transports, that may be enabled by mods in the future. Use CanRebaseTo instead. |
TestAll | bool | CanMoveInto(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY, bool bAttack, bool bDeclareWar) | Sent to ascertain if a player's unit can move into a given plot. Return false to stop the unit from moving into the plot. VERY, VERY CPU INTENSIVE!!! |
TestAll | bool | CannotParadropFrom(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY) | Return true to prevent a unit from paradropping from a plot which is normally allowed. |
TestAny | bool | CanParadropFrom(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY) | Return true to allow a unit to paradrop from a plot which is normally not allowed. |
TestAll | bool | CanRazeOverride(PlayerID iPlayer, CityID iCity) | Checking if a player is allowed to raze a city. Return true to force allow. |
TestAny | bool | CanRebaseInCity(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY) | Event when checking if a unit can rebase to a city. Return true to allow a unit to rebase to a city it normally cannot. |
TestAny | bool | CanRebaseTo(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY, bool bIsCity) | Event when checking if a unit can rebase to a plot. A more general version of CanRebaseInCity. Return true to allow a unit to rebase to a plot it normally cannot. |
Hook | CapitalChanged(PlayerID iPlayer, CityID iNewCapital, CityID iOldCapital) | ||
Hook | CircumnavigatedGlobe(TeamID iTeam) | Called when someone first circumnavigates the globe. | |
Hook | CityBeginsWLTKD(PlayerID iCityOwner, int iPlotX, int iPlotY, int iChange) | A city has began celebrating 'We Love The King Day'. iChange is the change in number of turns. | |
Hook | CityBoughtPlot(PlayerID iCityOwner, CityID iCity, int iPlotX, int iPlotY, bool bGold, bool bCulture) | Event sent when a city acquires a plot. Contrary to what the name suggests, includes both bought plots and plots acquired due to culture. | |
TestAll | bool | CityCanAcquirePlot(PlayerID iCityOwner, CityID iCity, int iPlotX, int iPlotY) | Event for checking if a city can acquire a plot, whether using gold or culture. Return false to make this plot unobtainable by the city. |
TestAny | bool | CityCanAirlift(PlayerID iCityOnwer, CityID iCity) | Event when checking if a city can be used to airlift to or from. Return true to force allow cities for airlift. |
TestAny | bool | CityConnected(PlayerID iCityOwner, int iCityX, int iCityY, int iToCityX, int iToCityY, bool bDomestic) | Event to determine if city is connected by an alternate (Lua based) route. bDomestric is true for direct (land connection), false for indirect (sea connection). Return true to connect the two cities (requires the CityConnections event with return true to work). |
TestAny | bool | CityConnections(PlayerID iCityOwner, bool bDomestic) | Event to determine if we support alternative (Lua based) route types. bDomestric is true for direct (land connection), false for indirect (sea connection). Return true to enable the CityConnected event. |
Hook | CityConstructed(PlayerID iCityOwner, CityID iCity, BuildingType iBuilding, bool bGold, bool bFaith) | Event when a city has constructed a building. bGold for gold purchased (gold invest does not count), bFaith for faith purchase. | |
Hook | CityCreated(PlayerID iCityOwner, CityID iCity, ProjectType iProject, bool bGold, bool bFaith) | Event when a city has created a project. bGold for gold purchased (gold invest does not count), bFaith for faith purchase. | |
Hook | CityEndsWLTKD(PlayerID iCityOwner, int iPlotX, int iPlotY, 0) | A city has stopped celebrating 'We Love The King Day'. the last parameter is always a 0. | |
Hook | CityEventActivated(PlayerID iCityOwner, CityID iCity, CityEventType iCityEvent) | A city event has been activated. | |
TestAll | bool | CityEventCanActivate(PlayerID iCityOwner, CityID iCity, CityEventType iCityEvent) | Checking if a city event is valid. Return false to prevent the city event from activating. |
TestAll | bool | CityEventCanTake(PlayerID iCityOwner, CityID iCity, CityEventType iCityEvent) | Checking if the game should check if the city event is valid. Return false the city event from being checked. In effect similar as CityEventCanActivate, but the game exits checking faster. However, does not decrement cooldown timers. |
Hook | CityEventChoiceActivated(PlayerID iCityOwner, CityID iCity, CityEventChoiceType iEventChoice) | A player has selected a city event choice. | |
TestAll | bool | CityEventChoiceCanTake(PlayerID iCityOwner, CityID iCity, CityEventChoiceType iEventChoice) | Checking if a player can choose a city event choice. Return false to forbid. |
Hook | CityEventChoiceEnded(PlayerID iCityOwner, CityID iCity, CityEventChoiceType iEventChoice) | A city event choice has ended. | |
Value | int | CityFlipChance(CityID iCity, PlayerID iPlayer) | Determining which city is the next to revolt for the player. Return a value to modify the likelihood for a city. |
Hook | CityFlipped(City pCity, PlayerID iRecipientPlayer, PlayerID iPreviousOwner) | A city has revolted and changed owners. | |
Value | int | CityFlipRecipientChance(CityID iCity, PlayerID iCityOwner, PlayerID iRecipientPlayer) | Calculating the chance of each player receiving a revolting city. Return a value to modify the chance for a player. |
Hook | CityInvestedBuilding(PlayerID iCityOwner, CityID iCity, BuildingClassType iBuildingClass, true) | A city has invested in a building. The last parameter is always true. | |
Hook | CityInvestedUnit(PlayerID iCityOwner, CityID iCity, UnitClassType iUnitClass, true) | A city has invested in a unit. The last parameter is always true. | |
Hook | CityPrepared(PlayerID iCityOwner, CityID iCity, SpecialistType iSpecialist, int iChange, int iThreshold) | Event when a city gains great person points each turn (so does not include points from external sources). iChange is the amount gained that turn, iThreshold is the total amount of points needed for the next great person to spawn. | |
Hook | CityRazed(PlayerID iCityOwner, int iPlotX, int iPlotY) | A city has been completely razed. | |
Hook | CitySoldBuilding(PlayerID iCityOwner, CityID iCity, BuildingType iBuilding) | Event when a city sells a building. | |
Hook | CityTrained(PlayerID iCityOwner, CityID iCity, UnitType iUnit, bool bGold, bool bFaith) | Event when a city has trained a unit. bGold for gold purchased (gold invest does not count), bFaith for faith purchase. | |
Hook | CityProjectComplete(PlayerID iCityOwner, CityID iCity, ProjectType iProject) | Event when a project is created. Essentially the same as the CityCreated event but with less options (this event happens immediately before CityCreated). Use that one instead. | |
TestAll | bool | ConquerorValidBuilding(PlayerID iCityOwner, CityID iCity, PlayerID iPlayer, BuildingType iBuilding) | Checking if a building is valid to be kept after iPlayer conquers a city. Return false to forbid. |
Hook | ContractEnded(PlayerID iPlayer, ContractType iContract) | Event for JFDLC. A contract has ended. | |
Hook | ContractsRefreshed() | Event for JFDLC. Game has updated all contracts in the current game. | |
Hook | ContractStarted(PlayerID iPlayer, ContractType iContract, int iTurns, int iMaintenance) | Event for JFDLC. A contract has been started. | |
TestAny | bool | CustomMissionCompleted(PlayerID iUnitOwner, UnitID iUnit, int iMission, int iData1, int iData2, int iFlags, int iTurn) | |
Value | int | CustomMissionCameraTime(PlayerID iUnitOwner, UnitID iUnit, int iMission, int iData1, int iData2, int iFlags, int iTurn) | Return 0, 1, 5, or 10. |
Value | int | CustomMissionDoStep(PlayerID iUnitOwner, UnitID iUnit, int iMission, int iData1, int iData2, int iFlags, int iTurn) | Return 0 = no action, 1 = action, 2 = done, 3 = action and done. |
TestAny | bool | CustomMissionPossible(PlayerID iUnitOwner, UnitID iUnit, int iMission, int iData1, int iData2, int iFlags = 0, int iTurn = -1) | Return true to enable the custom mission. |
Value | int | CustomMissionStart(PlayerID iUnitOwner, UnitID iUnit, int iMission, int iData1, int iData2, int iFlags, int iTurn) | Return 1 to start the custom mission. |
Value | int | CustomMissionSetActivity(PlayerID iUnitOwner, UnitID iUnit, int iMission, int iData1, int iData2, int iFlags, int iTurn) | Return 0 = no action, 1 = action, 2 = done, 3 = action and done. |
Value | int | CustomMissionTargetPlot(PlayerID iUnitOwner, UnitID iUnit, int iMission, int iData1, int iData2, int iFlags, int iTurn) | Return the plot index. |
Value | int | CustomMissionTimerInc(PlayerID iUnitOwner, UnitID iUnit, int iMission, int iData1, int iData2, int iFlags, int iTurn) | Return an amount to increment the timer before the next time the mission will be checked. The timer is not in real time, but in passes through the Game Core update loop. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | DeclareWar(PlayerID iOriginatingPlayer, TeamID iTeam, bool bAggressor) | War has been declared. iTeam is the team the originating player is declaring war on. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
TestAll | bool | EspionageCanMoveSpyTo(PlayerID iSpyOwner, PlayerID iCityOwner, CityID iCity) | Event when checking if a spy can move to a city. Return false to prevent the city from being a valid target for the spy. |
TestAll | bool | EspionageCanStageCoup(PlayerID iSpyOwner, PlayerID iCityOwner, CityID iCity) | Event when checking if a spy can stage a coup at the city. Return false to disallow the spy from staging a coup. |
Hook | EspionageResult(PlayerID iSpyOwner, int iSpyIndex, int iSpyResult, int iCityX, int iCityY) | Hook for the result of a spy action. For spy result, 0 = undetected, 1 = detected, 2 = identified, 3 = killed, 4 = eliminated. | |
Hook | ElectionResultSuccess(PlayerID iSpyOwner, int iSpyIndex, int iInfluenceGained, int iCityX, int iCityY) | Event when an election is successfully rigged by a player. City coordinates are of the city state's capital. | |
Hook | ElectionResultFailure(PlayerID iPlayer, int iSpyIndex, int iInfluenceLost, int iCityX, int iCityY) | Event when another player rigged an election. iSpyIndex is -1 if the player does not have a spy in the city state. | |
Hook | EspionageNotificationData(int iCityX, int iCityY, PlayerID iAttackingPlayer, int iDefendingPlayer, int iSpyResult, TechType iStolenTech, BuildingType iSabotagedBuilding, UnitType iSabotagedUnit, bool bUnrest, int iStolenGold, int iStolenScience, bool bRebel, int iStolenGreatWork) | Event after another player's spy action. For spy result, 0 = undetected, 1 = detected, 2 = identified, 3 = killed, 4 = eliminated. | |
Hook | EspionageState(PlayerID iSpyOwner, int iSpyIndex, int iSpyResult, int iCityX, int iCityY) | Event when a spy's state is set. For spy state, 0 = unassigned, 1 = travelling, 2 = surveillance, 3 = gathering intel, 4 = preparing heist, 5 = rigging election, 6 = counter intelligience, 7 = making introductions, 8 = schmoozing, 9 = dead, 10 = terminated. | |
Hook | EventActivated(PlayerID iPlayer, EventType iEvent) | An event has been activated. | |
TestAll | bool | EventCanActivate(PlayerID iPlayer, EventType iEvent) | Checking if an event is valid. Return false to prevent the event from activating. |
TestAll | bool | EventCanTake(PlayerID iPlayer, EventType iEvent) | Checking if the game should check if the event is valid. Return false the event from being checked. In effect similar as EventCanActivate, but the game exits checking faster. However, does not decrement cooldown timers. |
Hook | EventChoiceActivated(PlayerID iPlayer, EventChoiceType iEventChoice) | A player has selected an event choice. | |
TestAll | bool | EventChoiceCanTake(PlayerID iPlayer, EventType iEvent) | Checking if a player can choose an event choice. Return false to forbid. |
Hook | EventChoiceEnded(PlayerID iPlayer, EventChoiceType iEventChoice) | An event choice has ended. | |
Hook | EventUnitCreated(PlayerID iPlayer, EventChoiceType or CityEventChoiceType iEventChoice | A unit has been created due to selecting a certain event choice. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | GameSave() | Event when the game is saved, though doesn't work on first autosave made on turn 0. Use to save/load tables. Needs EVENTS_GAME_SAVE set to 1. | |
Value | int | GetDiploModifier(int iEvent, PlayerID iFromPlayer, PlayerID iToPlayer) | Event when trying to fetch the diplomatic modifier of the AI. Returning a value will add this to the modifier. |
Value | int | GetBombardRange(PlayerID iCityOwner, CityID iCity) | Checking for the city bombard range. Return a number to alter the range. Cannot be greater than MAX_CITY_ATTACK_RANGE as defined in Defines. Put a minus sign before the value to indicate indirect fire not allowed. |
Value | int | GetBeliefToFound(PlayerID iPlayer, ReligionType iReligion) | AI player has founded a religion. Return a religion type to pick a bonus belief for the AI (4th belief, normally only allowed for Byzantium). |
Value | int | GetContractDuration(PlayerID iPlayer, ContractType iContract) | Event for JFDLC. Called when starting a contract. Return a number to set the duration of a contract. |
Value | int | GetContractMaintenance(PlayerID iPlayer, ContractType iContract) | Event for JFDLC. Called when starting a contract. Return a number to set the maintenance cost of a contract. |
Value | int | GetNumContractUnit(ContractType iContract, UnitType iUnitType) | Event for JFDLC. Updating all inactive contracts. Return an integer to set the number of a specific unit type for the contract. |
Value | int | GetReligionToFound(PlayerID iPlayer, ReligionType iPreferredReligion, bool bAlreadyFounded) | Determining the religion that the AI player will found, based on the table Civilization_Religions. bAlreadyFounded will be true if the preferred religion has already been founded. Return a religion type to change the AI player's choice. |
TestAny | bool | GoodyHutCanNotReceive(PlayerID iPlayer, UnitID iUnit, GoodyType iGoody, bool bPick) | Checking if a goody type is valid. bPick is true if the unit picking up the goody hut has a promotion that allows it to pick the bonus type. Return false to prevent the unit from receiving a type of bonus. |
Hook | GoodyHutReceivedBonus(PlayerID iPlayer, UnitID iUnit, GoodyType iGoody, int iPlotX, int iPlotY) | Event when a player receives a bonus from a goody hut. Triggers for bad effects as well. | |
TestAll | bool | GoodyHutCanResearch(PlayerID iPlayer, TechType iTech) | Checking if a technology is a valid bonus for a goody hut. Return false to make a tech invalid. |
Hook | GoodyHutTechResearched(PlayerID iPlayer, TechType iTech) | Player has gained a technology from a goody hut. | |
Hook | GovernmentCooldownChanges(PlayerID iPlayer, int iCooldown) | Hook for JFDLC. iCooldown is after the change. | |
Hook | GovernmentCooldownRateChanges(PlayerID iPlayer, int iRate) | Hook for JFDLC. iRate is before the change. | |
Hook | GreatPersonExpended(PlayerID iPlayer, UnitID iUnit, UnitType iUnitType, int iPlotX, int iPlotY) | A player has expended a great person. | |
Hook | GreatWorkCreated(PlayerID iPlayer, UnitID iUnit, GreatWorkType iGreatWork) | A great work has been created. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | IdeologyAdopted(PlayerID iPlayer, PolicyBranchType iPolicyBranch) | A player has adopted a new ideology. Does not include switching due to revolution. | |
Hook | IdeologySwitched(PlayerID iPlayer, PolicyBranchType iOldPolicyBranch, PolicyBranchType iNewPolicyBranch) | A player has switched ideologies. | |
TestAll | bool | IsAbleToDeclareWar(PlayerID iOriginatingPlayer, TeamID iTeam) | Checking if a player can declare war on a team. Deprecated, use PlayerCanDeclareWar. Return false to forbid. |
TestAll | bool | IsAbleToMakePeace(PlayerID iPlayer, TeamID iTeam) | Checking if a player can make peace with a team. Deprecated, use PlayerCanMakePeace. Return false to forbid. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | LoyaltyStateChanged(PlayerID iPlayer, CityID iCity, int iOldLoyalty, int iNewLoyalty) | Event for JFDLC. A city's loyalty has changed. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | MakePeace(PlayerID iOriginatingPlayer, TeamID iTeam, bool bPacifier) | Player has made peace with a team. bPacifier seems to always be true. | |
Hook | MinorAlliesChanged(PlayerID iMinorPlayer, PlayerID iMajorPlayer bool bIsAlly, int iOldFriendship, int iNewFriendship) | The ally of a city state has changed. | |
Hook | MinorFriendsChanged(PlayerID iMinorPlayer, PlayerID iMajorPlayer bool bIsAlly, int iOldFriendship, int iNewFriendship) | The friends of a city state have changed. | |
Hook | MinorGift(PlayerID iMinorPlayer, PlayerID iMajorPlayer, int iGift, int iFriendshipBoost, 0, bool bFirstMajorCiv, false, string szTxtKeySuffix | A city state has gifted a player something due to first meeting. szTxtKeySuffix will indicate the type of gift. iGift can be 0. | |
Hook | MinorGiftUnit(PlayerID iMinorPlayer, PlayerID iMajorPlayer, UnitType iUnitType) | A city state has gited a civilization a unit. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | NaturalWonderDiscovered(TeamID iTeam, FeatureType iFeatureType, int iPlotX, int iPlotY, bool bFirst, PlayerID iUnitOwner, UnitID iUnit) | A player has discovered a natural wonder. If not discovered by a unit, iUnitOwner and iUnit will both be -1. | |
Hook | NuclearDetonation(PlayerID iAttackingPlayer, int iPlotX, int iPlotY, bool bWar, bool bBystander) | A nuke has been detonated. If other players have been affected, bWar = true if the nuke is detonated at another player's plot, else bBystander = true. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
TestAny | bool | OverrideAIEvent(PlayerID iPlayer, EventType iEvent) | An event has started for the AI. Return true to prevent the AI from making a choice. |
TestAny | bool | OverrideAIEventChoice(PlayerID iPlayer, EventType iEvent) | Determining the best choice for the event type. Return true to prevent the AI from making a choice. |
TestAny | bool | OverrideAICityEvent(PlayerID iCityOwner, CityID iCity, CityEventType iCityEvent) | A city event has started for the AI. Return true to prevent the AI from making a choice. |
TestAny | bool | OverrideAICityEventChoice(PlayerID iCityOwner, CityID iCity, CityEventType iCityEvent) | Determining the best choice for the city event type. Return true to prevent the AI from making a choice. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | PantheonFounded(PlayerID iPlayer, CityID iCapitalCity, ReligionType iReligion, BeliefType iBelief) | A player has founded a pantheon. iReligion will always be RELIGION_PANTHEON. | |
Hook | ParadropAt(PlayerID iUnitOwner, UnitID iUnit, int iFromX, int iFromY, int iToX, int iToY) | A unit has performed a paradrop. | |
Hook | PietyChange(PlayerID iPlayer, int iPiety, int iChange) | Hook for JFDLC. iPiety is before the change. | |
Hook | PietyRateChange(PlayerID iPlayer, int iPietyRate, int iChange) | Hook for JDLC. iPietyRate is before the change. | |
Hook | PlaceResource(PlayerID iPlayer, ResourceType iResource, int iCount, int iCityX, int iCityY) | A player's civilization's unique luxuries have been place. In the unmodded game, this will be triggered by Indonesia. | |
Hook | PlayerAdoptsCurrency(PlayerID iPlayer, int iNewCurrency, int iOldCurrency) | Hook for JFDLC. | |
Hook | PlayerAdoptsGovernment(PlayerID iPlayer, int iGovernment) | Hook for JFDLC. | |
Hook | PlayerAnarchyBegins(PlayerID iPlayer, bool bBegin, int iTurn) | Anarchy has began or ended (contrary to the name) for a player. bBegin is true for beginning, false for ending. iTurn is the number of anarchy turns if beginning, or 0 if ending. | |
Hook | PlayerBoughtOut(PlayerID iMajor, PlayerID iMinor) | A player has bought the city state. In the unmodded game, this is triggered by Austria's trait and Merchants of Venice. | |
Hook | PlayerBuilding(PlayerID iPlayer, UnitID iUnit, int iPlotX, int iPlotY, BuildType iBuild, bool bStarting) | Player is building an improvement, route, etc. Triggers every turn the build is happening. | |
Hook | PlayerBuilt(PlayerID iPlayer, UnitID iUnit, int iPlotX, int iPlotY, BuildType iBuild) | Player has finished a build. | |
Hook | PlayerBullied(PlayerID iMajor, PlayerID iMinor, int iYield, UnitType iUnitType, int iPlotX, int iPlotY, YieldType iYield) | A player has bullied a city state. iUnitType, iPlotX, and iPlotY are related to demanding a unit from a city state. If a parameter is not applicable, its value will be -1. | |
TestAll | bool | PlayerCanDisband(PlayerID iPlayer) | Checking if a player should be forced to disband a unit due to a gold deficit. Return false to prevent disbanding. |
TestAll | bool | PlayerCanDisbandUnit(PlayerID iUnitOwner, UnitID iUnit) | Checking if a player is allowed to disband a unit. Return false to forbid. |
TestAll | bool | PlayerCanAdoptIdeology(PlayerID iPlayer, PolicyBranchType iIdeology) | Checking if a player is allowed to adopt an ideology. Return false to forbid. |
TestAll | bool | PlayerCanAdoptTenet(PlayerID iPlayer, PolicyType iTenet) | Checking if a player is allowed to adopt a tenet. Return false to forbid. |
TestAll | bool | PlayerCanBuild(PlayerID iPlayer, UnitID iUnit, int iPlotX, int iPlotY, BuildType iBuild) | Checking if a player can build an improvement, route, etc. |
TestAll | bool | PlayerCanBullyGold(PlayerID iMajor, PlayerID iMinor) | Checking if a player can demand gold from a city state. Return false to forbid. |
TestAll | bool | PlayerCanBullyUnit(PlayerID iMajor, PlayerID iMinor) | Checking if a player can demand a unit from a city state. Return false to forbid. |
TestAll | bool | PlayerCanBuyOut(PlayerID iMajor, PlayerID iMinor) | Checking if a player can buy a city state. Applicable for Austria and Venice in the unmodded game. Return false to forbid. |
TestAll | bool | PlayerCanCreateTradeRoute(PlayerID iFromPlayer, CityID iFromCity, PlayerID iToPlayer, CityID iToCity, DomainType iDomain, int iConnectionType) | Checking if a player can create a trade route between two cities. For iConnectionType, 0 = international, 1 = food, 2 = production, 3 = wonder bonus from resource, 4 = domestic gold. Return false to forbid. |
Hook | PlayerTradeRouteCompleted(PlayerID iFromPlayer, CityID iFromCity, PlayerID iToPlayer, CityID iToCity, DomainType iDomain, int iConnectionType) | A trade route has completed. | |
TestAll | bool | PlayerCanDeclareWar(PlayerID iOriginatingPlayer, TeamID iTeam) | Checking if a player can declare war on a team. Return false to forbid. |
TestAll | bool | PlayerCanFoundCity(PlayerID iPlayer, int iPlotX, int iPlotY) | Checking if a player can found a city at a plot. Return false to forbid. |
TestAny | bool | PlayerCanFoundCityRegardless(PlayerID iPlayer, int iPlotX, int iPlotY) | Checking if a player can found a city at a plot. Return true to force allow. |
TestAll | bool | PlayerCanFoundPantheon(PlayerID iPlayer) | Checking if a player can found a pantheon. Return false to forbid. |
TestAll | bool | PlayerCanFoundReligion(PlayerID iPlayer, CityID iCity) | Checking if a player can found a religion with iCity as the holy city. Return false to forbid. |
TestAll | bool | PlayerCanGiftGold(PlayerID iMajor, PlayerID iMinor) | Checking if a civilization can gift gold to a city state. Return false to forbid. |
TestAll | bool | PlayerCanGiftImprovement(PlayerID iMajor, PlayerID iMinor) | Checking if a civilization is allowed to gift an improvement to a city state. Gifting here refers to when done through the diplomacy window, rather than using a unit to build in the city state's territory directly. Return false to forbid. |
TestAll | bool | PlayerCanGiftUnit(PlayerID iMajor, PlayerID iMinor, UnitID iUnit) | Checking if a civilization is allowed to gift a unit to a city state. Return false to forbid. |
TestAll | bool | PlayerCanHaveBelief(PlayerID iPlayer, BeliefType iBelief) | Checking if a player is allowed to have a certain belief as a pantheon. Use event ReligionCanHaveBelief instead to for beliefs other than pantheons. Return false to forbid. |
TestAll | bool | PlayerCanLiberate(PlayerID iPlayer, PlayerType iOtherPlayer) | Checking if iPlayer can liberate iOtherPlayer. Return false to forbid. |
TestAll | bool | PlayerCanMakePeace(PlayerID iOriginatingPlayer, TeamID iTeam) | Checking if a player can make peace with a team. Return false to forbid. |
TestAll | bool | PlayerCanPropose(PlayerID iPlayer, ResolutionType iResolution, int iChoice, bool bEnact) | Checking if a player can propose to enact or repeal a resolution. iChoice is used to sphere of influence, open doors, sanction. Return false to forbid. |
TestAll | bool | PlayerCanProtect(PlayerID iMajor, PlayerID iMinor) | Checking if a major civilization is allowed to pledge to protect a city state. Return false to forbid. |
TestAny | bool | PlayerCanRaze(PlayerID iPlayer, CityID iCity) | Checking if a player is allowed to raze a city. Return true to force allow. |
TestAll | bool | PlayerCanRemoveHeresy(PlayerID iPlayer, UnitID iUnit, int iPlotX, int iPlotY) | Checking if a player is allowed to use an inquisitor. Return false to forbid. |
TestAll | bool | PlayerCanRevoke(PlayerID iMajor, PlayerID iMinor) | Checking if a player is allowed to revoke its pledge of protection towards a city state. Return false to forbid. |
TestAll | bool | PlayerCanSpreadReligion(PlayerID iPlayer, UnitID iUnit, int iPlotX, int iPlotY) | Checking if a player is allowed to spread religion. Return false to forbid. |
TestAll | bool | PlayerCanTransitMinorCity(PlayerID iPlayer, PlayerID iMinor, CityID iCity, int iPlotX, int iPlotY) | Checking if a player is allowed to pass through a city state's city. This event is called rather than UnitCanTransitMinorCity when the game does not check for a specific unit (which is most of the time). Return false to forbid. |
Hook | PlayerDoneTurn(PlayerID iPlayer) | A player has finished its turn. Unlike PlayerDoTurn, which is called at the start of a turn. | |
Hook | PlayerGifted(PlayerID iMajor, PlayerID iMinor, int iGold, UnitType iUnitType, int iPlotX, int iPlotY) | A civilization has gifted something to a city state. Parameters which are not applicable will have a value of -1. Plot coordinates refer to gifted improvements only. | |
Hook | PlayerGoldenAge(PlayerID iPlayer, bool bStart, int iTurns) | Golden age related hook. If a player has started a golden age, or has its golden age turns increased, bStart = true and iTurns = the increase in golden age turns. If a player has ende a golden age, bStart = false and iTurns = 0. | |
Hook | PlayerEndOfMayaLongCount(PlayerID iPlayer, int iBaktun, int iBaktunPreviousTurn) | End of a Maya Long Count. | |
Hook | PlayerLiberated(PlayerID iPlayer, PlayerID iOtherPlayer, CityID iCity) | iPlayer has liberated iOtherPlayer by liberating iCity. | |
Hook | PlayerPlunderedTradeRoute(PlayerID iPlayer, UnitID iUnit, int iPlunderedGold, PlayerID iFromPlayer, CityID iFromCity, PlayerID iToPlayer, CityID iToCity, int iRouteType, DomainType iRouteDomain) | iPlayer has plundered a trade route using iUnit. For iRouteType, 0 = international, 1 = food, 2 = production, 3 = wonder bonus from resource, 4 = domestic gold. | |
Hook | PlayerProtected(PlayerID iMajor, PlayerID iMinor) | A civilization has pledged to protect a city state. | |
Hook | PlayerRevoked(PlayerID iMajor, PlayerID iMinor, bool bPledgeBroken) | A civilization has revoked a pledge of protection for a city state. bPledgeBroken is true if the civilization revoked protection when the city state was being bullied by another player. | |
Hook | PlayerSecularizes(PlayerID iPlayer, ReligionType iStateReligion, bool bSecular) | Event for JFDLC. | |
Hook | PlayerStateReligionAdopted(PlayerID iPlayer, ReligionType iNewStateReligion, -1) | Event for JFDLC. Player has adopted a state religion, where previously there was none. The last parameter will always be -1. | |
Hook | PlayerStateReligionChanged(PlayerID iPlayer, ReligionType iNewStateReligion, -1) | Event for JFDLC. Player has changed state religion. | |
TestAll | bool | PlotCanImprove(int iPlotX, int iPlotY, ImprovementType iImprovement) | Checking if a plot is allowed to have an improvement. Return false to forbid. |
Hook | ProvinceLevelChanged(PlayerID iPlayer, CityID iCity, int iOldLevel, int iNewLevel) | Event for JFDLC. A city's province level has changed. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | RebaseTo(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY) | A unit has rebased to a plot. | |
TestAll | bool | ReligionCanHaveBelief(PlayerID iPlayer, ReligionType iReligion, BeliefType iBelief) | Checking if a player can add a belief to a religion. Return false to forbid. |
Hook | ReformCooldownChanges(PlayerID iPlayer, int iReformCooldown) | Hook for JFDLC. iReformCooldown is after the change. | |
Hook | ReformCooldownRateChanges(PlayerID iPlayer, int iRate) | Hook for JFDLC. iRate is before the change. | |
Hook | ReligionEnhanced(PlayerID iPlayer, ReligionType iReligion, BeliefType iBelief1, BeliefType iBelief2) | A player has enhanced a religion. | |
Hook | ReligionFounded(PlayerID iPlayer, CityID iHolyCity, ReligionType iReligion, BeliefType iBelief1, BeliefType iBelief2, BeliefType iBelief3, BeliefType iBelief4, BeliefType iBelief5) | A player has founded a religion. | |
Hook | ReligionReformed(PlayerID iPlayer, ReligionType iReligion, BeliefType iBelief) | A player has reformed a religion. | |
TestAny | bool | ResolutionProposing(PlayerID iPlayer, int iLeague) | Event when an AI player is going to propose a resolution. Return true to prevent the AI from proposing. |
Hook | ResolutionResult(ResolutionType iResolution, PlayerID iProposer, int iChoice, bool bEnact, bool bPassed) | A resolution has finished being voted on. iChoice is used for spheres of influence, open doors, etc. bEnact is true for proposing to enact, false for proposing to repeal. | |
TestAny | bool | ResolutionVoting(PlayerID iPlayer, int iLeague) | Event when an AI player will vote on proposals. Return true to prevent the AI from voting. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | SetFreeCityType(PlayerID iMinor, MinorCivTraitType iMinorType) | A free city has been created, usually through cities settled by a player revolting from unhappiness. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | TeamSetEra(TeamID iTeam, EraType iEra, bool bFirst) | A team has reached a new era. bFirst is true if the team is the first to reach the era in the game. | |
Hook | TerraformingMap(int iEvent, int iLoad) | The map has been terraformed. iEvent is always 0. iLoad is 0 at new game, 1 when loading a save. | |
Hook | TerraformingPlot(int iEvent, int iPlotX, int iPlotY, int iInfo, int iNewValue, int iOldValue, int iNewExtra, int iOldExtra) | A plot has been terraformed. For iEvent, 1 = area, 2 = landmass, 4 = plot, 5 = terrain, 6 = feature, 7 = river, 8 = city. iInfo is used when a river is changed: 0 = north east, 4 = west, 5 = north west. For iNewValue and iOldValue, it indicates the change. iNewExtra an iOldExtra are for river flow directions. | |
Hook | TileFeatureChanged(int iPlotX, int iPlotY, PlayerID iPlotOwner, FeatureType iOldFeature, FeatureType iNewFeature) | The feature of a plot has been changed. | |
Hook | TileImprovementChanged(int iPlotX, int iPlotY, PlayerID iPlotOwner, ImprovementType iOldImprovement, ImprovementType iNewImprovement, bool bPillaged) | There has been a change to the improvement on a plot. Triggered for a change of improvement types, pillaging, and repairing. | |
Hook | TileOwnershipChanged(int iPlotX, int iPlotY, PlayerID iNewOwner, PlayerID iOldOwner) | A plot has changed owners. Note that this includes when the plot has no owner. | |
Hook | TileRevealed(int iPlotX, int iPlotY, TeamID iTeam, TeamID iFromTeam, bool bFirst, PlayerID iUnitOwner, UnitID iUnit) | A team has revealed a plot. bFirst is true if the team is the first major civilization to reveal the plot. iFromTeam is the team that owns the plot revealed. | |
Hook | TileRouteChanged(int iPlotX, int iPlotY, PlayerID iPlotOwner, RouteType iOldRoute, RouteType iNewRoute, bool bPillaged) | The route on a plot has changed. Includes building, removing, pillaging, and reparing. |
Category | Return | Event (parameters) | Description |
---|---|---|---|
Hook | UiDiploEvent(int iEvent, PlayerID iAiPlayer, int iArg1, int iArg2) | Event sent during Game.DoFromUIDiploEvent, see also DiscussionDialog.lua. | |
TestAll | bool | UnitCanHaveAnyUpgrade(PlayerID iUnitOwner, UnitID iUnit) | Checking if a unit can be upgraded. Return false to disable upgrading. |
TestAll | bool | UnitCanHaveGreatWork(PlayerID iUnitOwner, UnitID iUnit, GreatWorkType iGreatWork) | Checking if a unit is allowed to create a great work. Return false to forbid. |
TestAll | bool | UnitCanHaveName(PlayerID iUnitOwner, UnitID iUnit, int iName) | Checking if a unit is allowed to have a certain name. iName is an index based on the order in the database table Unit_UniqueNames. Return false to forbid. |
TestAll | bool | UnitCanHavePromotion(PlayerID iUnitOwner, UnitID iUnit, PromotionType iPromotion) | Checking if a unit can have a specific promotion. Return false to disable the promotion for the unit. |
TestAll | bool | UnitCanHaveUpgrade(PlayerID iUnitOwner, UnitID iUnit, UnitClassType iUnitClassType, UnitType iUnitType) | Checking if the unit can be upgraded to the specified unit class type and unit type. Return false to forbid. |
TestAll | bool | UnitCanPillage(PlayerID iUnitOwner, UnitID iUnit, ImprovementType iImprovement, RouteType iRoute) | Checking if a unit is allowed to pillage an improvement or route (or a combination of both). Return false to forbid. |
TestAny | bool | UnitCanRangeAttackAt(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY, bool bNeedWar) | Checking if a unit (including air units) is allowed to perform a range attack, with a specific plot as the target. Return true to force allow. Use in conjunction with UnitRangeAttackAt to allow range attacking at normally forbidden plots. |
TestAll | bool | UnitCanTransitMinorCity(Player iUnitOwner, UnitID iUnit, PlayerID iMinor, CityID iCity, int iPlotX, int iPlotY) | Checking if a unit is allowed to pass through a city state's city. This event is called rather than PlayerCanTransitMinorCity when the game is checking for a specific unit. This event does not appear to get triggered compared to PlayerCanTransitMinorCity. Return false to forbid. |
Hook | UnitCaptured(PlayerID iByPlayer, UnitID iByUnit, PlayerID iCapturedPlayer, UnitID iCapturedUnit, bool bWillBeKilled, int iReason) | A unit has captured another unit. bWillBeKilled is true for cases when the captured unit is killed instead, such as units which cannot capture civilians, or attempting to capture embarked units. For iReason, 0 = move (civilians), 1 = combat, 2 = trait (barbarian land), 3 = trait (barbarian naval), 4 = belief. | |
Value | int | UnitCaptureType(PlayerID iByPlayer, UnitID iByUnit, UnitType iByUnitType, CivilizationType iByCivilization) | Determining what unit type should be spawned after the capture. Return a UnitType to override the normal behaviour. |
Hook | UnitCityFounded(PlayerID iUnitOwner, UnitID iUnit, UnitType iUnitType, int iPlotX, int iPlotY) | A unit has founded a city at a plot. | |
Hook | UnitCreated(PlayerID iUnitOwner, UnitID iUnit, UnitType iUnitType, int iPlotX, int iPlotY) | A unit has been created due to any reason at a plot. | |
Value | int | UnitPillageGold(PlayerID iUnitOwner, UnitID iUnit, ImprovementType iImprovement, int iGold) | Game is checking what is the gold from pillaging improvements. iGold is the normal value before modifiers. Return a value to increment (before modifiers). |
Hook | UnitPrekill(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY, bool bDelay, PlayerID iKillerPlayer) | A unit has been killed, but the game has not deleted the unit yet. bDelay is true for delayed deaths, where the unit will be partially cleaned up, but its final removal will happen at the end of the frame. | |
Hook | UnitPromoted(PlayerID iUnitOwner, UnitID iUnit, PromotionType iPromotion) | A unit has gained a new promotion. | |
Value | int | UnitRangeAttackAt(PlayerID iUnitOwner, UnitID iUnit, int iPlotX, int iPlotY) | Checking the result of a range attack (including air units) targeting a certain plot. Return a value larger than 0 to force the attack to be successful (eg against no targets on the plot). Use in conjunction with UnitCanRangeAttackAt to allow range attacking at normally forbidden plots. |
Hook | UnitUpgraded(PlayerID iUnitOwner, UnitID iOldUnit, UnitID iNewUnit, bool bGoodyHut) | A unit has been upgraded. bGoodyHut is true if the upgrade is due to picking up ancient ruins. | |
Hook | UnitConverted(PlayerID iOldPlayer, PlayerID iNewPlayer, UnitID iOldUnit, UnitID iNewUnit, bool bIsUpgrade) | Events sent as units are converted (wherever CvUnit::convert() is called, eg upgrade, barbarian capture, Lua). |