Scenario, lualib story how to?
Posted: Wed Aug 19, 2020 12:52 pm
I'm trying for the first time to create a scenario in which I want to use some lua scripting to get story elements going on. I've tried 2 sets of examples (in the Wiki and the story-skeleton file in the core lualib) but they simply don't work when I try to launch a game.
I'm getting nil errors on either "story_init_helpers" (for the Wiki example) or "story" (for the story-skeleton). Are either examples supposed to work if simply plugged into a control.lua file or do they need something else? I'm trying to get them working in a freeplay environment with no mods in verion 1.0.0.
Wiki error message:
...Data/Roaming/Factorio/temp/currently-playing/control.lua:62: attempt to call global 'story_init_helpers' (a nil value)
stack traceback:
...Data/Roaming/Factorio/temp/currently-playing/control.lua:62: in main chunk
story-skeleton error message:
The scenario level caused a non-recoverable error.
Please report this error to the scenario author.
Error while running event level::on_pre_player_removed (ID 133)
__core__/lualib/story.lua:44: attempt to index local 'story' (a nil value)
stack traceback:
__core__/lualib/story.lua:44: in function 'story_update'
...Data/Roaming/Factorio/temp/currently-playing/control.lua:10: in function <...Data/Roaming/Factorio/temp/currently-playing/control.lua:9>
EDIT:
I've done some playing around and I feel like I'm missing something.
If I create a scenario using Freeplay and use "story_table" in the control lua file, it'll give me error messages like the previous ones.
If I create a scenario using the Tutorial 05, I'm able to use and modify the "story_table" in the control lua file, but if I replace the entire file with either examples from the Wiki or story-skeleton, the game will load but none of the story element in "story_table" will actually engage. If I only change the "story-table" part and leave the rest as is, everything works.
I've tried creating a Freeplay scenario and plug in the control, new-hope-util and final_screen lua files from the Tutorial 05 and that didn't work either.
So is it possible to have story element in a Freeplay environment or do I need to piggyback one of the other campaigns?
I'm getting nil errors on either "story_init_helpers" (for the Wiki example) or "story" (for the story-skeleton). Are either examples supposed to work if simply plugged into a control.lua file or do they need something else? I'm trying to get them working in a freeplay environment with no mods in verion 1.0.0.
Wiki error message:
...Data/Roaming/Factorio/temp/currently-playing/control.lua:62: attempt to call global 'story_init_helpers' (a nil value)
stack traceback:
...Data/Roaming/Factorio/temp/currently-playing/control.lua:62: in main chunk
story-skeleton error message:
The scenario level caused a non-recoverable error.
Please report this error to the scenario author.
Error while running event level::on_pre_player_removed (ID 133)
__core__/lualib/story.lua:44: attempt to index local 'story' (a nil value)
stack traceback:
__core__/lualib/story.lua:44: in function 'story_update'
...Data/Roaming/Factorio/temp/currently-playing/control.lua:10: in function <...Data/Roaming/Factorio/temp/currently-playing/control.lua:9>
EDIT:
I've done some playing around and I feel like I'm missing something.
If I create a scenario using Freeplay and use "story_table" in the control lua file, it'll give me error messages like the previous ones.
If I create a scenario using the Tutorial 05, I'm able to use and modify the "story_table" in the control lua file, but if I replace the entire file with either examples from the Wiki or story-skeleton, the game will load but none of the story element in "story_table" will actually engage. If I only change the "story-table" part and leave the rest as is, everything works.
I've tried creating a Freeplay scenario and plug in the control, new-hope-util and final_screen lua files from the Tutorial 05 and that didn't work either.
So is it possible to have story element in a Freeplay environment or do I need to piggyback one of the other campaigns?