generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit
This commit is contained in:
43
_module/nss/cm_onplayerdyin1.nss
Normal file
43
_module/nss/cm_onplayerdyin1.nss
Normal file
@@ -0,0 +1,43 @@
|
||||
// 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();
|
||||
if (GetLocalInt(oPC,"arena"))
|
||||
{
|
||||
SetLocalInt(oPC, "PlayerHealth", PC_HEALTH_DEAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
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_DYING);
|
||||
|
||||
} 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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user