HiddenTradition_PRC8/_module/nss/i420_helcat_hb.nss
2024-06-20 15:47:42 -04:00

61 lines
2.4 KiB
Plaintext

// Begin preprocess Code
#include "nw_i0_plot"
#include "i420_helcat_inc"
// Find the location of self and nearest PC
location lSelfLoc = GetLocation(OBJECT_SELF);
object oNearestPC = GetNearestPC();
location lNearPC = GetLocation(oNearestPC);
// Find the distance between self and nearest PC
float fPCDistance = GetDistanceBetween(OBJECT_SELF,oNearestPC);
// Begin main code
void main()
{
// Check that its day or light is cast upon the creature
if ((GetIsDay() == TRUE) ||
(GetHasSpellEffect(SPELL_LIGHT,OBJECT_SELF) == TRUE))
{
// Re-apply Invisibility
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectInvisibility(INVISIBILITY_TYPE_IMPROVED),OBJECT_SELF);
// Return Local Int IS_INVIZ to 0
SetLocalInt(OBJECT_SELF,"IS_INVIZ",1);
}
// Fire only if NearestPC is within 30 meters
if (fPCDistance <= fIncDist)
{
// Check that it's night or if effected by magic darkness
if ((GetIsNight() == TRUE) ||
(GetHasSpellEffect(SPELL_DARKNESS,OBJECT_SELF) == TRUE))
{
RemoveEffect(OBJECT_SELF,EffectInvisibility(INVISIBILITY_TYPE_IMPROVED));
}
}
// Get the Nearest PC
object oNearestPC = GetNearestPC();
// Perform a melee touch attack
int iTA = TouchAttackMelee(oNearestPC,FALSE);
// Get the distance between the creature and the pc
float fDBetween = GetDistanceBetween(OBJECT_SELF,oNearestPC);
// Check if the melee touch attack hit, if the pc is valid, and within 3 meters
if ((iTA > 0) && (oNearestPC != OBJECT_INVALID) && (fDBetween <= 3.0))
{
// Get the name of the grappling creature, display a message, grapple, and rake the PC
string sCName = GetName(OBJECT_SELF);
// Decrease the PC's movement for 1d4+4 seconds (Grappled)
int id4 = d4(1)+4;
float fd4 = IntToFloat(id4);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectMovementSpeedDecrease(99),oNearestPC,fd4);
AssignCommand(oNearestPC,JumpToObject(OBJECT_SELF));
PlayAnimation(ANIMATION_FIREFORGET_TAUNT,1.25,2.0);
SendMessageToPC(oNearestPC,"The "+sCName+" grapples with its bite and rakes you with its claws.");
// Apply Bite damage to PC
int iBiteDmg = d6(2)+3;
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(iBiteDmg,DAMAGE_TYPE_PIERCING,DAMAGE_POWER_NORMAL),oNearestPC);
// Rake the PC with 2d4+12 slashing
int iRakeDmg = d4(2)+12;
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(iRakeDmg,DAMAGE_TYPE_SLASHING,DAMAGE_POWER_NORMAL),oNearestPC);
}
}