Jump to content

Where can I find the new way to add custom peice into map?


Recommended Posts

Sadlly, But I can't find the way add custom piece anywhere. Need someone help. Old tutorials and old mod didn't work anymore. I feel a tired after many hour to try. Should I give up? I still used Tiled mod tool to create custome peice but don't know how to add it into map.

Hope someone here help me.
Thank you.

Edited by VuPhan
Link to comment
Share on other sites

local require = GLOBAL.require
local StaticLayout = require("map/static_layout")
local Layouts = require("map/layouts")

Layouts.Layouts["MySetPieceName"] = StaticLayout.Get("map/static_layouts/my_setpiece_file")

local function AddMySetPiece(taskset)
	taskset.set_pieces["MySetPieceName"] = {count = 1, tasks = {"Make a pick", "Dig that rock", "Great Plains", "For a nice walk"}}
end

AddTaskSetPreInit("default", AddMySetPiece)
AddTaskSetPreInit("classic", AddMySetPiece)

 

Edited by DarkXero
Link to comment
Share on other sites

@DarkXero Hi again, I was use your code to add custom peice into map. But no luck, it's not work. Here is error logs and with my test mod:

[00:00:06]: No layout available for    ancientarea    
[00:00:06]: DoLuaFile Error: #[string "scripts/map/object_layout.lua"]:185: No layout was provided!
#LUA ERROR stack traceback:
@=[C]:-1 in (global) assert (C) <-1--1>
@scripts/map/object_layout.lua:185 in (upvalue) ConvertLayoutToEntitylist (Lua) <184-274>
   layout = nil
@scripts/map/object_layout.lua:427 in (field) Convert (Lua) <424-429>
   node_id = Dig that rock:5:Rocky
   item = ancientarea
   addEntity = table: 16169858
   layout = nil
@scripts/map/graphnode.lua:273 in (method) ConvertGround (Lua) <250-284>
   self =
      children_populated = false
      graph = table: 15093D98
      populated = false
      edges = table: 15094EC8
      id = Dig that rock:5:Rocky
      visited = false
      data = table: 15094D60
      colour = table: 15092FB0
   spawnFn = table: 14FB2C28
   entitiesOut = table: 15123270
   width = 360
   height = 360
   world_gen_choices = nil
   obj_layout = table: 15277FE0
   prefab_list = table: 161696F0
   add_fn = table: 16169858
   k = ancientarea
   count = 1
   i = 1
@scripts/map/network.lua:633 in (method) ConvertGround (Lua) <630-635>
   self =
      wormholeprefab = wormhole
      story_depth = -1
      MIN_WORMHOLE_ID = 2300000
      id = GAME_root
      required_prefabs = table: 14FB7340
      data = table: 14FB7660
      visited = false
      exit_nodes = table: 14FB7638
      exit_edges = table: 14FB7570
      nodes = table: 14FB7610
      edges = table: 14FB76D8
      children = table: 14FB7548
      colour = table: 14FB74D0
   map = table: 14FB2C28
   spawnFN = table: 15123270
   entities = 360
   check_col = 360
   nodes = table: 152785F8
   k = Dig that rock:5:Rocky
   node = table: 15094D88
@scripts/map/forest_map.lua:586 in (field) Generate (Lua) <282-740>
   prefab = forest
   map_width = 360
   map_height = 360
   tasks = table: 14DB4728
   level = table: 14DB47C8
   level_type = SURVIVAL
   start_time = 4000
   SpawnFunctions = table: 14FB2C28
   current_gen_params = table: 14FB2CA0
   story_gen_params = table: 14FB27C8
   default_impassible_tile = 1
   min_size = 350
   topology_save = table: 151231A8
   entities = table: 15123270
   save = table: 15123360
   join_islands = true
   nodes = table: 151F5BA0
   translated_prefabs = table: 152771F8
   runtime_overrides = table: 152772E8
   obj_layout = table: 15277FE0
   add_fn = table: 15277D10
@scripts/worldgen_main.lua:350 in () ? (Lua) <315-426>
   debug = false
   world_gen_data = table: 14DA3820
   level = table: 14DB47C8
   prefab = forest
   choose_tasks = table: 14DB4728
   savedata = nil
   max_map_width = 1024
   max_map_height = 1024
   try = 1
   maxtries = 5
@=(tail call):-1 in ()  (tail) <-1--1>
@=(tail call):-1 in ()  (tail) <-1--1>
[00:00:06]: #[string "scripts/map/object_layout.lua"]:185: No layout was provided!
#LUA ERROR stack traceback:
@=[C]:-1 in (global) assert (C) <-1--1>
@scripts/map/object_layout.lua:185 in (upvalue) ConvertLayoutToEntitylist (Lua) <184-274>
   layout = nil
@scripts/map/object_layout.lua:427 in (field) Convert (Lua) <424-429>
   node_id = Dig that rock:5:Rocky
   item = ancientarea
   addEntity = table: 16169858
   layout = nil
@scripts/map/graphnode.lua:273 in (method) ConvertGround (Lua) <250-284>
   self =
      children_populated = false
      graph = table: 15093D98
      populated = false
      edges = table: 15094EC8
      id = Dig that rock:5:Rocky
      visited = false
      data = table: 15094D60
      colour = table: 15092FB0
   spawnFn = table: 14FB2C28
   entitiesOut = table: 15123270
   width = 360
   height = 360
   world_gen_choices = nil
   obj_layout = table: 15277FE0
   prefab_list = table: 161696F0
   add_fn = table: 16169858
   k = ancientarea
   count = 1
   i = 1
