Is there any way to mod in new backstories?

Started by Kingmal, December 30, 2014, 05:46:20 PM

Previous topic - Next topic

Kingmal

I've been looking through the files in the "Source" mod since I'm interested in modding some basic things into the game, and making new backstories looks like it would be an easy and fun thing to start with. Problem is, I can't figure out which file holds them, so I can't look at how they're constructed and how I could make a mod out of one. I'm not sure if this is intentional or not, but if I'm missing something obvious, I'd really like some help.
Proud member of Sirius Cybernetics Corporation.

Sirius Cybernetics Corporation - First against the wall when the revolution comes!

mipen

Currently there is no "official" way to add back stories, as one of Tynans payment options for the game is to make your own back story to go into the game. Making it easy to add your own whenever you want would defeat the purpose of that. That being said, it is possible to add back stories through some dll modding. It is quite difficult to do and adding them into the back story database would be tricky, but the way I am thinking of how it could be done is by using EdB's method of changing game components. He has a special class (an Itab) which is initialised when the game starts. In this class, you could have a method which generates your new back stories and then puts them in to the back story database. To see what a back story is made up of, use ilspy to look up the "Backstory" class

unifex

I got snagged on some SkillDefs I was adding and why they were disabled, and looked into the backstories bit. Its fairly straight-forward to add them to the adult/child lists (harder to fiddle with the WorkTags enumeration!), but I guess if its a kickstarter thing it'd be frowned upon to fiddle too much with it.

EdB

Quote from: mipen on January 08, 2015, 01:22:21 AM
it is possible to add back stories through some dll modding. It is quite difficult to do and adding them into the back story database would be tricky, but the way I am thinking of how it could be done is by using EdB's method of changing game components. He has a special class (an Itab) which is initialised when the game starts. In this class, you could have a method which generates your new back stories and then puts them in to the back story database. To see what a back story is made up of, use ilspy to look up the "Backstory" class

You can add backstories pretty easily using this technique.  Really all you need to do is call BackstoryDatabase.AddBackstory()--though there may be some details around how backstories are used during pawn generation that I don't fully understand.  I was able to add a backstory and get it to show up randomly during colonist creation.  If you're curious about how the ITab technique works, download the Mod Order mod.  It include source code with comments describing it.

mipen

Yep, that would be the way to do it :) you could even set up a new xml Def to write all your new back stories in and then add them all in when the game starts. That way it would be very easy to add new ones whenever you want and you wouldn't need to recompile each time :D

mipen

However I'm still now sure how kindly Tynan would take to it, as back stories are something people can buy to add to the game

EdB

Quote from: mipen on January 09, 2015, 12:23:00 AM
Yep, that would be the way to do it :) you could even set up a new xml Def to write all your new back stories in and then add them all in when the game starts. That way it would be very easy to add new ones whenever you want and you wouldn't need to recompile each time :D

I thought the same thing, a mod to make them mod-able.  But I agree--it somehow feels a little wrong to do it.