Kill Player if X NPC dies

Any aspects of level design for the Source engine.

Kill Player if X NPC dies

Postby c0ldpr0xy on Tue May 21, 2013 9:23 am

Hello. Does any of you know how to make the fade-to-black screen come up (where it says mission failed) when you kill a specific NPC? I'm assuming that screen was only made for ally NPCs? Thanks.

I tried to do it with logic_auto but I can't since it fires all outputs immediately. How can I make a trigger that will kill the player? I tried using "trigger_once" but the player doesn't have an entity name.
c0ldpr0xy
Member
Member
 
Joined: Sun Oct 03, 2010 8:58 pm

Re: Kill Player if X NPC dies

Postby ErikKiller on Tue May 21, 2013 12:28 pm

!player is the player entity name. Try again.
Image
Image
First rodeo? Use the Source SDK Documentation for reference!
User avatar
ErikKiller
May Contain Skills
May Contain Skills
 
Joined: Sun Sep 09, 2007 4:05 pm
Location: Estonia

Re: Kill Player if X NPC dies

Postby greenman on Tue May 21, 2013 12:31 pm

The player does have an entity name, it's "!player" without the quotation marks; You could also use the consolecommand entity to fire a "kill" command in the console.
greenman
Regular
Regular
 
Joined: Thu Aug 13, 2009 8:09 pm

Re: Kill Player if X NPC dies

Postby marnamai on Tue May 21, 2013 12:45 pm

Killing the !player entity can cause a crash you're better off using "sethealth 0"
User avatar
marnamai
Veteran
Veteran
 
Joined: Thu Nov 10, 2005 12:17 pm
Location: Belgium

Re: Kill Player if X NPC dies

Postby ErikKiller on Tue May 21, 2013 1:04 pm

marnamai wrote:Killing the !player entity can cause a crash you're better off using "sethealth 0"

Ah, good point, this is way more elegant.
Image
Image
First rodeo? Use the Source SDK Documentation for reference!
User avatar
ErikKiller
May Contain Skills
May Contain Skills
 
Joined: Sun Sep 09, 2007 4:05 pm
Location: Estonia

Re: Kill Player if X NPC dies

Postby c0ldpr0xy on Tue May 21, 2013 1:14 pm

Thank you guys, I will have a look when I get back. :)
c0ldpr0xy
Member
Member
 
Joined: Sun Oct 03, 2010 8:58 pm

Re: Kill Player if X NPC dies

Postby Major Banter on Tue May 21, 2013 3:08 pm

I think all allied NPCs have a flag for this specific scenario as well - 'essential?' or something like that.
ImageImageImage
Major Banter
Veteran
Veteran
 
Joined: Tue Apr 01, 2008 10:52 pm
Location: UK

Re: Kill Player if X NPC dies

Postby c0ldpr0xy on Tue May 21, 2013 11:44 pm

Major Banter wrote:I think all allied NPCs have a flag for this specific scenario as well - 'essential?' or something like that.


Yes, that's for ally NPCs. I was looking a way to make the "mission failed" screen come up if you kill a specific enemy NPC. I'm still working on it.
c0ldpr0xy
Member
Member
 
Joined: Sun Oct 03, 2010 8:58 pm

Re: Kill Player if X NPC dies

Postby Armageddon on Wed May 22, 2013 12:49 am

1. Place a logic_relay give it a name.

2. Go to your NPC and add an output that says OnDeath>Relay01>Trigger.

3. Place an player_loadsaved and an env_message. Give the player_loadsaved a fade duration of 0.6 and hold the fade for 8. Make sure it's color is black and give it a realod delay of 8 as well. Use whichever message you think fits best for the env_message or write your own in the hl2_%language% file. Name both of them.

4. Add an output to your relay OnTrigger>Loadsaved01>Reload add another, OnTrigger>Message01>ShowMessage, give it a delay of 1.50.
User avatar
Armageddon
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Sun Dec 14, 2008 5:53 am

Re: Kill Player if X NPC dies

Postby c0ldpr0xy on Wed May 22, 2013 4:01 am

Armageddon wrote:1. Place a logic_relay give it a name.

2. Go to your NPC and add an output that says OnDeath>Relay01>Trigger.

3. Place an player_loadsaved and an env_message. Give the player_loadsaved a fade duration of 0.6 and hold the fade for 8. Make sure it's color is black and give it a realod delay of 8 as well. Use whichever message you think fits best for the env_message or write your own in the hl2_%language% file. Name both of them.

4. Add an output to your relay OnTrigger>Loadsaved01>Reload add another, OnTrigger>Message01>ShowMessage, give it a delay of 1.50.



Thanks for that mate. Honestly, I still haven't started using the logic_relay entity yet. Nevertheless, I figured out a workaround for my issue. Here is what I did:

I have 3 entities, one is point_clientcommand, next is env_fade and last one is game_text. Basically I made an output on the NPC with "OnDeath", it will trigger all 3 of them at the same time. Worked out pretty well :)
c0ldpr0xy
Member
Member
 
Joined: Sun Oct 03, 2010 8:58 pm

Re: Kill Player if X NPC dies

Postby Armageddon on Wed May 22, 2013 8:13 am

You really don't want to kill the player, it's not good like that...
User avatar
Armageddon
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Sun Dec 14, 2008 5:53 am

Re: Kill Player if X NPC dies

Postby c0ldpr0xy on Thu May 23, 2013 12:48 am

Armageddon wrote:You really don't want to kill the player, it's not good like that...


Alright, I don't seem to understand the downsides of it. It's a single level for singleplayer for HL2. I'm still learning my ways through the Hammer editor. Thankfully, this forum is still active!
c0ldpr0xy
Member
Member
 
Joined: Sun Oct 03, 2010 8:58 pm

Re: Kill Player if X NPC dies

Postby Armageddon on Thu May 23, 2013 12:59 am

The downside is 1, your text will look bad, and 2, when the player is dead he clicks to reload and the screen is tinted red, and 3, it doesn't fit HL2 gameplay aesthetic.
User avatar
Armageddon
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Sun Dec 14, 2008 5:53 am

Re: Kill Player if X NPC dies

Postby c0ldpr0xy on Thu May 23, 2013 2:06 am

Armageddon wrote:The downside is 1, your text will look bad, and 2, when the player is dead he clicks to reload and the screen is tinted red, and 3, it doesn't fit HL2 gameplay aesthetic.


That's right. That's why I asked if there is any way to make the "mission failed" screen like in HL1 when you kill an important scientist (ally NPC). I tried to recreate that, but if there is any proper way to do that "mission failed" screen come up, please let me know :).
c0ldpr0xy
Member
Member
 
Joined: Sun Oct 03, 2010 8:58 pm

Re: Kill Player if X NPC dies

Postby Armageddon on Thu May 23, 2013 2:19 am

I, I already told you, it's env_message.
User avatar
Armageddon
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Sun Dec 14, 2008 5:53 am
Next

Return to Hammer Editor Help

Who is online

Users browsing this forum: Bing [Bot]