[2.0.11] Trying to port Nauvis Post Collapse to 2.0

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
User avatar
lilstrip
Fast Inserter
Fast Inserter
Posts: 194
Joined: Fri Aug 07, 2015 5:01 pm
Contact:

[2.0.11] Trying to port Nauvis Post Collapse to 2.0

Post 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
User avatar
LCStark
Fast Inserter
Fast Inserter
Posts: 205
Joined: Thu Jan 28, 2021 5:04 pm
Contact:

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

Post by LCStark »

Renamed `global` into `storage`.
viewtopic.php?t=116184
User avatar
lilstrip
Fast Inserter
Fast Inserter
Posts: 194
Joined: Fri Aug 07, 2015 5:01 pm
Contact:

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

Post 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
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3883
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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.
User avatar
lilstrip
Fast Inserter
Fast Inserter
Posts: 194
Joined: Fri Aug 07, 2015 5:01 pm
Contact:

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

Post by lilstrip »

so how do I fix this then?
TaylorItaly
Inserter
Inserter
Posts: 23
Joined: Mon Jan 06, 2020 6:02 am
Contact:

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

Post by TaylorItaly »

Any news about how to fix that ?
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3883
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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.
TaylorItaly
Inserter
Inserter
Posts: 23
Joined: Mon Jan 06, 2020 6:02 am
Contact:

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

Post 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
})
Last edited by TaylorItaly on Mon May 12, 2025 5:36 pm, edited 1 time in total.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3883
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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.
TaylorItaly
Inserter
Inserter
Posts: 23
Joined: Mon Jan 06, 2020 6:02 am
Contact:

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

Post by TaylorItaly »

:D

Awesome , the save was loaded and ported !!!

Thank you so much !!!!

For anyone who want it too : https://1drv.ms/u/c/1d1f33eacca8d329/EV ... A?e=JFJbmx
Post Reply

Return to “Technical Help”