How to get rid of the American tileset?

Optional

Deity
Joined
May 22, 2007
Messages
2,935
Location
It Dockumer Lokaeltsje
I know this should be possible, by adding some lines to the LUA of the mapscripts, but I'm not sure how to do it - not familiar enough with LUA. Would anybody with the knowledge be willing to post an example?
 
The code you need is already provided as a sample in MapGenerator.lua

Code:
function DetermineContinents()
	print("Determining continents for art purposes (MapGenerator.Lua)");
	-- Each plot has a continent art type. Mixing and matching these could look
	-- extremely bad, but there is nothing technical to prevent it. The worst 
	-- that will happen is that it can't find a blend and draws red checkerboards.
	
	-- Command for setting the art type for a plot is: <plot object>:SetContinentArtType(<art_set_number>)
	
	-- CONTINENTAL ART SETS
	-- 0) Ocean
	-- 1) America
	-- 2) Asia
	-- 3) Africa
	-- 4) Europe
	
	-- Here is an example that sets all land in the world to use the European art set.
	--[[
	for i, plot in Plots() do
		if plot:IsWater() then
			plot:SetContinentArtType(0);
		else
			plot:SetContinentArtType(4);
		end
	end
	]]--
	
	-- Default for this function operates in C++, but you can override by
	-- replacing this method with your own and not calling the default stamper.
	Map.DefaultContinentStamper();
end
 
I have found that (before I posted my question) and tried to work with that, but failed. My knowledge of LUA isn't good enough to know how to edit a map script based upon that text.
 
I fiddled around a bit more, and I think I can do it with continents maps. There's a mapscript called 'Fractal Mata' that does it, and I've added that text to the Continents mapscript, and it seems to work.

The used code is this:
Spoiler :
Code:
function DetermineContinents() 
	print("Determining continents for art purposes (MapGenerator.Lua)");
	-- Command for setting the art type for a plot is: <plot object>:SetContinentArtType(<art_set_number>)
	
	-- CONTINENTAL ART SETS
	-- 0) Ocean
	-- 1) America
	-- 2) Asia
	-- 3) Africa
	-- 4) Europe

	Map.DefaultContinentStamper();
 --If option is no Orange Trees, reiterate and replace any American tiles.
	local allowAmerica = Map.GetCustomOption(7);
	
	if allowAmerica == 2 then 
		--Replace Orange Trees
		local coin = Map.Rand(2, "Flip Coin to break ties");
		local artType
		local numAsia, numAfri, numEuro, numAmer = 0, 0, 0, 0;
		local rankAsia, rankAfri, rankEuro = 0, 0, 0;
		local newType = 0
	
		--get number of tiles of each cont art type
		for i, plot in Plots() do
			artType = plot:GetContinentArtType();
			if artType == 1 then numAmer = numAmer + 1;
			elseif artType == 2 then numAsia = numAsia + 1;
			elseif artType == 3 then numAfri = numAfri + 1;
			elseif artType == 4 then numEuro = numEuro + 1;
			else --is 0, so is water tile do nothing
			end
		end
	
		print("____________Remove Orange Trees")
		print("Number of Asian Tiles", numAsia)
		print("Number of African Tiles", numAfri)
		print("Number of European Tiles", numEuro)
		print("Number of American Tiles", numAmer)
	
		if numAmer ~= 0 then --if there are American tiles, this will be greater than 0
			--which Continent is least represented on the map?
			if numAsia > numAfri then rankAsia = rankAsia + 1;
			elseif numAsia == numAfri then -- break tie with coin
				if coin == 0 then rankAsia = rankAsia + 1;
				else rankAfri = rankAfri + 1;
				end
			else
				rankAfri = rankAfri + 1;
			end
	
			if numAfri > numEuro then rankAfri = rankAfri + 1;
			elseif numAfri == numEuro then -- break tie with coin
				if coin == 0 then rankAfri = rankAfri + 1;
				else rankEuro = rankEuro + 1;
				end
			else
				rankEuro = rankEuro + 1;
			end
	
			if numEuro > numAsia then rankEuro = rankEuro + 1;
			elseif numEuro == numAsia then -- break tie with coin
				if coin == 0 then rankEuro = rankEuro + 1;
				else rankAsia = rankAsia + 1;
				end
			else
				rankAsia = rankAsia + 1;
			end
	
			--Now set artType to whatever scored 0 (lowest count)
			if rankAsia == 0 then newArt = 2; 
			elseif rankAfri == 0 then newArt = 3;
			elseif rankEuro == 0 then newArt = 4;
			else --something went horribly wrong
				print("Nothing scored lowest rank! - Remove Orange Trees")
			end	 
		
			print("_____Continent Rank Scores")
			print("Asian", rankAsia)
			print("African", rankAfri)
			print("European", rankEuro)
	
			--Replace America with lowest ranked continent art.
			for i, plot in Plots() do
				artType = plot:GetContinentArtType();			
				if artType == 1 then
					plot:SetContinentArtType(newArt);
			end
But I nearly only play Pangaeas (PangaeaPlus especially), and for that this code doesn't work.
 
Is it still possible to get off American art tileset ?

I tried your script and it did'nt works for me, maybe i put it at the wrong place in the continents.LUA

waiting for update, thx in advance.

Zaniez
 
Back
Top Bottom