Athelbras Posted July 25, 2018 Share Posted July 25, 2018 (edited) THE QUESTION: For FO4, does anyone know how to get the ObjectReference for a Dead NPC's dropped weapon? I have scripted a 'Bot that goes around gathering items from dead NPCs, and thereafter removes those corpses from the game world. But it is not yet able to acquire dead NPC's dropped weapons ... When an NPC dies and has a drawn weapon, that weapon is dropped. When a player examines the corpse, that weapon is presented as being in the corpse's inventory and can be taken by the player. The weapon can also be taken directly from the ground instead. However, the dropped weapon is not actually in the corpse's inventory. This can be readily confirmed using console mode commands and scripting. Hence, the seemingly obvious solution -- the RemoveAllItems function -- does not in fact acquire that weapon (it fails to do that). And unfortunately, the dropped weapon automatically disappears if not yet taken when the corpse is disabled or deleted. Which means my 'bot can't simply remove the corpse after looting it and leave the dropped weapon to be taken by the Player instead. So the game evidently creates a special non-container association between a corpse and its dropped weapon. My current conjecture is that the corpse has a "linked reference" to its dropped weapon. But I have not been able to confirm that fact. I have tested all of the "linked reference" functions on the corpse in hopes of getting the object reference for the weapon. I tried the keyword ObjectTypeWeapon, the custom link keywords (LinkedCustom01 to LinkedCustom10), and also without a keyword via None. No success; they all return None, I also tested the linkage reference functions, plus the ownership functions, on the weapon in hopes of getting a reference to an actor (alive or dead) that I could then use for comparison. Also no success. EDIT: [ I literally tried every papyrus linkage function and ownership function in various ways in both directions as appropriate ... GetLinkedRef, GetLinkedRefChain, GetLinkedRefArray, GetLinkedRefChildren, GetRefsLinkedToMe, HasOwner, HasActorOwner, HasActorRefOwner, GetActorOwner, GetActorRefOwner, GetFactionOwner, GetContainer, HasContainer, RemoveAllItems, Drop, DropFirstObject, HasKeyword, GetClass, ... ] If the game does indeed use a linked reference, then perhaps I simply need the correct keyword value ... if so, does anyone know it? Or does anyone have a suggestion, or perhaps an actual solution, that takes a different approach to solving this problem? < Athelbras > [ Moderators -- please do not move this post to elsewhere -- these are the folks from whom I would greatly appreciate advice for solving this problem ] Edited July 25, 2018 by Athelbras Link to comment Share on other sites More sharing options...
Reneer Posted July 25, 2018 Share Posted July 25, 2018 (edited) Ok, great explanation of what you've tried so far. But... what game are you making this for? :tongue: Also, this very post is (partly) the reason you're not supposed to ask mod support questions in the GMAD forum. If you had posted in the proper CK Modders forum I would know what game you were working with and thus what Papyrus functions you had available to you. But, since you didn't, I can't, and here we are. Edited July 25, 2018 by Reneer Link to comment Share on other sites More sharing options...
Athelbras Posted July 25, 2018 Author Share Posted July 25, 2018 (edited) Whoopsy!!! It is for Fallout 4. [ edited the content, but don't seem to be allowed to edit the title ] Edited July 25, 2018 by Athelbras Link to comment Share on other sites More sharing options...
Reneer Posted July 25, 2018 Share Posted July 25, 2018 You will likely want to try FindAllReferencesWithKeyword and use the ObjectTypeWeapon keyword. Link to comment Share on other sites More sharing options...
Athelbras Posted July 25, 2018 Author Share Posted July 25, 2018 Well ... according to the title blurb for this forum, this is indeed an acceptable place for this to be posted ... General Mod Author DiscussionA place for established mod authors to discuss anything they want So this is a problem that I would like to discuss, here, with the established mod authors, instead of with the multitude of less experienced authors who frequent other forums. [ no disrespect intended ] Link to comment Share on other sites More sharing options...
Athelbras Posted July 25, 2018 Author Share Posted July 25, 2018 (edited) Thank you for your reply ... I currently use Find that way as a make-shift mechanism. It works for finding weapons in the area, but there are notable issues with it, since the discovered objects can not (apparently) be related back to the specific corpses that dropped them. So I am hesitant to upload this mod (which is otherwise completed) because of those issues/risks. I was tempted to include all of that as part of my initial post, but figured it was already rather wordy. Edited July 25, 2018 by Athelbras Link to comment Share on other sites More sharing options...
Reneer Posted July 25, 2018 Share Posted July 25, 2018 (edited) Well ... according to the title blurb for this forum, this is indeed an acceptable place for this to be posted ... General Mod Author DiscussionA place for established mod authors to discuss anything they want So this is a problem that I would like to discuss, here, with the established mod authors, instead of with the multitude of less experienced authors who frequent other forums. [ no disrespect intended ]Actually, not quite anything. As the post by Dark0ne states, troubleshooting / technical support should be done elsewhere so that information isn't "locked away" in the GMAD forum. Yes, thank you for the suggestion ... I have already done that as a make-shift. It works, but only to a degree -- there are notable issues with it, since the discovered objects can not (apparently) be related back to the specific corpses that dropped them. I was tempted to include all of that as part of my initial post, but figured it was already rather wordy.If you're not going to include everything you've tried, you're just going to make people (like me) frustrated when they offer up a solution you already tested but failed to mention. I know listing everything you tried is a chore, but it helps the people who are trying to help you. Edited July 25, 2018 by Reneer Link to comment Share on other sites More sharing options...
Athelbras Posted July 25, 2018 Author Share Posted July 25, 2018 (edited) For what can be posted here .. as you noted, then someone must change the blurb for this forum, because otherwise it is a misleading and blatant falsehood. For example, I've been around here for years (as a very infrequent poster), and it has evidently misled me, because I took it at face value. [so is this forum (now) just a chit-chat forum? That seems to make "established mod author" irrelevant] Your everything-I-have-tried comment is valid. Apologies. I literally tried every papyrus linkage function and ownership function in various ways in both directions (as appropriate). The idea is/was to establish a solid one-to-one relationship, but would settle for at least a loose reasonably-likely association (e.g. an attempt to relate the corpse's known actor Class to the weapon's supposed owner's actor Class and coupled by proximity -- but the Class values returned for Actor corpses are broken/unreliable; as in an Actor can have a Raider Class but that Actor's corpse has a meaningless Class value). [ GetLinkedRef, GetLinkedRefChain, GetLinkedRefArray, GetLinkedRefChildren, GetRefsLinkedToMe, HasOwner, HasActorOwner, HasActorRefOwner, GetActorOwner, GetActorRefOwner, GetFactionOwner, GetContainer, HasContainer, RemoveAllItems, Drop, DropFirstObject, HasKeyword, GetClass, ... ] Edited July 25, 2018 by Athelbras Link to comment Share on other sites More sharing options...
Reneer Posted July 25, 2018 Share Posted July 25, 2018 (edited) For what can be posted here .. if it is as you say, then someone must change the blurb for this forum, because otherwise it is a misleading and blatant falsehood. For example, I've been around here for years, and it has evidently misled me. Your everything-I-have-tried comment is valid. Apologies. I literally tried every combination of papyrus linkage function and ownership function in both directions (as appropriate). [i suspect that listing them here adds no intrinsic value]Well, since you've been here for years, then you've no doubt seen moderators move topics such as this to their respective CK Modders forums multiple times. :tongue: As for the issue at hand, my guess is that when the actor dies the weapon is dropped and ownership is removed so that the player isn't "stealing" (but it has been a long while since I tested this particular game mechanic.) So to accomplish your goal you will likely need to get at this information while the NPC is still alive. Edited July 25, 2018 by Reneer Link to comment Share on other sites More sharing options...
Athelbras Posted July 25, 2018 Author Share Posted July 25, 2018 (edited) Okay, thank you for your insights about this forum. The 'bot is essentially an Undertaker who deals with the dead, as they pile up around a settlement. I've had multiple requests for it. The living are someone else's purview. <chuckle> Edited July 25, 2018 by Athelbras Link to comment Share on other sites More sharing options...
Recommended Posts