Jump to content

AddSimPostInit not working, what should i use instead?


Recommended Posts

I'm trying to port my old character mods to Don't Starve Together, and generally for character strings that the game may not have data for characters on. By this I essentially mean Wigfrid and Webber, since the player won't have those characters if they don't have reign of giants.

 

Generally I would use code like this, to make the game check, but not require the data on Wigfrid and Webber to run it, but if the player has the dlc, then wigfrid and webber will speak those lines, as well as other potential mod characters the player may not have.

AddSimPostInit(function(inst)        if inst.prefab == "wathgrithr" thenSTRINGS.CHARACTERS.WATHGRITHR.DESCRIBE.SNIPER = {	GENERIC = "'Allo to you bushman, or is it swagman?",	ATTACKER = "You won't be any match to me sniper!",	MURDERER = "You may have killed, but not as many as I!",	REVIVER = "He has brought me back from Valhalla! Thanks sire...",	GHOST = "You must have not been hard to kill!",}elseif inst.prefab == "webber" thenSTRINGS.CHARACTERS.WEBBER.DESCRIBE.SNIPER = {	GENERIC = "He can help us with nature survival!",	ATTACKER = "No! Don't hurt us!",	MURDERER = "We are not a monster, trust us!",	REVIVER = "Thank you big man...",	GHOST = "AAAAAAAH!!",}end	end)

 

 

However this code is no longer working (they still use the generic character lines), most likely due to how dst seems to handle the players differently. I've tried using AddPrefabPostInit, but that isn't working either... What kind of code should I add to get these working in dst? let me know if you need additional details.

Link to comment
Share on other sites

@1337gamer15, Hmm, well, there are definitely many approaches you could use here. The one I would use offhand would be putting everything into an AddPrefabPostInit("forest", function() end), to make sure it always runs the string part after all other mods/characters have loaded. At that point, instead of checking the prefab names, you could either check DST_CHARACTERLIST and MODCHARACTERLIST, or you could just check if STRINGS.CHARACTERS.WEBBER, etc exist. so...

AddPrefabPostInit("forest", function(inst)        if STRINGS.CHARACTERS.WATHGRITHR thenSTRINGS.CHARACTERS.WATHGRITHR.DESCRIBE.SNIPER = {    GENERIC = "'Allo to you bushman, or is it swagman?",    ATTACKER = "You won't be any match to me sniper!",    MURDERER = "You may have killed, but not as many as I!",    REVIVER = "He has brought me back from Valhalla! Thanks sire...",    GHOST = "You must have not been hard to kill!",}endif STRINGS.CHARACTERS.WEBBER thenSTRINGS.CHARACTERS.WEBBER.DESCRIBE.SNIPER = {    GENERIC = "He can help us with nature survival!",    ATTACKER = "No! Don't hurt us!",    MURDERER = "We are not a monster, trust us!",    REVIVER = "Thank you big man...",    GHOST = "AAAAAAAH!!",}end    end)
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...