Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

[OnPlayerDeath] Leave Raiseable PC Corpse - Mulitplayer (One Line of Code)

PstemariePstemarie Member Posts: 191
edited February 2018 in Builders - Scripting
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.

dunahan

Comments

  • PstemariePstemarie Member Posts: 191
    edited February 2018
    You might to want to add this snippet of code to nw_s0_raisdead.nss and nw_s0_resserec.nss at the end of the
    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));
    }
    }

  • ShadowMShadowM Member Posts: 569
    Basically you making a copy of the dead pc and then you can make the copy corpse selectable/lootable you can put a corpse item on them that disappears when taken and when place on the ground put the copy back again. You need to change your spell.2da if you want it to target the corpse item. Look at HR base. You saving the pc data to the item / copy corpse. So it know who to grab on raising.

  • PstemariePstemarie Member Posts: 191
    Using AssignCommand(oPlayer, SetIsDestroyable(FALSE, FALSE, FALSE)); works well enough for what I want. I don't want other players looting the corpse - when I play multiplayer its over LAN with my family and looting a dead PC would cause no small amount of whining and arguing (mostly from me if I was the victim). It also turns out you don't need to modify Resurrection or Raise Dead.

    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.

  • PstemariePstemarie Member Posts: 191
    After some more combing through faqs, scripts, and other odds-n-ends, I have discovered that using AssignCommand(oPlayer, SetIsDestroyable(FALSE, FALSE, FALSE)); may well be a moot point in a multi-player environment. I'm fairly certain that the PC corpse stick around if you pop up the DeathGUI with the "Wait for Help" button enabled.

  • BalkothBalkoth Member Posts: 147
    Pstemarie said:

    I'm fairly certain that the PC corpse stick around if you pop up the DeathGUI with the "Wait for Help" button enabled.

    Correct.

  • PstemariePstemarie Member Posts: 191
    Yup. Just confirmed that. Funny how my family and I have been playing over LAN for years and I never knew that did that - more because I always had KDS 2.2 installed into the LAN modules we played or just used PW modules that the authors were so nice to put up on the Vault.

    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...

Sign In or Register to comment.