A couple more "quick" inquiries

<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 ;)
OuroborosOrder's user-name is quite appropriate here. The BuildingClass and Building have the same string for their names, so in essence within the BuildingClasses table the game is being told that the Building-Class has a default building that is itself, and in table Buildings the game is being told that the Building belongs to a Building-Class that is itself.

Head, eat thy Tail, to infinity!

This is new territory you've discovered here, AW. I bet the CTD was helped along by the game throwing a fit when trying to build the GameInfoTypes for the API :lol:
 
OuroborosOrder's user-name is quite appropriate here. The BuildingClass and Building have the same string for their names, so in essence within the BuildingClasses table the game is being told that the Building-Class has a default building that is itself, and in table Buildings the game is being told that the Building belongs to a Building-Class that is itself.

Head, eat thy Tail, to infinity!

This is new territory you've discovered here, AW. I bet the CTD was helped along by the game throwing a fit when trying to build the GameInfoTypes for the API :lol:

I was a bit tired when I did this last night, can not believe I didn't notice the infinite recursion that this created though. I'm usually more on top of my game then that. XD

See my previous post at the end of the last page, it was this specifically as a matter of fact, you hit the nail on the head. :)
 
Okay, so an actually quick inquiry

1) To check for a ideology, do I just check for if the player has the opener policy?
 
Okay, so an actually quick inquiry

1) To check for a ideology, do I just check for if the player has the opener policy?

No, use IsPolicyBranchUnlocked - ideologies don't have opener policies.
 
So... is there actually any way to push diplomacy, like force civilizations to accept embassies from each other and DoF each other? I'm finding no such function on the modiki (maybe I should be looking in whoward's BNW methods file :p), although if I can't find it... I may have to think of a new decision for my civ.
 
