• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

A couple more "quick" inquiries

Alright! I've got a new problem! Fun fun fun :D

This one should just be a nitpicking problem. I'm trying to get the decisions I wrote for one of my civs into the game, but instead of showing up in the list of decisions, they apparently prevent all other decisions from showing up. Useful! :p

So if anyone here knows how to make mods compatible with E&D and could find anything that I forgot, much appreciated
Download

TIA,
AW
 
I'm getting an error on line 98. It seems that if the "HymnsOfRepentance" hasn't been enacted, iNumTimes is nil. Adding a check after you load the number of times and before the you compare it to 8 to convert iNumTimes to 0 if it's nil (like you do elsewhere in the code) might solve it.

Side note: maybe I'm not understanding the cost formula correctly, but it seems as if the decision will cost a ridiculous amount of faith very quickly ( 50 ^ 2 = 2500; 50 ^ 3 = 125,000)

The civ is beautiful!
 
I probably meant to multiply rather than raise to an exponent. Gnah, it's all just doing stuff to numbers. Practically all the same :p

So I added in a line right before the decision that sets the load(pPlayer blah blah blah) to 0 if it's nil. And with that... it still manages to remove all decisions from the enactable plaenl. What the heck life :shake:
 
And with that... it still manages to remove all decisions from the enactable plaenl. What the heck life :shake:

And this is why I think E&D support is the same amount of work as creating an entire civ... :crazyeye: Let me keep looking.

EDIT:
OK, I got the other decisions to show up but not the civ-specific ones. Notes:

  • I'm getting a Database error, I believe related to the EventsAndDecisions_REDACTED.sql file:
    Code:
    3 values for 5 columns
     near "(": syntax error
  • The TXT_KEYs were not updated in the Lua file for Hymns decision nor did they exist in the sql file
  • The Hymns .DoFunc didn't do a save( x,x ) function, which I think is necessary
  • In the Synod decision, the function GetReligiousUnity looks for 2 arguments (pPlayer, iReligion) and iReligion was missing

As it stands, there must be something more or my fixes were wrong, too - since I still didn't get it to work (yet)
 
OK, I'm still getting an error in the SQL file that is making the TXT_KEYS not work (Since my majority religion is XML-ism I'm a little lost in SQL-land :lol:) but the decisions seem to be firing and having the desired affect. One exception: the Synod decision is throwing an error with the dummy policy that I didn't explore.

Link to the modified file
 
Bump!

I'm playing a game with several of my mods currently, and let's just say testing seems to have glossed over quite a number of glitches... :blush:

I mean,
  • Forgot to include the danrell's special animations for the Magyar Horka's late-game graphics (a Hungarian tank model), so it appears a tank driving top-first through the ground
  • Forgot to give the Livonian Herrmeister a unit flag
  • Forgot to give Arpad a unique introduction dialogue, and I think Argishti's isn't hooked up correctly
  • Various log errors from Zapotecs and Urartu that I haven't looked much into
  • et cetera, et cetera

What the one really disturbing error is:
  • Kurdish cities... are invincible?!?

I'm attackinga Kurdish city with artillery (I've also steamrolled Georgia and the Zapotecs FWIW :p) and the city health bar just refills to full health!

...but not instantly.

You can actually visibly see the health bar rising at a constant rate, not being healed all at once, which is cool, but it this obviously an error, and not a convenient one for me.

There's basically two explanations for this, and they both come from Georgia.

Hunch #1 is that for some reason the Georgian code which pushes HP regen for Metsikhovne is firing when attacking a city (and not a Georgian one at that, although the Metsikhovne code doesn't take civilization into account on purpose). So:

Problem #1: Does Events.EndCombatSim fire for cities as well as units?

Hunch #2 is that the problem is related to Georgia's UA, which stipulates that each follower of Georgia's main religion reduces the damage taken by cities by 5%, even in friendly foreign cities. Indeed, a new error shows up whenever I attack the Kurdish city, and it traces back to Georgia's UA lua file, not the UU lua file.

This raises several problems:

Problem #2: Is there some way about the way that I coded Georgia's UA that would cause Georgia's friends cities to be healed... but not those of Georgia itself?

Problem #3: ...especially since there isn't a single Eastern Orthodox (Georgia's main religion) follower in the target city?

Problem #4: ...and why DIDN'T it heal immediately, instead of showing the HP bar rise?

