Page 1 of 1

[2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Sat Oct 26, 2024 4:04 pm
by lilstrip
The scenario level caused a non-recoverable error.
Please report this error to the scenario author.

Error while running event level::on_configuration_changed
__level__/control.lua:53: attempt to index global 'global' (a nil value)
stack traceback:
__level__/control.lua:53: in function <__level__/control.lua:52>

getting this crash trying to load in the save from 1.1.110 to port it so people can play the map while we keep working on our procedural map project which will replace said map at some point

heres the save file in question:https://www.mediafire.com/file/dbjp8yk0 ... t.zip/file

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Sat Oct 26, 2024 5:36 pm
by LCStark
Renamed `global` into `storage`.
viewtopic.php?t=116184

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Sat Oct 26, 2024 6:46 pm
by lilstrip
isnt the game supposed to automatically convert a save to the newest version if its vanilla though?
Besides, the save file is massive and I dont even know how to go edit that change in the save itself

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Tue Oct 29, 2024 11:46 pm
by boskid
Thanks for the report however this is not a bug. This save file reports as coming from "Nauvis Post Collapse Renewed" scenario and as such is not eligible to a freeplay scenario script replacement from base mod because it is a different scenario.

Scenario names are used to pair up save files with related scenarios provided by mods and if you have mod updated with new version of scenario and script reload is requested then it would replace the script from that mod. Since you do not have mods enabled that contain newer version of the "Nauvis Post Collapse Renewed" scenario the game has nowhere to look for a new version of the script.

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Sun Nov 24, 2024 4:26 pm
by lilstrip
so how do I fix this then?

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Sun May 11, 2025 7:23 pm
by TaylorItaly
Any news about how to fix that ?

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Sun May 11, 2025 7:49 pm
by boskid
TaylorItaly wrote: Sun May 11, 2025 7:23 pm Any news about how to fix that ?
Assuming you are on factorio version 2.0.29 or newer:
1/ Unzip a a save file
2/ open `control.lua` inside of extracted save using a text editor
3/ replace content of it with this:

Code: Select all

require('__base__/script/freeplay/control.lua')
4/ save
5/ zip that directory again to get a new save file.

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Mon May 12, 2025 5:32 pm
by TaylorItaly
Thanks for the quick reply !!
However ,where should i replace such :

Code: Select all

local util = require("util")
local silo_script = require("silo-script")

local created_items = function()
  return
  {
    ["iron-plate"] = 8,
    ["wood"] = 1,
    ["pistol"] = 1,
    ["firearm-magazine"] = 10,
    ["burner-mining-drill"] = 1,
    ["stone-furnace"] = 1
  }
end

local respawn_items = function()
  return
  {
    ["pistol"] = 1,
    ["firearm-magazine"] = 10
  }
end

for k,v in pairs(silo_script.get_events()) do
  script.on_event(k, v)
end

script.on_event(defines.events.on_player_created, function(event)
  local player = game.players[event.player_index]
  util.insert_safe(player, global.created_items)

  local r = global.chart_distance or 200
  player.force.chart(player.surface, {{player.position.x - r, player.position.y - r}, {player.position.x + r, player.position.y + r}})

  if not global.skip_intro then
    if game.is_multiplayer() then
      player.print({"msg-intro"})
    else
      game.show_message_dialog{text = {"msg-intro"}}
    end
  end

  --silo_script.on_event(event)
end)

script.on_event(defines.events.on_player_respawned, function(event)
  local player = game.players[event.player_index]
  util.insert_safe(player, global.respawn_items)
  --silo_script.on_event(event)
end)

script.on_configuration_changed(function(event)
  global.created_items = global.created_items or created_items()
  global.respawn_items = global.respawn_items or respawn_items()
 -- silo_script.on_configuration_changed(event)
end)

script.on_load(function()
  silo_script.on_load()
end)

script.on_init(function()
  global.created_items = created_items()
  global.respawn_items = respawn_items()
  silo_script.on_init()
end)

silo_script.add_remote_interface()
silo_script.add_commands()

remote.add_interface("freeplay",
{
  get_created_items = function()
    return global.created_items
  end,
  set_created_items = function(map)
    global.created_items = map
  end,
  get_respawn_items = function()
    return global.respawn_items
  end,
  set_respawn_items = function(map)
    global.respawn_items = map
  end,
  set_skip_intro = function(bool)
    global.skip_intro = bool
  end,
  set_chart_distance = function(value)
    global.chart_distance = tonumber(value)
  end
})

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Mon May 12, 2025 5:35 pm
by boskid
TaylorItaly wrote: Mon May 12, 2025 5:32 pm Thanks for the quick reply !!
However ,where should i replace such :
Get rid of everything inside of control.lua and make it to only have what i described before.

Re: [2.0.11] Trying to port Nauvis Post Collapse to 2.0

Posted: Mon May 12, 2025 5:46 pm
by TaylorItaly
:D

Awesome , the save was loaded and ported !!!

Thank you so much !!!!