Cleanup is going to take awhile, so the site is back up but editing has been disabled.

Attaching Flashlight To Npc

From HalfLife 2 Knowledge Base

Jump to: navigation, search

By Mxthe

Contents



Introduction

First, let me explain the basic :

We will attach a brush-physbox flashlight to the npcs, thanks the the Attachements Points on the models, it will follow every animation the combine, or rebel depending to wich model we use.

Lets begin !


Placing Entities

First place a npc_combine_s in your map, name it Soldier1.

Then create a brush with a metal texture, that may looks like a flashlight, it can be composed of multiple brushes. (Note : To create a nice small flashlight, you need to reduce the grid)

Once you finished creating your brush based flashlight, place it where you want it on the combine, for example on the side of the head.

exampleflashlight19dw.jpg

Then, select all the brushes of your flashlight, ant tie it to a func_physbox :


func_physbox

Name: flashlight_soldier1

Parent: Soldier1

Not Solid To World : Passes Trough World

Disable Shadows : Yes

Later on we will attach this physbox to the eyes attachment of the combine, you can open in Half Life Model Viewer the combine to see his attachments, the eyes is between the 2 eyes, the trick is to put the Origin of the physbox at this position :

exampleflashlight47es.jpg

Then, place a point_spotlight, to make it correspond to the flashlight like this :

exampleflashlight24iq.jpg

point_spotlight

Name: Flashlight_soldier1_spotlight

Parent: Flashlight_soldier1

Width : 10 will do for this flashlight's size, if you make a bigger brush, make a bigger width

You choose the rest

Then, we need to attach to the animations


Putting it Together

Create a logic auto, and do this :

exampleflashlight30lh.jpg

Then add 2 outputs in the Soldier1 :

OnDeath : Flashlight_Soldier1 Kill

OnDeath : Flashlight_soldier1_spotlight Kill


Compile And Done

Compile and test ! It should work !

Hint : You can add a sprite to the flashlight, to make it better !

Hint2 : You can make a shoulder type flashlight (included in the example map)

Hin3 : Put the face of the flashlight wich project the light with a lightwhite texture ! Makes it better ^^

Warning : Because of the origin, the flashlight CANNOT be a model.

PS : The brushworks used in this tut suck indeed, its just to, as Nudel says, "Stimulate your imagination "

PS2: Using this stuff in daylight outside maps would be stupid ^^ This is for Indoor Dark maps, the cool thing is that it helps to detect the ennemy

OOps : This technique has to be made for EACH NPC you want a flashlight on, I know it kinda stinks, but its nice ingame

Ingame :


flashlightexample00021tm.jpg

flashlightexample00014pd.jpg

Example Map : http://rapidshare.de/files/15459920/Flashlight_Example.rar.html

Have fun !

Personal tools