HL Sp: npc_sniper

HL Sp: npc_sniper

Re: HL Sp: npc_sniper Posted by Stilton on Tue Dec 28th 2004 at 9:29pm
Stilton
7 posts
Posted 2004-12-28 9:29pm
Stilton
member
7 posts 1 snarkmarks Registered: Dec 28th 2004 Occupation: mmm bacon Location: Uk
I understand the basics of mapping, i think...

im trying to do a map, of my village, including a sniper as in the hl2 singleplayer..

ive done quite a deal of architecture and i tried playing around with the sniper entity, it spawns a normal combine (weaponless) but it never targets me..

i also inserted an "info_snipertarget" but had little success changing the values of it to get the sniper to actually do anything..

I assumed the targets were sort of like triggers? i could be wrong though..

If anyone could help me with a brief explanation id really appreciate it, i did search around on this site and a few others but theres not much out there atm..
Re: HL Sp: npc_sniper Posted by Yak_Fighter on Tue Dec 28th 2004 at 9:33pm
Yak_Fighter
1832 posts
Posted 2004-12-28 9:33pm
1832 posts 742 snarkmarks Registered: Dec 30th 2001 Occupation: College Student/Slacker Location: Indianapolis, IN
I haven't bothered to look at it myself, but in HL they made snipers by using a func_tank tied to a grunt. The func_tank would target the player and shoot at him, and once the grunt was killed the func_tank would be deactivated. Perhaps they used the same technique in HL2?

The info_snipertarget is something that will tell the sniper to shoot here when the player is nearby. If you remember in the singleplayer game when you are hiding under the boxcars and trains from a sniper he would occasionally fire at explosive barrels and hit the flatbed car that had all those pipes or logs or whatever when you were nearby. Those I believe were snipertargets
Re: HL Sp: npc_sniper Posted by Stilton on Tue Dec 28th 2004 at 9:54pm
Stilton
7 posts
Posted 2004-12-28 9:54pm
Stilton
member
7 posts 1 snarkmarks Registered: Dec 28th 2004 Occupation: mmm bacon Location: Uk
ah, thanks for replying..

yeh, i did a bit of mapping for the original and i understand what your saying about the.. func_tank thing, the only thing that leads me to believe that the npc_sniper uses it itself is theres a flag, that allows you to turn on/off the blue laser trail (obviously im not sure of this, as i havent got it to work myself :biggrin: )

but, cheers for your suggestion anyway, ill give it a fiddle now and see what i can do, which is probably.. not a lot :smile:
Re: HL Sp: npc_sniper Posted by omnix32 on Thu Dec 30th 2004 at 11:57pm
omnix32
14 posts
Posted 2004-12-30 11:57pm
omnix32
member
14 posts 1 snarkmarks Registered: Dec 12th 2004
[size=13]nobody leaves there e-mail to e-mail them a sample map on how things are done. oh well.

you need:

1 "npc_sniper"
2 Several "npc_snipertarget"
3 something to trigger your sniper to start sniping. "trigger_once?"
4 "env_shooter" if you want a body to fall out of the window. that's how they did it in the game.

set one npc_snipertarget on the ground and give it a group name (snip). in the flags check "resume if interuppted".

copy a bunch to the positions where the beam is going to go to. this gives it a more real or interesting look.

next create npc_sniper and put them in the position or window that they will be sniping from. you can see the sniper if you want, but they shoot from there legs and don't move so it looks really silly. we need to make sure we can't see this sniper.
in the window area you put them in I would texture the sides of the room Halflife/black. do a texture serch for black. you can use your own variables.

NPC_SNIPER
name: sniper_1
pitch/yaw/roll: use the point At to have the sniper look down in the direction they will be firing.
rendermode: don't render (so you don't see the sniper)
beam brightness: 255
flags: long visibility shoot checked.

next we need a trigger to start our sniper. this will cause him to scan the sniper_targets with the beam.

