LordTrolldork Posted March 23, 2016 Share Posted March 23, 2016 I know it is possible because I have done it in the past, but I do not have that mod any more, I was wondering how you changed the color of the speech for a character mod Link to comment https://forums.kleientertainment.com/forums/topic/65703-how-to-make-text-a-different-color/ Share on other sites More sharing options...
CarlZalph Posted March 24, 2016 Share Posted March 24, 2016 Talker component has a table variable you can set colour. Taken from components/talker.lua:37-39: if inst.components.talker.colour then inst.components.talker.widget.text:SetColour(inst.components.talker.colour.x, inst.components.talker.colour.y, inst.components.talker.colour.z, 1) end Link to comment https://forums.kleientertainment.com/forums/topic/65703-how-to-make-text-a-different-color/#findComment-737833 Share on other sites More sharing options...
LordTrolldork Posted April 2, 2016 Author Share Posted April 2, 2016 Sorry I'm replying so late, I didn't see this, but where exactly do I put this code? Link to comment https://forums.kleientertainment.com/forums/topic/65703-how-to-make-text-a-different-color/#findComment-743241 Share on other sites More sharing options...
CarlZalph Posted April 3, 2016 Share Posted April 3, 2016 1 hour ago, LordTrolldork said: Sorry I'm replying so late, I didn't see this, but where exactly do I put this code? Under the assumption that this is a custom character. Let's look at prefabs/wilson.lua and prefabs/player_common.lua. prefabs/player_common.lua:19, 187, 304-306:: local function MakePlayerCharacter(name, customprefabs, customassets, customfn, starting_inventory) ... inst:AddComponent("talker") ... if customfn then customfn(inst) end prefabs/wilson.lua:16, 43, 45:: local fn = function(inst) ... end ... return MakePlayerCharacter("wilson", prefabs, assets, fn) So in this case the prefabs/player_common.lua puts in the talker component which enables the text-over-the-head and sounds. If we wanted to make all Wilsons talk in pure red, we would edit the function 'fn' in prefabs/wilson.lua. This is a callback defined in prefabs/player_common.lua's MakePlayerCharacter that happens after all of the base player components are loaded in. Thus Wilson's 'fn' would have: inst.components.talker.colour = {} inst.components.talker.colour.x = 255.0/255.0 inst.components.talker.colour.y = 0.0/255.0 inst.components.talker.colour.z = 0.0/255.0 If this isn't for a custom character, then you would need to add a prefab post init with it checking for the talker component and finally adding in your custom colouring. Link to comment https://forums.kleientertainment.com/forums/topic/65703-how-to-make-text-a-different-color/#findComment-743352 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