/* 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); //give anti-cheat item if (GetItemPossessedBy(oPlayerDying, "Death")== OBJECT_INVALID) { CreateItemOnObject("death", oPlayerDying, 1); } //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); } }