Lumina Posted August 25, 2016 Share Posted August 25, 2016 I use the tag "shelter" on a custom structure. The tag do exactly what i want (protection against heat and rain), but it's associated with a speech, often about tree, depending of the character. (Like "Wolfgang hide under tree." for wolfgang). Is there an easy way to have a custom speech for the sheltering part, for this specific structure ? Link to comment https://forums.kleientertainment.com/forums/topic/69776-tag-shelter-and-custom-speech/ Share on other sites More sharing options...
Maris Posted August 27, 2016 Share Posted August 27, 2016 It won't work if your structure has one of these tags: "FX", "NOCLICK", "DECOR", "INLIMBO", "stump", "burnt" Link to comment https://forums.kleientertainment.com/forums/topic/69776-tag-shelter-and-custom-speech/#findComment-807613 Share on other sites More sharing options...
DarkXero Posted August 27, 2016 Share Posted August 27, 2016 AddPrefabPostInit("flower", function(inst) inst:AddTag("shelter") end) local function GetCustomShelterString(character, shelter) if shelter.prefab == "flower" then if character.prefab == "wilson" then return "Thanks, flower." end end end AddComponentPostInit("sheltered", function(self) local _SetSheltered = self.SetSheltered self.SetSheltered = function(self, issheltered) local cooldown_before = self.announcecooldown _SetSheltered(self, issheltered) local cooldown_after = self.announcecooldown if cooldown_before ~= cooldown_after then local shelter = GLOBAL.GetClosestInstWithTag("shelter", self.inst, 2) local custom_string = shelter and GetCustomShelterString(self.inst, shelter) if custom_string then self.inst.components.talker:ShutUp() self.inst.components.talker:Say(custom_string) end end end end) Link to comment https://forums.kleientertainment.com/forums/topic/69776-tag-shelter-and-custom-speech/#findComment-807643 Share on other sites More sharing options...
Lumina Posted August 28, 2016 Author Share Posted August 28, 2016 Thanks, it works fine. Is there a way to make a generic line ? Link to comment https://forums.kleientertainment.com/forums/topic/69776-tag-shelter-and-custom-speech/#findComment-807864 Share on other sites More sharing options...
DarkXero Posted August 28, 2016 Share Posted August 28, 2016 6 hours ago, Lumina said: Is there a way to make a generic line ? Remove the character.prefab check and everybody will spout it. local function GetCustomShelterString(character, shelter) if shelter.prefab == "flower" then return "Everybody says this." end end Link to comment https://forums.kleientertainment.com/forums/topic/69776-tag-shelter-and-custom-speech/#findComment-807963 Share on other sites More sharing options...
Lumina Posted August 28, 2016 Author Share Posted August 28, 2016 Oh perfect, thanks ! Link to comment https://forums.kleientertainment.com/forums/topic/69776-tag-shelter-and-custom-speech/#findComment-807964 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