The mystery of the missing function definition

criZp

Emperor
Joined
Jul 19, 2013
Messages
1,963
Location
Nidaros, Norway
So I'm trying to make a mod that keeps unit icons translucent when the units go into fortify, instead of becoming semi-transparent.

There is a function called UnitFlag.SetDim( self, bDim : boolean ), located in the UnitFlagManager.lua file, which changes the dimming state (transparency) of the unit icon. SetDim is called by another function:

function UnitFlag.UpdateReadyState( self )
local pUnit : table = self:GetUnit();
if (pUnit ~= nil and pUnit:IsHuman()) then
self:SetDim(not pUnit:IsReadyToSelect());
end
end

This is the only function that calls the UnitFlag.SetDim function. The call to SetDim requires a third function, this one called IsReadyToSelect().

Now here is the weird thing: IsReadyToSelect does not have a function definition anywhere...

pic1.jpg


pic2.jpg


As you can see in the images, one function call, but zero function definition. Anyone have a clue about what's going on?
 
Last edited:
Alright so I found a mention of IsReadyToSelect in the GameCOre_Base_FinalRelease.dll file (in civ6/base/binaries/Win64Steam):

pic3.jpg


Is this a clue that the function is defined inside of the .dll file?

Then I came over this link: http://modiki.civfanatics.com/index.php?title=Basic_DLL_tasks

Where it says "The Civilization V SDK ships with the C++ source code for the Civilization V CvGameCoreDLL. This is the most powerful tool modders have, as it allows us to directly alter game code and game logic"

But that, of course, is for civ 5. I looked through the civ 6 SDK folder for source code, but didn't find any, althought I don't really know what it should look like.

So, is it impossible to view the code of the .dll file?
 
Firaxis have not released the DLL for Civ6. So, no, you cannot access it.

-----------------------------------------------------------

And yes, the Unit:IsReadyToSelect() would be part of the API built into the DLL and so would not be defined within any of the lua files anywhere.

This "built into the DLL" will be true for any Unit:X(), City:X(), Player:X(), etc functions, and not all such functions are valid in UI context nor in GameplayScript context (some that are valid in UI are not valid in Gameplay, and Vice Versa). You should see Gedemon's thread in the tutorials for what functions are valid in which contexts.
 
UI is for lua that runs a User Interface panel, like the city production panel where you select what to build.

GameplayScripts is for lua that creates a direct in-game effect, like giving more money to the player, or adding a building to a city, based on the code set up in the script.
 
Top Bottom