Gods and Kings API Documentation Changes

Found something interesting. You can found 2 religions in a civilization, so you have two holy cities (two different cities...I didn't try founding in same city). This breaks some assumptions in ReligiousOverview.lua, so the screens only show the last founded. But this could probably be fixed and it seems to be working otherwise (well...I checked to make sure at least 1 belief was working for each religion).

Something annoying. I haven't figured out an easy way to do a simple check to see if a religion has been founded. I thought that Game.GetFounder(eReligion,-1) might return -1 or nil, but this function and all others I've tested give CTD if you supply an eReligion that has not been founded yet.
 
I haven't figured out an easy way to do a simple check to see if a religion has been founded.

You need to iterate all players, see if they have founded a religion and then check which one they have founded (eg)

Code:
for iPlayer = 0, GameDefines.MAX_MAJOR_CIVS - 1 do
  local pPlayer = Players[iPlayer]
  if (pPlayer:IsEverAlive() and pPlayer:HasCreatedReligion()) then
    takenReligions[pPlayer:GetReligionCreatedByPlayer()] = iPlayer
  end
end

Not "simple" but it doesn't CTD ;)
 
That method is thwarted by the weird thing I'm doing in the first part of my post above (having a player found >1 religion).

Oh well... I'm using Lua to found each religion so I can certainly use my own data storage to remember it.
 
Still related to combat events badly broken since .674, I've tried the following:

Spoiler :
Code:
function ListFightingUnits()
	for iPlayer = 0, GameDefines.MAX_PLAYERS do
		local player = Players[iPlayer]
		if player ~= nil then
			if player:IsAlive() then
				for unit in player:Units() do
					local missionPlot = unit:LastMissionPlot()
					local unitPlot = unit:GetPlot()
					local plotStr = ""
					if missionPlot then
						plotStr = plotStr .. ", last mission plot = (".. missionPlot:GetX() .. "," .. missionPlot:GetY() ..")"
					else
						plotStr = plotStr .. ", last mission plot = none"
					end
					if unitPlot then
						plotStr = plotStr .. ", unit plot = (".. unitPlot:GetX() .. "," .. unitPlot:GetY() ..")"
					else
						plotStr = plotStr .. ", unit plot = none"
					end
					if (missionPlot and unitPlot) and (missionPlot ~= unitPlot) then
						print (" -" .. unit:GetName() .. " missionplot ("..tostring(GetPlotKey ( missionPlot ))..") is different than unitplot ("..tostring(GetPlotKey ( unitPlot ))..")")
					end
					if unit:IsFighting() then
						print (" -" .. unit:GetName() .. " is Fighting".. plotStr)
					end
					if unit:IsInCombat() then
						print (" -" .. unit:GetName() .. " is in Combat".. plotStr)
					end
					if unit:IsDefending() then
						print (" -" .. unit:GetName() .. " is defending".. plotStr)
					end
					if unit:IsAttacking() then
						print (" -" .. unit:GetName() .. " is attacking".. plotStr)
					end
					if unit:IsBusy() then
						print (" -" .. unit:GetName() .. " is busy".. plotStr)
					end
				end
			end
		end
	end
end
GameEvents.GameCoreUpdateBegin.Add(ListFightingUnits)
Events.LocalMachineAppUpdate.Add(ListFightingUnits)

It seems that IsFighting, IsAttacking, IsDefending, IsInCombat are now always false whatever the situation, and IsBusy is only called during movement, never in combat.

LastMissionPlot refers to a targeted plot for multiple turns movement, and never refer to a ranged target as it was before the .674 patch during start combat sim.

So I've still found no way to repair my combats functions :cry: :cry: :cry:
 
So I've still found no way to repair my combats functions :cry: :cry: :cry:

Tell me about it. You wouldn't BELIEVE the list of things I've tried, many of which are so flaky they'd cause experienced programmers to run screaming in terror. I've given up on it, which means my mods will stay dead until we get the DLL and I can fix it RIGHT.

It's just so stupid. I can understand why they'd want to add a combat event that's more UI-efficient for their own use, but did they really have to break the ones we already had?
 
Can someone confirm that EndCombatSim is not called not only when the defending unit dies, but also when the combat is in the fog of war for the active player ?

If true that the end of the WWII mod until the DLL is out.

Or I'll have to made full map visibility for all player until then, maybe not a so bad alternative for that type of mod, except for the hours-long turns. :think:
 
Top Bottom