ES_PRC8/_module/nss/ondying.nss
Jaysyn904 08e84b4e71 Initial upload
Initial upload.
2023-11-14 12:09:02 -05:00

37 lines
1.0 KiB
Plaintext

// Module : OnPlayerDying by Brian "spilth" Kelly
// For Neverwinter Nights - Bleeding Tutorial
#include "bleeding_config"
void main() {
object oPC = GetLastPlayerDying();
// Let the module know somebody is not alive
object oModule = GetModule();
SetLocalInt(oModule, "EverybodyAlive", FALSE);
// Check if they stablized, disconnected and then reconnected...
if (GetLocalInt(oPC, "PlayerHealth") != PC_HEALTH_STABLE) {
int iCurrentHitPoints = GetCurrentHitPoints(oPC);
// How bad is it doc?
if (iCurrentHitPoints == 0) {
SetLocalInt(oPC, "PlayerHealth", PC_HEALTH_DISABLED);
} else {
// Flag them as dying. We make them bleed in the module's OnHeartbeat script
SetLocalInt(oPC, "PlayerHealth", PC_HEALTH_DYING);
}
// Save their hit points in case they disconnect
SetLocalInt(oPC, "LastHitPoints", iCurrentHitPoints);
} else {
// Do nothing. Heartbeat will take care of prompting the player
}
}