C++/Lua Request Thread

Looking for a Lua that will allow a replacement galleass to conduct Great Merchant Trade Missions (with reduced profits) in other Civs, not city-states. EDIT: Instead of Influence for the other civ they'd get gold equal to half of what the player gets.

Also looking for something that will allow an improvement that gives the same bonus as the feitoria (copy of random resource) but in other Civs, not city-states. EDIT: Ideally it would still work in city states, too, though not build-able in your own borders.

Thanks in advance!
 
I am looking for a couple of things which could be done either in separate codes or all in one which is easier. Any help on the following would be much appreciated:

1. Increasing resting influence with city states by 10 (similar to consulates policy in patronage)
2. Reducing cost of great prophets by 25%
3. Enemy units lose 5hp while in your territory during war
4. Being unable to puppet cities or build courthouses and increasing production by +50% in all occupied cities.

I realise some things such as removing courthouses can be done in the xml document but im not sure if it would be neater to leave this command in an lua script.

Many thanks once again.
 
I want cities losing their national identity after captured and it will be native city in the conquerer civilization.
Example, I'm Ottoman and Aztecs captured my city. I want my captured city will be native city in the Aztecs and if i recapture then, i must puppet or annex the city.

Is this possible? If this is possible,can you modding this? Thx.
(Sorry for my bad english.)
 
lua provides Player:ChangeNumResourceTotal(ResourceType, intchange). We also have City:GetNumGreatWorks() but I am not sure if that requires a specification of a Great Work Type, or if it is always going to give the total number of great works in the city.

I gave some thought to your post #345 but I didn't make any response because I couldn't see a straightforward way to get past all the possible conditions in which a worker could appear, and to ensure that workers that should be kept are in fact kept.
 
I might when I get home.
 
Hold on, if you have 1 Great Work of Writing, do you get one copy of each or do you need 6 (Oil's a thing too) Great Works of Writing to get all Strategic Resources?
 
No, each great work = 1 of each strategic resources (5 in all), no matter its type. Sorry for previous confusing details.

Strategic Resources are Horse, Iron, Coal, Oil, Aluminium and Uranium. 6 in the total.

But thanks, that helps.
 
It might actually be easier to use a dummy-building that gives 1 of each of the resources in this case rather than using Player:ChangeNumResourceTotal(ResourceType, intchange). The main functioning part of the code would be
Code:
local pCapitalCity = pPlayer:GetCapitalCity()
pCapitalCity:SetNumRealBuilding(GameInfoTypes.BUILDING_RESOURCES_DUMMY, pCapitalCity:GetNumGreatWorks())
You would need the "wrapper" parts of the code that assign a function and hook it into the proper lua-type events, and define pPlayer, of course, but this basic approach should get you around needing to "remember" how many times the player resource amounts were previously adjusted. So part of the dummy building definition would be
Code:
<Building_ResourceQuantity>
	<Row>
		<BuildingType>BUILDING_RESOURCES_DUMMY</BuildingType>
		<ResourceType>RESOURCE_ALUMINUM</ResourceType>
		<Quantity>1</Quantity>
	</Row>
	<Row>
		<BuildingType>BUILDING_RESOURCES_DUMMY</BuildingType>
		<ResourceType>RESOURCE_COAL</ResourceType>
		<Quantity>1</Quantity>
	</Row>
	<Row>
		<BuildingType>BUILDING_RESOURCES_DUMMY</BuildingType>
		<ResourceType>RESOURCE_URANIUM</ResourceType>
		<Quantity>1</Quantity>
	</Row>
	<Row>
		<BuildingType>BUILDING_RESOURCES_DUMMY</BuildingType>
		<ResourceType>RESOURCE_IRON</ResourceType>
		<Quantity>1</Quantity>
	</Row>
	<Row>
		<BuildingType>BUILDING_RESOURCES_DUMMY</BuildingType>
		<ResourceType>RESOURCE_HORSE</ResourceType>
		<Quantity>1</Quantity>
	</Row>
	<Row>
		<BuildingType>BUILDING_RESOURCES_DUMMY</BuildingType>
		<ResourceType>RESOURCE_OIL</ResourceType>
		<Quantity>1</Quantity>
	</Row>
</Building_ResourceQuantity>
 
@Salamandre

Code:
local buildingCapitalStrategicID	= GameInfoTypes["BUILDING_YOUR_BUILDING_HERE"]
local greatWorkLiteratureID			= GameInfoTypes["GREAT_WORK_SLOT_LITERATURE"]
local greatWorkArtOrArtifactID		= GameInfoTypes["GREAT_WORK_SLOT_ART_ARTIFACT"]
local greatWorkMusicID				= GameInfoTypes["GREAT_WORK_SLOT_MUSIC"]

function numGreatWorks(greatWork)
	for city in player:Cities() do
		local cityGreatWorks = city:GetNumGreatWorks(greatWork)
	end
	return cityGreatWorks
end

function GPuz_StrategicsForGreatWorks(playerID)
	local player = Players[playerID]
	local greatWorkCount = numGreatWorks(greatWorkLiteratureID)+numGreatWorks(greatWorkArtOrArtifactID)+numGreatWorks(greatWorkMusicID)
	if (player:IsAlive() and player:GetCivilizationType() == civilisationID) then
		for city in player:Cities() do
		local capital = city:IsCapital()
			if capital then
				city:SetNumRealBuilding(buildingCapitalStrategicID, greatWorkCount)
			else
				if city:IsHasBuilding(buildingCapitalStrategicID) then
					city:SetNumRealBuilding(buildingCapitalStrategicID, 0)
				end
			end
		end
	end
end

GameEvents.PlayerDoTurn.Add(GPuz_StrategicsForGreatWorks)

It should work, you just need to add your dummy building's name and it should be done.
 
Back
Top Bottom