Jump to content

[TEMPLATE/TUTORIAL] Properly adding campfire stories for Walter


Recommended Posts

Something I've noticed a lot of people have been struggling with is adding stories for Walter to tell that will be compatible with ones that are already there. Many people replace his story table, which means no other stories will be told other than the ones in that specific mod. In some cases you might want this, say if you're making a joke or a meme mod. However in most cases people want these stories to be told alongside other mods and the vanilla game, so here I will show how you do it properly. 

In its most basic form, this all will go in your modmain. (The forums hate me when it comes to formatting, so I'll provide a download link as well)


local storiestoadd = {
        lines = {
			"Here's a example,",
			"Of how the stories are written.",
			"Each line Walter says,",
			"Is explicitly typed out.",
			"Doing it like this gives control,",
			"But takes longer than an automatic parser,",
			"Because you individually write the strings.",
			"This is how Klei does it...",
        lines = {
			"I'm allergic to bees.",
			"Eusong loves bees.",
			"If Eusong plays as me,",
			"She can't be a beekeeper,",
			"Unless she wants to die a lot.",
			"Eusong doesn't want to play as me...",
        lines = {
			"Neither does the number of lines.",
			"The length of the lines however,",
			"Is very important.",
			"If the lines are too long,",
			"The game will crash.",
			"Eusong learned that the hard way...",
			"More lines takes longer to tell,",
			"So you may not see the whole story,",
			"Before the night ends,",
			"But at least it won't crash.",
			"The content of the lines,",
			"it DOESNT reeeealllllu mattr",
			"because it doesn't effect the code",
			"1t m1ght make your mod look bad tho",
			"If you want quotation marks,",
			"Put them after a backslash,",
			"Like \"this\".",
			"If you don't,",
			"It will cause issues.",
		lines = {
			{duration = 2, line = "If you do this,"},
			{duration = 2.5, line = "You can choose how long I spend saying this."},
			{duration = 10, line = "This line will last quite a while..."},
			{duration = 1, line = "This one disappears rather quickly."},
			{duration = 2.5, line = "I'm not sure how many seconds 1 is equal to,"},
			{duration = 2, line = "If anyone knows, please tell me."},

for name,content in pairs(storiestoadd) do --This is where the magic happens. This loop goes through all the stories you put in the storiestoadd table and changes the "name" and "content" variables depending on how far through the table it is.
    GLOBAL.STRINGS.STORYTELLER.WALTER.CAMPFIRE[name] = {lines = content.lines} --This line adds to the story table rather than replacing it, and it uses the "name" and "content" variables that the loop creates. These variables are only used inside the loop though, so if you try to call them outside the loop it won't work.


This can be used in mods that aren't exclusively for stories as well. Imagine having secrets in your mod that are hinted about by Walter when he tells stories...

If someone else's mod isn't compatible and people use it alongside yours, you can still let your stories show up by putting this line at the bottom of your modinfo.

priority = -10

What this does is cause your mod to load after other mods by lowering the priority of it. Their mod will have already replaced the story table by the time yours adds stories to it.

Hopefully this can help people who want to add stories. I love seeing the lore-friendly ideas other people have, it's fun to read them. :wilson_vforvictory:


Edited by Eusong
  • Like 4
  • Thanks 1
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

  • Create New...