waddle_dee Posted July 28, 2022 Share Posted July 28, 2022 Hi, first post here (hope I’m doing it correctly.) I am making a character mod and I was wondering if it’s possible to make something similar to wigfrids umlauts? (Replacing the os with ös) for my own character? I’d want to replace some other letter but I’m not sure how I’d go on making that? I can’t find the script with the code anywhere that changes her dialogue. thanks Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/ Share on other sites More sharing options...
Leonidas IV Posted July 30, 2022 Share Posted July 30, 2022 Actually wigfrid has a special font, I think you can find something related to that in her prefab: prefabs/wathgrithr.lua 1 Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/#findComment-1590408 Share on other sites More sharing options...
HarryPPP Posted July 30, 2022 Share Posted July 30, 2022 (edited) Wigfrid actually uses a special function of the "talker" component to replace every O in her speech with an Ö. inst.components.talker.mod_str_fn = Umlautify "Umlauntify" is a function value found within "stringutil.lua", and looks like this: Spoiler function Umlautify(string) if not Profile:IsWathgrithrFontEnabled() then return string end local ret = "" local last = false for i = 1, #string do local c = string:sub(i,i) if not last and (c == "o" or c == "O") then ret = ret .. ((c == "o" and "ö") or (c == "O" and "Ö") or c) last = true else ret = ret .. c last = false end end return ret end So, all you have to do is add the first line of code and create a function to make the replacements as you wish. Edited July 30, 2022 by HarryPPP 1 Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/#findComment-1590605 Share on other sites More sharing options...
waddle_dee Posted July 31, 2022 Author Share Posted July 31, 2022 17 hours ago, HarryPPP said: Wigfrid actually uses a special function of the "talker" component to replace every O in her speech with an Ö. inst.components.talker.mod_str_fn = Umlautify "Umlauntify" is a function value found within "stringutil.lua", and looks like this: Hide contents function Umlautify(string) if not Profile:IsWathgrithrFontEnabled() then return string end local ret = "" local last = false for i = 1, #string do local c = string:sub(i,i) if not last and (c == "o" or c == "O") then ret = ret .. ((c == "o" and "ö") or (c == "O" and "Ö") or c) last = true else ret = ret .. c last = false end end return ret end So, all you have to do is add the first line of code and create a function to make the replacements as you wish. Thank you so much for your response. I feel a bit lost of what to do next though. I am not that experienced and I’m not quite sure how I’d go on creating the function to make it work? What exactly would I be typing out? Do I just copy the already existing function? If so, what is it that I have to edit so it works with my own character? Sorry if it’s kind of a simple question, just want to make sure I’m doing it right. thanks again! Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/#findComment-1590760 Share on other sites More sharing options...
HarryPPP Posted July 31, 2022 Share Posted July 31, 2022 (edited) 4 hours ago, waddle_dee said: What exactly would I be typing out? Do I just copy the already existing function? I've written a function with some handy comments to try and explain: function Acutify(string) -- Goal: replace every E with an É. local ret = "" for i = 1, #string do -- All the letters are taken out of the message, and each one goes through a check: local c = string:sub(i,i) -- "c", short for "character" -- Here, I am checking if the found character is an accentless, capitalized or not, letter "E". if c == "e" or c == "E" then ret = ret .. ((c == "e" and "é") or (c == "E" and "É") or c) -- Each letter E found will be replaced with an É. else ret = ret .. c -- If the letter is not E, it will just be put back on its place, with no alterations. end end return ret -- This replaces the original message with the newly compiled one. end 4 hours ago, waddle_dee said: Sorry if it’s kind of a simple question, just want to make sure I’m doing it right. thanks again! Oh, don't worry. It took me a while to figure this out... But it's quite simple with some tips, eh? Edited July 31, 2022 by HarryPPP 1 Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/#findComment-1590815 Share on other sites More sharing options...
waddle_dee Posted August 1, 2022 Author Share Posted August 1, 2022 4 hours ago, HarryPPP said: I've written a function with some handy comments to try and explain: function Acutify(string) -- Goal: replace every E with an É. local ret = "" for i = 1, #string do -- All the letters are taken out of the message, and each one goes through a check: local c = string:sub(i,i) -- "c", short for "character" -- Here, I am checking if the found character is an accentless, capitalized or not, letter "E". if c == "e" or c == "E" then ret = ret .. ((c == "e" and "é") or (c == "E" and "É") or c) -- Each letter E found will be replaced with an É. else ret = ret .. c -- If the letter is not E, it will just be put back on its place, with no alterations. end end return ret -- This replaces the original message with the newly compiled one. end Oh, don't worry. It took me a while to figure this out... But it's quite simple with some tips, eh? ahh thank you so much! The tips sure help a lot!! I will try this tomorrow. :) thanks again! Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/#findComment-1590875 Share on other sites More sharing options...
waddle_dee Posted August 3, 2022 Author Share Posted August 3, 2022 On 7/31/2022 at 10:47 PM, HarryPPP said: Oh, don't worry. It took me a while to figure this out... But it's quite simple with some tips, eh? And here I am back with another question I added your function to my character, word for word, just to try it out. I made sure to add the component thingy too, becuase I assume that is what you meant to be the "first line of code" On 7/31/2022 at 12:23 AM, HarryPPP said: So, all you have to do is add the first line of code and create a function to make the replacements as you wish. Well, I tried to run the game with it but nothing really happened or changed? I've been trying to figure out what I am missing but I am so clueless maybe I am missing where exactly im supposed to put everything. I have tried to look at other scripts with similar stuff but I cannot figure it out thanks again for your time and patience Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/#findComment-1591239 Share on other sites More sharing options...
HarryPPP Posted August 4, 2022 Share Posted August 4, 2022 On 8/3/2022 at 12:09 AM, waddle_dee said: I've been trying to figure out what I am missing but I am so clueless maybe I am missing where exactly im supposed to put everything Make sure "inst.components.talker.mod_str_fn = Acutify" is inside the "master_postinit" function, and that the "Acutify" function is anywhere above it outside of a function. On 8/3/2022 at 12:09 AM, waddle_dee said: thanks again for your time and patience Don't worry, this has been a learning experience to me too. I never really questioned how Wigfrid's Umlaunts were made... Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/#findComment-1591650 Share on other sites More sharing options...
waddle_dee Posted August 4, 2022 Author Share Posted August 4, 2022 9 hours ago, HarryPPP said: Don't worry, this has been a learning experience to me too. I never really questioned how Wigfrid's Umlaunts were made... I figured it out!!! Thanks!! Link to comment https://forums.kleientertainment.com/forums/topic/142184-something-similar-to-wigfrids-umlauts/#findComment-1591984 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