trigger_multiple
name: trig_multi
output tab:
my output named: On trigger
target entities named: sniper_1 (name of our sniper)
via this output: SweepGroupRandomaly (tells command for sniper to start doing)
with a parameter override of: snip (group name of your sniper_targets)

the sniper will start to sweep the targets once the trigger is triggered and shoot at the player if the player gets in the way or in sight.

the sniper can only be killed by the RPG or gernades. so once you toss a nade into the window the sniper dies.
if you want a body to fall out of the window you need a env_shooter.

set the shooter right at the edge of the window and point it in the direction of the opening.
set the shooter with these param's

env_shooter
name: dead_combine
gib direction: the direction that the body will fly
number of gibs: 1 (we only need one body)
gib velocity: 150 you may have to adjust this
course variance: 0
gib life: 30
model: models/Combine_Soldier.mdl
simulate: ragdoll
gib skin: 0

now we need to set up a trigger to let the env_shooter know that it needs to spew out a dead combine. go back to your NPC_Sniper and open the output tab.

Npc_sniper (output tab) put these in order

OnDeath
sniper_1
kill

New line:
OnDeath
dead_combine
shoot

now the original sniper will dissapear as the kill command gets ride of that entity. the next line will tell the shooter to throw out a dead combine from the window.

Now let's say that we run up and get behind a wall with some barrels and boxes that need destroyed by the sniper. remember how the sniper in the game hit other things besides shooting at us?

put some sniper_target's with a different group name in front of the things you want the sniper to shoot at.

set a trigger_once by the wall the player will run behind to trigger this event.

sniper_targets
group name: hitme
flags
shoot_me
no interuptions.

now we will change how the sniper acts by the trigger the player set off.

put these in order

OnTrigger
sniper_1
SweepTargetHighestPriority
shoot_me (param override)

the sniper will now shoot these targets. goto add new output and set the sniper back to normal.

OnTrigger
trig_multi
Toggle

sets the sniper back into sweep mod from original trigger.

I have not worked out every possible bug and I do not understand everything about the sniper. I know this works like it's suppose to as I figured it out by looking at the code of the original d1_town_05. there was alot to look at and sift through so I might have missed some things.

If you want my sample map. my e-mail is
omnix32w@hotmail.com
I will only mail these back until Dec 31 2004 thats a saturday.
[/size]
Re: HL Sp: npc_sniper Posted by Stilton on Fri Dec 31st 2004 at 5:29pm
Stilton
7 posts
Posted 2004-12-31 5:29pm
Stilton
member
7 posts 1 snarkmarks Registered: Dec 28th 2004 Occupation: mmm bacon Location: Uk
bah, thought my email was in my profile..

Well, thanks for the reply, i got it working, without using that many enetities by far, but im sure it'll be nice to have a decent tutorial explaining most of the facets of how the npc works, so.. cheers.

I'm currently making a tower-block for him to sit in you see, so once i got it working basic-like i just was glad it worked at all.

but i'll save this to my favs and refer to it :wink: cheers omnix.
Re: HL Sp: npc_sniper Posted by Forceflow on Fri Dec 31st 2004 at 5:35pm
Forceflow
2420 posts
Posted 2004-12-31 5:35pm
2420 posts 451 snarkmarks Registered: Nov 6th 2003 Occupation: Engineering Student (CS) Location: Belgium
Hey omnix, that would make a good tutorial. Could you format the text a bit and submit it ?
Re: HL Sp: npc_sniper Posted by omnix32 on Fri Dec 31st 2004 at 10:33pm
omnix32
14 posts
Posted 2004-12-31 10:33pm
omnix32
member
14 posts 1 snarkmarks Registered: Dec 12th 2004
thanx for the comments. I e-mailed both of you the map.

you can also find the map here.

http://www.hl2world.com/bbs/dload.php?action=file&file_id=767

yea, could take the time to reformat and make a tutorial. but don't really have the time.

fun mapping.