Compiled DLL for vanilla civ5 with combat events and functions.
WARNING, This has not been updated after patch 1.0.3.18., it's not working with current version of the game and development has switched to Brave New World, so this mod is not supported anymore.
See the R.E.D. DLL for BNW thread for the current version of the mod.
Added in v.1:
a new game event related to combats, GameEvents.CombatResult which gives the same variables in the same order as the old Events.RunCombatSim and Events.EndCombatSim and adds the following: iInterceptingPlayer, iInterceptingUnit, interceptorDamage, plotX, plotY.
It fire before the combat is resolved.
Example of Lua code:
Added in v.2:
Added in v.3:
- GameEvents.CanSendDiploStatement(iPlayer) that allows to prevent AI contact to the human player using the diplo screen.
- define SUPPLY_PRODMOD_PER_UNIT used to calculate production penalty modifier per unit above the supply limit (was hardcoded at 10)
- GameEvents.PlayerEndTurnInitiated(iPlayer) which is called when any player (human or AI) "ask" for end turn but before various reset functions are called (DoUnitReset, RespositionInvalidUnits, ...)and unitsGameEvents.PlayerEndTurnCompleted(iPlayer) which is called after those functions.
- GameEvents.TurnComplete (iActivePlayer) called when a human player click "finish turn"
- GameEvents.CanRangeStrikeAt(iPlayer, iUnit, x, y)
- Balance embarked units combat by considering them DOMAIN_SEA (they were considered DOMAIN_LAND) and ignore all other bonus/penalties except a 100% bonus vs aircraft.
- GameEvents.MustAbortAttack() with same parameters as GameEvents.CombatResult(), it's checked just before it and if true it will not resolve the planned combat. Be warned that it may have an influence on the Tactical AI, as it remove one of the planned attacking units of an objective. In R.E.D. it does so at such ratio that the unit should not have had a big impact anyway.
- Make Embarked units double strength against air attack an option (GAMEOPTION_DOUBLE_EMBARKED_DEFENSE_AGAINST_AIR) to set via XML, SQL or Lua.
SQL example:
- GameEvents.PushingMissionTo(iPlayer, iUnit, x, y, iMission) and GameEvents.TacticalAILaunchUnitAttack(iPlayer, iUnit, x, y) to catch an attack just before it's launched. Used for "Supporting Fire" feature in R.E.D. WWII.
- unit->isSpecialType(), unit->setIsSpecialType(bNewValue) to C++ and unit:IsSpecialType(), unit:SetIsSpecialType() to Lua. That allows a specific unit to stack with unit of same type (but not others "special type" units)
- Hack to allow loading of WB maps with more than 255 unit types.
- Crash fix: On move through, don't allow embarked special units to stack, and prevent AI sea units to stack with embarked units to prevent a crash occurring during auto-mission.
Added in v.4:
- Add unit->IsMarkedBestDefender(), unit->SetMarkedBestDefender( bNewValue ) to DLL and unit:IsMarkedBestDefender(), unit:SetMarkedBestDefender( bNewValue ) to Lua. It will override the game logic when choosing the best defender on a plot, used in R.E.D. WWII to temporary set an unit as the target of an attack (or counter-attack) even if there are better defending units on that plot.
- Add "GAMEOPTION_CAN_ENTER_FOREIGN_CITY" and "GAMEOPTION_CAN_STACK_IN_CITY" to allow all unit types in foreign cities (must have allied level for minor civilizations cities) and multiple units of same type in one city.
- Add "GAMEOPTION_NO_MINOR_DIPLO_SPAM" to prevent minor civilizations to send help request messages (and when the option is set to ON, it fixes an unresolved crash in R.E.D. WWII related to those messages...)
- Add "GAMEOPTION_FREE_PLOTS" to prevent tiles from changing ownership on cities capture.
v4.1:
- Add "GAMEOPTION_UNIT_LIMIT_FIX" to trigger the hack to allow loading of WB maps with more than 255 unit types. (better to be an option...)
Code source on Git-Hub (RED branch).
Installation when using vanilla civ5:
Download link
Extract and replace CvGameCoreDLLFinal Release.dll in civ5 installation directory.
Remember to make a backup first.
Inclusion in a Mod for G+K:
Just put the G+K DLL (CvGameCore_Expansion1.dll) in the root of your project in modbuddy and set that file VFS property to true.
WARNING, This has not been updated after patch 1.0.3.18., it's not working with current version of the game and development has switched to Brave New World, so this mod is not supported anymore.
See the R.E.D. DLL for BNW thread for the current version of the mod.
Added in v.1:
Spoiler :
a new game event related to combats, GameEvents.CombatResult which gives the same variables in the same order as the old Events.RunCombatSim and Events.EndCombatSim and adds the following: iInterceptingPlayer, iInterceptingUnit, interceptorDamage, plotX, plotY.
It fire before the combat is resolved.
Example of Lua code:
Code:
function CombatResult (iAttackingPlayer, iAttackingUnit, attackerDamage, attackerFinalDamage, attackerMaxHP, iDefendingPlayer, iDefendingUnit, defenderDamage, defenderFinalDamage, defenderMaxHP, iInterceptingPlayer, iInterceptingUnit, interceptorDamage, plotX, plotY)
-- your code here
end
GameEvents.CombatResult.Add( CombatResult )
Added in v.2:
Spoiler :
- 2 Lua functions team:IsClosedBorder() and team:SetClosedBorder(bNewValue) to allow movement restriction to any unit on a civilization territory. R.E.D. WWII will use this to prevent entering neutral City States territory. When team:IsClosedBorder() return true, only civs with allied relation level can enter the CS territory.
- Set GAMEOPTION_REBASE_IN_FRIENDLY_CITY to true to allows rebasing of aircraft in cities of civilization with which you share open borders. Include CS with allied relation level.
- GameEvents.CombatEnded, same variables as GameEvents.CombatResult, fire after the combat is resolved. (may need to check if the defender is still alive there!)
- Set GAMEOPTION_REBASE_IN_FRIENDLY_CITY to true to allows rebasing of aircraft in cities of civilization with which you share open borders. Include CS with allied relation level.
- GameEvents.CombatEnded, same variables as GameEvents.CombatResult, fire after the combat is resolved. (may need to check if the defender is still alive there!)
Added in v.3:
Spoiler :
- GameEvents.CanSendDiploStatement(iPlayer) that allows to prevent AI contact to the human player using the diplo screen.
- define SUPPLY_PRODMOD_PER_UNIT used to calculate production penalty modifier per unit above the supply limit (was hardcoded at 10)
- GameEvents.PlayerEndTurnInitiated(iPlayer) which is called when any player (human or AI) "ask" for end turn but before various reset functions are called (DoUnitReset, RespositionInvalidUnits, ...)and unitsGameEvents.PlayerEndTurnCompleted(iPlayer) which is called after those functions.
- GameEvents.TurnComplete (iActivePlayer) called when a human player click "finish turn"
- GameEvents.CanRangeStrikeAt(iPlayer, iUnit, x, y)
- Balance embarked units combat by considering them DOMAIN_SEA (they were considered DOMAIN_LAND) and ignore all other bonus/penalties except a 100% bonus vs aircraft.
- GameEvents.MustAbortAttack() with same parameters as GameEvents.CombatResult(), it's checked just before it and if true it will not resolve the planned combat. Be warned that it may have an influence on the Tactical AI, as it remove one of the planned attacking units of an objective. In R.E.D. it does so at such ratio that the unit should not have had a big impact anyway.
- Make Embarked units double strength against air attack an option (GAMEOPTION_DOUBLE_EMBARKED_DEFENSE_AGAINST_AIR) to set via XML, SQL or Lua.
SQL example:
Code:
INSERT INTO GameOptions (Type, "Default", Visible) VALUES ( 'GAMEOPTION_DOUBLE_EMBARKED_DEFENSE_AGAINST_AIR', 1, 0 );
- GameEvents.PushingMissionTo(iPlayer, iUnit, x, y, iMission) and GameEvents.TacticalAILaunchUnitAttack(iPlayer, iUnit, x, y) to catch an attack just before it's launched. Used for "Supporting Fire" feature in R.E.D. WWII.
- unit->isSpecialType(), unit->setIsSpecialType(bNewValue) to C++ and unit:IsSpecialType(), unit:SetIsSpecialType() to Lua. That allows a specific unit to stack with unit of same type (but not others "special type" units)
- Hack to allow loading of WB maps with more than 255 unit types.
- Crash fix: On move through, don't allow embarked special units to stack, and prevent AI sea units to stack with embarked units to prevent a crash occurring during auto-mission.
Added in v.4:
Spoiler :
- Add unit->IsMarkedBestDefender(), unit->SetMarkedBestDefender( bNewValue ) to DLL and unit:IsMarkedBestDefender(), unit:SetMarkedBestDefender( bNewValue ) to Lua. It will override the game logic when choosing the best defender on a plot, used in R.E.D. WWII to temporary set an unit as the target of an attack (or counter-attack) even if there are better defending units on that plot.
- Add "GAMEOPTION_CAN_ENTER_FOREIGN_CITY" and "GAMEOPTION_CAN_STACK_IN_CITY" to allow all unit types in foreign cities (must have allied level for minor civilizations cities) and multiple units of same type in one city.
- Add "GAMEOPTION_NO_MINOR_DIPLO_SPAM" to prevent minor civilizations to send help request messages (and when the option is set to ON, it fixes an unresolved crash in R.E.D. WWII related to those messages...)
- Add "GAMEOPTION_FREE_PLOTS" to prevent tiles from changing ownership on cities capture.
v4.1:
- Add "GAMEOPTION_UNIT_LIMIT_FIX" to trigger the hack to allow loading of WB maps with more than 255 unit types. (better to be an option...)
Code source on Git-Hub (RED branch).
Installation when using vanilla civ5:
Download link
Extract and replace CvGameCoreDLLFinal Release.dll in civ5 installation directory.
Remember to make a backup first.
Inclusion in a Mod for G+K:
Just put the G+K DLL (CvGameCore_Expansion1.dll) in the root of your project in modbuddy and set that file VFS property to true.