Batmanwarrior Posted January 3, 2015 Share Posted January 3, 2015 (edited) Hey guys, I found some code to enable a lightsource at night (nightvision) but right now it is visible for all the players on the server. I want it to be playervision-only. This is the code for the "light":--Nightvisionlocal light = inst.entity:AddLight()inst.Light:Enable(false)inst.Light:SetRadius(15)inst.Light:SetFalloff(0.75)inst.Light:SetIntensity(.6)inst.Light:SetColour(70/255,255/255,12/255) Is it possible to make this light (or any other light) player-only? I really think that nightvision is a cool perk, but it's a gamebreaker when everyone can see it. I looked into woddie's code for beaver, but it's just the same as stated above. Since it was singleplayer, it worked as intended.Is it possible to make a player-only light now when it's multiplayer? Best regards Edited January 3, 2015 by Batmanwarrior Link to comment Share on other sites More sharing options...
rezecib Posted January 4, 2015 Share Posted January 4, 2015 woddie's code for beaver, but it's just the same as stated above. That's because he hasn't actually been updated yet. I don't think anyone's really solved this problem in DST yet, but I had an idea for it a while back that I was thinking of turning to get Woodie fixed... If you actually have light there, then it has to be for all players. But you can separate out the two components of the light: the visual effect, and the removal of Charlie. So you could remove the "grue" component, and then write code for a light that's only client-side. Not sure exactly how to do the second part yet, but I'll let you know if I get around to figuring it out. Link to comment Share on other sites More sharing options...
Sarcen Posted January 4, 2015 Share Posted January 4, 2015 I definitely think this is doable, simply by only adding the light component to the inst when the inst is the local player. AddPlayerPostPrefab(function(player)player:ListenForEvent("setowner", function(inst) if inst == ThePlayer theninst.entity:AddLight()...endend)end) Something like that Link to comment Share on other sites More sharing options...
Woodside235 Posted January 8, 2015 Share Posted January 8, 2015 I definitely think this is doable, simply by only adding the light component to the inst when the inst is the local player. AddPlayerPostPrefab(function(player)player:ListenForEvent("setowner", function(inst) if inst == ThePlayer theninst.entity:AddLight()...endend)end) Something like that Can you give a little more context on how to use this? I'm a bit confused. Link to comment Share on other sites More sharing options...
DarkXero Posted January 8, 2015 Share Posted January 8, 2015 (edited) How about removing inst.entity:AddNetwork() on the light source.Kinda like how lanterns and mining hats were before they fixed them. EDIT: Now I remember the client lights couldn't be seen by clients. Edited January 8, 2015 by DarkXero 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