RATDOG/_module/nss/codi_ondeath.nss
Jaysyn904 37b68cf6b6 Updated TLK for PRC8 update
Updated TLK for PRC8 update.  Added placeable house blueprints.  Updated NWNxEE.  Full compile.
2024-08-31 20:38:17 -04:00

112 lines
4.1 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name codi_ondeath
//::
//:://////////////////////////////////////////////
/*
NPC OnDeath event script caller to run
CODI AI & PRC events.
*/
//:://////////////////////////////////////////////
//:: Created By: Jaysyn
//:: Created On: 20240331
//:://////////////////////////////////////////////
#include "prc_inc_spells"
#include "prc_inc_combmove"
void main()
{
//:: Declare major variables
object oNPC = OBJECT_SELF;
object oPC = GetLastKiller();
//int nKillFlag = GetLocalInt(GetLastKiller(), "KILL_TASK_FLAG");
string sTagSelf = GetTag(oNPC);
//string sTagTarget = GetLocalString(oPC, "KILL_TASK_TARGET");
string sResRef = GetResRef(oNPC);
if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB")&&GetIsObjectValid(GetMaster(OBJECT_SELF))) SetLocalInt(GetMaster(OBJECT_SELF),"bX3_STORE_MOUNT_INFO",TRUE);
//:: End any active grapple from Improved Grab
EndGrapple(oNPC, GetGrappleTarget(oNPC));
int nBalor = GetStringLeft(GetTag(OBJECT_SELF), 9) == "POA_BALOR" ? TRUE : FALSE;
if(nBalor)
{
DelayCommand(0.0f, ExecuteScript("nw_s3_balordeth",OBJECT_SELF));
}
int nInsanity = GetLocalInt(OBJECT_SELF,"INSANITY");
if(nInsanity)
{
object oCaster = OBJECT_SELF;
object oTarget = GetLastKiller();
effect eConfuse = EffectConfused();
effect eImpact = EffectVisualEffect(VFX_FNF_LOS_NORMAL_20);
effect eVis = EffectVisualEffect(VFX_IMP_CONFUSION_S);
effect eMind = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_DISABLED);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
effect eLink = EffectLinkEffects(eMind, eConfuse);
eLink = EffectLinkEffects(eLink, eDur);
eLink = SupernaturalEffect(eLink);
// Get oCaster's DC
int nCreCHAMod = GetAbilityModifier(ABILITY_CHARISMA, oCaster);
int nCreHD = GetHitDice (oCaster);
int nDC = (10 + (nCreHD/2) + nCreCHAMod);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, GetSpellTargetLocation());
if ( !PRCMySavingThrow(SAVING_THROW_WILL, oTarget, nDC, SAVING_THROW_TYPE_MIND_SPELLS, oCaster))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget); // Apply Viz
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oTarget);
AssignCommand(oTarget,SpeakString("*The "+GetName(oCaster)+" has driven you insane!*"));
}
}
//:: Vampire's Gaseous Form onDeath
if(sResRef == "ra_vampspawn01" || sResRef == "ra_vampspawn02")
{
effect eVFX;
object oSpawn;
location lSelf = GetLocation(OBJECT_SELF);
//:: Apply some visual effects & unload the model.
eVFX = EffectVisualEffect(VFX_COM_UNLOAD_MODEL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oNPC);
eVFX = EffectVisualEffect(VFX_COM_BLOOD_CRT_RED);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oNPC);
eVFX = EffectVisualEffect(491);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oNPC);
eVFX = EffectVisualEffect(VFX_COM_CHUNK_RED_SMALL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oNPC);
eVFX = EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oNPC);
//:: Spawn Gaseous Form.
eVFX = EffectVisualEffect(133);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "ra_vamp_gas_form", GetLocation(oNPC));
DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpawn));;
}
//:: Execute CODI AI NPC OnDeath script
DelayCommand(0.0f, ExecuteScript("no_ai_dth", OBJECT_SELF));
//:: Execute NWN NPC OnDeath script
//ExecuteScript("nw_c2_default7", OBJECT_SELF);
//:: Execute PWFXP XP script
//DelayCommand(0.0f, ExecuteScript("pwfxp", OBJECT_SELF));
//:: Execute PRC NPC OnDeath script
DelayCommand(0.0f, ExecuteScript("prc_npc_death", OBJECT_SELF));
//:: Execute PRC PW OnDeath scripts
DelayCommand(0.0f, ExecuteScript("prc_pwondeath", OBJECT_SELF));
}