HoS_PRC8/_mod/_module/nss/vamp_coffin_hb.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

33 lines
1.1 KiB
Plaintext

// vamp_coffin_hb
void fnDestroyCoffin(object oCoffin)
{
object oMe=OBJECT_SELF;
if (GetIsInCombat(oMe)==FALSE&&IsInConversation(oMe)==FALSE)
{ // destroy it if you can
AssignCommand(oMe,ClearAllActions());
AssignCommand(oMe,ActionAttack(oCoffin));
} // destroy it if you can
} // fnDestroyCoffin()
void main()
{
object oMe=OBJECT_SELF;
object oCR;
float fDist;
int nC=1;
oCR=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oMe,nC,CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_NOT_PC);
fDist=GetDistanceBetween(oMe,oCR);
while(oCR!=OBJECT_INVALID&&fDist<7.0)
{ // see if NPC should destroy object
if (GetAlignmentGoodEvil(oCR)==ALIGNMENT_GOOD)
{ // destroy coffin if you can
AssignCommand(oCR,fnDestroyCoffin(oMe));
} // destroy coffin if you can
nC++;
oCR=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oMe,nC,CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_NOT_PC);
fDist=GetDistanceBetween(oMe,oCR);
} // see if NPC should destroy object
if (GetLocalObject(oMe,"oVampire")==OBJECT_INVALID) { DestroyObject(oMe); }
}