UAs involving Ancient Ruins

RetroA

Chieftain
Joined
Sep 15, 2015
Messages
25
Location
UK
I've been racking my brain to come up with a suitable UA for a fictional civ I'm trying to make (based on an old RTS game, Populous the Beginning). I initially wanted it to involve Antiquity Sites like being able to see and excavate them earlier but there's a whole heap of issues there so I was thinking something to do with Ancient Ruins instead. Are the following concepts feasible and relatively easy to code given my experience with LUA isn't great?

1. When founding your capital, nearby Ancient Ruins are revealed.

2. Being able to create a UI on/next to the site of a former Ruin? Or perhaps a UI appearing when claiming a Ruin.

Just throwing out ideas so I'm open to others if anyone can think of any.
 
1) is relatively easy - catch the city founded event, check for specific civ, check for it being the capital, loop all plots within desired range, check for ancient ruins (it's a type of improvement), if so, reveal the tile, remove the event listener - but that depends on your definition of "relatively"

2) is significantly harder. It would be easier if you could depend on a modded DLL (as there are additional events you could use), otherwise you're looking at modding UnitPanel to add a custom mission
 
Depending on how you did it, I don't think 2 would be that hard. I've seen some mods that trigger effects that occur when you explore an Ancient Ruins. Since they count as Improvements, I'd think you could just check if a tile one of your units walks onto has one. RawSasquatch's Kyrat civ builds a table of all the ancient ruins locations when the game is loaded, and checks to see when a unit walks onto one.

The harder part would be limiting someone to building a UI on the site of a former ruin, although the latter idea (having one appear automatically) could be done fairly easily.
 
Auto-building the improvement is much easier than limiting a build later, but that means you'll end up with a lot of auto-built UIs outside of your territory and it'll also be impossible to later build the UI on/near a ruin the civ itself didn't capture
 
whoward69 said:
Depends on your definition of "relatively"
I'm pretty new to it but I now understand the processes required - I'll need to learn the code but this should give me a good start, thanks.

bouncymicha said:
RawSasquatch's Kyrat civ builds a table of all the ancient ruins locations when the game is loaded, and checks to see when a unit walks onto one.
I had seen his mod but didn't realise that's how the script worked, that'll give me some something to work with, thanks for pointing it out.

At the risk of complicating things further, what about if claiming an Ancient Ruin spawned a unique resource on the tile, which could then be improved by a UI?
 
At the risk of complicating things further, what about if claiming an Ancient Ruin spawned a unique resource on the tile, which could then be improved by a UI?

Possible, but runs the risk of over-writing a hidden resource (iron, coal, etc) already under the goody hut
 
1) is relatively easy - catch the city founded event, check for specific civ, check for it being the capital, loop all plots within desired range, check for ancient ruins (it's a type of improvement), if so, reveal the tile, remove the event listener - but that depends on your definition of "relatively"

If I've understood this correctly - do you really want to do this (removing the event listener). What if there two civs with this UA? If you disable the event listener on one fire, wouldn't the second one not trigger it? Unless that listener is player specific?
 
If I've understood this correctly - do you really want to do this (removing the event listener). What if there two civs with this UA? If you disable the event listener on one fire, wouldn't the second one not trigger it? Unless that listener is player specific?
If there are two civs with the UA there will either be one listener processing both civs, or two listeners processing one civ each (either in the same lua file with different names or with the same name in different files) - whichever implementation is used, removing the listener will work.
 
Possible, but runs the risk of over-writing a hidden resource (iron, coal, etc) already under the goody hut

So many considerations, perhaps it's back to the drawing board with this idea...


Thanks for the link, looks like I've got some homework to do!


Now I have actually played this mod recently but couldn't get any Antiquity Sites to appear before Archaeology despite clearing encampments, cities and ruins - other people seemed to have run into this as well. It's odd, I still don't really understand how/when Antiquity Sites are created, I know they are suppose to appear near encampments and ruins etc but if you start a new game and give yourself Archaeology straight away using an ingame editor, Antiquity Sites appear scattered around the map before any combat has taken place - that's what I was looking for when designing this civ initially, to be able to see all of them from the get go as opposed to see them as and when they are supposed to be officially created.
 
I still don't really understand how/when Antiquity Sites are created

Every time a goody hut is cleared, a unit dies, a city is razed (and possibly a couple of others) an "antiquity record" is added to the plot (if it doesn't already have one). These do nothing until ...

... the first team to research Archaeology triggers the conversion of some of these plots into actual antiquity sites (a random selection of them are chosen depending on the size of the map / number of players - if there are insufficient records, random sites will be created to meet the required minimum).

All this is hard-coded in the DLL, any other behaviour would require extensive Lua coding or a modded DLL - especially as there is no out-of-the-box API method to create a site or record via Lua

W
 
Well that explains it, thanks once again. As I predicted, a whole heap of issues. I think I'll try for that reveal Ancient Ruins idea and then maybe something simpler like increased yields on Landmarks or something.
 
If there are two civs with the UA there will either be one listener processing both civs, or two listeners processing one civ each (either in the same lua file with different names or with the same name in different files) - whichever implementation is used, removing the listener will work.
I think what Putmalk was referring to was the situation of : 'I have two Cows in my game. I am playing as Cow #1, and the AI is running Cow #2.' This happens sometimes when players set a particular civ for use as an AI player in Advanced Setup, and then forget to remove it when they start another game.

For both Cows, would not
Code:
pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_COWS
return 'true'? Would not the first Cow to run the code (the first to found their capital) disable the code before the code can run for the second Cow?
Code:
iRequiredCiv = GameInfoTypes.CIVILIZATION_COWS

function PlayerCapitalFounded(iPlayer, iCityX, iCityY)
	local pPlayer = Players[iPlayer]
	if pPlayer:GetCivilizationType() == iRequiredCiv then
		local pCapital = pPlayer:GetCapitalCity()
		if (pCapital:GetX() == iCityX) and (pCapital:GetY() == iCityY) then
			--we just founded the Cow Capital city
			--do blah blah
			GameEvents.PlayerCityFounded.Remove(PlayerCapitalFounded)
		end
	end
end
GameEvents.PlayerCityFounded.Add(PlayerCapitalFounded)
 
Top Bottom