2024-06-14 10:48:20 -04:00
|
|
|
//::///////////////////////////////////////////////
|
|
|
|
//:: 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"
|
|
|
|
object CreatePlaceable(string sObject, location lPlace, float fDuration);
|
|
|
|
void main()
|
|
|
|
{
|
2024-09-16 23:40:48 -04:00
|
|
|
ExecuteScript("prc_npc_death", OBJECT_SELF);
|
|
|
|
|
|
|
|
object oKiller = GetLastKiller();
|
2024-09-14 13:52:39 -04:00
|
|
|
int noleech = 0;
|
|
|
|
int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
|
|
|
|
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
|
|
|
|
if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
|
|
|
|
{
|
|
|
|
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
|
|
|
|
}
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
float BaseEXP = ((GetChallengeRating(OBJECT_SELF)*3.0)+5);
|
|
|
|
float BonusEXP = GetChallengeRating(OBJECT_SELF)+5;
|
|
|
|
float BaseMonEXP = BaseEXP;
|
|
|
|
int NumOfParty = 0;
|
|
|
|
float PartyLevelSum = 0.0;
|
|
|
|
object oPartyMember = GetFirstFactionMember(oKiller, TRUE);
|
|
|
|
while(GetIsObjectValid(oPartyMember)) {
|
|
|
|
if (GetArea(OBJECT_SELF) == GetArea(oPartyMember))
|
|
|
|
{
|
|
|
|
int leech = GetHitDice(oPartyMember);
|
|
|
|
if (leech >= noleech){
|
|
|
|
noleech = leech;
|
|
|
|
}
|
|
|
|
NumOfParty++;
|
|
|
|
PartyLevelSum += GetCharacterLevel(oPartyMember);
|
|
|
|
}
|
|
|
|
oPartyMember = GetNextFactionMember(oKiller, TRUE);
|
|
|
|
}
|
|
|
|
if (PartyLevelSum <= 1.0)
|
|
|
|
{
|
|
|
|
PartyLevelSum = 1.0;
|
|
|
|
}
|
|
|
|
if (NumOfParty <= 1)
|
|
|
|
{
|
|
|
|
NumOfParty = 1;
|
|
|
|
}
|
|
|
|
float PartyAvgLvl = PartyLevelSum / NumOfParty;
|
|
|
|
//Calculate Adjustment Value
|
|
|
|
if (PartyAvgLvl <= 1.0)
|
|
|
|
{
|
|
|
|
PartyAvgLvl = 1.0;
|
|
|
|
}
|
|
|
|
float x = GetChallengeRating(OBJECT_SELF);
|
|
|
|
if (x <= 1.0)
|
|
|
|
{
|
|
|
|
x = 1.0;
|
|
|
|
}
|
|
|
|
float z = (x / PartyAvgLvl);
|
|
|
|
float AdjustValue = ((z+2)/3);
|
|
|
|
float FinalMonValue;
|
|
|
|
//Determine Final Experience Value
|
|
|
|
if (AdjustValue == 0.0) {
|
|
|
|
FinalMonValue = BaseMonEXP;
|
|
|
|
} else {
|
|
|
|
if (AdjustValue < 1.0) {
|
|
|
|
FinalMonValue = BaseMonEXP * AdjustValue;
|
|
|
|
} else {
|
|
|
|
FinalMonValue = BaseMonEXP + (BonusEXP * (AdjustValue * (1.10)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Determine the value of the Split EXP
|
|
|
|
if (NumOfParty >= 6)
|
|
|
|
{
|
|
|
|
NumOfParty = 5;
|
|
|
|
}
|
|
|
|
if (NumOfParty <= 1)
|
|
|
|
{
|
|
|
|
NumOfParty = 1;
|
|
|
|
}
|
|
|
|
if (FinalMonValue <= 1.0)
|
|
|
|
{
|
|
|
|
FinalMonValue = 1.0;
|
|
|
|
}
|
|
|
|
float SplitFinalEXP = FinalMonValue / NumOfParty;
|
|
|
|
if (SplitFinalEXP <= 1.0)
|
|
|
|
{
|
|
|
|
SplitFinalEXP = 1.0;
|
|
|
|
}
|
|
|
|
float y = (FinalMonValue - SplitFinalEXP);
|
|
|
|
if (y <= 1.0)
|
|
|
|
{
|
|
|
|
y = 1.0;
|
|
|
|
}
|
|
|
|
if (PartyAvgLvl >= 15.0)
|
|
|
|
{
|
|
|
|
FinalMonValue = FinalMonValue - ( PartyAvgLvl);
|
|
|
|
}
|
|
|
|
float PartyBonus = ((y +1)/ 1.75) + (FinalMonValue + ((21-PartyAvgLvl)/3));
|
|
|
|
int SFEint = FloatToInt(PartyBonus);
|
|
|
|
//Distribute EXP to all PCs in the Party
|
|
|
|
oPartyMember = GetFirstFactionMember(oKiller, TRUE);
|
|
|
|
while (GetIsObjectValid(oPartyMember)) {
|
|
|
|
if (GetArea(OBJECT_SELF) == GetArea(oPartyMember)) {
|
|
|
|
int nHD = GetHitDice(oPartyMember) + 1;
|
|
|
|
int nMax = (((nHD * (nHD - 1)) / 2) * 1000)+1;
|
|
|
|
if (nMax <= GetXP(oPartyMember) && nHD <= 40) {
|
|
|
|
SendMessageToPC(oPartyMember, "You cannot gain experience until you have leveled.");
|
|
|
|
} else if (GetIsDead(oPartyMember)) {
|
|
|
|
SendMessageToPC(oPartyMember, "You cannot gain experience while dead. Your XP has been reset.");
|
|
|
|
} else if ((GetHitDice(oPartyMember)) <= (noleech - 7) || (GetHitDice(oPartyMember)) >= FloatToInt(PartyAvgLvl) + 7) {
|
|
|
|
SendMessageToPC(oPartyMember, "All party members must be within 6 levels of each other.");
|
|
|
|
} else {
|
|
|
|
GiveXPToCreature(oPartyMember, SFEint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
oPartyMember = GetNextFactionMember(oKiller, TRUE);
|
|
|
|
}
|
2024-09-01 14:11:15 -04:00
|
|
|
|
|
|
|
SetIsDestroyable(FALSE,FALSE,FALSE);
|
2024-06-14 10:48:20 -04:00
|
|
|
DelayCommand(120.0,SetIsDestroyable(TRUE,FALSE,FALSE));
|
|
|
|
DelayCommand(121.0,DestroyObject(OBJECT_SELF));
|
|
|
|
object oTemp = CreatePlaceable("corpse",GetLocation(OBJECT_SELF),120.0);
|
|
|
|
string sResSelf = GetResRef(OBJECT_SELF);
|
|
|
|
|
|
|
|
if (sResSelf == "wooly_razorback")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","item_wool");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat029");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
}
|
|
|
|
if (sResSelf == "deer002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt023");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat023");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
}
|
|
|
|
if (sResSelf == "beardireboss001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt006");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat006");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",700);
|
|
|
|
}
|
|
|
|
if (sResSelf == "bearblck001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt002");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat002");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",200);
|
|
|
|
}
|
|
|
|
if (sResSelf == "bearbrwn001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt001");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat001");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",300);
|
|
|
|
}
|
|
|
|
if (sResSelf == "beardire001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt005");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat005");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",600);
|
|
|
|
}
|
|
|
|
if (sResSelf == "bearkodiak001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt003");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat003");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",500);
|
|
|
|
}
|
|
|
|
if (sResSelf == "bearpolar001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt004");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat004");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",550);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sResSelf == "wolfwint001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt011");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat011");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",350);
|
|
|
|
}
|
|
|
|
if (sResSelf == "dog002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt007");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat007");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
}
|
|
|
|
if (sResSelf == "direwolf001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt010");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat010");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",500);
|
|
|
|
}
|
|
|
|
if (sResSelf == "wolf001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt008");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat008");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",50);
|
|
|
|
}
|
|
|
|
if (sResSelf == "worg001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt009");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat009");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",150);
|
|
|
|
}
|
|
|
|
if (sResSelf == "cat001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt017");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat017");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",70);
|
|
|
|
}
|
|
|
|
if (sResSelf == "beastmalar002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt015");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat015");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",650);
|
|
|
|
}
|
|
|
|
if (sResSelf == "cougar001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt012");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat012");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",150);
|
|
|
|
}
|
|
|
|
if (sResSelf == "cragcat001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt013");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat013");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",250);
|
|
|
|
}
|
|
|
|
if (sResSelf == "panther001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt014");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat014");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",300);
|
|
|
|
}
|
|
|
|
if (sResSelf == "lion001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt016");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat016");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",400);
|
|
|
|
}
|
|
|
|
if (sResSelf == "jaguar001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt018");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat018");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",300);
|
|
|
|
}
|
|
|
|
if (sResSelf == "diretiger001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt019");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat019");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",650);
|
|
|
|
}
|
|
|
|
if (sResSelf == "badger001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt020");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat020");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
}
|
|
|
|
if (sResSelf == "bat002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt021");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat021");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
}
|
|
|
|
if (sResSelf == "cow002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt022");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat022");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",20);
|
|
|
|
}
|
|
|
|
if (sResSelf == "direbadg001")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt024");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat024");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",200);
|
|
|
|
}
|
|
|
|
if (sResSelf == "ratdire002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt025");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat025");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",150);
|
|
|
|
}
|
|
|
|
if (sResSelf == "ox002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt027");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat027");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",75);
|
|
|
|
}
|
|
|
|
if (sResSelf == "deerstag002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt028");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat028");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
SetLocalInt(oTemp,"iPenalty",300);
|
|
|
|
}
|
|
|
|
if (sResSelf == "rat002")
|
|
|
|
{
|
|
|
|
SetLocalString(oTemp,"sPelt","pelt026");
|
|
|
|
SetLocalString(oTemp,"sMeat","meat026");
|
|
|
|
SetLocalObject(oTemp,"oCorpse",OBJECT_SELF);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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(GetAreaFromLocation(GetLocation(OBJECT_SELF)), EventUserDefined(1007));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
object CreatePlaceable(string sObject, location lPlace, float fDuration)
|
|
|
|
{
|
|
|
|
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
|
|
|
if (fDuration != 0.0)
|
|
|
|
DestroyObject(oPlaceable,fDuration);
|
|
|
|
return oPlaceable;
|
|
|
|
}
|