PaulHartmut Posted May 11, 2018 Share Posted May 11, 2018 Hello there and thank you for reading this I created a custom hat for my character, its working well without one thing : Its glowing while dropped on the ground. The Line: 26 in the OnEquip function : inst.Light:Enable(true) is working, so if i change it to (false) it doesn't glow when equipped. So i just did the same in the OnUnequip function in Line: 48 but it´s still glowing when dropped. I can´t find out whats the problem, but it seems to be easy. I´m new to modding and don´t have the eye for bad scripts, so i hope for help from your side. Again: Thanks for your time cigar.lua Link to comment Share on other sites More sharing options...
RedHairedHero Posted May 11, 2018 Share Posted May 11, 2018 (edited) 4 hours ago, PaulHartmut said: Hello there and thank you for reading this I created a custom hat for my character, its working well without one thing : Its glowing while dropped on the ground. The Line: 26 in the OnEquip function : inst.Light:Enable(true) is working, so if i change it to (false) it doesn't glow when equipped. So i just did the same in the OnUnequip function in Line: 48 but it´s still glowing when dropped. I can´t find out whats the problem, but it seems to be easy. I´m new to modding and don´t have the eye for bad scripts, so i hope for help from your side. Again: Thanks for your time cigar.lua You can do inst.Light:Remove() instead, this would completely despawn the light on unequip. There's also a function you can call using inst.components.inventoryitem:SetOnDroppedFn(your_function) and have it call a function when your drop the item. I would look at the miner hat (hats.lua) prefab to get a good idea on what to do. Edited May 11, 2018 by RedHairedHero Link to comment Share on other sites More sharing options...
PaulHartmut Posted May 12, 2018 Author Share Posted May 12, 2018 First thanks for the reply. inst.components.inventoryitem:SetOnDroppedFn is working. The problem is that its still glowing when i drag it with the mouse from the hat-slot. It´s dark when i drag it from an normal inventory slot. I cant find something that allows me to deactivate the light while its dragged from the Equipment-slot but neither dropped or stowed in inventory. I tried: inst.components.inventoryitem:OnRemoved() and inst.OnRemoveEntity = both don´t have any effects. Thanks again cigar.lua OH i just realized that i was deleting the inst.Light:Enable(false) line in the Onunequipped function sorry for that. its working fine now Thank u so much for your help! i attached the working file for someone who is interested in the future. cigar.lua 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