CommunistMountain
Chieftain
- Joined
- Aug 4, 2018
- Messages
- 4
If I want to make an lua script which checks for map size (in this case, Duel) before creating a certain building, should I use the following? (I made a different building for different mapsizes in order to scale their effect by map size.)
Edit: added the whole code instead of just that part.
Edit 2: Nevermind, I found out how. But I have another question... the above was for spawning a free, hidden building, but how would I go about replacing a particular building with my own building based on map size? I would have used XML to simply change that one parameter I want changed if I didn't have to factor in map size... so now I'm creating buildings from scratch.
Edit 3: Nevermind, I found out how as well. How do I delete this post
Code:
function addBuilding(vHexPos, iPlayer, iCity, artStyleType, eraType, continent, populationSize, size, fogState)
local iBuildingDuel = GameInfoTypes.BUILDING_BLAH_DUEL
local player = Players[iPlayer];
local city = player:GetCityByID(iCity);
local sizeofworld = worldsizes[Map.GetWorldSize()];
if sizeofworld == GameInfo.Worlds.WORLDSIZE_DUEL.ID then
city:SetNumRealBuilding(iBuildingDuel, 1);
end
end
Events.SerialEventCityCreated.Add(addBuildingDuel)
Edit: added the whole code instead of just that part.
Edit 2: Nevermind, I found out how. But I have another question... the above was for spawning a free, hidden building, but how would I go about replacing a particular building with my own building based on map size? I would have used XML to simply change that one parameter I want changed if I didn't have to factor in map size... so now I'm creating buildings from scratch.
Edit 3: Nevermind, I found out how as well. How do I delete this post
Last edited: