Midgame settler replacement: The Colonist.

layelaye

Warlord
Joined
Nov 12, 2013
Messages
118
In relation to this thread: http://forums.civfanatics.com/showthread.php?t=519949

So after forever of wanting a mod doing this, i made one myself. No dll and so completly compatible with basically every mod.

The colonist: Unlocks at Compass. May found cities. Cities found by colonists start with additional pop, territory and buildings. The colonist turns into a worker after founding a city.

This unit is quite expensive, since its a settler + worker + 5 buildings + extra pop all in one package. Still, if you think its too expensive (or too cheap) let me know, as i havent tested it gameplay wise yet.

Get the mod here:

http://steamcommunity.com/sharedfiles/filedetails/?id=288121685

Or my previous mod, now including the Colonist as well as balancing Liberty to be on par with Tradition:

http://steamcommunity.com/sharedfiles/filedetails/?id=251628203

Enjoy!

P.S: Thanks wHoward for helping me deal with the lua and thanks community patch project guys for letting me use some of their code in this mod.
 
I'll repost my question from the other thread, in case you see it here before the other one:

Is it possible to modify the script, so instead of applying to the new unit Colonist, it applies to normal Settlers but only after a key policy is aquired?
 
Yes, quite easily infact :]

I guess you want to make a colonialization Policy?

Take note, that the Colonist has 350:c5production: worth of buildings in it, 70:c5production: more from the worker and 106:c5production: Of hammers from the settler. If you make it so that normal settlers settle those advanced cities, players are just going to spam them - Which is why i made a new, more expensive unit for it.
 
Yes, something like that. I would make some changes however - for instance, I would remove/replace some of the buildings (the Coliseum for one, because the new city should not be self-fueling with regards to happines), and I might also remove the worker. I think I would make this a new finisher for Exploration (re-dubbed Expansion) tree, and move the hidden archeology sites to Aesthetics ... perhaps. Or I might smear the effect out over several policies in Explo... Expansion tree, so that for instance one policy gives the extra population and land, another gives the buildings, a third gives the worker ...

Can you show me how the LUA line would look that checks for policy instead of unit type?
 
There you go:

Spoiler :
function IsColonist(pPlayer, pPlot)

local iNumUnits = pPlot:GetNumUnits();
local pUnit


if (pPlayer:HasPolicy(GameInfo.Policies["POLICY_LIBERTY"].ID)) then
local pCity = pPlot:GetPlotCity();
if (pCity == nil) then return; end
--Adds territory to the newly found city
AddTerritory(pPlayer:GetID(), pCity, 3);
--Adds pop.
pCity:ChangePopulation(3, true);
--Adds buildings
MidGameBuildings(pCity);
--A free worker to srart improving the city
pPlayer:InitUnit (1, pPlot:GetX(), pPlot:GetY());
break
end
end
end


In my liberty modification i added 2 free tiles for every city in the opener. The colonist unit is really meant to be used with my other mod.

Regarding the happiness, the new city will have at least 4 citizens (more if you use LibertyMod) and so even with the colloseum will cost 5 happiness the moment you settle it. Since it has 5 buildings and no market, your GPT will take a major hit (6) as well.

So thats -5 GPT and -5 Happiness on top of the normal science/ culture penalties and the 350 hammers ot get the unit - I wouldent say thats self sufficient...
 
Good point on the extra citizens causing more unhappiness. Thanx a ton for the code snippet, that'll be useful.
 
How about different types of colonist for different types of city. E.g. you might want to create 2 quick-set-up cities, one science-based and one military-based. Or even let the parent city insert any building it likes while creating the colonist unit, but all at double cost! (Prob much harder to do without DLL changes though :hmm:)
 
What you describe was not my intent. I simply wanted to make maps such as Terra have a point, Or make it possible to actually colonise far lands during the reinassance, As happened in real life.

Choosing buildings will probably be possible but will take far more work then im willing to put in.

In a related matter, if you guys find an icon that looks like it will fit the unit, lemme know! i couldent find one so im currently just using the settler icon.

@kaspergm: No problem, feel free to ask for help if you need it. However if you use my code please dont refer to it as your own, and credit the original mode it was taken from ;)
 
@kaspergm: However if you use my code please dont refer to it as your own, and credit the original mode it was taken from ;)
Of course - and anyway, I'm probably only going to use it for a personal mod and not something I'll upload and be credited for.
 
Hi Layelaye, I hope I can ask for your help once more. I tried to adjust the lua script to my mod, but I get an error in the lua.log, so I must have done something wrong.

The script I used looks like this:

Spoiler :
Code:
function OnCityFounded(iPlayer, iCityX, iCityY)
	local pPlayer = Players[iPlayer];
	if (pPlayer == nil) then return; end

	local pPlot = Map.GetPlot(iCityX, iCityY);
	if (pPlot == nil) then return; end

	local pCity = pPlot:GetPlotCity();
	if (pCity == nil) then return; end

	 IsExploration(pPlayer, pPlot);
end



function IsExploration(pPlayer, pPlot)

	local iNumUnits = pPlot:GetNumUnits();
	local pUnit
	
	--Checks if the player has the policy
	if (pPlayer:HasPolicy(GameInfo.Policies["POLICY_MERCHANT_NAVY"].ID)) then
			local pCity = pPlot:GetPlotCity();
			if (pCity == nil) then return; end
			--Adds territory to the newly found city
			AddTerritory(pPlayer:GetID(), pCity, 4);
			--A free worker to srart improving the city
			pPlayer:InitUnit (1, pPlot:GetX(), pPlot:GetY());
			break
		[B][COLOR="Red"]end[/COLOR][/B]
	end

	if (pPlayer:HasPolicy(GameInfo.Policies["POLICY_TREASURE_FLEETS"].ID)) then
			local pCity = pPlot:GetPlotCity();
			if (pCity == nil) then return; end
			--Adds buildings
			MidGameBuildings(pCity);
			break
		end
	end


end
--
function AddTerritory(lordOfTheLand, pCity, freePlots)

	for i = 1, freePlots do
		local plot = pCity:GetNextBuyablePlot();
		plot:SetOwner(lordOfTheLand, pCity);
		end
	 end

	 --]]

function MidGameBuildings(pCity)
	AddBuilding(pCity, GameInfoTypes["BUILDING_GRAINMILL"]);
	AddBuilding(pCity, GameInfoTypes["BUILDING_MONUMENT"]);
	AddBuilding(pCity, GameInfoTypes["BUILDING_SHRINE"]);
end
	

-- Adds the building to the city, if able

function AddBuilding (pCity, tBuilding)
	if (pCity == nil) then return; end
	if (tBuilding == nil) then return; end

	local pPlayer = pCity:GetOwner();
	--local pOwner = Players[pPlayer];
	if (pPlayer ~= nil) then
		if (pCity:CanConstruct(tBuilding)) then -- Still check base game rules such as tech and resource requirements
			if (not pCity:IsHasBuilding(tBuilding)) then
				pCity:SetNumRealBuilding(tBuilding, 1);
			end
		end
	end
end


GameEvents.PlayerCityFounded.Add( OnCityFounded );

The lua.log gives me the following error message:
Spoiler :
Code:
[19397.055] Syntax Error: C:\Users\...\Documents\My Games\Sid Meier's Civilization 5\MODS\AlciMods (BnW)\LUA/Exploration.lua:[B]32: no loop to break near 'end'[/B]
[19397.055] Runtime Error: Error loading C:\Users\...\Documents\My Games\Sid Meier's Civilization 5\MODS\AlciMods (BnW)\LUA/Exploration.lua.

I highlighted the "end" in line 32 of the code which appearantly is the one that causes the error (or at least the first error that breaks the file) - I don't know if you can tell me what I need to do to get the script working.


Nevermind, got it working by pillaging the script from your Liberty mod. Learns to understand a tine bit of lua each time. :rolleyes:
 
Haha, sorry for not being around. feel free to pm me if you need some help.

BTW can you list what you plan your mod to do? im curious what the coloniasation tree will be like.
Thanx, I might take you up on that if I run into further troubles, but for now, I got it working perfectly. ^_^

Well at the moment the "colonisation" tree is basically an attempt to bring Exploration up on par with some of the other trees (although I have also buffed a couple of other trees like Honor, Liberty and Aesthetics and minor tweaks to Commerce, Piety and Patronage as well as a nerf to Rationalism).

My current Exploration tree looks like this:

Opener: +1 Sight and Movement to naval units, +50 % production when building maritime buildings (Lighthouse, Harbor, Seaport)
Left side:
Pioneer Expansion: Settlers gain +2 movement. Newly founded cities start with 2 extra population and 4 extra workable tiles
Treasure Fleets: (Probably needs new name) +25 % yield from internal trade routes. New cities start with a Grainmill*, Monument and Shrine. [requires Pioneer Expansion and Maritime Infrastructure]
Right side:
Maritime Infrastructure: +3 production in coastal cities.
Naval Tradition: +1 happines and +1 gold from maritime buildings. [requires Maritime Infrastructure]
Navigation Schools: As is (Admiral stuff) + 1 science from maritime buildings.
Finisher: Unchanged (for now!)

In time, I might want to actually split this into two different trees: One that focuses on the city-building stuff (left side) and one that focuses on the maritime stuff (right side) - however, that would require that someone comes up with a good framework for making a 10th policy tree. I also consider moving the hidden archeology sites to Aesthetics and instead make the free buildings on city founding part of the finisher for the colonization tree.
 
Top Bottom