Aller au contenu

Photo

All About Corpses


  • Veuillez vous connecter pour répondre
28 réponses à ce sujet

#26
henesua

henesua
  • Members
  • 3 855 messages

I'm writing a corpse system for PCs that integrates with the NPC corpse system in NESS. This is for oldfog.

 

The purpose is to reinvent a wheel that has been done many times, because for some reason I have not found anything that actually works. Fugue system. Carryable body. Raise dead spell targeting etc... I know this is out there, but haven't found it.

 

Just about done. Would have taken longer to find and then rewrite to work with my scripts anyway.

 

 

One very minor problem that really irritates me and I could not solve however is as follows:

 

how do you determine if a PC dies on their back or on their face?



#27
SHOVA

SHOVA
  • Members
  • 522 messages

in the HCR, the on dying script  causes the PC to play animation dead looping back- I assume the on dying script fires before the on death script.



#28
henesua

henesua
  • Members
  • 3 855 messages

I got all of this working. Unfortunately the solution is very tied in with both the module's persistency setup as well as its spawn system (NESS) so its difficult to share.

 

I never figured out how to determine which way a creature is flipped after they are dead. Getting this information would be nice, but in the end Its not too much of a problem since it makes more sense to look at a corpse or place a corpse face up. So I just ensure that the corpse I create falls face up. The PC's corpse has a 50% chance of flipping over (if its not already face up) when the PC "respawns" as a ghost in "the fugue".

 

So anyway, here's how I handled corpses:

 

PCs leave their normal corpse (a dead character) until they respawn. NPCs leave their normal corpse, until their corpse is picked up and then put down again. After those events, I create a doppelganger that looks like the dead creature, dress it (if it had anything equipped) and then kill it whenever I need to see a corpse on the ground. These corpses are not destructable, not raisable, and not lootable.

 

Instead I link an invisible placeable with inventory to the visible body. The invisible placeable is the node with which all corpse related things happen. Looting, animating, skinning, raising...

 

For persistency I link the inventory to a creature somewhere else which is linked to the dead character's corpse. This inventory is maintained as a copy, and starts a save process once a minute whenever the linked inventory changes (ondisturbed event).

 

For persistency of all the data saved on the corpse I link the data to an item in an inventory elsewhere. If the corpse is ever destroyed in game or raised this data item is also destroyed. Having the persistent data makes corpses persistent across server resets, including their location. Storing the "corpses" in an inventory makes a nice place to have a list of all active corpses if I ever need to check rather than making database queries. I just load this inventory once at onmodule load and then check it or update it as things change. I periodically save it (once a minute).

 

Corpses are also carryable as items. The item needs to be put down on the ground to interact with where it becomes a placeable and has all the normal functionality. BUT a raise or animate spell can target an item corpse just as well as the placeable.

 

What functionality is open to any particular corpse is identified in a series of bit flags buried in one integer: corpse type. These are animating, raising, skinning, and persistence.

 

Anyway, thats the quick and dirty. I may upload this sometime if I have time to rewrite it for public consumption.



#29
henesua

henesua
  • Members
  • 3 855 messages

I extracted the code for maintaining the inventory persistence of carryable corpses which I wrote from the above project. There was a lot of interconnected functionality involved with my implementation of corpses, so if I am going to ever share it I need to extract all the parts and make them work outside of a specific server. This example project showing inventory persistence is a small part of that.

 

I don't know if I will have the time to do all this work. But I figured this was an easy share, so I put in the effort to extract this very small part of the whole thing. The Demo module is what you'll want to look at to see the possibilities of the core functions.

 

Persistent Inventory Examples

 

I apologize for not writing a manual for how to use the code. Ask me questions in the NW Vault thread and I might be able to help you. If I ever write instructions they'll be there.


  • YeoldeFog aime ceci