Jump to content

script to subtract HP from Npc, then add item to them and equip it


gob2

Recommended Posts

I'm trying to make a general script that, when triggered, subtracts a certain amount of HP from the npc, adds a piece of armor from a custom leveled list to the npc, and then makes them equip the armor piece just added. I'm not sure how to go about this. May I have some help please?

Link to comment
Share on other sites

Exactly how do you want the script to trigger? OnDeath, OnTriggerEnter, OnTriggerLeave, OnActivate, OnDying, OnLoad, OnCellAttach, etc.. or in the case of the specific actor, a referencealias script.

Edited by Rasikko
Link to comment
Share on other sites

  On 5/16/2018 at 6:51 PM, Rasikko said:

Exactly how do you want the script to trigger? OnDeath, OnTriggerEnter, OnTriggerLeave, OnActivate, OnDying, OnLoad, OnCellAttach, etc.. or in the case of the specific actor, a referencealias script.

 

Spacefiddle's Scarcity mod uses a script that checks if a power armor piece is at zero HP, and then destroys the piece in question if it is. I've gotten permission to use some of the script so long as I give proper credit. As I understand it, it's an ObjectReference script attached to the power armor piece that fires from an OnHit Event.

 

So when the piece is destroyed the idea is that it would also 1) Subtract a chunk of HP from the owner npc's health pool, NOT the armor's health pool, if that makes sense and 2) Add a piece of armor from a leveled list to the npc and 3) have the npc equip that new piece.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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