WoR_PRC8/_module/nss/xp_dragon_deth.nss

50 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 11:49:34 -04:00
//:://////////////////////////////////////////////////
//:: Dragon Death
/*
Default OnDeath event handler for Dragons.
Adjusts killer's alignment if appropriate and
alerts allies to our death.
*/
#include "x2_inc_compon"
#include "x0_i0_spawncond"
#include "nw_i0_tool"
void main()
{
int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
object oKiller = GetLastKiller();
// 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);
}
if(nClass > 0 && (nAlign == ALIGNMENT_EVIL))
{
if(GetAlignmentGoodEvil(GetLastKiller()) == ALIGNMENT_GOOD){
object oKiller = GetLastKiller();
AdjustAlignment(oKiller, ALIGNMENT_GOOD, 3);}
}
// 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);
//ExecuteScript("sha_xpsystem", OBJECT_SELF); //:: Replaced by PWFXP
DelayCommand(0.0f, ExecuteScript("pwfxp", OBJECT_SELF));
RewardPartyXP(300, GetLastKiller());
}