Settler Unique Unit

VainApocalypse

Warlord
Joined
Aug 10, 2010
Messages
245
Does anyone know whether a Civ with a unique unit that replaces the settler will spawn into the game with that unique unit or is it specifically coded that civs spawn in with regular settlers at turn 0?

Just curious whether anyone knew before I went through the trouble of experimenting.
 
Last edited:
I remember someone making a post about something like that. he replaced the settler with a merchant of venice like unit and the result was venice spawning with that unit, not with a settler
 
I remember someone making a post about something like that. he replaced the settler with a merchant of venice like unit and the result was venice spawning with that unit, not with a settler
Yup, I see that post now. That would be problematic for Venice. xD
 
That was me. LeeS wrote some code for this that fixed it and caused the game to generate a settler on turn 1. The Lua script is here. You have to replace CIVILIZATION_ROME with your civilization's name. Do this and give the settler replacement a prereq tech or civic and the game will start without the replacement unit, just the normal settler. You will no longer be able to build settlers.

This does not stop settler capture or city capture.

Code:
local sRequiredCivilizationName = "CIVILIZATION_ROME"
local iSettlerIndex = GameInfo.Units["UNIT_SETTLER"].Index

function OnPlayerTurnActivated(iPlayer)
    if (PlayerConfigurations[iPlayer]:GetCivilizationTypeName() == sRequiredCivilizationName) then
        local pPlayer = Players[iPlayer]
        if (pPlayer:GetCities():GetCount() == 0) then
            local bHasSettlers = false
            local pPlayerUnits = pPlayer:GetUnits()
            for i, pUnit in pPlayerUnits:Members() do
                if pUnit:GetType() == iSettlerIndex then
                    bHasSettlers = true
                    break
                end
            end
            if (bHasSettlers == false) then
                local pPlot = pPlayer:GetStartingPlot()
                pPlayerUnits:Create(iSettlerIndex, pPlot:GetX(), pPlot:GetY())
            end
        end
    end
end
Events.PlayerTurnActivated.Add(OnPlayerTurnActivated)
 
Last edited:
That was me. LeeS wrote some code for this that fixed it and caused the game to generate a settler on turn 1. The Lua script is here. You have to replace CIVILIZATION_ROME with your civilization's name. Do this and give the settler replacement a prereq tech or civic and the game will start without the replacement unit, just the normal settler. You will no longer be able to build settlers.

Thanks
 
... Do this and give the settler replacement a prereq tech or civic and the game will start without the replacement unit, just the normal settler.

Is that how it works for you? I've put a PrereqTech on my UU-settler AND a BuildingPrereq just to be sure, but it still spawns on turn 1 with the settler generated by the script. I know the Prereqs are working, because I can't produce the UU once I found my first city.

Any other idea how to block the UU from spawning? It'd be easy to write a similar script that ended in something like, pPlayerUnits:Destroy(GameInfo.Units["UNIQUE_SETTLER"].Index), but I don't know what the appropriate function name is for "destroy" or "delete."

EDIT
I found the quirkiest fix. Changing the UU's domain to DOMAIN_SEA prevents it from spawning on turn 1. This is not a problem for me, as I never intended to use this UU as anything other than a way to block Settler production.
 
Last edited:
Back
Top Bottom