NWNDS/nwn_dark_sun/zep_demi_bone_hb.nss
Jaysyn904 b01c5cc7db Added PnP Dire Rat.
Added PnP Dire Rat.
2021-07-21 17:48:43 -04:00

49 lines
1.7 KiB
Plaintext

//::///////////////////////////////////////////////
//:: zep_demi_bone_hb
//:: Legacy OnHeartbeat event for the CEP demilich
//:: Pile of Bones placeable (found under the custom
//:: placeables: "Dungeons->Tombs, Grave Markers ->
//:: Pile of Bones").
//:://////////////////////////////////////////////
/*
This script is no longer needed for demiliches,
but is retained for backwards-compatibility, and
in case someone is interested in changing the
perception range of demilich placeables.
*/
//:://////////////////////////////////////////////
//:: Created by: Loki Hakanin
//:: Created on: April 21, 2004
//:://////////////////////////////////////////////
//:: Modified by: The Krit
//:: Modified on: May 10, 2007
//:://////////////////////////////////////////////
#include "zep_inc_demi"
void main()
{
// Find the distance to the nearest enemy.
float fDistance = GetDistanceToObject(
GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY,
OBJECT_SELF, 1, CREATURE_TYPE_IS_ALIVE, TRUE));
// Is the nearest enemy within perception range?
if ( 0.0 <= fDistance && fDistance <= ZEP_DEMI_PERC_RANGE )
{
// Respawn the demilich.
ZEPDemilichFromBones(OBJECT_SELF, GetLocalString(OBJECT_SELF, ZEP_DEMI_LOCAL_RESREF), TRUE);
// Destroy the placeables.
object oDust = GetLocalObject(OBJECT_SELF, ZEP_DEMI_LOCAL_AMBIENT);
if ( oDust != OBJECT_INVALID )
DestroyObject(oDust);
else
// Probably a legacy placeable. Destroy nearest dust cloud.
DestroyObject(GetNearestObjectByTag("zep_demi_dust"));
DestroyObject(OBJECT_SELF);
}
}