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

76 lines
2.9 KiB
Plaintext

/////////////////////////////////////////////////////////////////////////////
// Real Time Strategy - NWN Modified OnDeath script (rts_mon_death)
//===========================================================================
// By Deva Bryson Winblood. 02/26/2003
// modified Jeremy Greene 06/14/2004
/////////////////////////////////////////////////////////////////////////////
//::///////////////////////////////////////////////
//:: Default:On Death
//:: NW_C2_DEFAULT7
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Shouts to allies that they have been killed
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
#include "hos_alignment"
#include "hos_respawn_h"
void main()
{
object oMe=OBJECT_SELF;
int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(oMe);
object oKiller = GetLastKiller();
object oMod=GetModule();
int nPow=GetLocalInt(oMod,"nEvilPower");
int nAdjust=0;
float fCR=GetChallengeRating(OBJECT_SELF);
string sIDK=GetLocalString(oKiller,"sTeamID");
string sID=GetLocalString(OBJECT_SELF,"sTeamID");
int nN;
object oItem;
if (GetTag(oMe)=="THEJUDGE")
{ // spawn a new one
oItem=GetWaypointByTag("SPAWN_NEWJUDGE");
oItem=CreateObject(OBJECT_TYPE_CREATURE,"thejudge",GetLocation(oItem));
oItem=OBJECT_INVALID;
} // spawn a new one
if (GetLocalInt(oMod,"nMONGoldDrop")>0&&(GetIsPC(oKiller)||GetMaster(oKiller)!=OBJECT_INVALID||GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC,oMe,1,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_ENEMY,CREATURE_TYPE_IS_ALIVE,TRUE)!=OBJECT_INVALID))
{ // possibly drop gold
if (GetStringLength(sID)>0&&sID!=sIDK&&!GetIsPossessedFamiliar(oKiller)) ExecuteScript("rts_mon_gold",oMe);
} // possibly drop gold
if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
AdjustAlignmentPartyProtected(oKiller, ALIGNMENT_EVIL, 5);
}
if (nAlign==ALIGNMENT_GOOD)
{ // someone good died
nAdjust=1;
if (fCR>11.9) nAdjust=FloatToInt(fCR)/12;
} // someone good died
if (nAlign==ALIGNMENT_EVIL)
{ // someone evil died
nAdjust=0;
if (fCR>7.9) nAdjust=FloatToInt(fCR)/8;
nAdjust= -nAdjust;
} // someone evil died
nPow=nPow+nAdjust;
SetLocalInt(oMod,"nEvilPower",nPow);
if (nPow>1000) ExecuteScript("rise_of_evil",oMod);
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);
if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}
ExecuteScript("rts_mon_deathx",OBJECT_SELF);
}