. . . Posted August 16, 2016 Share Posted August 16, 2016 (edited) Hello, I need help ! So, I want to know is there a code to make a character glow a certain color? For example I want my character be able to glow bright white so I tried putting code to make him give off light act.target.Light:Enable(true) act.target.Light:SetRadius(.15) act.target.Light:SetFalloff(0.95) act.target.Light:SetIntensity(.15) act.target.Light:SetColour(255 / 255, 255 / 255, 255 / 255) but it just puts some light under his feet not on her entire body ... Can someone tell me if there's a code to make a character's body glow a certain color or make his body light up a certain color? I would be really happy and joyous if someone could tell me if there even is a code like this !! Thanks a lot for reading my problem I hope you have a wonderful day/night !!!!!!!!!!! PS. I almost forgot , if someone can also tell me if it's possible to change the color of a effect like "sparks_fx"? I saw in the "fx.lua" for example the "die_fx" has something like "tint = Vector3(90/255, 66/255, 41/255)". If possible can someone tell me how I would make a white color "sparks_fx" if it's even possible in the first place , sorry for asking for so much thanks so much!!!!! Edited September 20, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/ Share on other sites More sharing options...
Maris Posted August 16, 2016 Share Posted August 16, 2016 inst.AnimState:SetMultColour(255/255, 255/255, 255/255, 1) Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-803989 Share on other sites More sharing options...
. . . Posted August 16, 2016 Author Share Posted August 16, 2016 1 hour ago, Maris said: inst.AnimState:SetMultColour(255/255, 255/255, 255/255, 1) What does that do ? I added it and nothing changed or happened. Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-804006 Share on other sites More sharing options...
rezecib Posted August 16, 2016 Share Posted August 16, 2016 @SuperDavid AnimState:SetMultColour will tint the player, doing the light will tint the light. I think to get the exact effect you're thinking of when you say "glow", you'd have to get into bloom. Unfortunately I really don't know much about bloom. You can look at the magiluminescence code (prefabs/amulet.lua), as it puts a bloom effect on the character when worn. I don't see any way to change the color from the code, so my guess is that you'd have to create your own bloom effect file for that. With a little investigation... It appears the bloom files have some code in them. shaders/anim_bloom.ksh looked like the easiest one to edit for color purposes. Make a copy of that, rename it something, and then edit it as text-- you'll see a part at the bottom like this: gl_FragColor.rgba = vec4( 0, 0, 0, colour.a ); I was able to get it to show white, red, blue, teal, etc by changing those zeroes to 1s, but I couldn't seem to get it to accept anything between (game would crash). Once you've got your file you should load it into your mod by declaring it as an asset: Asset("SHADER", "shaders/my_anim_bloom.ksh"), I couldn't get it to load fully, it seems like there must be some other renaming required-- I can see three parts in the file where it mentions anim_bloom, but renaming all of them seemed to crash as well, and renaming none didn't load it. Perhaps someone else can figure out the rest, I ran out of time on this. Bonus shenanigans picture from when I was screwing around with it: Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-804007 Share on other sites More sharing options...
. . . Posted August 16, 2016 Author Share Posted August 16, 2016 9 minutes ago, rezecib said: I laughed so hard at this i'm so sorry xD And thanks a lot for your help, i'll look into the shading things ! Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-804011 Share on other sites More sharing options...
Neu7ral Posted August 16, 2016 Share Posted August 16, 2016 6 hours ago, rezecib said: Seems like the world and Wilson is evolving! Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-804082 Share on other sites More sharing options...
CarlZalph Posted August 16, 2016 Share Posted August 16, 2016 inst.AnimState:SetMultColour(<0-1>, <0-1>, <0-1>, <0-1>) inst.AnimState:SetAddColour(<0-1>, <0-1>, <0-1>, <0-1>) inst.AnimState:SetLightOverride(<0-inf>) Mult is the colour scaling applied multiplicative, so the RGBA channels are each multiplied by the constants from zero to one. Add is the colour scaling applied additive, so the RGBA channels are each adding this offset from zero to one. Spoiler Format: Mult(RGBA), Add(RGBA) Default: (1,1,1,1), (0,0,0,0) (0,1,1,1), (1,0,0,0) (0,1,1,1), (0,0,0,0) (0,0,0,0.5), (0,0,0,0) (0,0,0,0.5), (0,0,1,0) (1,1,1,1), (1,0,1,0) (0,1,0,1), (0.5,0,0,0) Light values:: 0 1 10 10000 The light parameter will make you render over the darkness at night, so you will be a true "glowing" thing whereas the other two modulate the colour tint and intensity. Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-804165 Share on other sites More sharing options...
Joachim Posted August 19, 2016 Share Posted August 19, 2016 On 8/16/2016 at 8:25 AM, rezecib said: gl_FragColor.rgba = vec4( 0, 0, 0, colour.a ); I was able to get it to show white, red, blue, teal, etc by changing those zeroes to 1s, but I couldn't seem to get it to accept anything between (game would crash) That's strange, because I see fractions being used everywhere in the shader files. Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-804963 Share on other sites More sharing options...
CarlZalph Posted August 19, 2016 Share Posted August 19, 2016 33 minutes ago, Joachim said: That's strange, because I see fractions being used everywhere in the shader files. He probably was editing the file itself instead of compiling the shader using Klei's tools to join the two different shader parts, messing up the header at the top of the file. Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-804975 Share on other sites More sharing options...
Jpianist Posted August 21, 2016 Share Posted August 21, 2016 (edited) On 16/8/2016 at 4:50 PM, CarlZalph said: inst.AnimState:SetMultColour(<0-1>, <0-1>, <0-1>, <0-1>) inst.AnimState:SetAddColour(<0-1>, <0-1>, <0-1>, <0-1>) inst.AnimState:SetLightOverride(<0-inf>) Mult is the colour scaling applied multiplicative, so the RGBA channels are each multiplied by the constants from zero to one. Add is the colour scaling applied additive, so the RGBA channels are each adding this offset from zero to one. Reveal hidden contents Format: Mult(RGBA), Add(RGBA) Default: (1,1,1,1), (0,0,0,0) (0,1,1,1), (1,0,0,0) (0,1,1,1), (0,0,0,0) (0,0,0,0.5), (0,0,0,0) (0,0,0,0.5), (0,0,1,0) (1,1,1,1), (1,0,1,0) (0,1,0,1), (0.5,0,0,0) Light values:: 0 1 10 10000 The light parameter will make you render over the darkness at night, so you will be a true "glowing" thing whereas the other two modulate the colour tint and intensity. How do i do this? spefically the number (1,1,1,1), (1,0,1,0) I am currently using this: local function health_drop(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.health:StartRegen(-1, 2) owner.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.5) owner.components.combat.damagemultiplier = 2 owner.components.health.maxhealth=300 owner.Light:Enable(true) owner.Light:SetRadius(2) owner.Light:SetFalloff(1) owner.Light:SetIntensity(0.5) owner.Light:SetColour(128/255,128/255,255/255) end end How do i change this code to make it look like the one in the picture, the the number (1,1,1,1), (1,0,1,0) Edited August 21, 2016 by Jpianist Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-805446 Share on other sites More sharing options...
rezecib Posted August 21, 2016 Share Posted August 21, 2016 @Jpianist owner.AnimState:SetMultColour(1, 1, 1, 1) owner.AnimState:SetAddColour(1, 0, 1, 0) owner.AnimState:SetLightOverride(<0-inf>) -- you'll have to fiddle with this one. Start with 0 and increase until you like it --Note that you can test this all in game much faster by doing ThePlayer.AnimState:... on the console. Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-805466 Share on other sites More sharing options...
Jpianist Posted August 21, 2016 Share Posted August 21, 2016 (edited) @rezecib i got an error, this is how my code looks now: local function health_drop(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.health:StartRegen(-1, 2) owner.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.5) owner.components.combat.damagemultiplier = 2 owner.components.health.maxhealth=300 owner.Light:Enable(true) owner.Light:SetRadius(2) owner.Light:SetFalloff(1) owner.Light:SetIntensity(0.5) owner.Light:SetColour(128/255,128/255,255/255) owner.AnimState:SetMultColour(1, 1, 1, 1) owner.AnimState:SetAddColour(1, 0, 1, 0) owner.AnimState:SetLightOverride(<0-inf>) end end The error message says: unexpected symbol near '<' Said error points to this line: owner.AnimState:SetLightOverride(<0-inf>) EDIT: Fixed the problem by removing the symbols and letters, only leaving the number: owner.AnimState:SetLightOverride(0) I got the color i wanted, but now, in order to stop the light when i unequip the ítem, i have: owner.Light:Enable(false) But when i unequip the ítem, i'm still purple like in the picture, the color doesn't go, the light does because of lowner.Light:Enable(false), so darkness can kill me, but i'm still purple. How do i remove the color when unequiping the ítem? EDIT 2: I found the answer, just applied the default values to unequip, so equiping the ítem will do: owner.AnimState:SetMultColour(1, 1, 1, 1) owner.AnimState:SetAddColour(1, 0, 1, 0) owner.AnimState:SetLightOverride(0) And unequiping it does: owner.AnimState:SetMultColour(1, 1, 1, 1) owner.AnimState:SetAddColour(0, 0, 0, 0) owner.AnimState:SetLightOverride(0) Now i have the color i wanted, thank you so much @rezecib!! Like i said before in a different post, you're going into my mod's colaborators (this far you're the only one. Lol) Edited August 21, 2016 by Jpianist update (found my answer) Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-805474 Share on other sites More sharing options...
CarlZalph Posted August 21, 2016 Share Posted August 21, 2016 7 hours ago, Jpianist said: @rezecib i got an error, this is how my code looks now: local function health_drop(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.health:StartRegen(-1, 2) owner.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.5) owner.components.combat.damagemultiplier = 2 owner.components.health.maxhealth=300 owner.Light:Enable(true) owner.Light:SetRadius(2) owner.Light:SetFalloff(1) owner.Light:SetIntensity(0.5) owner.Light:SetColour(128/255,128/255,255/255) owner.AnimState:SetMultColour(1, 1, 1, 1) owner.AnimState:SetAddColour(1, 0, 1, 0) owner.AnimState:SetLightOverride(<0-inf>) end end The error message says: unexpected symbol near '<' Said error points to this line: owner.AnimState:SetLightOverride(<0-inf>) EDIT: Fixed the problem by removing the symbols and letters, only leaving the number: owner.AnimState:SetLightOverride(0) I got the color i wanted, but now, in order to stop the light when i unequip the ítem, i have: owner.Light:Enable(false) But when i unequip the ítem, i'm still purple like in the picture, the color doesn't go, the light does because of lowner.Light:Enable(false), so darkness can kill me, but i'm still purple. How do i remove the color when unequiping the ítem? EDIT 2: I found the answer, just applied the default values to unequip, so equiping the ítem will do: owner.AnimState:SetMultColour(1, 1, 1, 1) owner.AnimState:SetAddColour(1, 0, 1, 0) owner.AnimState:SetLightOverride(0) And unequiping it does: owner.AnimState:SetMultColour(1, 1, 1, 1) owner.AnimState:SetAddColour(0, 0, 0, 0) owner.AnimState:SetLightOverride(0) Now i have the color i wanted, thank you so much @rezecib!! Like i said before in a different post, you're going into my mod's colaborators (this far you're the only one. Lol) Since you're not touching the LightOverride might I recommend not touching it? Lest another mod uses it for something and you're just overriding it with zero. You are also able to get the current values of these with GetMultColour and GetAddColour should you choose. It returns back four variables, so example usage: local r,g,b,a = owner.AnimState:GetAddColour() There is no GetLightOverride unfortunately. Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-805594 Share on other sites More sharing options...
Jpianist Posted August 21, 2016 Share Posted August 21, 2016 7 hours ago, CarlZalph said: Since you're not touching the LightOverride might I recommend not touching it? Lest another mod uses it for something and you're just overriding it with zero. So leaving it in 0 is pointless so it's better to just remove it. That's what you mean right? Allright, i just though that it was important to maintain it even without really changing it, but it makes sense, i'll delete it from my mod. 7 hours ago, CarlZalph said: You are also able to get the current values of these with GetMultColour and GetAddColour should you choose. It returns back four variables, so example usage: local r,g,b,a = owner.AnimState:GetAddColour() There is no GetLightOverride unfortunately. Are you talking about console commands code? So if i use GetMultColour and GetAddColour on the console i should recieve the current values of my character? (that's what i understood from this part of the message) Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-805682 Share on other sites More sharing options...
CarlZalph Posted August 21, 2016 Share Posted August 21, 2016 2 hours ago, Jpianist said: Are you talking about console commands code? So if i use GetMultColour and GetAddColour on the console i should recieve the current values of my character? (that's what i understood from this part of the message) Nah, it's just for if you want to make a tint based off of the current user's colour value for whatever reason. Since there isn't a table storing changes to the colours that's 'bout all you can use it for. Link to comment https://forums.kleientertainment.com/forums/topic/69594-solved-how-to-make-character-glow-a-certain-color/#findComment-805738 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