RATDOG/_module/nss/nw_ai_ondeath.nss
Jaysyn904 269eca1d1e Encounter work
Separated static spawns in "Forest of Hope: Central".  Fixed faction issues with Corrak's Crew.  Added "Faction Zoo" area for future faction work.  Tweaked factions.  Made sure creatures with CODI AI were granting XP.  Tweaked Masterwork weapons.  Fixed Warforged appearance not showing up properly in toolset.
2022-12-04 12:37:44 -05:00

63 lines
2.0 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Vanilla NWN On Death
//:: nw_ai_ondeath
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default OnDeath event handler for NPCs.
Adjusts killer's alignment if appropriate and
alerts allies to our death.
*/
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/22/2002
//:://////////////////////////////////////////////////
//:://////////////////////////////////////////////////
//:: Modified By: Deva Winblood
//:: Modified On: April 1st, 2008
//:: Added Support for Dying Wile Mounted
//:://///////////////////////////////////////////////
#include "x2_inc_compon"
#include "x0_i0_spawncond"
#include "x3_inc_horse"
void main()
{
int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
object oKiller = GetLastKiller();
if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB")&&GetIsObjectValid(GetMaster(OBJECT_SELF))) SetLocalInt(GetMaster(OBJECT_SELF),"bX3_STORE_MOUNT_INFO",TRUE);
// If we're a good/neutral commoner,
// adjust the killer's alignment evil
if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
}
// Call to allies to let them know we're dead
SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
// NOTE: the OnDeath user-defined event does not
// trigger reliably and should probably be removed
if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}
craft_drop_items(oKiller);
//:: Execute Default NPC OnDeath script
ExecuteScript("nw_c2_default7", OBJECT_SELF);
//:: Execute PRC NPC OnDeath script
ExecuteScript("prc_npc_death", OBJECT_SELF);
}