I would like to start creating my own scenarios and have read the "Modding Info References" and then tried to adapt the "tutorial lvl 2" to my needs.
but I have a problem with the following section.
i thought that if i place an item in the game editor, give it an entity tag and then query it in the lua so that it will be stored there in the variable when the game state starts.
Code: Select all
local init = function()
global.story = story_init()
game.map_settings.pollution.enabled = false
global.inserter_chest = game.get_entity_by_tag("inserter-chest") or error("Inserter chest missing")
global.inserter_chest_position = global.inserter_chest.position
global.inserter_chest_position.energy = 0
global.inserter_furnace = game.get_entity_by_tag("inserter-furnace") or error("Inserter furnace missing")
global.inserter_furnace_position = global.inserter_furnace.position
end
I copied the lvl 2 of the tutorial into my scenario folder.
afterwards i played the tutorial and looked at what which code section does and made notes about it.
then i made minor adjustments (allowing other recipes, completing research, etc.) inside the control.lua which were all successful.
after that i tried to adjust the inserter, but it fails every time and i don't know what the reason could be.
first i had deleted the inserter and replaced it with fast inserter, replaced the entity-tag and also replaced it in the code.
but when I then started, he said directly that I had deconstructed the inserter and should place it again.
so I thought I had made a mistake in doing so and restored the previous status.
currently I have tested that it works when I do not change anything or when i only change the entity-tag ingame or inside the lua.
it dosnt matter what entity-tag i insert.
As soon as I remove the inserter and place it again, i get the error message, that i deconstructed the inserter, even if i add the correct entity-tag.
can someone please explain to me what I am doing wrong?
greetings
Stumpy