Problem #5: ...and why did it heal all the HP? Isn't each follower (of which, I will reiterate, there were zero) supposed to reduce damage by 5% of the city's max HP? Or did I code that wrong too?

Problem #6: Or does City.GetMaxHitPoints() not do what I think it does?

I'm hoping the problem is really hunch #1, because that will be much easier to fix. :p

TIA,
AW
 
Code:
Events.SerialEventCitySetDamage.Add(
function(iPlayer, iCity, iDamage, iPreviousDamage)
	local pPlayer = Players[iPlayer]
	local pCity = pPlayer:GetCityByID(iCity)
	for k,v in pairs(GetFriendlyGeorgianReligions(iPlayer)) do
		local iMaxHP = pCity:GetMaxHitPoints()
		pCity:ChangeDamage(-math.ceil(iMaxHP * (iHPHPMRFB * fHPHPMRFM) ))
		if pPlot:IsVisibleToWatchingHuman() then
			local pPlot = pCity:Plot()
			Events.AddPopupTextEvent(HexToWorld(ToHexFromGrid(Vector2(pPlot:GetX(), pPlot:GetY()))), "[COLOR_16NP_BLUE]Georgia's faithful will not be subdued![ENDCOLOR]", 0)
		end
	end
end)

The above UA code triggers when the hit points of a city changes ...

... Spotted the error yet?

... No? Ask yourself what the code does

... Still not spotted it?

BUT, the code itself changes the hit points of the city.

... Still not got it?

Which causes the event to trigger again ... which changes the hit points of the city ... which causes the event to trigger again ...

Code:
local bProcessingCityDamage = false

Events.SerialEventCitySetDamage.Add(
function(iPlayer, iCity, iDamage, iPreviousDamage)
	if (not bProcessingCityDamage ) then
		bProcessingCityDamage = true

		local pPlayer = Players[iPlayer]
		local pCity = pPlayer:GetCityByID(iCity)
		for k,v in pairs(GetFriendlyGeorgianReligions(iPlayer)) do
			local iMaxHP = pCity:GetMaxHitPoints()
			pCity:ChangeDamage(-math.ceil(iMaxHP * (iHPHPMRFB * fHPHPMRFM) ))
			if pPlot:IsVisibleToWatchingHuman() then
				local pPlot = pCity:Plot()
				Events.AddPopupTextEvent(HexToWorld(ToHexFromGrid(Vector2(pPlot:GetX(), pPlot:GetY()))), "[COLOR_16NP_BLUE]Georgia's faithful will not be subdued![ENDCOLOR]", 0)
			end
		end

		bProcessingCityDamage = false
	end
end)
 
Ooohhhhhhhhhhhh boy, rookie mistake :crazyeye:
thx hoo-ward :D

I guess I'll have to a little digging to figure out why it's firing at all, but this is a good start. (since the table GetFriendlyGeorgianReligions(iPlayer) should be empty if there are no georgian religious followers present in the city, and therefore the iterator should cause nothing to happen)
 
So here's the frustration of the day...

You know how many functions come in sets of three:
- The "Get" function which returns an integer,
- The "Set" function which assigns the integer, and
- The "Change" function, which is basically Set(Get + Delta)

Well... :p
So there's this function City.ChangeSpecialistGreatPersonProgressTimes100, which you'd think would be a Change function, y'know, given it's name... but it turns about to be a Get function.... even though Firaxis already supplied a Get function for this! :mad:

From FireTuner:
Code:
> Players[0]:GetCityByID(8192):ChangeSpecialistGreatPersonProgressTimes100(GameInfoTypes.SPECIALIST_ENGINEER, 2)
2

So I actually need to change Great Person points in a city. I made a new function using City.SetGreatPeopleUnitProgress, which is as follows:
Code:
function ChangeSpecialistGreatPersonProgress(pCity, iGPType, iDelta)
	local get = pCity:ChangeSpecialistGreatPersonProgressTimes100(iGPType)
	pCity:SetGreatPeopleUnitProgress(iGPType, get + iDelta)
end

And then you know what FireTuner gave me when I tried to run this?!?
Code:
Runtime Error: C:\Users\AW\Documents\My Games\Sid Meier's Civilization 5\MODS\[COLOR_16NP_BLUE]AW's [REDACTED] Mod[ENDCOLOR] (v 1)\Lua/UB_Functions_REDACTED.lua:38: attempt to call method 'SetGreatPeopleUnitProgress' (a nil value)
[pissed][pissed][pissed][pissed][pissed][pissed][pissed]

