Page 1 of 3

acr_death_i

Posted: Sat Mar 31, 2007 9:01 pm
by AcadiusLost
Was checking to see if this compiled under NWN2 for possible inclusion with the ACR release, ran into this snag:

Code: Select all

    // create a body at the morgue and store the player's information on it
    // a chest object reference should be cached on the module OnModuleLoad
    object oRecord = CreateItemOnObject(ACR_DTH_BODY_RESREF, oCooler, 1, GetPCPublicCDKey(oPC));
The problem is, CreateItemOnObject() only takes resref, object, and number as operands, meaning we can't attach the PC's public CD key to the corpse, at least not with that function. I haven't looked into the details, but I imagine that's rather important for the proper functioning of the death system.

We can set a local string on the "body" item, or name it once (if) we get the SetName() functions back, potentially.

Should this system be left out of the ACR until we're further along, or is there an easy fix we can manage?

[edit: SetName() is used twice in the script as well- commented those lines out for now, but they likely break functionality fairly critically.]

Posted: Sat Mar 31, 2007 11:02 pm
by ç i p h é r
Yes, we need to exclude it for the time being. CreateItemOnObject() is not backward compatible with the NWN1 version and SetName() is not yet available. This only affects player characters, so we have time yet. I'm just hoping that they address these in 1.06 or else we may have to modify the implementation. We may want to anyway, now that we've committed to NWNX.

Posted: Sat Apr 28, 2007 8:48 am
by AcadiusLost
Did a quick revision of this tonight, switched out the SetName() calls for SetDescription() ones, with a few tweaks.

However, I still get function mismatches on CreateItemOnObject() when we pass the custom tag parameter. This was supposed to be OK in 1.05, did I miss something?

Posted: Sat Apr 28, 2007 4:31 pm
by ç i p h é r
I just checked the v1.05 patch notes and there's no mention of a fix for that function. So I guess the evidence points to NOT FIXED.

We could always use CopyObject() as a workaround for now. Instantiate, copy (to create new tag), then destroy the original. Once CopyItemOnObject() is fixed, we can reintroduce it.

Posted: Sat Apr 28, 2007 7:32 pm
by AcadiusLost
I think it was slated for 1.05, but sneakily shifted over to 1.06 before final release. If CopyObject lets you retag objects, then I should still be able to adapt the code- I'll take a stab at it today, though I've not got a wealth of time on my hands this weekend.

Posted: Sat Apr 28, 2007 7:44 pm
by AcadiusLost
Bah, seems like we've got a catch-22 with our dance to get the tags right:

CopyObject() lets you supply a new tag, which is all well and good, but it doesn't copy any local variables that were on the original object (rather important for the death system).

CopyItem() does let you copy all variables onto the new object, but doesn't let you set a new tag.

So, I could write a subfunction that mirrors all the variables we need onto the newly created, retagged corpse object, though it seems a tad laborious. I;ll give it a shot anyway, though.

Posted: Sat Apr 28, 2007 8:32 pm
by AcadiusLost
Not finding blueprints on the Repository for:

items:
abr_it_mi_symbol (Black Rock of Death)

placeables:
abr_pl_co_sarcophagus_03 (Morgue Cooler container)

Found the undertaker, PC body, and Morgue Waypoint though.

Posted: Sun Apr 29, 2007 8:45 am
by AcadiusLost
A few observations in testing so far:

The PC corpse placeables have the dead PC's inventory, but are missing a PC Body item. The morgue cooler (or the inventoried placeholder placeable I put in it's place, since we didn't have a blueprint in the repository) remains empty, through multiple PC deaths.

Do we have anything for a bleeding/dying script? I know someone was working on one at some point- seems a bit odd currently since you just basically stand around paralyzed from 0 to -10 HP. Jumps you to the morgue just fine after -10, though.

Also, I noticed the "Death Symbol" isn't actually created or used anywhere that I could find. Was that by intention?

Posted: Sun Apr 29, 2007 9:30 am
by ç i p h é r
Looks like I never got around to recreating a placeholder cooler for NWN2. I was using a sarcophagus, but really any container object will work - though something with a morbid nature seems apropos. :)

The black rock isn't being used. I kept in the references just in case, but I simply don't see the need for it any longer. If you feel compelled to pull them out, feel free.

