LeeS
Imperator
Spoiler :
Code:
-- RomanBuildingsScript
-- Author: LeeS
-- DateCreated: 8/16/2016
--------------------------------------------------------------
local tRequiredCivs = {}
local tBuildingsForSpecifiedCivs = { [GameInfoTypes.BUILDING_TRAJAN] = "true", [GameInfoTypes.BUILDING_THERMAE] = "true" }
for row in GameInfo.Civilizations("Type='CIVILIZATION_ROME'") do
tRequiredCivs[row.ID] = "true"
end
for row in GameInfo.Civilizations("Type='CIVILIZATION_SCIPIO_ROME'") do
tRequiredCivs[row.ID] = "true"
end
for row in GameInfo.Civilizations("Type='CIVILIZATION_GPUZ_ROME_JULIUS'") do
tRequiredCivs[row.ID] = "true"
end
for row in GameInfo.Civilizations("Type='CIVILIZATION_GPUZ_GAIUS_ROME'") do
tRequiredCivs[row.ID] = "true"
end
for row in GameInfo.Civilizations("Type='CIVILIZATION_JFD_ROME_CONSTANTINE'") do
tRequiredCivs[row.ID] = "true"
end
for row in GameInfo.Civilizations("Type='CIVILIZATION_TCM_AURELIAN_ROME'") do
tRequiredCivs[row.ID] = "true"
end
function PlayerCanBuildRomanBuildings(PlayerID, BuildingType)
if tBuildingsForSpecifiedCivs[BuildingType] then
local pPlayer = Players[PlayerID]
if tRequiredCivs[pPlayer:GetCivilizationType()] then
return true
else
return false
end
end
return true
end
GameEvents.PlayerCanConstruct.Add(PlayerCanBuildRomanBuildings)
print("RomanBuildingsScript loaded to end")
- In the table called tBuildingsForSpecifiedCivs you list the buildings only these specified civs can construct. The buildings would normally only be those added within your mod, so you will know whether or not such a building exists within the game's database (ie, you have just added it). If you want to give compatibility to another of your mods when both mods are enabled (such as the thermae mod, where this code would work as-is, and some other 'Roman' building mod), you just add the buildings for that mod as like this:
Code:
for row in GameInfo.Buildings("Type='BUILDING_ROMAN_WALLS'") do tBuildingsForSpecifiedCivs[row.ID] = "true" end
- In the table called tRequiredCivs you list the civilizations that get to construct the specified buildings. As we did for the Baths of Trajan, the list of civs is built depending on whether or not a user has the mod or DLC for any of the specified civilizations.
I saw your chat PM but forgot to get back to after I was done pushing out update to the Scipio mod. Sorry if that seemed kinda rude.