attempt to index field 'character' (a nil value) - Help Please
Posted: Tue Jul 05, 2016 3:12 am
Hi,
I've got a report with the below error in MP. This was also reported back in 0.12, so not new to 0.13.
Below is my code. I'm already checking if "character" is valid. So not sure what else to do.
Line 201 is: "if player.connected and player.character.valid then"
Any suggestions on a fix?
Thanks.
I've got a report with the below error in MP. This was also reported back in 0.12, so not new to 0.13.
Code: Select all
10714.937 Error MultiplayerManager.cpp:129: MultiplayerManager failed: "Error while running the event handler: __Natural_Evolution_Enemies__/control.lua:201: attempt to index field 'character' (a nil value)"
Code: Select all
for i = 1, #game.players, 1 do
player = game.players[i]
if player.connected and player.character.valid then
player.surface.set_multi_command{command = {type=defines.command.attack, target=player.character, distraction=defines.distraction.by_enemy},unit_count = (20+math.floor(game.evolution_factor*100/#game.players)), unit_search_distance = 600}
end
end
Any suggestions on a fix?
Thanks.