If you're not getting a body item on the corpse placeable, then either the item isn't in the palette (and thus not instantiating) or there's still something wrong with the item/object management functions. I really hammered at that under NWN1 and it was working flawlessly. Are the database functions performing at all?

The lack of bleeding is indeed a royal pain for testing the death system. Just make sure you put creatures in your mod that do massive damage and you won't have to worry about getting stuck between 0 and -10. I had that happen to me a number of times before I quit pussy footing around with mobs. :twisted:

Oh and one small FYI. When you die, any weapons you were holding will drop to the ground. It just didn't seem right for those items to get put on the body and buried amid a host of other things. If that's not objectionable behavior, then we'll need to make their locations persistent so they can be restored on reset (if they haven't been picked up).

Posted: Sun Apr 29, 2007 5:10 pm
by AcadiusLost
I've got a blueprint made for the cooler now- should it have any event scripts defined?

The body items are in the palette, but are not appearing on the corpses or in the cooler- it's possible we're seeing this because of the "create", "copy with new tag", "Set Description", "Destroy Original" dance I'm doing for them to get around lack of the 4th parameter on CreateItemOnObject() and SetName(). As I recall from my horse system work, there may be some lag-time associated with the creation event which may make it unavailable for copying before it's destroyed.

As an aside- PC skins are not being equipped OnClientEnter, but equip automatically on the first ACR_GetPCPersistentStorageObject() call. If one hasn't been equipped yet at the moment a PC dies, it's showing up in their corpse's inventory. Do we need any special handling of the skins through the death process?

Posted: Tue May 01, 2007 7:17 am
by ç i p h é r
It probably should but it's not likely to be opened.

The PC Skins are going to be replaced with NWNx4 so I don't think it's worth the effort to add more code to deal with this situation. It probably won't manifest normally anyway unless a PC just logs in and dies at character creation.

Posted: Wed May 02, 2007 9:38 am
by AcadiusLost
committed my PreRelease version of this code, with all my workarounds in. The system seems to work well while the module remains up, but does not persist properly across module resets. For early Beta, this is not a problem, but it will bear reexamination down the road.

Posted: Wed May 02, 2007 7:42 pm
by AcadiusLost
Also, might as well document here how I handled the corpse identification. My CopyObject() trick to re-tag generic PC Body items made with CreateItemOnObject() worked once I followed Cipher's suggestion to wrap the DestroyObject() call with an AssignCommand() to delay it long enough to avoid a race condition. That still left the problem of not being able to ID corpses IG though- I'd swapped out the SetName() calls for SetDescription() ones, but those currently don't change the viewable descriptions of the body items ingame- however, since GetDescription() returns the new description, I was able to use SendMessageToPC() to pass the dead PC's name to anyone who picks up or sets down a PC body. Ideally, we'd be passing other things like gender and race (perhaps instead of the PC name, or in addition), I figured I'd leave that for now in the intrest of time (and as we may be changing how we handle this on the back end).

There were also problems with the placeable corpse- it was remaining in place when the body item was looted from it, but spawning a new copy every time a body item was dropped, meaning you got many of the same corpse placeable- fixed this, also added handling for unlooted inventory when the corpse placeable is destroyed (gets dropped to ground at that location).

No idea how things work for raise dead castings or anything like that, need more nuanced testing to make that work (at least having a DM and player logged in at the same time).

Posted: Mon May 07, 2007 4:16 pm
by AcadiusLost
Another note on this system: currently it's tagging corpses with the body's tag, plus the public CDkey of the player.

What happens when the player rerolls and then dies again? Wouldn't the new corpse get the same tag, potentially breaking the system? Potentially we could use a shorter prefix, then the CD Key, then some combination of characters from the PC's name (first 3 and last 3 letters, or something?).

Posted: Mon May 07, 2007 5:05 pm
by ç i p h é r
I believe I did that to enforce the 1 character per player rule with the expectation that some web interface would be made available for character management. To start a new player, the first must be removed, but there may be some wrinkles in there which I didn't think through. For the time being though, maybe it would be best to add in part of the player's name, as you suggested, to limit the system to act only on dead characters, not all characters belonging to the player.