Jump to content

adding items on death to all human npc's


nahtanod

Recommended Posts

hello, i was just wondering if anyone could point me in the direction of how to do this.

im a beginner with scripting and i know how to add items on death but my biggest thing is this, will i have to go and add the item i want to all human npc's in geck?, or is there a way to run a script to do this for me in game? also this item i dont want it to be able to be pick pocketed.

 

thanks.

Link to comment
Share on other sites

@davidlallen what you seem to want to do in that other topic is the same thing i want to do in mine, but not just one stage of a quest. i want mine to be active the whole game. and thanks for pointing me to that :)

 

@kert349 ive tried that but what i was having issues with was adding it to just humans, i was being lazy and didnt want to go threw and edit every human in the geck to carry the item on death, but rather have a way to add it threw a script at there death.

Link to comment
Share on other sites

Use the OnDeath script to add an item to their inventory when they die. Let's say you set NPC's Editor ID to be "FarmerBob" and make your script's name "BobsKey". Let's also say that Bob's key editor ID is FarmerBobKey

 

1. Open up FarmerBob in the object viewer (Actors->NPC->FarmerBob)

2. Where it says Script, click the ellipses (...).

3. Go to the top and hit Script->New

4. Type the following:

scn Bobskey; This is to name the script
begin ondeath; This means the script runs when the object dies, in this case FarmerBob is the object
additem FarmerBobKey 1; This adds the item FarmerBobKey to the object's inventory
End; Ends the script

5. Click save, and then under the script drop down on FarmerBob, click the BobsKey script.

 

You can cut out the comments in the code after you change it to your needs. This also guarantees that the item will be on his corpse no matter what, even he gets blasted by some raiders.

Edited by heythereguys
Link to comment
Share on other sites

@ heythereguys, the original poster wanted to add this to *all* human npc's. Yours is a good suggestion for a single npc. I don't think there is a way to apply ondeath to "all NPCs of a certain type".

 

@ nahtanod, Because there are many human npc's, the "death item" approach may not work. Most npc's use "death item" to determine their basic loot drop. If you change it, then they might drop the new item; but they will no longer drop their regular loot. In some cases this may include quest items. I don't think anybody has quite solved this problem, exactly the way you stated it. What is the particular effect you are trying to achieve? Maybe there is another game method to use to get the effect you want.

Link to comment
Share on other sites

There's a couple of ways you can do this without touching every NPC in the Geck. One requires NVSE (my preference) and another doesn't, but the non NVSE way is less efficient. If you do a 'ref walk' in a quest script, you can gather the references to an object type, in this case 'NPC'. Once you have the reference to an object, you can do anything you want to it. The quest script will ref walk the Player's current cell and add the death items within a second of loading into a cell. If an NPC is killed after that, it is updated within a second.

 

The non NVSE way involves using placed explosions at the player and applies an effect to actors within a certain radius. In the effect script is where you add the death items. I haven't done it this way but others have.

 

More about loops - http://www.cipscis.c...ials/loops.aspx

 

 

scn MyDeathItemQuestScript

;Start game enabled, Quest delay 1 second
;Everywhere the player goes, dead and killed npcs will get updated
;Requires NVSE

ref rTarget


BEGIN GameMode

 set rTarget to GetFirstRef 42 1 0 ; NPC 1 cell deep.

 Label 10
 if rTarget
  if (rTarget.GetDisabled)
  else
   if (rTarget.GetDead)
    if (rTarget.GetItemCount MyDeadNPCToken) ;Token is an armor item, non playable, with no biped slots
    else
     rTarget.AddItem MyDeadNPCToken 1
     rTarget.AddItem MyDeadNPCItemFormList 1 ;A form list of all the items I want added
    endif
   endif
  endif
  set rTarget to Pencil01
  set rTarget to GetNextRef
  Goto 10
 endif
 
END
 

Link to comment
Share on other sites

@ heythereguys, the original poster wanted to add this to *all* human npc's. Yours is a good suggestion for a single npc. I don't think there is a way to apply ondeath to "all NPCs of a certain type".

 

@ nahtanod, Because there are many human npc's, the "death item" approach may not work. Most npc's use "death item" to determine their basic loot drop. If you change it, then they might drop the new item; but they will no longer drop their regular loot. In some cases this may include quest items. I don't think anybody has quite solved this problem, exactly the way you stated it. What is the particular effect you are trying to achieve? Maybe there is another game method to use to get the effect you want.

 

 

@davidlallen. basically the same as the fingers and ears in fallout 3 i want to have a perk that lets you loot a specific item after they are dead, not from a faction but from races like humans.

Link to comment
Share on other sites

The thread I linked shows the solution. I am using this solution for exactly this reason, to get the ear/finger effect during a certain quest. It is working for me. The problem is that NPC's killed by the companions do not drop the item. In my games I use a high CHA main character and my companions wind up getting a significant number of kills; but the same problem is visible (if you look closely) in the ear/finger quest in FO3.
Link to comment
Share on other sites

The thread I linked shows the solution. I am using this solution for exactly this reason, to get the ear/finger effect during a certain quest. It is working for me. The problem is that NPC's killed by the companions do not drop the item. In my games I use a high CHA main character and my companions wind up getting a significant number of kills; but the same problem is visible (if you look closely) in the ear/finger quest in FO3.

 

im not to worried about it not showing up if my companions kill them, but i do have a question, do i have to use a quest to make the item show up or can i just have it in constant effect with out a quest?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...