A couple more "quick" inquiries

This would be disconcerting if true,

This does appear to be true for Civ:BE (and I believe the original comment was made in those forums) - but then Civ:BE has bigger database issues, ie the failure to flush the cache after adding promotions, builds, and possibly other "unit actions"
 
Alright, necroing again to ask about this:

#n) Free Golden Age points when anybody else's city is razed.

It occurs to me that we could use the same GameEvents.PopulationSet - probably - but since we'd need it to fire when the city is destroyed... and we need to check if the owner does not equal the player who has this UA, which requires getting the city's owner... but if the city is already erased from the map and doesn't exist anymore... won't that prove a tad problematic?
 
That would depend on when exactly during the process of City razing that event fires.

It would be best to write up a quick function to test it and see whether the City still exists or not at the time the event fires. My assumption is that it should be before the City is completely removed, since the game can't set Population to 0 for a City that doesn't exist.
 
Another necro!
(I wonder if the mods look down on this kind of personal help thread...)

Anyway, just to jump around one more time, I've got a simple SQL syntax question and a much more complicated UI question:
SQL) How does one delete all buildings whose buildingclasses have MaxGlobalInstances or MaxPlayerInstances > 0?
In other words, how to delete all wonders? I think this is possible in XML... maybe... except I'm pretty sure I need to put this in a trigger.

UI) How can I create a UI context that will list 12 boxes with nothing but text in them vertically, that can be selected to give free policies and promotions?
I'm not concerned about the second part. I'm more concerned just with setting up 12 boxes on top of each other. I was thinking of converting the Mayan calendar bonus UI, since it appears that XML portion just codes for one box and then the lua iterates over all great people and duplicates the box accordingly. I guess I could just maybe copy the XML... then edit the lua to make a new table for it to iterate over, then remove the icon hooking. Does that sound doable?
 
How does one delete all buildings whose buildingclasses have MaxGlobalInstances or MaxPlayerInstances > 0?
In other words, how to delete all wonders?
Use a "join" within a SELECT to find all the buildings and then delete them
Code:
DELETE FROM Buildings WHERE Type IN 
  (SELECT b.Type FROM Buildings b, BuildingClasses bc
     WHERE bc.MaxGlobalInstances > 1 OR bc.MaxPlayerInstances > 0
     AND bc.Type = b.BuildingClass AND b.Cost > 0);
You need the Cost > 0 part to avoid deleting the Palace

How can I create a UI context that will list 12 boxes with nothing but text in them vertically, that can be selected to give free policies and promotions?
You need 12 TextButtons. Simple way, list 12 TextButtons and hook them all up individually. More complex way, use the InstanceManager to create 12 instances of a generic button. The simple way is covered in UI Tutorial 1, the more complex way in UI Tutorial 2
 
And then to delete all wonder except some specific ones, add would add in WHERE Type NOT IN blah, blah, blah before the semicolon?

And the Mayan calendar bonus does the more complex way, right? Well if that's already set up... couldn't I just make a new table in lua for it to iterate over and remove the icons? Since otherwise I'd need to duplicate the generic button 11 times and I'm more concerned with screwing something up in the XML...
 
Alright, thanks whoward. I've basically got this, which is hopefully correct:
Spoiler :
Code:
DELETE FROM Buildings WHERE Type IN 
  (SELECT b.Type FROM Buildings b, BuildingClasses bc
     WHERE bc.MaxGlobalInstances > 1 OR bc.MaxPlayerInstances > 0
     AND bc.Type = b.BuildingClass AND b.Cost > 0 WHERE Type NOT IN(
		'BUILDING_X',
		'BUILDING_Y',
		'BUILDING_Z',
		'BUILDING_BLAH',
		'BUILDING_FOOBAR')
	);
Another thing about SQL... I've never seen anyone write their game text in SQL. Does SQL not work for that or is it just that XML is syntactically easier for writing text in?

I'd like to return to inquiry #n. So I guess I would make the golden age points be given when the city starts razing, allowing me to use GameEvents.SetPopulation.
This code right now... to be honest I'm kind of throwing lua at the wall to see what sticks (although it's probably going to stick as well as throwing a rubber frog at the wall), but here's my best guess:
Code:
GameEvents.SetPopulation.Add(
function(iX, iY, iOldPop, iNewPop)
	local pCity = Map.GetPlot(iX, iY):GetPlotCity()
	local pPlayer = Players[pCity:GetOwner()]
	if (iNewPop < iOldPop) and pCity:IsRazing() then
	if not (GameInfo.Leader_Traits{LeaderType={GameInfo.Civilization_Leaders{CivilizationType={GameInfo.Civilizations{ID=pPlayer:GetCivilizationType()}}}}} == GameInfoTypes.TRAIT_X) then
	-- that last check was essentially make sure pPlayer isn't the civilization in question
		for i, iPlayer in pairs(Players) do
			if not (Players[iPlayer] == pPlayer) then
				Players[iPlayer]:ChangeGoldenAgeProgressMeter(x)
					-- I'll worry about defining x later
				end
			end
		end
	end
end)
Currently this would give GA points for every turn that a city is razing, which I would need to fix. The main problem I have is finding a completely other civ other than the one whose city is changing population.
 