@scripts/map/network.lua:633 in (method) ConvertGround (Lua) <630-635>
   self =
      wormholeprefab = wormhole
      story_depth = -1
      MIN_WORMHOLE_ID = 2300000
      id = GAME_root
      required_prefabs = table: 14FB7340
      data = table: 14FB7660
      visited = false
      exit_nodes = table: 14FB7638
      exit_edges = table: 14FB7570
      nodes = table: 14FB7610
      edges = table: 14FB76D8
      children = table: 14FB7548
      colour = table: 14FB74D0
   map = table: 14FB2C28
   spawnFN = table: 15123270
   entities = 360
   check_col = 360
   nodes = table: 152785F8
   k = Dig that rock:5:Rocky
   node = table: 15094D88
@scripts/map/forest_map.lua:586 in (field) Generate (Lua) <282-740>
   prefab = forest
   map_width = 360
   map_height = 360
   tasks = table: 14DB4728
   level = table: 14DB47C8
   level_type = SURVIVAL
   start_time = 4000
   SpawnFunctions = table: 14FB2C28
   current_gen_params = table: 14FB2CA0
   story_gen_params = table: 14FB27C8
   default_impassible_tile = 1
   min_size = 350
   topology_save = table: 151231A8
   entities = table: 15123270
   save = table: 15123360
   join_islands = true
   nodes = table: 151F5BA0
   translated_prefabs = table: 152771F8
   runtime_overrides = table: 152772E8
   obj_layout = table: 15277FE0
   add_fn = table: 15277D10
@scripts/worldgen_main.lua:350 in () ? (Lua) <315-426>
   debug = false
   world_gen_data = table: 14DA3820
   level = table: 14DB47C8
   prefab = forest
   choose_tasks = table: 14DB4728
   savedata = nil
   max_map_width = 1024
   max_map_height = 1024
   try = 1
   maxtries = 5
@=(tail call):-1 in ()  (tail) <-1--1>
@=(tail call):-1 in ()  (tail) <-1--1>
[00:00:06]: Error loading worldgen_main.lua
[00:00:06]: WorldSim::SimThread::Main() ERROR
[00:00:06]: WorldSim::SimThread::Main() complete
[00:00:06]: Worldgen had an error, displaying...    
[00:00:06]: #[string "scripts/map/object_layout.lua"]:185: No layout was provided!
#LUA ERROR stack traceback:
@=[C]:-1 in (global) assert (C) <-1--1>
@scripts/map/object_layout.lua:185 in (upvalue) ConvertLayoutToEntitylist (Lua) <184-274>
   layout = nil
@scripts/map/object_layout.lua:427 in (field) Convert (Lua) <424-429>
   node_id = Dig that rock:5:Rocky
   item = ancientarea
   addEntity = table: 16169858
   layout = nil
@scripts/map/graphnode.lua:273 in (method) ConvertGround (Lua) <250-284>
   self =
      children_populated = false
      graph = table: 15093D98
      populated = false
      edges = table: 15094EC8
      id = Dig that rock:5:Rocky
      visited = false
      data = table: 15094D60
      colour = table: 15092FB0
   spawnFn = table: 14FB2C28
   entitiesOut = table: 15123270
   width = 360
   height = 360
   world_gen_choices = nil
   obj_layout = table: 15277FE0
   prefab_list = table: 161696F0
   add_fn = table: 16169858
   k = ancientarea
   count = 1
   i = 1
@scripts/map/network.lua:633 in (method) ConvertGround (Lua) <630-635>
   self =
      wormholeprefab = wormhole
      story_depth = -1
      MIN_WORMHOLE_ID = 2300000
      id = GAME_root
      required_prefabs = table: 14FB7340
      data = table: 14FB7660
      visited = false
      exit_nodes = table: 14FB7638
      exit_edges = table: 14FB7570
      nodes = table: 14FB7610
      edges = table: 14FB76D8
      children = table: 14FB7548
      colour = table: 14FB74D0
   map = table: 14FB2C28
   spawnFN = table: 15123270
   entities = 360
   check_col = 360
   nodes = table: 152785F8
   k = Dig that rock:5:Rocky
   node = table: 15094D88
@scripts/map/forest_map.lua:586 in (field) Generate (Lua) <282-740>
   prefab = forest
   map_width = 360
   map_height = 360
   tasks = table: 14DB4728
   level = table: 14DB47C8
   level_type = SURVIVAL
   start_time = 4000
   SpawnFunctions = table: 14FB2C28
   current_gen_params = table: 14FB2CA0
   story_gen_params = table: 14FB27C8
   default_impassible_tile = 1
   min_size = 350
   topology_save = table: 151231A8
   entities = table: 15123270
   save = table: 15123360
   join_islands = true
   nodes = table: 151F5BA0
   translated_prefabs = table: 152771F8
   runtime_overrides = table: 152772E8
   obj_layout = table: 15277FE0
   add_fn = table: 15277D10
@scripts/worldgen_main.lua:350 in () ? (Lua) <315-426>
   debug = false
   world_gen_data = table: 14DA3820
   level = table: 14DB47C8
   prefab = forest
   choose_tasks = table: 14DB4728
   savedata = nil
   max_map_width = 1024
   max_map_height = 1024
   try = 1
   maxtries = 5
@=(tail call):-1 in ()  (tail) <-1--1>
@=(tail call):-1 in ()  (tail) <-1--1>    

Thank you.

workshop-ancientarea.zip

Link to comment
Share on other sites

9 hours ago, VuPhan said:

Hi again, I was use your code to add custom peice into map. But no luck, it's not work. Here is error logs and with my test mod

Yes, when I wrote the code, I missed an extra word. Now I edited it and it works, I added ".Layouts" to the Layouts table.

Also, maxwell lights aren't in the game anymore, so you have to copy them from the base game, or just use night lights.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...