Opposing Shephard need help with a bit of coding...

hot564231

Newbie
Joined
Jun 25, 2005
Messages
2,260
Reaction score
0
Opposing Shephard need help with a bit of coding, we need to know how you get night vison into HL2 sp mod? can anyone help plz :eek:
 
I think facepunch made a nightvision mod dude, I'll have a look for you know.
 
In Opposing Force they did it by creating a light source in front of the player that only exists on his client, and then placing a green filter (or a transparent material, in Source) on the HUD. Instant night vision, really quite a clever way to do it.

-Angry Lawyer
 
well i know a bit of the simple stuff like the stuff you can edit your self like HUD color that kind of stuff but form what you said about C++ coding that's not my cup of tea well thank for helping any m8
 
angry lawyer. to do that effect in source, umm how would you make the light in front of the character. would you have to code it in. would it be like a code thats triggered when you press 'v' and then it loads the new hud display and turns the light on?
 
You would have to code it in, and I'd imagine it would be like coding in an alternate flashlight. Like Angry Lawyer said, you'd have a command to turn the night vision on, and it would activate a light, like the flashlight, and put a semi-transparent texture over the top of the view, covering the whole screen, to give it that "Night Vision" colour tint.

The HUD would stay the same, it'd just be like putting a big bit of green see-through plastic over your monitor, and turning a flash light on.

I think...
 
crackhead said:
angry lawyer. to do that effect in source, umm how would you make the light in front of the character. would you have to code it in. would it be like a code thats triggered when you press 'v' and then it loads the new hud display and turns the light on?

Yup. Just a spherical light source placed where the players eyes are - on that player's client, and that player's client alone. Otherwise, you'd glow to the other people on the server.

-Angry Lawyer
 
I could probably do it in ten minuites.

But I'm not going to do it, because then you'd complain that you don't know how to compile it.

-Angry Lawyer
 
lol i could compile it. but im sure its not that hard anyway. well need a coder on the team for bits an bobs like that.
 
Angry Lawyer said:
I could probably do it in ten minuites.

But I'm not going to do it, because then you'd complain that you don't know how to compile it.

-Angry Lawyer

i got a coder on the team i think he would know what to do m8

EDIT: 2 coder's now but still need help with night vison m8
 
well they aint very good then are you sure they actualy know how to code?
 
hot564231 said:
i got a coder on the team i think he would know what to do m8

EDIT: 2 coder's now but still need help with night vison m8

And they haven't worked out how to do night vision? *rolls his eyes*

Tell them to start by adding a variable to the player on the client (C_BasePlayer.cpp and C_BasePlayer.h). Add a console command to switch it on and off. In the think function of the player, when your variable is true, create a dynamic light (or switch it on and off, depending on how dynamic lights actually work) at the coordinates of the player's eyes (search for CreateDynamicLight to see what other entities use dynamic lights, and hhow to implement them).

There, that's the glow effect done. Now all you have to do is apply a material to the screen. Create a new HUD element (look at creating a BasePanel using VGUI2), fill it with the texture you want, and have the panel be hidden and shown based on the variable you defined earlier.

Easy. If you have competent coders, they'll be able to do it based on what I've said.

-Angry Lawyer
 
Angry Lawyer said:
If you have competent coders, they'll be able to do it based on what I've said.

-Angry Lawyer
I think to be honest that should be changed to "If you have coders, they'll be able to do it based on what I've said."

A compentent coder would probably be able to work that out just by looking at the source code and the rough plan posted earlier.

If they're having problems at this stage, what's it going to be like later?
 
Jasoon said:
A compentent coder would probably be able to work that out just by looking at the source code and the rough plan posted earlier.

If they're having problems at this stage, what's it going to be like later?
I agree wholeheartedly.

-Angry Lawyer
 
sigh, it seems to be a common problem with modding, coders! You get some young guns who have learnt how to do hello world, then they think they can be a coder on a mod team. Big mistake. I would consider myself a terrible c++ coder, i am untidy, and not that experienced, but after reading angry lawyers post, i believe it would be relatively easy to pull off this task, but i think i'd change the colour of the light to a green light. And then on the transparent screen in front of the players eyes, you could have a pattern, so it looks all tech, and blacken the edges to give it a moor narrow field as to give the impression of a nightvision headset like binoculars attatched to the head.
 
lol shutup u dont need pictures. im not a coder sure. i couldnt even compile a script from a tutorial for 3rd person camera without alot of help. but it just seems hard to believe you have two coders, which you didnt tell anyone about, thet cant put htere heads together and figure out how to bind a key to turning a light on and off infront of the player. and make a custom gui that also turns on and off at that button. also get jeff to do the texture and have like lines moving downwards or something thats how i imagine nightvision.
 
Wouldn't that light need to be dynamic? I always thought NVG in CS:S was just a green overlay and turned up the contrast a tad.
 
Crackhead and hot564231: This is my interpretation of how you make your posts.

"PLZ I NEEAD HELP COADING WUT IS THE CODE FOR NEIGHT VISHIN? - I TYPE NEIGHT VISHIN BUT H:L2 IS ERROR???

LoL CS 4 LiF e

any1 hear liek DBZ?????"
 
Pesmerga said:
Wouldn't that light need to be dynamic? I always thought NVG in CS:S was just a green overlay and turned up the contrast a tad.
Yup. Create a dynamic light on the client, and you're all set to go. I've never actually arsed about with dynamic lights before, so I don't know if you'd need one to be created and removed on each think frame (which is whay they do for overlays), or create one and find some way of attaching it to the player and physically switching it on and off.

dassbaba said:
Crackhead and hot564231: This is my interpretation of how you make your posts.

"PLZ I NEEAD HELP COADING WUT IS THE CODE FOR NEIGHT VISHIN? - I TYPE NEIGHT VISHIN BUT H:L2 IS ERROR???

LoL CS 4 LiF e

any1 hear liek DBZ?????"

You're my new favourite person.

-Angry Lawyer
 
well never mind plz close this topic we got General1337 working on the night vison. some of you may remember General1337?
 
Back
Top