Admittedly, the parameters listed on the Modiki require a UnitType ID and not a SpecialistType ID, but the fact that the method itself is nil...

Problem: Is there actually a way, in Lua, to change the Great Person Points of a city?

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

Sort of related... I'm basically trying to create a unique process. Since I don't know of any way of working with processes in Lua, I'm basically just making a building with a cost of 0 that, when built, yields, um... stuff, and then is removed from the city. (Also with HurryCostModifier = -1 on the guess that that disables gold purchasing)

An alternative way might be to set the cost at some freakishly high number - say, 99999999999999 - and every turn while the city is working on the building, stuff is yielded.

What I'm wondering is which way will register better with the AI. I don't know if the low cost will cause the AI to get stuck building this process each turn, at the expense of actually important buildings. And I also don't know if the high cost of the other way will discourage the AI from building the process-building... or if it will just make them waste Great Engineers on it, or what.
 
Well I could tell you ... but you called me "hoo-ward" :mad: ...

So there's this function City.ChangeSpecialistGreatPersonProgressTimes100, which you'd think would be a Change function, y'know, given it's name... but it turns about to be a Get function.... even though Firaxis already supplied a Get function for this! :mad:

From FireTuner:
Code:
> Players[0]:GetCityByID(8192):ChangeSpecialistGreatPersonProgressTimes100(GameInfoTypes.SPECIALIST_ENGINEER, 2)
2

See my spreadsheet of BNW API methods, this method is one of the "buggy" ones that return random crap (shown as "nil" in the return value column)

It does actually change the GP progress, but I'm guessing you meant to use 200 and not 2 (it's times 100), as 2/100th of a progress will get lost in the rounding process
 
Hmm. I thought I had responded to whoward's post. Since apparently I didn't... um... well, to begin, I guess I suck at foruming. :p
Less self-deprecatingly, yay for whoward :D It was indeed the input being 100x too small.

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

So new problem: my mod is crashing and I have no idea why. Game crashes right after hitting the "start game" button. :/

It might have something to with a bit of code which switches between to UAs depending on whether the user is using BNW or just G&K, but I don't know for sure.

At any rate, if anyone would like to help figure out why, here's the link, entitled "Tell No One" because redaction and secrecy, etc. etc. :p

TIA,
AW
 
This can't help but I don't think it is file-fatal
Code:
INSERT INTO Building_YieldChanges
	(BuildingType,						YieldType,				Yield)
VALUES
	('BUILDING_AW_TEXTILE_MILL_RIVER',	'YIELD_PRODUCTION',		2),
	('BUILDING_AW_TEXTILE_MILL_STEAM',	'YIELD_PRODUCTION',		2);
	
INSERT INTO Building_YieldChanges
	(BuildingType,						YieldType,				Yield)
VALUES
	('BUILDING_AW_TEXTILE_MILL_RIVER',	'YIELD_PRODUCTION',		2),
	('BUILDING_AW_TEXTILE_MILL_STEAM',	'YIELD_PRODUCTION',		2);
Nor would it cause the game to crash, I don't think.
 
Hmm. I thought I had responded to whoward's post. Since apparently I didn't... um... well, to begin, I guess I suck at foruming. :p
Less self-deprecatingly, yay for whoward :D It was indeed the input being 100x too small.

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

So new problem: my mod is crashing and I have no idea why. Game crashes right after hitting the "start game" button. :/

It might have something to with a bit of code which switches between to UAs depending on whether the user is using BNW or just G&K, but I don't know for sure.

At any rate, if anyone would like to help figure out why, here's the link, entitled "Tell No One" because redaction and secrecy, etc. etc. :p

TIA,
AW

Hello, I have seen your mods posted here and on steam, never tried them but they do look nice.

I have a question for you, as I am going to help you out if I can. Does your mod use a modified DLL? If so which one.

Sorry for my lack of knowledge on the specifics of your mod, this is the first time I have viewed this long running thread. It just caught my attention. ;)
 
Opening up the mod contents you provided, it appears you do not use a custom DLL, unless you omitted it from this copy. Is that correct?

Also, do I have permission to make a custom build of this mod for debugging purposes?
 
