[MOD 0.12.2+] Evolution | Alien Manipulation

Topics and discussion about specific mods
ZagatoMKR
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Aug 17, 2015 9:55 am
Contact:

Re: [0.12.2] Evolution | Alien Manipulation

Post by ZagatoMKR »

Great mod, thanks! One question thought, how do you pick up small/medium/etc. worms? Would be a waste to just kill them, especially if you have a lot of them.

Cheers.

User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Re: [0.12.2] Evolution | Alien Manipulation

Post by darkshadow1809 »

unfortunately theres no way to pick up :( I couldnt code it as minable either since its an actual AI controlled. "thing" :P Would also involve a bug when just picking it up dropping it back down resets it to full health.

so unfortunately you'd have to kill them off;(
ShadowsModpackDevelopment

keyten
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Aug 30, 2015 4:05 am
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by keyten »

Really nice mod. But I have some questions.

I am playing your modpack V5. I had rushed to Mind hive and had built 5 bitter hives. Now bitters are running around my base, screaming at each other and randomly explode filling conveyers with corpses and artifacts while spaming alarms. Is this behavior intended?

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by Kayser »

keyten wrote:Really nice mod. But I have some questions.

I am playing your modpack V5. I had rushed to Mind hive and had built 5 bitter hives. Now bitters are running around my base, screaming at each other and randomly explode filling conveyers with corpses and artifacts while spaming alarms. Is this behavior intended?
LOL. You just made my day :)

User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by darkshadow1809 »

keyten wrote:Really nice mod. But I have some questions.

