• CS Like nightvision?
    11 replies, posted
Hello guys. I'm making a gamemode which requires a nightvision. There's anyway to do that?
[QUOTE=Nicksf13;48094895]Hello guys. I'm making a gamemode which requires a nightvision. There's anyway to do that?[/QUOTE] You could parent dynamic light source to a player and have it turn on when he equips night vision swep. [url]http://wiki.garrysmod.com/page/Global/DynamicLight[/url]
TY man, two more question (kind of dumb). First: This Dynamic Light is on client side? How can I make a player (another player) be a ambulant lamp (Emit light)? Should I Use the same method, but on another player?
[QUOTE=Nicksf13;48096510]TY man, two more question (kind of dumb). First: This Dynamic Light is on client side? How can I make a player (another player) be a ambulant lamp (Emit light)? Should I Use the same method, but on another player?[/QUOTE] [quote] First: This Dynamic Light is on client side? [/quote] It's client-sided which is why you're able to make it so that only you can see the light. [quote] How can I make a player (another player) be a ambulant lamp [/quote] Use the code provided to you by wiki but change [code] dlight.pos = LocalPlayer():GetShootPos() [/code] to [code] dlight.pos = LocalPlayer():GetPos() [/code] so that dynamic light pos gets spawned at player's coordinates. Also if you want to make it look green, just change [code] dlight.r = 255 dlight.g = 255 dlight.b = 255 [/code] to [code] dlight.r = 0 dlight.g = 255 dlight.b = 0 [/code]
why change GetShootPos() to GetPos()? it will actually look really terrible because the light will be coming out of your feet, making an ugly ass circle on the ground. If anything it should be changed to LocalPlayer():EyePos()
[QUOTE=legendofrobbo;48097523]why change GetShootPos() to GetPos()? it will actually look really terrible because the light will be coming out of your feet, making an ugly ass circle on the ground. If anything it should be changed to LocalPlayer():EyePos()[/QUOTE] It's GetPos() is obviously better than GetShootPos()
Isn't CSS's nightvision useless ?
[QUOTE=baldursgate3;48097461]It's client-sided which is why you're able to make it so that only you can see the light. Use the code provided to you by wiki but change [code] dlight.pos = LocalPlayer():GetShootPos() [/code] to [code] dlight.pos = LocalPlayer():GetPos() [/code] so that dynamic light pos gets spawned at player's coordinates. Also if you want to make it look green, just change [code] dlight.r = 255 dlight.g = 255 dlight.b = 255 [/code] to [code] dlight.r = 0 dlight.g = 255 dlight.b = 0 [/code][/QUOTE] Nicksf13 asked how to make another player emit light, not how to make the LocalPlayer emit light. Have a loop that goes through all of the players on the server, create a light at them. [code] for k, v in pairs(player.GetAll()) do local dlight = DynamicLight( v:EntIndex() ) if ( dlight ) then dlight.pos = v:EyePos() dlight.r = 255 dlight.g = 255 dlight.b = 255 dlight.brightness = 2 dlight.Decay = 1000 dlight.Size = 256 dlight.DieTime = CurTime() + 1 end end [/code] Something like that, I haven't tested it so it may have errors.
[QUOTE=coolcat99;48112257]Nicksf13 asked how to make another player emit light, not how to make the LocalPlayer emit light. Have a loop that goes through all of the players on the server, create a light at them. [code] for k, v in pairs(player.GetAll()) do local dlight = DynamicLight( v:EntIndex() ) if ( dlight ) then dlight.pos = v:EyePos() dlight.r = 255 dlight.g = 255 dlight.b = 255 dlight.brightness = 2 dlight.Decay = 1000 dlight.Size = 256 dlight.DieTime = CurTime() + 1 end end [/code] Something like that, I haven't tested it so it may have errors.[/QUOTE] I don't think he meant all players. Also, creating dynamic light on every client for every player means that you'll see other players' night vision light which will defeat all the purpose of having night vision. Then once player amount reaches 32, you'll prevent lights and other entities that use DynamicLight() from working.
[QUOTE=baldursgate3;48098353]It's GetPos() is obviously better than GetShootPos()[/QUOTE] GetPos = a point at the bottom of their hull ie between their feet GetShootPos = the end of their gun, position can vary depending on holdtypes, animations and world models EyePos = the position their player camera is at (different from the position of the eyes on their player model) the difference in cpu usage between these methods is negligible so its up to the coder to choose which best suits what they are trying to do, which in the case of night vision is EyePos()
Lol a dynamic light is not how you do night vision. Override the rendering of players so they are rendered brighter than the environment (this emulates thermal radiation). Finally render an overlay texture to add the green color and goggle effect. I would recommend rendering the texture with the blend mode set to "multiply" which will allow you to modulate the colors rather than add them, but I'm not sure if that's possible. Maybe someone knows how to do that.
I don't know if You ever played zombie plague 4.3 (amxmodx/cs1.6/CSCZ). But I want to do something like nemesis/survivor glow light. Also I want to make a nightvision for players
Sorry, you need to Log In to post a reply to this thread.