*headdesking intensifies*

Well, this might be the problem... :p
Spoiler :
From SQL/TraitSwap.sql:
Code:
INSERT INTO BuildingClasses
	(Type, 										DefaultBuilding,							Description)
VALUES
	([COLOR="Red"][B]'BUILDING_AW_BELGIUM_BNW_DELEGATES_1', 	'BUILDING_AW_BELGIUM_BNW_DELEGATES_1',[/B][/COLOR] 		'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_1'),
	([COLOR="Red"][B]'BUILDING_AW_BELGIUM_BNW_DELEGATES_2', 	'BUILDING_AW_BELGIUM_BNW_DELEGATES_2',[/B][/COLOR] 		'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_2'),
	([COLOR="Red"][B]'BUILDING_AW_BELGIUM_BNW_DELEGATES_4', 	'BUILDING_AW_BELGIUM_BNW_DELEGATES_4',[/B][/COLOR] 		'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_4'),
	([COLOR="Red"][B]'BUILDING_AW_BELGIUM_BNW_DELEGATES_8', 	'BUILDING_AW_BELGIUM_BNW_DELEGATES_8',[/B][/COLOR] 		'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_8');

INSERT INTO Buildings		
	(Type, 									BuildingClass, 			  				Cost, 	FaithCost,	GreatWorkCount,	ExtraLeagueVotes,	Description, 									Help,												NeverCapture)
VALUES	                                                                                                                    
	([COLOR="Red"][B]'BUILDING_AW_BELGIUM_BNW_DELEGATES_1',	'BUILDING_AW_BELGIUM_BNW_DELEGATES_1',[/B][/COLOR]	-1, 	-1,			-1,				1,					'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_1', 	'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_1_HELP',	1),
	([COLOR="Red"][B]'BUILDING_AW_BELGIUM_BNW_DELEGATES_2',	'BUILDING_AW_BELGIUM_BNW_DELEGATES_2',[/B][/COLOR]	-1, 	-1,			-1,				2,					'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_2', 	'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_2_HELP',	1),
	([COLOR="Red"][B]'BUILDING_AW_BELGIUM_BNW_DELEGATES_4',	'BUILDING_AW_BELGIUM_BNW_DELEGATES_4',[/B][/COLOR]	-1, 	-1,			-1,				4,					'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_4', 	'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_4_HELP',	1),
	([COLOR="Red"][B]'BUILDING_AW_BELGIUM_BNW_DELEGATES_8',	'BUILDING_AW_BELGIUM_BNW_DELEGATES_8',[/B][/COLOR]	-1, 	-1,			-1,				8,					'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_8', 	'TXT_KEY_BUILDING_AW_BELGIUM_BNW_DELEGATES_8_HELP',	1);

:shake::shake::shake:

I actually found this out yesterday and then apparently closed the tab again before hitting the reply button. :p Once this was fixed it was discovered that the game was still crashing once settling a city or trying to produce anything, and that turned out to be caused a faulty "check for UA" line in the lua.
It's all fixed now :goodjob:
 
Just out of curiosity, what exactly did you do to the SQL file to fix your problem? I took it upon my self to do a custom build of the mod you linked, for debugging purposes. I came to the same conclusion that the TraitSwap.sql file was the culprit.

I am just curious what your solution was, as I found this crash problem to be rather interesting, and wanted to investigate for scientific purposes. :P
 
<Type> in BuildingClasses and <BuildingClass> in Buildings should be referencing a buildingclass, not a building. Basically, the code right here is stipulating something along the lines that the building is part of a larger group of itself. :p
That last sentence didn't make sense... not to the computer, either ;)
 
<Type> in BuildingClasses and <BuildingClass> in Buildings should be referencing a buildingclass, not a building. Basically, the code right here is stipulating something along the lines that the building is part of a larger group of itself. :p
That last sentence didn't make sense... not to the computer, either ;)

Yes, I thought that might be it. Interestingly enough, this crash you experienced was actually caused by a DLL, memory access violation. Which makes sense given that you had the wrong type of data being inserted into the database.

After I built the project I attached a built copy of the unmodified DLL to your project. After that, Visual Studio 2015 debugger showed that the memory access violation occurred at line 1726 of CvInfos.cpp, which is the return statement for the CvBuildingClassInfo::getMaxGlobalInstances() method.
 
Back
Top Bottom