I am playing your modpack V5. I had rushed to Mind hive and had built 5 bitter hives. Now bitters are running around my base, screaming at each other and randomly explode filling conveyers with corpses and artifacts while spaming alarms. Is this behavior intended?
Been trying to fix this. unfortunately factorio has no real options for AI behavior so i discontinued this mod :(
ShadowsModpackDevelopment

Andaren
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Nov 11, 2015 7:55 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by Andaren »

I encounter an error when starting a new world on version 0.12.16
"__Evolution__/control.lua:8: attempt to index global 'game' (a nil value)"

vedrit
Filter Inserter
Filter Inserter
Posts: 292
Joined: Sun Aug 03, 2014 2:25 am
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by vedrit »

Andaren wrote:I encounter an error when starting a new world on version 0.12.16
"__Evolution__/control.lua:8: attempt to index global 'game' (a nil value)"
Quick fix is to go and change those error-inducing 'game' to 'script'
Beyond that, you're probably not going to get much help because...
darkshadow1809 wrote:... i discontinued this mod :(

donoya
Fast Inserter
Fast Inserter
Posts: 119
Joined: Thu Dec 04, 2014 10:55 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by donoya »

I tried this mod a few months back and IT WAS AWESOME! I would really like to see the dytech biters and especially the mechanical biter. The mechanical biter sounds really, really cool. Anyways, keep up the good work. If there's any way to support you without needing to spend money, I'd be happy to do so.

Edit: I just noticed that you said you'd be discontinuing it. Why would you discontinue it?! It's such a great mod! What about the mechanical biter? Please reconsider!

DaysofKnight
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Mar 02, 2016 12:01 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by DaysofKnight »

Getting and error that makes no sense to me
"Unknown key:"Error while running the on_load:_ _Evolution_ _/control.lua:18: attempt to index global 'game' (a nil value)" "
From what I've seen all over Factorio mods when trying to run 0.11.x mods in 0.12.x is to swap the game.on code for script.on. I did this with the control.lua file for Evolution - Alien Manipulation mod already. So you can see my confusion..

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by daniel34 »

DaysofKnight wrote:Getting and error that makes no sense to me
"Unknown key:"Error while running the on_load:_ _Evolution_ _/control.lua:18: attempt to index global 'game' (a nil value)" "
From what I've seen all over Factorio mods when trying to run 0.11.x mods in 0.12.x is to swap the game.on code for script.on. I did this with the control.lua file for Evolution - Alien Manipulation mod already. So you can see my confusion..
Are you sure you got all of them?
control.lua:18: attempt to index global 'game'
Check line 18 again.
quick links: log file | graphical issues | wiki

DaysofKnight
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Mar 02, 2016 12:01 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by DaysofKnight »

daniel34 wrote:Are you sure you got all of them?
control.lua:18: attempt to index global 'game'
Check line 18 again.
I used the "Replace all" thing in notepad, I got'em all. I even scrolled though the whole thing myself, there's no game.on's in the control file. I even found the load line, there's a script.on there

EDIT: Unless you can ind it, I don't know lua, or any coding for that matter. So I wouldn't even know what line 18 is, or what is considered "line 18".

Code: Select all

require "defines"
local update_com_count = 80
local agro_area_rad = 40
local call_back_area_rad = agro_area_rad + 15
local max_unit_count = 20


script.on_init(function()
	if global.evolution == nil then
      global.evolution = {}
   end
end)

script.on_load(function()
   if global.evolution == nil then
      global.evolution = {}
   end
    for i = 1, #game.players, 1 do
        if game.players[i].force.technologies["Hive-mind"].researched then
           game.players[i].force.recipes["attractor-on2"].enabled = true
        end
    end
end)

script.on_event(defines.events.on_tick, function(event)
	if event.tick % update_com_count == 0 then
		for index, player in ipairs(game.players) do
			if player.character then
				UpdateUnitsCommands(index)		
			end
		end
	end
end)

function UpdateUnitsCommands(player_index)
	local player = game.players[player_index].character
	local pos = player.position
    local aggression_area = {{pos.x - agro_area_rad, pos.y - agro_area_rad}, {pos.x + agro_area_rad, pos.y + agro_area_rad}}
	if not player.surface.valid then return end
	local targets = player.surface.find_entities(aggression_area)
	local min_dist = agro_area_rad + 10;
	local closest_index = -1
	local surface = player.surface
	
	for index, target in ipairs(targets) do
		if target.health then
			if target.force == game.forces.enemy and target.type ~= "turret" and target.type ~= "unit" then
				local dist = GetDistance(target.position, pos)			
				if min_dist > dist then
					min_dist = dist
					closest_index = index
				end
			end
		end
	end
	
	local unit_count = 0
	if closest_index == -1 then
		
		local attOn = game.players[player_index].get_item_count("attractor-on") 
		local attOff = game.players[player_index].get_item_count("attractor-off") 
		local lastState = nil
		if global.evolution[game.players[player_index].name] and global.evolution[game.players[player_index].name].lastState then
			lastState = global.evolution[game.players[player_index].name].lastState
		else
			if global.evolution[game.players[player_index].name] == nil then
				global.evolution[game.players[player_index].name] = {}
			end
			global.evolution[game.players[player_index].name].lastState = nil
		end
		
		if attOn > 0 and attOff == 0 then
			if attOn > 1 then
				game.players[player_index].removeitem({name="attractor-on", count=(attOn - 1)})
			end
			lastState = "on"
		elseif attOn == 0 and attOff > 0 then
			if attOff > 1 then
				game.players[player_index].removeitem({name="attractor-off", count=(attOff - 1)})
			end
			lastState = "off"
		elseif attOn > 0 and attOff > 0 then
			if lastState ~= nil and lastState == "off" then
				game.players[player_index].removeitem({name="attractor-off", count=attOff})
				if attOn > 1 then
					game.players[player_index].removeitem({name="attractor-on", count=(attOn - 1)})
				end
				lastState = "on"
			else
				game.players[player_index].removeitem({name="attractor-on", count=attOn})
				if attOn > 1 then
					game.players[player_index].removeitem({name="attractor-on", count=(attOn - 1)})
				end
				lastState = "off"
			end
		else
			lastState = "off"
		end
		global.evolution[game.players[player_index].name].lastState = lastState
		
		if lastState == "off" then return end
		local call_back_area = {{pos.x -  call_back_area_rad, pos.y -  call_back_area_rad}, {pos.x +  call_back_area_rad, pos.y +  call_back_area_rad}}
		local biters = surface.find_entities_filtered{area = call_back_area, type = "unit"}
		for index, biter in ipairs(biters) do
			if biter.force == (player.force) then
				biter.set_command({type = defines.command.go_to_location, destination = pos, radius = 10, distraction = defines.distraction.byanything});	
				unit_count = unit_count + 1
				
			end
			if unit_count > max_unit_count then return end
		end	
	else
		local call_back_area = {{pos.x -  call_back_area_rad, pos.y -  call_back_area_rad}, {pos.x +  call_back_area_rad, pos.y +  call_back_area_rad}}
		local biters = player.surface.find_entities_filtered{area = call_back_area, type = "unit"}
		for index, biter in ipairs(biters) do
			if biter.force == player.force then
				biter.set_command({type = defines.command.attack, target = targets[closest_index], distraction = defines.distraction.byanything});
				unit_count = unit_count + 1					
			end
			if unit_count > max_unit_count then return end
		end	
	end
end

function GetDistance(pos1 , pos2)
	return math.sqrt((pos1.x - pos2.x)^2 + (pos1.y - pos2.y)^2)
end
There's the file if you wanna look it over

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by orzelek »

In this case follow the error command exactly :)

There is a script.on_load function there that has reference to game.player - thats not allowed anymore.
In on_load you can't reference game - that was one of changes of the patch also.

On the other hand.. this mod is obsolete and content from it should be in Natural Evolution mod.

DaysofKnight
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Mar 02, 2016 12:01 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by DaysofKnight »

orzelek wrote:In this case follow the error command exactly :)

