Jump to content

NPC gathering loot


DanielUA

Recommended Posts

Interesting and (although it's a year old) timely thread, seeing as how I'm trying to make a mod that does this.

 

The Search Body animation is indeed a vanilla asset, but as was stated, no one ever takes anything. However, Ralof will take the key from the dead Imperial in Helgen Keep if you move too far away or take too long to do it, so there's that. However, I've had no luck with converting that AI package to my needs, so there may be a scripted event (though I can find no such script attached to Ralof or the Package).

Link to comment
Share on other sites

I've learned a few things since that last post. I've not tried this but it may work. This is a function where you pass in a formlist that has the desired lootable items as well as the dead actor, the return result is a random item from the dead actor that is on the lootable list.

 

 

 

REQUIRES SKSE

Form Function LootRandomItem(FormList LootItems,ObjectReference TheDead)
	Form Result = NONE
	FormList TempList
	Int DI = TheDead.GetNumItems()
	Int ix = 0
	While ix < DI
		If LootItems.HasForm(TheDead.GetNthForm(ix))
			TempList.AddForm(TheDead.GetNthForm(ix))
		EndIf
		ix += 1
	EndWhile
	Int TL = (TempList.GetSize() - 1)
	Int RI = Utility.RandomInt(0,TL)
	Result = TempList.GetAt(RI)
	Return Result
EndFunction 

 

 

Link to comment
Share on other sites

I'll try the FormList idea first, then try the SKSE thing. Looking at the Find Food package for SkyTEST, it looks just like Ralof's GetDoorKey package, which is what I was working with, so that lets me know I just need to find the right way to specify the item for retrieval.

Link to comment
Share on other sites

Ok, so with the Script above, can I also substitute a specific actor with a list of actors? I'm unable to specify a Named Character since I'm targeting vanilla randomly-generated, leveled Actors.

 

The Lootable item is actually the only thing that is constant - they've all got one.

Link to comment
Share on other sites

The function I posted earlier works on passing in a formlist with the items to be randomly looted as well as passing in the reference of a dead actor. That seems to be opposite of what you've just stated. Loot a single item from a random group of dead actors.

 

The intent of the function was to have NPC A approach NPC B and take an item determined by the function from NPC B. How you determine who NPC A, NPC B or the potential loot is up to you.

 

If you already have NPC A approaching NPC B, then you must have already targeted NPC B in some way. Simply pass that information on...

Link to comment
Share on other sites

I implemented this and gathering by NPCs in a mod and it took... a lot of time for a follower/NPC to run to the corpse/bush and loot it so i dropped the feature. Rather use AutoLoot / Harvest mod and auto loot everything.

Edited by techprince
Link to comment
Share on other sites

Not exactly helpful, but I always thought the NPCs kneeling down to touch the bodies were looking for a pulse to see if they were actually dead.... Now I will want to scream "What is wrong with you people?!" whenever they do it. Corpse robbing those poor town guards who died to a dragon, tsk tsk.

Link to comment
Share on other sites

Ishara - Thanks again. Reading the page you linked to, I see there's a possible issue with Aliases not refilling properly, causing Script errors. I got enough troubles without that. :lol: As well, I'd be dynamically attaching a Script to an actor that's dynamically generated by a Script - is that even remotely "safe"?

 

TechPrince - Thanks for the tip on those mods, but I'd much rather have the actor perform the SearchBody idle, and have the item be transferred from the carrier to my NPC. Nitpicky, I know, and they'd only do it when I was there to witness it (otherwise it would be done automatically by "theory" alone), but I'm determined to get it working in a specific manner. Typically I frown on OCD, but it's like writing - there's something you want to say, and a specific way you want to say it :lol:

As well, Harvest relies on extensive settings in MCM, which I do not use. I'd like to keep it as Vanilla as possible, just to cut down on the clutter.

 

 

Another possible issue I'm concerned about is that since I'm targeting actors that are randomly spawned, there's as much chance of encountering only one as there is of encountering 3 or more in the same patrol schedule, so I would think that specifying a Number Of Items for the Acquire function would have to be dynamic as well. If I specify 1, and they run across 2 more patrols in the same patrol cycle, the other 2 wouldn't be looted since the condition was met. If I set it to 3 and they only encounter 1, they'd stay out until that condition was satisfied, which could overlap their "shift change" function.

 

It's already bad enough that the game is very often re-routing the patrols off the road and across the plains to avoid my Hunters :\

 

I'm still looking at Ralof's GetDoorKey Package as the template, but I need to incorporate that into a Patrol package so that when NPC A encounters NPC B, the "GetDoorKey" function kicks in.

However, that leads right into the issue of the Number To Acquire=1 being met, thus they may not try to loot from succeeding encounters.

 

I have built a custom Package that does include the GetDoorKey elements, but I'm unclear as to whether these branches should be Simultaneous or Stacked under the Patrol function.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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