Personne ne sait? :(
Spoiler (Translation) :
No one knows?


Also, I was having trouble finding a function that would suit my purposes for this, a new wonder:
#number) Free Castle and 10 free influence with all city-states, and building castles gives free influence for all city-states within 10 tiles of the city in which the castle was built.
I don't find any of this a problem... except for I can't find a method to change CS influence. :/ I'm not even sure there's a method to retrieve it... unless it's just poorly named and is... Player.GetMinorCivFriendshipWithMajor? Based on the example code given from CityBannerManager, it looks like it does the same thing...

So to change it, would you just reassign it?
Code:
minorPlayer.GetMinorCivFriendshipWithMajor(pPlayer) = minorPlayer.GetMinorCivFriendshipWithMajor(pPlayer) + 10
Assuming these players are already defined?

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

Also, another thing: I've asked this several times in separate places without any reply, but...
Is anyone aware of which parts of Gedemon's HSD I can "borrow" to make every civ except one spawn at 4000 BC? Because then I'd like to change the GlobalDefines value for default spawn date to -4500, giving that one player 5 extra turns or something.
 
player:GetSomething is pretty much always only going to let you capture the current information, but can't be used to alter the current information. You need to look for a player:SetSomething or a player:ChangeSomething

This will be true whether the leading element is "player" or "unit" or "city", or whatever.

Having said, there are still a boat-load of irksome exceptions. Such as you don't do city:GetPlot(), you do city:plot(). These exception cases are all both confusing and annoying.
 
I would think that the reciprocal function for Player.GetMinorCivFriendshipWithMajor would be Player.ChangeMinorCivFriendshipWithMajor, except it shows these parameters, which are completely unhelpful:
Code:
void Player:ChangeMinorCivFriendshipWithMajor(PlayerID player)
Which is why I brought up reassignment, which I'm pretty sure works in some cases, but I wasn't sure about this one.
 
player:GetSomething is pretty much always only going to let you capture the current information, but can't be used to alter the current information. You need to look for a player:SetSomething or a player:ChangeSomething

This will be true whether the leading element is "player" or "unit" or "city", or whatever.

Having said, there are still a boat-load of irksome exceptions. Such as you don't do city:GetPlot(), you do city:plot(). These exception cases are all both confusing and annoying.

But why IsHasTheseInconsistencies :/

I would think that the reciprocal function for Player.GetMinorCivFriendshipWithMajor would be Player.ChangeMinorCivFriendshipWithMajor, except it shows these parameters, which are completely unhelpful:
Code:
void Player:ChangeMinorCivFriendshipWithMajor(PlayerID player)
Which is why I brought up reassignment, which I'm pretty sure works in some cases, but I wasn't sure about this one.

Hm, there is a Player:ChangeMinorCivFriendshipWithMajor(PlayerID player, influenceChange) parameter, even if not on the wiki. The player object in this instance is the minor civ, btw.
 
Whoops, disregard; misread.

The modiki really needs a good overhaul to add all this missing info.
I know my Civ relies extremely heavily on one plot method that isn't even listed in there.
 
So, whilst trying to code this, I got this far:
Code:
GameEvents.CityConstructed.Add(
function(playerID, iCity, iBuilding)
	if (iBuilding == GameInfoTypes.BUILDING_X) then
		for iPlayer, pPlayer in pairs(Players) do
			if not (iPlayer == playerID) and (pPlayer:IsMinorCiv()) then -- beyond this point, pPlayer is a CS, NOT THE BUILDER OF THE WONDER
				pPlayer:ChangeMinorCivFriendshipWithMajor(playerID, 20)
			end
		end
	end
end)

GameEvents.CityConstructed.Add(
function(iPlayer, iCity, iBuilding)
	if (GameInfo.Buildings{ID=iBuilding}.BuildingClass == "BUILDINGCLASS_CASTLE") then
		pPlayer = Players[iPlayer]
		if (IsHasWonder(iPlayer, GameInfoTypes.BUILDING_X)) then
			pCity = pPlayer:GetCityByID(iCity)
And then confused myself. The second function deals with "building castles gives free influence for all city-states within 10 tiles of the city in which the castle was built". So how do I find all cities within 10 tiles of pCity? :confused: PlotIterators, no doubt?
Beyond that point it should be as easy as seeing if the owner of the city is a CS, and if it is, changing its influence with the major player like how has already been done.

whoward said GameEvents.CityConstructed works with all expansions, just isn't documented for all of them, right?

And if you're wondering what the heck IsHasWonder is, it's this, as a result of my not being able to find a Player.HasWonder function or the likes:
Spoiler :
Code:
function IsHasWonder(playerID, wonderType)
	local pPlayer = Players[playerID]
	local b_HasWonder = false
	for pCity in pPlayer:Cities() do
		if pCity:IsHasBuilding(wonderType) then
			b_HasWonder = true
		end
	end
	return b_HasWonder
end
 
You could try to make use of Map.PlotDistance() maybe.
Iterate through the players, check if they are minors, get their Capital's X/Y coordinates, and compare with your City's coordinates.

I haven't used it before though, so I'm not entirely sure how it calculates the distance.
Otherwise, you could try using whoward's PlotIterators script (be careful with using that name as a default, since it conflicts with RAS) and set the radius to 10... but that will be an absolute boatload of plots it'll have to iterate through.
 
Code:
iNumWonderArtemis = pPlayer:GetBuildingClassCount(GameInfoTypes.BUILDINGCLASS_TEMPLE_ARTEMIS)
will give you the number of Buildings that belong within the BUILDINGCLASS_TEMPLE_ARTEMIS that pPlayer has in all of its cities. But since world wonders are limited to 1 per world per game, if iNumWonderArtemis cames back as "1", then you know that pPlayer has built or is in control of Temple of Artemis. If the player hasn't built or isn't in control of the wonder, it will come back as "0".

I only figured out this simpler method a short time ago. I don't think I'd figured it out back when you asked about methods to detect if/when/who has control of a wonder.
 
Alright, when I finally tested this mod's Alpha 1.00000000000000000o0 version, I'm getting some strange errors in the database log.
The mod is mostly written in SQL because of the sheer amount of stuff I needed to code, so I'm getting errors like these:
Code:
[40641.052] near "(": syntax error
[40641.068] near "(": syntax error
[40641.068] near ",": syntax error
[40641.068] near "(": syntax error
The logs can't be any more specific about where? I don't suppose there's any way to make them? Or something I can run the SQL through to check for syntax errors?

Also, what? :hmm:
Code:
[40640.226] no such table: Language_zh_CN
[40640.226] In Query - insert into Language_zh_CN('Tag', 'Text') values (?, ?);
[40640.226] In XMLSerializer while updating table Language_zh_CN from file Localization/IGE_ZH_CN.xml.
I never tried adding Chinese text...?

It's also most likely complaining about this:
Code:
UPDATE Buildings SET WonderSplashAudio='AS2D_WONDER_QUOTE_'||Type WHERE BuildingClass.MaxGlobalInstances > 0;
Basically, there's 42 new wonders and I didn't want to be bothered to write out a toggleable UPDATE statement for every single one for wonder audio, so I just tried to circumvent it with this... it's apparently wrong? I'm guessing I'd have to borrow a line from whoward's code he posted earlier on this page to select the buildingclass?

And lastly... when I go to select civilizations, the leader shown at first is Haile Selassie... then all heck breaks loose when I choose the drop down menu, and the only civ choice is Random Leader. :confused: Is there a minimum number of civs that need to exist in the game? Because I deleted all the 43 standard ones and replaced them with... what, 10, I think?

Beginning playtest round 2 now that I've tracked down one error; can attach a mod privately, but like all things I'd like to keep it secret (although in a week I'm releasing the alpha version whether it functions or not :p) but also it's a pretty big download. But I'm wondering if anyone else has experienced this weirdness.
 
Chinese text issue is related to IGE. It always throws up errors about it. That and about a hundred other usual IGE errors are safe to ignore, though the sheer number of them does tend to make me prefer using Firetuner over IGE simply to avoid the error spam.

No idea on SQL stuff, since I haven't yet bothered with it just yet.

Broken Civ Select screen probably has to do with your other SQL files erroring out, since it typically means there's an issue with a Civ's unique stuff missing, or something around there.
 
If you're not adding 42 new mp3 files with the required audio, and the necessary AS2D tables required to register a single audio file into the game (x 42 new wonders), then I'd suggest taking the simplest route with <WonderSplashAudio>. Set to the default value of absolutely nothing (ie, omit the column altogether for those nifty new wonders). "NONE" also works.

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

IIRC 7 is the minimum number of valid civs registered to the database in order to not get CTD
 
Would anyone happen to know anything about this error ModBuddy gives me when it fails to build my whopper of a mod?
Code:
------ Build started: Project: AW's [REDACTED], Configuration: Default x86 ------
C:\Program Files (x86)\MSBuild\Firaxis\ModBuddy\Civ5Mod.targets(129,9): error MSB4018: The "PackageMod" task failed unexpectedly.
SevenZip.SevenZipException: The execution has failed due to the bug in the SevenZipSharp.
Please report about it to http://sevenzipsharp.codeplex.com/WorkItem/List.aspx, post the release number and attach the archive.
   at SevenZip.SevenZipBase.ThrowException(SevenZipBase handler, Exception[] e)
   at SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, SevenZipBase handler)
   at SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames)
   at SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, Int32 commonRootLength, String password, String[] fileFullNames)
   at SevenZip.SevenZipCompressor.CompressFiles(String archiveName, String[] fileFullNames)
   at Firaxis.ModBuddy.Civ5ModBuildTasks.PackageMod.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
I'm guessing the civ selection bug is happening because of a couple errors in the Building sql file.
 
Top Bottom