There is a script.on_load function there that has reference to game.player - thats not allowed anymore.
In on_load you can't reference game - that was one of changes of the patch also.

On the other hand.. this mod is obsolete and content from it should be in Natural Evolution mod.
Natural Evolution doesn't look as appealing, as it's main focus point seems to be PvP oriented.
How do I fix the line you mentioned? Show me the code that needs replacing and what it needs to be replaced with.

Again, not a coder in anyway, so I'm just winging it here. Would appreciate help trying to make it work.

Edit: Actually, I seem to have made it work on my own. I deleted the code for the game.player reference. Loaded up just fine (On a new world. Gonna test if having Evolution entities makes a difference).

Nukerman9
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Mar 04, 2016 8:33 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by Nukerman9 »

So I see the mod is giving some issues in the above posts, I think it still holds true now...http://puu.sh/nwWRk/dd7c50e81d.jpg

And what I don't understand is that the mods was working once before...I was to able to use everything and such, And i'd like to mention I don't think the ore gen works with Train Outposts...Never did do much to any testing but yea it doesnt seem like they work together.

DaysofKnight
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Mar 02, 2016 12:01 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by DaysofKnight »

Nukerman9 wrote:So I see the mod is giving some issues in the above posts, I think it still holds true now...http://puu.sh/nwWRk/dd7c50e81d.jpg

And what I don't understand is that the mods was working once before...I was to able to use everything and such, And i'd like to mention I don't think the ore gen works with Train Outposts...Never did do much to any testing but yea it doesnt seem like they work together.
You're having the same problem I had. All I did to make it work was -

Code: Select all

script.on_load(function()
   if global.evolution == nil then
      global.evolution = {}
   end
    for i = 1, #game.players, 1 do
        if game.players[i].force.technologies["Hive-mind"].researched then
           game.players[i].force.recipes["attractor-on2"].enabled = true
        end
    end
end)
Find this in your control.lua file, should be near the top.
Delete " for i = 1, #game.players, 1 do
if game.players.force.technologies["Hive-mind"].researched then
game.players.force.recipes["attractor-on2"].enabled = true
end "
and it should work. I really don't know what it does, I'm not a coder. But it made my game load fine

Nukerman9
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Mar 04, 2016 8:33 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by Nukerman9 »

DaysofKnight wrote:
Nukerman9 wrote:So I see the mod is giving some issues in the above posts, I think it still holds true now...http://puu.sh/nwWRk/dd7c50e81d.jpg

