Randriko Posted April 9, 2019 Share Posted April 9, 2019 (edited) So I recently made a character mod and I wanted him to have a glow.I have this pasted under stats. And it works fine til death. After respawning, it loses its shine and... im not sure but he may lost his heat too? What am i missing?? :< Edited April 9, 2019 by Randriko Link to comment Share on other sites More sharing options...
Ultroman Posted April 10, 2019 Share Posted April 10, 2019 If you look in the player_common_extensions prefab, you'll see that this happens whenever the player is resurrected: inst.Light:SetIntensity(.8) inst.Light:SetRadius(.5) inst.Light:SetFalloff(.65) inst.Light:SetColour(255 / 255, 255 / 255, 236 / 255) inst.Light:Enable(false) Happily, right after this, it pushes this event: inst:PushEvent("ms_respawnedfromghost") So you can listen for that, and call a function which sets all your custom light settings. Your character should not lose his heater component, though. Link to comment Share on other sites More sharing options...
Randriko Posted April 14, 2019 Author Share Posted April 14, 2019 On 10/4/2019 at 2:08 AM, Ultroman said: If you look in the player_common_extensions prefab, you'll see that this happens whenever the player is resurrected: inst.Light:SetIntensity(.8) inst.Light:SetRadius(.5) inst.Light:SetFalloff(.65) inst.Light:SetColour(255 / 255, 255 / 255, 236 / 255) inst.Light:Enable(false) Happily, right after this, it pushes this event: inst:PushEvent("ms_respawnedfromghost") So you can listen for that, and call a function which sets all your custom light settings. Your character should not lose his heater component, though. So.. it would be something like.. inst:PushEvent("ms_respawnedfromghost") paste that before isnt.Light:Enable(true) and add an 'end' at the bottom? Link to comment Share on other sites More sharing options...
Ultroman Posted April 14, 2019 Share Posted April 14, 2019 No. None of that makes any sense You don't just put "end" in somewhere. And you should not push the event. The game already does that. You're supposed to listen for the event. Remove your current light code from your fn() or master_postinit(). All your lines with inst.Light. Put this somewhere above fn() or master_postinit(): local function myLightFunction(inst) inst.Light:SetIntensity(.7) inst.Light:SetRadius(4) inst.Light:SetFalloff(.75) inst.Light:SetColour(255 / 255, 207 / 255, 98 / 255) inst.Light:Enable(true) end and then put this at the bottom of fn() or master_postinit() in your character LUA. -- Call function to make it happen on player spawn. myLightFunction(inst) -- Listen for whenever the player is respawned, and make it call the function when it happens. -- The inst parameter is automatically included by the event. inst:ListenForEvent("ms_respawnedfromghost", myLightFunction) Link to comment Share on other sites More sharing options...
Randriko Posted April 14, 2019 Author Share Posted April 14, 2019 1 hour ago, Ultroman said: No. None of that makes any sense You don't just put "end" in somewhere. And you should not push the event. The game already does that. You're supposed to listen for the event. Remove your current light code from your fn() or master_postinit(). All your lines with inst.Light. Put this somewhere above fn() or master_postinit(): local function myLightFunction(inst) inst.Light:SetIntensity(.7) inst.Light:SetRadius(4) inst.Light:SetFalloff(.75) inst.Light:SetColour(255 / 255, 207 / 255, 98 / 255) inst.Light:Enable(true) end and then put this at the bottom of fn() or master_postinit() in your character LUA. -- Call function to make it happen on player spawn. myLightFunction(inst) -- Listen for whenever the player is respawned, and make it call the function when it happens. -- The inst parameter is automatically included by the event. inst:ListenForEvent("ms_respawnedfromghost", myLightFunction) It works!! Thanks! <3 Link to comment Share on other sites More sharing options...
Ultroman Posted April 14, 2019 Share Posted April 14, 2019 You are very welcome Link to comment 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