83 lines
2.3 KiB
Plaintext
83 lines
2.3 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Dying Script
|
|
//:: NW_O0_DEATH.NSS
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This script handles the default behavior
|
|
that occurs when a player is dying.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Kilana Evra
|
|
//:: Created On:
|
|
//:://////////////////////////////////////////////
|
|
#include "x3_inc_string"
|
|
|
|
void DeathFunction(object oPC, int nDC)
|
|
{ int iHP = GetCurrentHitPoints(oPC);
|
|
if(!GetIsObjectValid(oPC)) return;
|
|
|
|
//Player Rolls a random number between 1 and 20+ConMod
|
|
int iRoll = 20 + GetAbilityModifier(ABILITY_CONSTITUTION, oPC);
|
|
iRoll = 1+Random(iRoll);
|
|
|
|
//Sanity Check
|
|
if(nDC>30) nDC = 30;
|
|
else if(nDC<4) nDC = 4;
|
|
|
|
effect eResult;
|
|
if(iHP<=0)
|
|
{ if(iRoll>=nDC) //Stabilize
|
|
{ nDC-=2;
|
|
eResult = EffectHeal(1);
|
|
//PlayVoiceChat(VOICE_CHAT_LAUGH);
|
|
}
|
|
else //Failed!
|
|
{ if(d2()==1) nDC++;
|
|
eResult = EffectDamage(1);
|
|
|
|
//Death!
|
|
if(iHP<=-9)
|
|
{ //PlayVoiceChat(VOICE_CHAT_DEATH);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oPC);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
/*
|
|
switch (d6())
|
|
{ case 1: PlayVoiceChat(VOICE_CHAT_PAIN1); break;
|
|
case 2: PlayVoiceChat(VOICE_CHAT_PAIN2); break;
|
|
case 3: PlayVoiceChat(VOICE_CHAT_PAIN3); break;
|
|
case 4: PlayVoiceChat(VOICE_CHAT_HEALME); break;
|
|
case 5: PlayVoiceChat(VOICE_CHAT_NEARDEATH); break;
|
|
case 6: PlayVoiceChat(VOICE_CHAT_HELP);
|
|
}
|
|
*/
|
|
SendMessageToPC(oPC, StringToRGBString("You failed to stabilize this round.", "700"));
|
|
}
|
|
}//Close Failed!
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eResult, oPC);
|
|
DelayCommand(3.0, DeathFunction(oPC, nDC));
|
|
}
|
|
}
|
|
|
|
|
|
void main()
|
|
{ object oPC = GetLastPlayerDying();
|
|
object oHelp = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oPC);
|
|
|
|
/*
|
|
if(GetIsObjectValid(oHelp)) //Player character has help
|
|
{ if(GetDistanceBetween(oPC, oHelp)<=10.0)
|
|
{ AssignCommand(oPC, ClearAllActions());
|
|
AssignCommand(oPC, DeathFunction(oPC, 8));
|
|
}
|
|
}
|
|
*/
|
|
|
|
AssignCommand(oPC, ClearAllActions());
|
|
AssignCommand(oPC, DeathFunction(oPC, 8));
|
|
}
|