Dead NPC Activating Trigger

Post » Wed Dec 30, 2009 3:29 am

Hi all,

I'm trying to make a simple set of quests that are activated by reading a terminal. One of these is to kill a NPC that I have added to a cell.

Basically, I'm trying to have the quest objective marked as complete when the NPC dies. Here's the script I have:

scn aaTarget1DeadMk2

begin OnTrigger player

if aatarget1.getdead 1

SetObjectiveCompleted aaCP2 10 1

endif

end



The NPC has the Reference Editor ID of 'aatarget1', and the quest is named 'aaCP2'. The trigger linked to this script covers the entire cell.

Anyone know why this isn't working? I kill the NPC, and nothing happens. I don't really know what I'm doing here, but I've tried everything I can think of.

Thanks for any help.
User avatar
Jimmie Allen
 
Posts: 3358
Joined: Sun Oct 14, 2007 6:39 am

Post » Wed Dec 30, 2009 12:34 am

2 things you could do in the case of just one NPC needing to die.


script your npc:

begin ondeath          setobjectivecompleted MyHappyQuest  1          setobjectivedisplayed MyHappyQuest  1end


The quest script itself can also detect dead npc as long as you defined it with a REF name (and checked persistant reference box)

if MyHappyQuest.getobjectivedisplayed       if MyNPCREF.getdead          setobjectivecompleted MyHappyQuest  1          setobjectivedisplayed MyHappyQuest  1     endifendif




Something like those should do it.
User avatar
Natalie J Webster
 
Posts: 3488
Joined: Tue Jul 25, 2006 1:35 pm

Post » Tue Dec 29, 2009 9:21 pm

Ontriggerenter only runs when something enters the trigger, not when something's just standing in it. If your npc isn't dead in that moment, that code won't do what you seem to have wanted.

Triggers svck however. The 2 ways above are what you're going to want to do, for this.
User avatar
Mrs. Patton
 
Posts: 3418
Joined: Fri Jan 26, 2007 8:00 am

Post » Tue Dec 29, 2009 9:30 pm

Ah, excellent. That's solved a big problem for me, many thanks.
User avatar
Brandon Wilson
 
Posts: 3487
Joined: Sat Oct 13, 2007 1:31 am

Post » Tue Dec 29, 2009 8:19 pm

Actually, as an addition, you mentioned that those were in case just one NPC needed to die. Is there a similar script I could use to trigger the same objective updates when three or four specific NPCs/creatures are killed?

Thanks.
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Tue Dec 29, 2009 9:26 pm

If doing multiples, IMO you should track each one's death individually via quest script instead of using ONDEATH block . I have seen strange things happen with ondeath blocks doing funny things when they run at about the same time - strange things which make dead NPC counters be all screwed up.
User avatar
Antonio Gigliotta
 
Posts: 3439
Joined: Fri Jul 06, 2007 1:39 pm

Post » Tue Dec 29, 2009 8:11 pm

Ah okay. What sort of script would I be looking for? I've managed to find some examples related to multiple deaths, but really don't know which parts I need to use, or how to apply them to my quest. My scripting knowledge is very very basic at this point.

Thanks for any help.
User avatar
Charleigh Anderson
 
Posts: 3398
Joined: Fri Feb 02, 2007 5:17 am

Post » Tue Dec 29, 2009 8:11 pm

Ah okay. What sort of script would I be looking for? I've managed to find some examples related to multiple deaths, but really don't know which parts I need to use, or how to apply them to my quest. My scripting knowledge is very very basic at this point.

Thanks for any help.



if MyHappyQuest.getobjectivedisplayed       if MyNPCREF.getdead && MyNPC2REF.getdead && MyNPC3REF.getdead && MyNPC4REF.getdead           setobjectivecompleted MyHappyQuest  1          setobjectivedisplayed MyHappyQuest  1     endifendif

User avatar
Thema
 
Posts: 3461
Joined: Thu Sep 21, 2006 2:36 am


Return to Fallout: New Vegas