Simple Flashlight Weapon?

Grab your favourite IDE and tinker with the innards of game engines

Simple Flashlight Weapon?

Postby Zally13 on Wed Aug 25, 2010 9:26 pm

I just want to first point out that I have next-to-none experience in C++, but just want a simple way to create a flashlight weapon for a Source Mod that turns the flashlight on and off. I just want it to be a separate like a pistol, and when you click it turns the flashlight on and off. That's all I really want from it. Any help would be appreciated.
Zally13
Member
Member
 
Joined: Wed Jul 15, 2009 3:01 am

Re: Simple Flashlight Weapon?

Postby Nutomic on Wed Aug 25, 2010 9:41 pm

All i know that might help you is that it uses the env_projectedtexture entity, so you would have to attach that to your weapon and enable/disable it on firing the weapon.
User avatar
Nutomic
Member
Member
 
Joined: Thu Aug 12, 2010 11:37 am

Re: Simple Flashlight Weapon?

Postby Plague on Wed Aug 25, 2010 9:45 pm

Maybe this technique.

Remove the ability to turn the flashlight on via key command.
Then make your weapons fire output trigger the flashlight.

Correct me if this is wrong coders, but even for someone who does not know much coding this is pretty simple?
Contact. The EU welcomes the pain free. That's emotional impact.
I actually think limitation is good for creativity. If we had an engine that could do everything, we would be in trouble. It gives us focus. ~~ Randy Lundeen
User avatar
Plague
Veteran
Veteran
 
Joined: Tue Jun 22, 2010 7:12 pm

Re: Simple Flashlight Weapon?

Postby Zally13 on Wed Aug 25, 2010 9:51 pm

Plague wrote:Maybe this technique.

Remove the ability to turn the flashlight on via key command.
Then make your weapons fire output trigger the flashlight.

Correct me if this is wrong coders, but even for someone who does not know much coding this is pretty simple?

I thought this i what you'd have to do, but I don't know coding at all so what would I do to make it?
Zally13
Member
Member
 
Joined: Wed Jul 15, 2009 3:01 am

Re: Simple Flashlight Weapon?

Postby Plague on Wed Aug 25, 2010 9:57 pm

Well this is all guessing, but you would probably want to remove the ability to turn the Flashlight on and off via a key. This code is probably in the Suits functions, so HEVSuit or something like that if I recall.
Then your flashlight rather then shooting anything would instead trigger the flashlight.
So sorta like binding the "f" key to the guns trigger.

But I wont go much further, I would have to go look at this stuff to figure it out in my head.
But if one of the awesome guys could step in, who might have access to a resource or know this stuff off the top of their head...
Contact. The EU welcomes the pain free. That's emotional impact.
I actually think limitation is good for creativity. If we had an engine that could do everything, we would be in trouble. It gives us focus. ~~ Randy Lundeen
User avatar
Plague
Veteran
Veteran
 
Joined: Tue Jun 22, 2010 7:12 pm

Re: Simple Flashlight Weapon?

Postby Major Banter on Wed Aug 25, 2010 10:06 pm

It'd be extremely easy for any competent coder.

You'd create your model and animations, rig it all up, and then the coder would simply make a weapon from it.

The weapon would then point in its command lines to trigger the flashlight when "fire" is pressed, and play the relevant animation, and activate the flashlight.

The coder would then simply disable the normal flashlight key; "F".

You could use stand-in models without any trouble. The difficult part would be knowing which bit of C++ to do the flashlight bit is.
ImageImageImage
Major Banter
Veteran
Veteran
 
Joined: Tue Apr 01, 2008 10:52 pm
Location: UK

Return to Programming

Who is online

Users browsing this forum: No registered users