Skip to content

Body decay and/or persistent corpses

Good day! If it's not overly complicated and something that I can easily toggle on my end, can anyone, please, tell me how I might adjust these factors with the toolset? To be more clear, I'm hoping that it might be reasonably feasible on my end to have a more consistent looting experience, as I adventure through a wide variety of custom modules. I can understand how creators are attempting to make things more immersive, but I'm finding it extremely difficult to loot in custom modules that have added persistent corpses. For my personal use and convenience, is there a simple toggle that might restore the loot system back to NWNEE's default settings here? Where the NPCs' bodies decay reasonably quickly and leave behind loot bags? Or is there a lot more to this that I'm likely not considering. Would doing this make plot items nearly impossible to find?

Comments

  • MelkiorMelkior Member Posts: 216
    Unfortunately, this depends entirely upon the module settings and has little to nothing to do with user settings.
  • JidokwonJidokwon Member Posts: 405
    I don't understand how scripting or barely any of this works. I did find that all of the modules and override scripts that I've checked, so far, have made changes to NWN's nw_c2_default7 script in some way. I haven't tested this fully by any means, but, so far, deleting this modified script from the modules in question seems to have worked for this purpose. I was never able to get override packages that claimed to work for this to work on my end, nor explored any of them fully, but from the few that I did look at, they appeared to involve that same script in some way.

    //:://////////////////////////////////////////////////
    //:: NW_C2_DEFAULT7
    /*
    Default OnDeath event handler for NPCs.

    Adjusts killer's alignment if appropriate and
    alerts allies to our death.
    */
    //:://////////////////////////////////////////////////
    //:: Copyright (c) 2002 Floodgate Entertainment
    //:: Created By: Naomi Novik
    //:: Created On: 12/22/2002
    //:://////////////////////////////////////////////////
    //:://////////////////////////////////////////////////
    //:: Modified By: Deva Winblood
    //:: Modified On: April 1st, 2008
    //:: Added Support for Dying Wile Mounted
    //:://///////////////////////////////////////////////

    #include "x2_inc_compon"
    #include "x0_i0_spawncond"
    #include "x3_inc_horse"

    void main()
    {
    int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
    int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
    object oKiller = GetLastKiller();

    if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB")&&GetIsObjectValid(GetMaster(OBJECT_SELF))) SetLocalInt(GetMaster(OBJECT_SELF),"bX3_STORE_MOUNT_INFO",TRUE);


    // If we're a good/neutral commoner,
    // adjust the killer's alignment evil
    if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
    {
    AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
    }

    // Call to allies to let them know we're dead
    SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);

    //Shout Attack my target, only works with the On Spawn In setup
    SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);

    // NOTE: the OnDeath user-defined event does not
    // trigger reliably and should probably be removed
    if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
    {
    SignalEvent(OBJECT_SELF, EventUserDefined(1007));
    }
    craft_drop_items(oKiller);
    }

    This is the script in question that *not* having anything relating towards it in my override file or a modified version of this script within a module seems to have reverted the looting system back to normal on my end. Again, I haven't fully tested this, nor do I claim to remotely understand how any of it works. In my case, though, deleting the modified versions of the script did remove the bodies persisting after death and spawned in loot bags with any loot that might have dropped.
  • MelkiorMelkior Member Posts: 216
    The time it takes for a body to "decay" = vanish is a setting you can change on the NPC. It's under the Advanced tab in the NPC properties, and is labelled "Corpse Decay Time". A short decay time is generally a good idea for loot-droppers, because otherwise the PCs have to stand around waiting for the Remains to appear, which can be very frustrating for the players.

    If you want to create "loot" on the NPC to be dropped for players to pick up after death, it's important to remember that anything which the NPC either has in the blueprint or has created by the on-spawn script can be used by the NPC if it has the appropriate feat (or the item doesn't require a feat to use). If you don't want to unexpectedly increase the difficulty of the NPC (and reduce the loot which will be available to the PC), then you need to instead generate the droppable loot on-death.

    You can instead use another setting under the Advanced tab to stop the body from decaying, which means that the body itself becomes the "body bag" instead of vanishing and leaving "Remains" behind. Check "Leaves Lootable Corpse" if this is what you want.

    There's an alternative which is scripted into some servers. Instead of the loot being created on the dead NPC, the OnDeath script creates a container (perhaps looking like a blood stain on the floor) which then receives the loot. This allows the NPC body to remain on-map but not be selectable. This may help with separating loot piles when there are a lot of dead NPCs, but so would just allowing the NPCs to create their default Remains when the body vanishes.

    It seems like the module which you've been playing does this alternative. It also seems to create loot before death since you're still getting loot after deleting the on-death script, except that it's now in Remains instead of in a "body".
    HOWEVER if the script which you deleted is the above, then the on-death scripting MUST be inside the OnUserDefined event script instead, since there is no processing for loot or bodies in the on-death script.

    OnUserDefined must be looking for event number 1007 and then taking special action to either create the loot or create a body and transfer the loot to the body.

    If the OnUserDefined script isn't too long, perhaps you could post it here so we can see what it does.
  • JidokwonJidokwon Member Posts: 405
    I'm going to need to dig deeper here. The modules in question had edited the nw_c2_default7 script and had added a LeaveCorpse(); line towards the end of the script. There were no OnUserDefined event scripts found in the module properties. After a short period, too, the bodies left would end up decaying further, turning in bone piles and destroying any loot in the process. My guess is that these further actions would occur from one of the many completely custom scripts found in the modules. Again, I'll dig deeper here, but now I'm rethinking the whole idea. Outside of immersion, there could very well be other reasons that many developers use persistent corpses. If there were any requirements for casting spells or performing actions on any of the bodies, I could very well be breaking things with my attempts to have a consistent looting system. I'm completely unsure if the modules would treat any plot related NPCs differently.
  • JidokwonJidokwon Member Posts: 405
    Might anyone tell me if looting scripts manage to acquire loot from bodies that a player would be unable to target? When there are multiple bodies piled closely on top of each other, I'm meaning. Would a looting script be a possible way to get the loot from bodies that aren't targetable?
  • MelkiorMelkior Member Posts: 216
    Regarding LeaveCorpse(), that must be a custom command. My guess is that it's creating a placeable object and the loot then goes into that object. It might be an invisible object in the same location as the body, or it might be a placeable which looks like a body.

    Regarding looting scripts, in the past I've created an auto-loot script which was triggered by an item.

    The idea is that when the item is activated, a visual effect is created at the target location (I used the Implode effect) and then a search is made within a radius (I chose something like 10 feet, making 20 feet diameter) for either remains or anything else which might contain loot drops, then the items inside the remains are copied across to the PC (including variables on the items) followed by the originals being deleted. All of this is done by scripting commands added inside the OnActivateItem scripting.
Sign In or Register to comment.