Jump to content

Recommended Posts

Posted

Hey, everyone. Let me just preface this thread with a couple things. First of all, I am not experienced with making mods, by ANY stretch of the imagination. I've used mods for the Elder Scrolls series for years, and I certainly know how mods "work," so to speak, at least more so than a newcomer would. But when it comes to creating anything more complicated than a sound/texture/etc. replacer, I'm not of much use to anyone. Second of all, rather than posting a thread here, I could be posting a slightly different thread in the Mod Requests section that would specifically request the mod I'm wanting to see created, but it's been requested before, and I figure that if nothing else, I can try and make the mod myself, so I figured that this subforum would be a better place to start. So now that all that is out of the way, here we go.

 

I'm interested in a mod that essentially allows the player to kill an NPC, activate the corpse like a container (as corpses usually are) so as to loot it, but then be able to take the corpse and place it in said player's inventory as an item that can be manipulated just like any other item (e.g., dropping, putting in a container, etc.) but that, when dropped and thus released back into the worldspace, will resume its original state as a manipulatable/moveable/etc. corpse of the "container" type. I know that Vile Art of Necromancy lets you "dissect" a corpse and place non-unique "body parts" into your inventory, but ideally, I'd like to be able to place the full corpse into the player's inventory (and if possible, have it retain its identity if it's a unique NPC; that is, if you kill, say, Nazeem and place his corpse into your inventory, the "itemized" corpse will specifically retain any information necessary to make it uniquely "Nazeem," and will be, once dropped back into the worldspace, restored as closely as possible to the state it was in when the player added it to his/her inventory, having the same "remaining" loot that it had once the player took what he/she wanted and then placed the body into his/her inventory).

 

My first thought is that in order to accomplish this, the corpse's object type (container, actor, static, etc.) would, upon being put into the player's inventory, need to change on the fly from "container" to some item type (such as potion, armor, miscellaneous, or whatever), and then be able to change back to "container" when dropped back into the worldspace. I believe that this kind of feat is possible because I've seen other mods do it. For example, LtMattmoo's Camping here on the Nexus has items called "storage sacks" that are miscellaneous items when in the inventory, but that turn into moveable, physics-enabled containers when dropped into the world (and that can even be picked back up and converted back to the item type upon entering the player's inventory). JustinOther's Bag of Holding (as well as Vidani's attempt at the same concept) do the same thing, except rather than being misc. items that function by being dropped, they exist in the player's inventory as clothing/armor and grant access to their own container "inventory" upon being equipped (and can then be dropped into the world, moved around, and picked back up).

 

So, assuming that my reasoning is sound, and this approach to making this corpse-to-inventory mod would actually work, I'd like some guidance on how to make the object type switch actually (and smoothly) occur in-game when the player adds the corpse to their inventory. Of course, if this approach is a good one, I could consult the authors of the mods I linked as examples, but I thought I could get extra insight here, and more than that, if this approach to making the mod simply isn't a practical one, then perhaps you guys could guide me in the right direction.

 

Forgive me if I've said anything ignorant or negligent about the process of mod-making. As I stated initially, I'm no expert with this kind of thing. I just have an "apprentice" understanding of how TES mods work. In any case, any guidance you guys could offer would be great. Thanks a lot.

Posted

First the bag of holding mods you linked (as well as my own) are armor pieces that when interacted with in a certain way activate a separate container. They do not switch at any point to a different object type. The same would have to be true of the NPC.

 

It would be theoretically possible to use the OnActivate event coupled with sneaking to place a corpse object in the player inventory while moving the NPC body to a holding cell. Then when the corpse object is dropped to the ground, the NPC body is moved to that position. Realistically you wouldn't be able to carry more than one body so limiting it to one at a time (which makes coding easier) would be a smart idea.

 

So...

 

 

Step one:

Create a small interior room, not linked to any other cell

 

Step two:

Place a COC marker to teleport the npc body (and so you can teleport yourself for testing)

 

Step three:

Create a MiscObject item, perhaps use an NPC mesh from one of the loading screen images (at least as a placeholder till something better is created)

 

Step four:

Create a global variable (Global subsection of Misc in Object window in Creation Kit) with a value of 0

 

Step five:

Create a dummy quest with a single alias for the player -- See linked subsection Set Up A Reference Alias

 

Step six:

Give the player alias a script similar to the following

 

 

Scriptname YourScriptNameHere Extends ReferenceAlias
 
MiscObject Property DeadBody Auto
Actor Property PlayerRef Auto
Quest Property DeadBodyQuest Auto
GlobalVariable Property DeadBodyBool Auto
Actor DeadDude
 
Event OnCombatStateChanged(Actor akTarget, int aeCombatState) ;use combat state change since 90% of dead bodies come from combat
  If DeadBodyBool.GetValueInt() == 0
    DeadBodyQuest.Start()
    RegisterForSingleUpdate(60.0) ;one minute -- real world
  EndIf
EndEvent
 
Event OnUpdate()
  ;if player has not gotten the dead body -- stop the quest, start it again and register again to check a minute later -- this changes the aliases
  If (PlayerRef.GetItemCount(DeadBody) == 0)
    DeadBodyQuest.Stop()
    Utility.Wait(0.1)
    DeadBodyQuest.Start()
    RegisterForSingleUpdate(60.0) ;one minute
  EndIf
EndEvent
 
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
  If akBaseItem == DeadBody
    DeadBodyBool.SetValueInt(1)
    DeadDude = akSourceContainer as Actor
  EndIf
EndEvent   
 
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
  If (akBaseItem == DeadBody) && (!akDestContainer) ; no destination container means the ground -- usually
    DeadDude.MoveTo(DeadBody)
    Utility.Wait(0.1)
    DeadBody.Disable()
    DeadBodyQuest.Stop()
    DeadBodyBool.SetValueInt(0)
  EndIf
EndEvent

 

Step seven:

Create a dummy quest with up to 20 or so aliases.

The aliases would find matching references in the loaded cell and closest.

The conditions to match would be IsActor and GetDead

 

Step eight:

Apply a script similar to this (if not this) to each of the aliases

 

 

Scriptname YourScriptNameHere Extends ReferenceAlias
 
MiscObject Property DeadBody Auto
Actor Property PlayerRef Auto
ObjectReference Property HoldingCellMarker Auto
 
Event OnActivate(ObjectReference akActivator)
  Actor Me = Self.GetReference()
  If (akActivator == PlayerRef) && (Me.IsDead) && (PlayerRef.IsSneaking)
    PlayerRef.AddItem(DeadBody,1)
    RegisterForSingleUpdate(5.0)
  EndIf  
EndEvent
 
Event OnUpdate()
  If (UI.IsMenuOpen("InventoryMenu"))  ;requires SKSE -- keeps the body from disappearing while inventory is still open
    RegisterForSingleUpdate(5.0)
  Else
    Actor Me = Self.GetReference()
    Me.MoveTo(HoldingCellMarker)
  EndIf
EndEvent

 

Step nine:

Test the heck out of it cause surely my brain forgot something :P

 

 

Posted

As it happens, this mod pack contains a mod that achieves the end goal, presumably by the same method you described, Ishara. In any case, if anyone else is interested in it, there you go. The mod you want is "Clean Up Your Corpses" in the download section.

  • Recently Browsing   0 members

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