And what I don't understand is that the mods was working once before...I was to able to use everything and such, And i'd like to mention I don't think the ore gen works with Train Outposts...Never did do much to any testing but yea it doesnt seem like they work together.
You're having the same problem I had. All I did to make it work was -

Code: Select all

script.on_load(function()
   if global.evolution == nil then
      global.evolution = {}
   end
    for i = 1, #game.players, 1 do
        if game.players[i].force.technologies["Hive-mind"].researched then
           game.players[i].force.recipes["attractor-on2"].enabled = true
        end
    end
end)
Find this in your control.lua file, should be near the top.
Delete " for i = 1, #game.players, 1 do
if game.players.force.technologies["Hive-mind"].researched then
game.players.force.recipes["attractor-on2"].enabled = true
end "
and it should work. I really don't know what it does, I'm not a coder. But it made my game load fine


Yup that seemed to fix it, and yes to the mod developer, Doesn't look like Train Ouposts generates the Alien Artifact ore.

Other than the few names that kinda bug me for not being capitalized, Great mod over all (I'm just a tab OCD when it comes to names) And yes, Thanks to you DaysofKnight for the fix

Nukerman9
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Mar 04, 2016 8:33 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by Nukerman9 »

OK I know I'm repeating this, but the mod worked once i started a new map and everything worked i started playing with the mod some, saved it, quit game for a bit loaded it again but it gave the same error control.lua:18: attempt to index a nil value... Always does this after i save then try loading the game. This is confusing...

Nukerman9
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Mar 04, 2016 8:33 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by Nukerman9 »

OK so I've been messing around with a friend who is familiar with Lua, and he was saying how this bit...

Code: Select all

    for i = 1, game.players, 1 do
        if game.players[i].force.technologies["Hive-mind"].researched then
           game.players[i].force.recipes["attractor-on2"].enabled = true
        end
    end
Is a loop i guess? Constantly checking or something, so i got rid of it, started up the game went into my world just fine, tested around it worked and i was able to research stuff and use it, i closed the game after saving it and it still worked. Sooo yea... Delete that bit of code EXCLUSIVELY. And the mod should then work? If it doesn't then i have no idea.

DaysofKnight
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Mar 02, 2016 12:01 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by DaysofKnight »

Nukerman9 wrote:OK so I've been messing around with a friend who is familiar with Lua, and he was saying how this bit...

Code: Select all

    for i = 1, game.players, 1 do
        if game.players[i].force.technologies["Hive-mind"].researched then
           game.players[i].force.recipes["attractor-on2"].enabled = true
        end
    end
Is a loop i guess? Constantly checking or something, so i got rid of it, started up the game went into my world just fine, tested around it worked and i was able to research stuff and use it, i closed the game after saving it and it still worked. Sooo yea... Delete that bit of code EXCLUSIVELY. And the mod should then work? If it doesn't then i have no idea.
Isn't that exactly what I said? Albeit missing that extra "end", but that's literally exactly what I said...

Cyriel
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Mar 20, 2016 2:34 pm
Contact:

Re: [MOD 0.12.2+] Evolution | Alien Manipulation

Post by Cyriel »

Didn't work for me initially but i've updated the control.lua so it at least activates without problem (had an issue with game.on being outdated. Minor search/replace fixed it) . Haven't tested much in game beyond that point, but it's a start. How many times is this now ?

e2. DaysofKnight's part about removing

Code: Select all

    for i = 1, #game.players, 1 do
        if game.players[i].force.technologies["Hive-mind"].researched then
           game.players[i].force.recipes["attractor-on2"].enabled = true
        end
    end
updated in there as well. (commented out)

Code: Select all

require "defines"
local update_com_count = 80
local agro_area_rad = 40
local call_back_area_rad = agro_area_rad + 15
local max_unit_count = 20


script.on_init(function()
	if global.evolution == nil then
      global.evolution = {}
   end
end)

script.on_load(function()
   if global.evolution == nil then
      global.evolution = {}
   end
--    for i = 1, #game.players, 1 do
--        if game.players[i].force.technologies["Hive-mind"].researched then
--           game.players[i].force.recipes["attractor-on2"].enabled = true
--        end
--    end
end)

script.on_event(defines.events.on_tick, function(event)
	if event.tick % update_com_count == 0 then
		for index, player in ipairs(game.players) do
			if player.character then
				UpdateUnitsCommands(index)		
			end
		end
	end
end)

function UpdateUnitsCommands(player_index)
	local player = game.players[player_index].character
	local pos = player.position
    local aggression_area = {{pos.x - agro_area_rad, pos.y - agro_area_rad}, {pos.x + agro_area_rad, pos.y + agro_area_rad}}
	if not player.surface.valid then return end
	local targets = player.surface.find_entities(aggression_area)
	local min_dist = agro_area_rad + 10;
	local closest_index = -1
	local surface = player.surface
	
	for index, target in ipairs(targets) do
		if target.health then
			if target.force == game.forces.enemy and target.type ~= "turret" and target.type ~= "unit" then
				local dist = GetDistance(target.position, pos)			
				if min_dist > dist then
					min_dist = dist
					closest_index = index
				end
			end
		end
	end
	
	local unit_count = 0
	if closest_index == -1 then
		
		local attOn = game.players[player_index].get_item_count("attractor-on") 
		local attOff = game.players[player_index].get_item_count("attractor-off") 
		local lastState = nil
		if global.evolution[game.players[player_index].name] and global.evolution[game.players[player_index].name].lastState then
			lastState = global.evolution[game.players[player_index].name].lastState
		else
			if global.evolution[game.players[player_index].name] == nil then
				global.evolution[game.players[player_index].name] = {}
			end
			global.evolution[game.players[player_index].name].lastState = nil
		end
		
		if attOn > 0 and attOff == 0 then
			if attOn > 1 then
				game.players[player_index].removeitem({name="attractor-on", count=(attOn - 1)})
			end
			lastState = "on"
		elseif attOn == 0 and attOff > 0 then
			if attOff > 1 then
				game.players[player_index].removeitem({name="attractor-off", count=(attOff - 1)})
			end
			lastState = "off"
		elseif attOn > 0 and attOff > 0 then
			if lastState ~= nil and lastState == "off" then
				game.players[player_index].removeitem({name="attractor-off", count=attOff})
				if attOn > 1 then
					game.players[player_index].removeitem({name="attractor-on", count=(attOn - 1)})
				end
				lastState = "on"
			else
				game.players[player_index].removeitem({name="attractor-on", count=attOn})
				if attOn > 1 then
					game.players[player_index].removeitem({name="attractor-on", count=(attOn - 1)})
				end
				lastState = "off"
			end
		else
			lastState = "off"
		end
		global.evolution[game.players[player_index].name].lastState = lastState
		
		if lastState == "off" then return end
		local call_back_area = {{pos.x -  call_back_area_rad, pos.y -  call_back_area_rad}, {pos.x +  call_back_area_rad, pos.y +  call_back_area_rad}}
		local biters = surface.find_entities_filtered{area = call_back_area, type = "unit"}
		for index, biter in ipairs(biters) do
			if biter.force == (player.force) then
				biter.set_command({type = defines.command.go_to_location, destination = pos, radius = 10, distraction = defines.distraction.byanything});	
				unit_count = unit_count + 1
				
			end
			if unit_count > max_unit_count then return end
		end	
	else
		local call_back_area = {{pos.x -  call_back_area_rad, pos.y -  call_back_area_rad}, {pos.x +  call_back_area_rad, pos.y +  call_back_area_rad}}
		local biters = player.surface.find_entities_filtered{area = call_back_area, type = "unit"}
		for index, biter in ipairs(biters) do
			if biter.force == player.force then
				biter.set_command({type = defines.command.attack, target = targets[closest_index], distraction = defines.distraction.byanything});
				unit_count = unit_count + 1					
			end
			if unit_count > max_unit_count then return end
		end	
	end
end

function GetDistance(pos1 , pos2)
	return math.sqrt((pos1.x - pos2.x)^2 + (pos1.y - pos2.y)^2)
end
TL:DR. Copy paste 2nd codebox, replace entire control.lua with that.

Post Reply

Return to “Mods”