Author Sticky: Post Working Scripts Here
EtherDragon Posted: Thursday, 27 June 07:21PM
Hey all, here's my On-Dying work. It's much closer to D&D3e rules.

1. On_Dying

2. Players who are between 0 and -10 hitpoints will lose one hit point per round. Once at -10 they will die.

4.

NWScript:
/*

    On Dying script created by EtherDragon, Jun 27, 2002.

    Send comments to my Bioware Message Board account.

    This script creates an more authentic D&D3e dying

    sequence. The character will begin to bleed at 0 HPs.

    When they reach -10 HPs they will die.

    NPCs and Monsters will stop attacking the character

    once they are unconcious.

*/



void main()

{

    //Initialize objects, variables and effects.

    object oPlayerDying = GetLastPlayerDying();

    object oAttacker = GetLastAttacker(oPlayerDying);

    int iHPs = GetCurrentHitPoints(oPlayerDying);

    effect eHPLoss = EffectHitPointChangeWhenDying(-1.0);

    effect eSanctuary = EffectSanctuary(99);

    effect eGive1HP = EffectHeal(abs(iHPs)+1);

    effect eDeath = EffectDeath(FALSE, FALSE);

    //Main condition, If the Player is between 0 and -9 HPs make them bleed.

    //...otherwise make them die.

    if (iHPs >= -9)

    {

        //Inform the people around that the player is dying.

        AssignCommand(oPlayerDying, SpeakString("Help! I'm Dying!", TALKVOLUME_TALK));

        FloatingTextStringOnCreature("You are bleeding to death!", oPlayerDying);

        //Stop the NPC from attacking the player

        SetPCLike(oPlayerDying, oAttacker);

        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSanctuary, oPlayerDying, 10.0);

        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eHPLoss, oPlayerDying, 10.0);

    }

    else

    {

        //Make the Player die if at -10 or below.

        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPlayerDying);

    }

}



~ED