Script for unlocking technologies based on type.
Posted: Wed Dec 30, 2020 10:18 pm
I use different blueprints for different stages of the game, so I categorize them based on which science packs are available at the time.
This is an easy way to unlock only those technologies available for a certain stage of the game.
To use, paste the following code into the console (don't forget to prefix it with "/c ").
To unlock all technologies
To unlock everything you would have available with automation, logistic, and chemical science.
To reset research
This is an easy way to unlock only those technologies available for a certain stage of the game.
To use, paste the following code into the console (don't forget to prefix it with "/c ").
Code: Select all
function acceptTechnology(technology, sciencePacks)
for _, ingredient in pairs(technology.research_unit_ingredients) do
local sciencePackFound = false
for _, sciencePack in pairs(sciencePacks) do
local sciencePackName = string.format('%s-science-pack', sciencePack)
if(sciencePackName == ingredient.name) then
sciencePackFound = true
end
end
if(not sciencePackFound) then
return false
end
end
return true
end
function filterTechnologies(technologies, sciencePacks)
local results = {}
for _, technology in pairs(technologies) do
if(acceptTechnology(technology, sciencePacks)) then
table.insert(results, technology)
end
end
return results
end
function unlockTechnologies(sciencePacks)
local technologies = game.player.force.technologies
local filteredTechnologies = filterTechnologies(technologies, sciencePacks)
for _, technology in pairs(filteredTechnologies) do
technology.researched = true
end
end
function lockTechnologies()
local technologies = game.player.force.technologies
for _, technology in pairs(technologies) do
technology.researched = false
end
end
Code: Select all
/c unlockTechnologies({'automation', 'logistic', 'military', 'chemical', 'production', 'utility'})
Code: Select all
/c unlockTechnologies({'automation', 'logistic', 'chemical'})
Code: Select all
/c lockTechnologies()