Event that triggers when an improvement is contructed; how to reveal a resource

PawelS

Ancient Druid
Joined
Dec 11, 2003
Messages
2,811
Location
Poland
I'm going to make some types of great people able to discover new resources by constructing a temporary improvement with good yields (so the AI will do it), immediately after constructing this improvement should disappear and create a resource on the tile. I think I can handle the code that removes the improvement and places the resource, but I need help with 2 things:

1. How to make an event trigger when a specific improvement is created?
2. In case the hex where the improvement is constructed already contains a resource, undiscovered due to not having the needed technology, the resource should be revealed instead of creating a new one (like it's done with an unused goody hut effect). Is it possible to do it with Lua, and if so, how?
 
1. How to make an event trigger when a specific improvement is created?

The standard event which triggers for the completion of an improvement is particularly useless as it only fires if the hex is visible to the human player :(
 
The standard event which triggers for the completion of an improvement is particularly useless as it only fires if the hex is visible to the human player :(

So I guess doing it properly will require DLL changes. Theoretically it can be done by scanning the entire map with Lua every turn, but this can have a negative effect on performance...
 
So I guess doing it properly will require DLL changes.
Already added

Theoretically it can be done by scanning the entire map with Lua every turn, but this can have a negative effect on performance...
Depends on the size of the map ;) And if the improvements can only be built on certain terrain, you can cache the possible tiles on the first full pass.
 
Back
Top Bottom