Paralyzing a NPC via script ?

Post » Wed Jun 20, 2012 10:40 am

Yup, seems something is missing with the removeallitems function. If i don't take an item in their inventory, they respawn nvde.
User avatar
jadie kell
 
Posts: 3497
Joined: Sat Jul 29, 2006 3:54 pm

Post » Wed Jun 20, 2012 1:05 am

They have their items, they just don't bother to re-dress themselves until they are reset (Remember, you are taking all their stuff away for a moment then giving it back)

When he gets revived, try doing a reset() on him and see if that makes him put his clothes back on without respawning his entire inventory?
User avatar
Tarka
 
Posts: 3430
Joined: Sun Jun 10, 2007 9:22 pm

Post » Wed Jun 20, 2012 9:27 am

Hmm nope, reset didn't seems to change a thing.

edit : nope, doesn't seems to work after some tests
User avatar
Laurenn Doylee
 
Posts: 3427
Joined: Sun Dec 03, 2006 11:48 am

Post » Wed Jun 20, 2012 8:41 am

Try pickpocketing him and his clothes should be there, just not being worn. maybe there's a way to go through his inventory and do an EquipItem on everything?
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am

Post » Wed Jun 20, 2012 6:43 am

Indeed, his clothes are there, but like you said, unequipped, that's why he respawn nvde.
User avatar
nath
 
Posts: 3463
Joined: Mon Jan 22, 2007 5:34 am

Post » Tue Jun 19, 2012 9:41 pm

You know how if your follower is wearing his default outfit, you can add an item to his inventory to cause him to put on his best items? After you resurrect the NPC, try adding something (eg an iron dagger) to the NPC and then removing it.
User avatar
Lavender Brown
 
Posts: 3448
Joined: Tue Jul 25, 2006 9:37 am

Post » Wed Jun 20, 2012 9:12 am

Tried, sadly done nothing.
User avatar
Soph
 
Posts: 3499
Joined: Fri Oct 13, 2006 8:24 am

Post » Tue Jun 19, 2012 10:43 pm

Couple of ideas to redress the stumbler - I thought the stumbling was cool btw :)

1/ Looping through a formlist of everything. See http://www.gamesas.com/topic/1357739-actor-equipitem-not-applying-armor-enchantments/page__view__findpost__p__20513233's post in this thread.

2/ Build the clothes formlist as they are removed from the NPC. So mod-added clothing could be detected.
You can't loop through the inventory directly, but as you are moving them to a custom container then you can put a script into the container to catch http://www.creationkit.com/OnItemAdded_-_ObjectReference() Events.

Something like...
Spoiler

Scriptname SavedItemsBoxScript extends ObjectReferenceFormlist Property myNewEmptyFL AutoEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)  RegisterForSingleUpdate(2)  If (akBaseItem As Armor) ; All clothing is Armor right?    myNewEmptyFL.AddForm(akBaseItem)  EndIfEndEventEvent OnUpdate()  ; It's been 2 seconds since the last added itemEndEvent

The pain with this though is the threading, and that multiple NPC's could be knocked out together.

The events on the container would start to populate the formlist while your main script is waiting for Resurrect.
You may be able to use the 2 second thing to set a state on the container that events have finished.

Umm, I give up. I think it would break too easily.
It will be far easier to wait for SKSE and do an inventory loop directly :)

User avatar
Roy Harris
 
Posts: 3463
Joined: Tue Sep 11, 2007 8:58 pm

Post » Wed Jun 20, 2012 1:04 am

Couple of ideas to redress the stumbler - I thought the stumbling was cool btw :smile:

1/ Looping through a formlist of everything. See http://www.gamesas.com/topic/1357739-actor-equipitem-not-applying-armor-enchantments/page__view__findpost__p__20513233's post in this thread.

2/ Build the clothes formlist as they are removed from the NPC. So mod-added clothing could be detected.
You can't loop through the inventory directly, but as you are moving them to a custom container then you can put a script into the container to catch http://www.creationkit.com/OnItemAdded_-_ObjectReference() Events.

Something like...
Spoiler

Scriptname SavedItemsBoxScript extends ObjectReferenceFormlist Property myNewEmptyFL AutoEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)  RegisterForSingleUpdate(2)  If (akBaseItem As Armor) ; All clothing is Armor right?	myNewEmptyFL.AddForm(akBaseItem)  EndIfEndEventEvent OnUpdate()  ; It's been 2 seconds since the last added itemEndEvent

The pain with this though is the threading, and that multiple NPC's could be knocked out together.

The events on the container would start to populate the formlist while your main script is waiting for Resurrect.
You may be able to use the 2 second thing to set a state on the container that events have finished.

Umm, I give up. I think it would break too easily.
It will be far easier to wait for SKSE and do an inventory loop directly :smile:


Well you could make the Formlist global...once it determines an item is clothing, it shouldn't have to check again, just do a check on whether it's already in there first before adding it, and have it initially load a CK-made formlist of existing clothing types.
User avatar
Jessica Stokes
 
Posts: 3315
Joined: Fri Jul 28, 2006 11:01 am

Post » Wed Jun 20, 2012 9:36 am

Of course! I couldn't see the wood for the trees.
The check isn't even needed either as AddForm refuses to add Dupes.
User avatar
DarkGypsy
 
Posts: 3309
Joined: Tue Jan 23, 2007 11:32 am

Post » Wed Jun 20, 2012 12:08 pm

Of course! I couldn't see the wood for the trees.
The check isn't even needed either as AddForm refuses to add Dupes.

Dang, then I'll have to rethink my ScavangerHunt Script I was working on...it was going to use a Formlist that had a number of entries for an item equal to the number of items needed...guess I'll have to set up an array of integers for the counts...
User avatar
Timara White
 
Posts: 3464
Joined: Mon Aug 27, 2007 7:39 am

Previous

Return to V - Skyrim