MF99K Posted April 15, 2016 Share Posted April 15, 2016 I think this is a fairly simple problem, but the way I thought I could get it to work doesn't seem to work at all so I'm basically wondering how would I get custom canon character examination strings for mod items via modmain? Link to comment Share on other sites More sharing options...
DarkXero Posted April 15, 2016 Share Posted April 15, 2016 local STRINGS = GLOBAL.STRINGS STRINGS.CHARACTERS.GENERIC.DESCRIBE.MOD_ITEM_PREFAB = "Wilson says this" STRINGS.CHARACTERS.WAXWELL.DESCRIBE.MOD_ITEM_PREFAB = "Maxwell" STRINGS.CHARACTERS.WOLFGANG.DESCRIBE.MOD_ITEM_PREFAB = "Wolfgang" STRINGS.CHARACTERS.WX78.DESCRIBE.MOD_ITEM_PREFAB = "WX78" STRINGS.CHARACTERS.WILLOW.DESCRIBE.MOD_ITEM_PREFAB = "Willow" STRINGS.CHARACTERS.WENDY.DESCRIBE.MOD_ITEM_PREFAB = "Wendy" STRINGS.CHARACTERS.WOODIE.DESCRIBE.MOD_ITEM_PREFAB = "Woodie" STRINGS.CHARACTERS.WICKERBOTTOM.DESCRIBE.MOD_ITEM_PREFAB = "Wickerbottom" STRINGS.CHARACTERS.WATHGRITHR.DESCRIBE.MOD_ITEM_PREFAB = "Wigfrid" STRINGS.CHARACTERS.WEBBER.DESCRIBE.MOD_ITEM_PREFAB = "Webber" Remember the character prefab has to be uppercase, as well as the name of the prefab. If you want it a bit more clean to avoid all those STRINGS STRINGS STRINGS: local STRINGS = GLOBAL.STRINGS local descriptions = { MOD_ITEM_PREFAB = { GENERIC = "Wilson says this.", WAXWELL = "Maxwell.", WOLFGANG = "Wolfgang.", WX78 = "WX78.", WILLOW = "Willow.", WENDY = "Wendy.", WOODIE = "Woodie.", WICKERBOTTOM = "Wickerbottom.", WATHGRITHR = "Wigfrid.", WEBBER = "Webber.", }, } for PREFAB, speeches in pairs(descriptions) do for GUY, speechline in pairs(speeches) do STRINGS.CHARACTERS[GUY].DESCRIBE[PREFAB] = speechline end end Link to comment Share on other sites More sharing options...
MF99K Posted April 18, 2016 Author Share Posted April 18, 2016 On 4/15/2016 at 11:44 PM, DarkXero said: local STRINGS = GLOBAL.STRINGS STRINGS.CHARACTERS.GENERIC.DESCRIBE.MOD_ITEM_PREFAB = "Wilson says this" STRINGS.CHARACTERS.WAXWELL.DESCRIBE.MOD_ITEM_PREFAB = "Maxwell" STRINGS.CHARACTERS.WOLFGANG.DESCRIBE.MOD_ITEM_PREFAB = "Wolfgang" STRINGS.CHARACTERS.WX78.DESCRIBE.MOD_ITEM_PREFAB = "WX78" STRINGS.CHARACTERS.WILLOW.DESCRIBE.MOD_ITEM_PREFAB = "Willow" STRINGS.CHARACTERS.WENDY.DESCRIBE.MOD_ITEM_PREFAB = "Wendy" STRINGS.CHARACTERS.WOODIE.DESCRIBE.MOD_ITEM_PREFAB = "Woodie" STRINGS.CHARACTERS.WICKERBOTTOM.DESCRIBE.MOD_ITEM_PREFAB = "Wickerbottom" STRINGS.CHARACTERS.WATHGRITHR.DESCRIBE.MOD_ITEM_PREFAB = "Wigfrid" STRINGS.CHARACTERS.WEBBER.DESCRIBE.MOD_ITEM_PREFAB = "Webber" Remember the character prefab has to be uppercase, as well as the name of the prefab. If you want it a bit more clean to avoid all those STRINGS STRINGS STRINGS: local STRINGS = GLOBAL.STRINGS local descriptions = { MOD_ITEM_PREFAB = { GENERIC = "Wilson says this.", WAXWELL = "Maxwell.", WOLFGANG = "Wolfgang.", WX78 = "WX78.", WILLOW = "Willow.", WENDY = "Wendy.", WOODIE = "Woodie.", WICKERBOTTOM = "Wickerbottom.", WATHGRITHR = "Wigfrid.", WEBBER = "Webber.", }, } for PREFAB, speeches in pairs(descriptions) do for GUY, speechline in pairs(speeches) do STRINGS.CHARACTERS[GUY].DESCRIBE[PREFAB] = speechline end end thanks. could I do this with mod characters as well? or only if it's the same mod/both mods are enabled? Link to comment Share on other sites More sharing options...
Aquaterion Posted April 18, 2016 Share Posted April 18, 2016 (edited) You could probably do something like: if KnownModIndex:IsModEnabled("workshop-123456789") then descriptions.MOD_ITEM_PRFAB[MODCHARACTERNAME] = "Whatever you put here" end before the for loop Edited April 18, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
MF99K Posted April 18, 2016 Author Share Posted April 18, 2016 10 minutes ago, Aquaterion said: You could probably do something like: if KnownModIndex:IsModEnabled("workshop-123456789") then descriptions.MOD_ITEM_PRFAB[MODCHARACTERNAME] = "Whatever you put here" end before the for loop which loop do you mean? Link to comment Share on other sites More sharing options...
Aquaterion Posted April 18, 2016 Share Posted April 18, 2016 (edited) Just now, mf99k said: which loop do you mean? local descriptions = { MOD_ITEM_PREFAB = { GENERIC = "Wilson says this.", WAXWELL = "Maxwell.", WOLFGANG = "Wolfgang.", WX78 = "WX78.", WILLOW = "Willow.", WENDY = "Wendy.", WOODIE = "Woodie.", WICKERBOTTOM = "Wickerbottom.", WATHGRITHR = "Wigfrid.", WEBBER = "Webber.", }, } if KnownModIndex:IsModEnabled("workshop-123456789") then descriptions.MOD_ITEM_PRFAB[MODCHARACTERNAME] = "Whatever you put here" end for PREFAB, speeches in pairs(descriptions) do for GUY, speechline in pairs(speeches) do STRINGS.CHARACTERS[GUY].DESCRIBE[PREFAB] = speechline end end Edited April 18, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
MF99K Posted April 18, 2016 Author Share Posted April 18, 2016 Just now, Aquaterion said: local descriptions = { MOD_ITEM_PREFAB = { GENERIC = "Wilson says this.", WAXWELL = "Maxwell.", WOLFGANG = "Wolfgang.", WX78 = "WX78.", WILLOW = "Willow.", WENDY = "Wendy.", WOODIE = "Woodie.", WICKERBOTTOM = "Wickerbottom.", WATHGRITHR = "Wigfrid.", WEBBER = "Webber.", }, } if KnownModIndex:IsModEnabled("workshop-123456789") then descriptions.MOD_ITEM_PRFAB[MODCHARACTERNAME] = "Whatever you put here" end for PREFAB, speeches in pairs(descriptions) do for GUY, speechline in pairs(speeches) do STRINGS.CHARACTERS[GUY].DESCRIBE[PREFAB] = speechline end end I was probably going to just do the speech strings without the character table. Would it work the same way or is that code specifically for the table format? Link to comment Share on other sites More sharing options...
Aquaterion Posted April 18, 2016 Share Posted April 18, 2016 14 minutes ago, mf99k said: I was probably going to just do the speech strings without the character table. Would it work the same way or is that code specifically for the table format? the "if" should still work Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now