Sacco Posted September 11, 2024 Share Posted September 11, 2024 I added a "curse" in the game, and when you get cursed the character will say "wait what, i got cursed". Obviously, i'd like to change it so every character says his own quote, but how? I have no clue. local Curse = Class(function(self, inst) self.inst = inst self.remaining_time = 0 self.task = nil end) function Curse:ApplyCurse(time) self.inst.components.talker:Say("Wait what, i got cursed!") if self.task ~= nil then self.task:Cancel() end self.remaining_time = time > self.remaining_time and time or self.remaining_time self.task = self.inst:DoPeriodicTask(1, function(_) if self.remaining_time == 0 then self.task:Cancel() return end self.inst.components.health:DoDelta(-3) self.remaining_time = self.remaining_time - 1 end) end return Curse Link to comment https://forums.kleientertainment.com/forums/topic/159630-how-do-i-add-different-quotes/ Share on other sites More sharing options...
ClumsyPenny Posted September 12, 2024 Share Posted September 12, 2024 Instead of your "Wait what, i got cursed!" string, use this function here: GetString(self.inst, "ANNOUNCE_I_GOT_CURSED") So that your line will look like this: self.inst.components.talker:Say(GetString(self.inst, "ANNOUNCE_I_GOT_CURSED")) You can use whatever string you prefer instead of "ANNOUNCE_I_GOT_CURSED", just make sure to also add the string to a character in the modmain environment, for example like this: GLOBAL.STRINGS.CHARACTERS.GENERIC.ANNOUNCE_I_GOT_CURSED = "Wait what, i got cursed!" 1 Link to comment https://forums.kleientertainment.com/forums/topic/159630-how-do-i-add-different-quotes/#findComment-1747245 Share on other sites More sharing options...
RexySeven Posted September 12, 2024 Share Posted September 12, 2024 2 hours ago, ClumsyPenny said: Instead of your "Wait what, i got cursed!" string, use this function here: GetString(self.inst, "ANNOUNCE_I_GOT_CURSED") So that your line will look like this: self.inst.components.talker:Say(GetString(self.inst, "ANNOUNCE_I_GOT_CURSED")) You can use whatever string you prefer instead of "ANNOUNCE_I_GOT_CURSED", just make sure to also add the string to a character in the modmain environment, for example like this: GLOBAL.STRINGS.CHARACTERS.GENERIC.ANNOUNCE_I_GOT_CURSED = "Wait what, i got cursed!" Sorry, bit off-topic but if I want to make so strings are taken from another file (I want to do different language support) I should do in skilltree file: whispy_beard_1 = { title = GetString(self.inst, "WHISPY_SKILL_I"), in string file: GLOBAL.STRINGS.WHISPY_SKILL_I = "Beardlord I" ? Link to comment https://forums.kleientertainment.com/forums/topic/159630-how-do-i-add-different-quotes/#findComment-1747265 Share on other sites More sharing options...
ClumsyPenny Posted September 12, 2024 Share Posted September 12, 2024 1 hour ago, RexySeven said: Sorry, bit off-topic but if I want to make so strings are taken from another file (I want to do different language support) I should do in skilltree file: whispy_beard_1 = { title = GetString(self.inst, "WHISPY_SKILL_I"), in string file: GLOBAL.STRINGS.WHISPY_SKILL_I = "Beardlord I" ? GetString is specifically for character quotes, not translation. I don't know how mods are supposed to handle translation, so I can't help you there. Link to comment https://forums.kleientertainment.com/forums/topic/159630-how-do-i-add-different-quotes/#findComment-1747277 Share on other sites More sharing options...
Sacco Posted September 12, 2024 Author Share Posted September 12, 2024 4 hours ago, ClumsyPenny said: Instead of your "Wait what, i got cursed!" string, use this function here: GetString(self.inst, "ANNOUNCE_I_GOT_CURSED") So that your line will look like this: self.inst.components.talker:Say(GetString(self.inst, "ANNOUNCE_I_GOT_CURSED")) You can use whatever string you prefer instead of "ANNOUNCE_I_GOT_CURSED", just make sure to also add the string to a character in the modmain environment, for example like this: GLOBAL.STRINGS.CHARACTERS.GENERIC.ANNOUNCE_I_GOT_CURSED = "Wait what, i got cursed!" i was testing what you said, and it was working. Until a friend of mine entered and chose a character, at that point my character (walter) started saying winona's quote. In other words, the last one to enter dictates the quote. What's the problem? Link to comment https://forums.kleientertainment.com/forums/topic/159630-how-do-i-add-different-quotes/#findComment-1747290 Share on other sites More sharing options...
ClumsyPenny Posted September 12, 2024 Share Posted September 12, 2024 42 minutes ago, Sacco said: What's the problem? Show me your code. Link to comment https://forums.kleientertainment.com/forums/topic/159630-how-do-i-add-different-quotes/#findComment-1747300 Share on other sites More sharing options...
Sacco Posted September 12, 2024 Author Share Posted September 12, 2024 14 minutes ago, ClumsyPenny said: Show me your code. local Curse = Class(function(self, inst) self.inst = inst self.remaining_time = 0 self.task = nil end) function Curse:ApplyCurse(time) self.inst.components.talker:Say(GetString(self.inst, "ANNOUNCE_I_GOT_CURSED")) if self.task ~= nil then self.task:Cancel() end self.remaining_time = time > self.remaining_time and time or self.remaining_time self.task = self.inst:DoPeriodicTask(1, function(_) if self.remaining_time == 0 then self.task:Cancel() return end self.inst.components.health:DoDelta(-3) self.remaining_time = self.remaining_time - 1 end) end return Curse then i put in a different folder every character quote (every character has its own folder) all linked to modmain example: AddPrefabPostInit("woodie", function(inst) if GLOBAL.TheWorld.ismastersim then GLOBAL.STRINGS.CHARACTERS.GENERIC.ANNOUNCE_I_GOT_CURSED = "Another day, another curse" end end) Link to comment https://forums.kleientertainment.com/forums/topic/159630-how-do-i-add-different-quotes/#findComment-1747304 Share on other sites More sharing options...
ClumsyPenny Posted September 12, 2024 Share Posted September 12, 2024 59 minutes ago, Sacco said: AddPrefabPostInit("woodie", function(inst) if GLOBAL.TheWorld.ismastersim then GLOBAL.STRINGS.CHARACTERS.GENERIC.ANNOUNCE_I_GOT_CURSED = "Another day, another curse" end end) They're not supposed to be in a AddPrefabPostInit, I just said in the modmain environment. Also, instead of GENERIC, you're supposed to change that for each character's prefab (aside for Wilson, who uses the default GENERIC). For example: GLOBAL.STRINGS.CHARACTERS.GENERIC.ANNOUNCE_I_GOT_CURSED = "Wait what, i got cursed!" GLOBAL.STRINGS.CHARACTERS.WILLOW.ANNOUNCE_I_GOT_CURSED = "oh no" GLOBAL.STRINGS.CHARACTERS.WOLFGANG.ANNOUNCE_I_GOT_CURSED = "mighty wolfgang is cursed" GLOBAL.STRINGS.CHARACTERS.WENDY.ANNOUNCE_I_GOT_CURSED = "yay" -- etc. A character's prefab name usually matches their name, but there's some notable exceptions like WX-78 is WX78, Wigfrid is WATHGRITHR and Maxwell is WAXWELL. 1 Link to comment https://forums.kleientertainment.com/forums/topic/159630-how-do-i-add-different-quotes/#findComment-1747320 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