Researched all technologies before science pack 3

Place to get help with not working mods / modding interface.
Post Reply
User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

Researched all technologies before science pack 3

Post by WIZ4 »

How can I research all technologies before science pack 3?
I tried to use it, but it research all technologies:

Code: Select all

for k, force in pairs (game.forces) do
	for k, technology in pairs (force.technologies) do
		for k, ingredient in pairs (technology.research_unit_ingredients) do
			if ingredient.name ~= 'science-pack-3' then 
			technology.researched = true
			end
		end	
	end
end
My native language is russian. Sorry if my messages are difficult to read.

betrok
Fast Inserter
Fast Inserter
Posts: 101
Joined: Wed Feb 28, 2018 12:08 pm
Contact:

Re: Researched all technologies before science pack 3

Post by betrok »

Code: Select all

for k, force in pairs (game.forces) do
   for k, technology in pairs (force.technologies) do
      local before_3 = true
      for k, ingredient in pairs (technology.research_unit_ingredients) do
         if ingredient.name == 'science-pack-3' then
          before_3 = false
         end
      end
      if before_3 than
        technology.researched = true
      end
   end
end
I did not test it though.

User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

Re: Researched all technologies before science pack 3

Post by WIZ4 »

betrok wrote:

Code: Select all

for k, force in pairs (game.forces) do
   for k, technology in pairs (force.technologies) do
      local before_3 = true
      for k, ingredient in pairs (technology.research_unit_ingredients) do
         if ingredient.name == 'science-pack-3' then
          before_3 = false
         end
      end
      if before_3 than
        technology.researched = true
      end
   end
end
I did not test it though.
Yes, it worked, thanks:)
My native language is russian. Sorry if my messages are difficult to read.

Post Reply

Return to “Modding help”