(maybe I should be looking in whoward's BNW methods file :p)

Indeed you should. :p Player:DoForceDoF(eOtherPlayer) does exactly what it says on the tin, although there doesn't seem to be anything equivalent for embassies.
 
Indeed you should. :p Player:DoForceDoF(eOtherPlayer) does exactly what it says on the tin, although there doesn't seem to be anything equivalent for embassies.

This is why code wraps :lol: Otherwise the forum software is so very helpful.
 
So, in <Buildings>, is <MutuallyExclusiveGroup>, er, mutually exclusive with the <NoLimit> in <BuildingClasses>? Basically, I have two versions of the "same" UB which are mutually exclusive with each other and which also should be limitless to build... but upon building one, I can't build any more of them, even of the same version. If that made sense.
 
So, in <Buildings>, is <MutuallyExclusiveGroup>, er, mutually exclusive with the <NoLimit> in <BuildingClasses>? Basically, I have two versions of the "same" UB which are mutually exclusive with each other and which also should be limitless to build... but upon building one, I can't build any more of them, even of the same version. If that made sense.

<MutuallyExclusiveGroup> makes all buildings with the same setting unbuildable in a city once one building with the group-number has been constructed. But if you are trying to allow one city to have multiple copies of a building with a valid <MutuallyExclusiveGroup> number, I expect all kind of 'hilarity' will ensue. <NoLimit> in BuildingClasses is theoretically to allow multiple copies of the same building to be constructed within a city, but I don't know if anyone has successfully gotten this to work. The <NoLimit> column doesn't affect lua methods for adding a building, nor does it seem to have any effect on whether or not multiple copies of the same building can give 'stacked' effects. How do you have your buildings and buildingclasses structured?
 
although there doesn't seem to be anything equivalent for embassies.
You'll need to create a trade deal between the two players and enact it via the Lua API
 
<MutuallyExclusiveGroup> makes all buildings with the same setting unbuildable in a city once one building with the group-number has been constructed.

This is the important bit.

A and B are exclusive, so both A and B are in the same group. Once you've built A, you've built something in the group so can no longer build anything else in the group, including another A. Bug or by design - hard to tell. It's not intuitive (bug) but is doing what it says (design)
 
I guess then I would keep <NoLimit> but remove <MutuallyExclusiveGroup>, and use GameEvents.CityCanConstruct to enact the restriction. It's used fairly extensively in my current - secret (:p :p :p) - mod.
You'll need to create a trade deal between the two players and enact it via the Lua API
I don't suppose there's a tutorial for working with deals? I have no experience with them; I understand that whatever I do I'll probably use Deal.AddAllowEmbassy() but I don't know how to either create or push that deal.
 
I found one DiploTrade.lua and it shows not indication of any kind of function for initializing or pushing deals; it does include() "TradeLogic", but I couldn't find that maybe I should get agent ransack

At any rate, the trouble with the buildings continues. I removed the MutuallyExclusiveGroup tag from the buildings and added to my current GameEvents.CityCanConstruct function:

(First off - is it fair to say that the "secret" of what my in-dev mod is is pretty much general knowledge? :p If you'd still rather not be surprised, DO NOT CLICK THE SPOILER BELOW)

Spoiler :
Code:
GameEvents.CityCanConstruct.Add(
function(iPlayer, iCity, iBuilding)
	if ((iBuilding == GameInfoTypes.BUILDING_AW_TEXTILE_MILL_RIVER) or (iBuilding == GameInfoTypes.BUILDING_AW_TEXTILE_MILL_STEAM)) then
		local pPlayer = Players[iPlayer]
		local pCity = pPlayer:GetCityByID(iCity)
		if not (pCity:IsHasBuilding(GameInfoTypes.BUILDING_AW_CLOTH_HALL)) then return false end
		[COLOR="Blue"]if ((iBuilding == GameInfoTypes.BUILDING_AW_TEXTILE_MILL_RIVER) and (pCity:IsHasBuilding(GameInfoTypes.BUILDING_AW_TEXTILE_MILL_STEAM))) then return false end
		if ((iBuilding == GameInfoTypes.BUILDING_AW_TEXTILE_MILL_STEAM) and (pCity:IsHasBuilding(GameInfoTypes.BUILDING_AW_TEXTILE_MILL_RIVER))) then return false end[/COLOR]
	elseif (
		   (iBuilding == GameInfoTypes.BUILDING_AW_BELGIUM_GA)
		or (iBuilding == GameInfoTypes.BUILDING_AW_BELGIUM_GE)
		or (iBuilding == GameInfoTypes.BUILDING_AW_BELGIUM_GM)
		or (iBuilding == GameInfoTypes.BUILDING_AW_BELGIUM_GS)
	) then
	--	if not (GameInfo.Leader_Traits{LeaderheadType=GameInfo.Leaders[Players[iPlayer]:GetLeaderType()].Type}().TraitType == "TRAIT_AW_ALBERT_I_GNK") then return false end
	--	if not (GameInfo.Leader_Traits("LeaderType ='" .. GameInfo.Leaders[Players[iPlayer]:GetLeaderType()].Type .. "'")().TraitType == "TRAIT_AW_ALBERT_I_GNK") then return end
		if not (GetPlayerTrait(Players[iPlayer]) == GameInfoTypes.TRAIT_AW_ALBERT_I_GNK) then return false end
	end
	return true
end)

GetPlayerTrait is a function defined further up in the code, which works pretty well other than a couple *harmless* runtime errors I haven;t yet sorted out

This... makes it behave exactly like before. The same-version UB excludes itself, just with Lua instead of XML (well, SQL actually) this time. :p I thought the swapped-position of those two different building types would make them exclude only each other instead of both each other AND themselves?

(And do I need to attach the mod again?)
 
Under the current set-up of your SQL/XML, and without the CityConstructed event active, are you able to construct the same building in the same city more than once? Are you able to construct a "RIVER" if the city already has a "STEAM"? If not, then the issue is not in your lua because your lua is not firing for these buildings.

Remember, "CanSomething" events only fire if the "Something" is possible without the lua script running.
 
Aight, just disabled the GameEvents.CityCanConstruct, and here's what I found:

I built RIVER... afterwards I could still build STEAM* but not RIVER. @#$%&! <NoLimit>, I'm not really convinced it works any more...

siiiiiiiiiiiiiighhhhh

Well, here's the updated version: --> https://www.dropbox.com/s/apwx42qfyhklhs8/Tell No One (v 2).zip?dl=1
Builds are defined in the SQL file in XML/Buildings
The disabled CityCanConstruct segment is in Lua/UB_Functions

*I mean, not really, since I didn't have the coal needed, but it showed up in the production menu, at least
 
I found one DiploTrade.lua and it shows not indication of any kind of function for initializing or pushing deals; it does include() "TradeLogic", but I couldn't find that maybe I should get agent ransack

Search TradeLogic for AddAllowEmbassy and/or TRADE_ITEM_ALLOW_EMBASSY
 
So now that I finally found TradeLogic.lua, I found that the function for creating a deal is
Code:
local g_Deal = UI.GetScratchDeal();
But I found no method for pushing a deal, for, er, "doing" the deal. Part of it is, of course, not knowing what to look for anyway.

But as far as just creating the deal to be pushed...
Code:
local deal = UI.GetScratchDeal():AddAllowEmbassy(iTargetPlayer)
assuming iTargetPlayer is predefined?

Also, no ideas on why NoLimit isn't working? :(
(I looked in all the C++ files that had something like Building or Production in the name and none of them made any reference to NoLimit)
 
Wow... it's been one day shy of a whole month since I've done any modding whatsoever. That's what playing BTS and tinkering with Java will do. :p

Anyway... uh... to recap my current problems (this took a little while to remember):

1) Two buildings which are mutually exclusive with each other but have NoLimit = true, so they AREN'T self-exclusive, and
2) creating a diplomacy deal, adding embassy/DoF/open borders/whatever, and pushing it in Lua.

1st part isn't working... don't remember why a simple GameEvents.CityCanConstruct function wasn't working, but I guess it wasn't. Last part of 2nd goal is the problem; anyone know the method for pushing a deal in Lua?

Like, this pseudocode wouldn't have worked?
Code:
GameEvents.CityCanConstruct.Add(
function(iPlayer, iCity, iBuilding)
	local pPlayer = Players[iPlayer]
	local pCity = pPlayer:GetCityByID(iCity)
	if ((iBuilding == 1) or (iBuilding = 2)) then
	-- obviously we would change those values :P
		if ((iBuilding == 1) and (pCity:IsHasBuilding(2)) 
		or ((iBuilding == 2) and (pCity:IsHasBuilding(1))
		then return false end
	end
	return true
end

If anyone has any idea for either of these, or even for helping me to remember what it was I was doing, thanks in advance. Also, this post seems exceptionally poorly written.

TIA,
AW
 
Back
Top Bottom