YnAEMP issue with the mod... and City States.

Civ5Play

Chieftain
Joined
Oct 8, 2015
Messages
50
Is there something that forces YnAEMP to create city states in the game when using CPP?

Even though I put the # at 0, it still creates the city states. I have deactivated CPP and just had the YnAEMP and in game editor activated, and the city states aren't created when starting a new game.

Any ideas?
 
I very rarely play YnAEMP because my computer doesn't run it well late game, but when I do I just place the CS I want manually with the in-game editor. Kind of a pain, but that's my workaround. If you want no CS then just delete the units. Although i'm sure you would rather have an actual fix as opposed to a workaround :P
 
Am I getting this right? You set the number of CS to 0, when you are in the setup of creating a game? So you navigated to Mods, Custom Game, YnAEMP chose the YnAEMP map size and set the CS quantity to 0..?
 
Am I getting this right? You set the number of CS to 0, when you are in the setup of creating a game? So you navigated to Mods, Custom Game, YnAEMP chose the YnAEMP map size and set the CS quantity to 0..?

Yup.

And they still populate. I have to use the editor to remove them.
 
I think the lua has some bug (or CPP/CP caused it)...too lazy to debug it though. I have another problem which I see city state with warrior only but not actual city states (unless the settler got killed by barbarians..)

when I have time will need to use IGE along with lua log to see what happened

FYI from what I read the lua code last time, it suppose to create minor by adding after the number of major civ till max number of players (unless placement all random, then it use game default logic), then later it will remove some of them if they are not TSL/native american(depends what you selected)

YnaemLoading.lua
Code:
	if modUserData.GetValue("MinorPlacement") ~= MINOR_ALL_RANDOM then
		print("-------------------------------")
		print("Set minor civs Starting Plots")

		-- place minor civs
		local toRemove = {}
		for i = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS - 1 do
			local player = Players[i]
			local minorCivID = player:GetMinorCivType() 
			print("-------------------------------")
			print ("Search starting position for Minor Civ : " .. minorCivID )
			local plot = GetStartingPositionMinorCiv(minorCivID)
			if plot then
				--print ("Found starting position for Minor Civ : " .. minorCivID )
				player:SetStartingPlot(plot)
			elseif modUserData.GetValue("MinorPlacement") ~= MINOR_TSL_RANDOM then
				-- no random placement allowed, mark civ to be removed
				--print("Minor civ marked for removing : " .. minorCivID)
				table.insert(toRemove, "minor"..minorCivID.."tr")
			end
	    end
		modUserData.SetValue("ToRemove", table.concat(toRemove,","))
		print("To remove : " .. table.concat(toRemove,","))
	else
		print("-------------------------------")
		print("Minor civs option = all random")

In YnaemInGame.lua there are some code to remove minor civs(city states)
...there are some funny comments about how it has to randomly remove minor:p
Code:
function FinalizeCityState(numMinorCivs)
	-- tab for playerID
	local ynaemSelection = {}
	for playerID = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS - 1 do
		local player = Players[playerID]
		local minorCivID = player:GetMinorCivType()
		-- Does this civ exist ?
		if minorCivID ~= -1 then
			-- keep only TSL ?
			if (not MinorCivHasTSL(minorCivID) and PreGame.GetMapOption(MINOR_PLACEMENT) == MINOR_TSL_ONLY) then
				YnaemRemoveCiv (playerID)
			-- was marked for removing ?
			elseif string.find(modUserData.GetValue("ToRemove"), "minor"..minorCivID.."tr") then
				YnaemRemoveCiv (playerID)
				print ("kill marked civ : " .. minorCivID)
			else
				table.insert(ynaemSelection, playerID)
			end
		end
	end

	print ("Actual Number of City States = " .. #ynaemSelection )
		
	if #ynaemSelection > numMinorCivs then
		print ("Ok, exterminating a few settlers discretly..." )
		-- remove excedent
		-- but first shuffle selection
		-- so we can't be accused of deliberate ethnic cleaning
		for i = #ynaemSelection, 2, -1 do
			local r = math.random(i)
			ynaemSelection[i], ynaemSelection[r] = ynaemSelection[r], ynaemSelection[i]
		end
		-- keep only the requested number
		for i = numMinorCivs + 1 , #ynaemSelection do
			YnaemRemoveCiv (ynaemSelection[i])
		end		
	end
end

if someone have time to debug them would be great :lol:

Edited.. I realized there is a V24 now so will have to look at the code again to see the changes
 
Ah well thanks for the effort.

lol @ "Accused of deliberate ethnic cleansing" :lol:
 
ok I think I fixed it (at least fixed my issue that i don't see city state with lonely warrior without settler in middle of nowhere , looks like player:Units() no longer list all units to kill for some reason so I changed to use player:KillUnits() instead

Code:
function YnaemRemoveCiv (playerID)
	local player = Players[playerID]
	-- kill all units
	--for v in player:Units() do
	--	v:Kill()
	--end
	player:KillUnits()
	print("Killed all units for  " .. playerID)
end

I attached the changes to LUA\YnaemInGame.lua for v23, you can make your own changes in v24 since I haven't looked into that yet
 

Attachments

ok I think I fixed it (at least fixed my issue that i don't see city state with lonely warrior without settler in middle of nowhere , looks like player:Units() no longer list all units to kill for some reason so I changed to use player:KillUnits() instead

Code:
function YnaemRemoveCiv (playerID)
	local player = Players[playerID]
	-- kill all units
	--for v in player:Units() do
	--	v:Kill()
	--end
	player:KillUnits()
	print("Killed all units for  " .. playerID)
end

I attached the changes to LUA\YnaemInGame.lua for v23, you can make your own changes in v24 since I haven't looked into that yet

Thanks
 
Back
Top Bottom