[OnPlayerDeath] Leave Raiseable PC Corpse - Mulitplayer (One Line of Code)
[Deleted User]
Posts: 0
Many death systems go through an elaborate process to leave a PC corpse that other PCs can raise, loot, etc. These systems are often bulky and add a ton of scripts to your module. Some also include a bunch of items: corpse creatures, corpse placeables, death tokens, etc.
I like to keep things slim and prefer to work within what BioWare already has in the game. So, if you don't mind not being able to loot the PC's corpse, you can use this one line of code in your module's OnPlayerDeath script to create a PC corpse that can be resurrected.
AssignCommand(oPlayer, SetIsDestroyable(FALSE, FALSE, FALSE));
I haven't tested out Raise Dead yet and I'm going see if there is a way to allow other PCs to access the corpse's inventory. Once I figure out more, I'll post the results here.
I like to keep things slim and prefer to work within what BioWare already has in the game. So, if you don't mind not being able to loot the PC's corpse, you can use this one line of code in your module's OnPlayerDeath script to create a PC corpse that can be resurrected.
AssignCommand(oPlayer, SetIsDestroyable(FALSE, FALSE, FALSE));
I haven't tested out Raise Dead yet and I'm going see if there is a way to allow other PCs to access the corpse's inventory. Once I figure out more, I'll post the results here.
1
Comments
if (GetIsDead(oTarget) block of code (within the code execution block defined by the if statement) :
if (GetIsPC(oTarget)) AssignCommand(oTarget, SetIsDestroyable(TRUE, TRUE, TRUE));
For example, nw_s0_raisdead.nss will look like so:
void main()
{
// a bunch of code (okay, its a small bunch...
if(GetIsDead(oTarget))
{
//Apply raise dead effect and VFX impact
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oTarget));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, oTarget);
if (GetIsPC(oTarget))
AssignCommand(oTarget, SetIsDestroyable(TRUE, TRUE, TRUE));
}
}
I'm using this method in the single player module I'm developing, which I'm also coding to be multiplayer friendly as best I can. When a PC dies this is what happens:
1) If the game difficulty is Hardcore or Difficult, the PC drops their entire inventory to a loot bag placeable - in single player they drop everything; in multiplayer they drop just the contents of their backpack.
2) In single player, the PC is sent to Purgatory. In multiplayer, the PC remains a corpse until another player uses Raise Dead or Resurrection on them.
I'm also thinking of putting in a timer to send the dead PC to Purgatory in multiplayer games so as to avoid other players being douches and leaving the poor dead sap lying around indefinitely.
Despite wasting half a day on this, I've learned a lot more about what BioWare has built right into the game already. After seeing all these elaborate death systems everywhere, I honestly thought BioWare never bothered to script one and that's why builders were making their own. While BioWare's system doesn't have all the bells and whistles of those other systems, it is more than adequate for a single player module that might see some play in a multiplayer environment.
I wonder what else BioWare has tucked away in the scripts and hardcoding...