Initial upload
Initial upload
This commit is contained in:
142
_module/nss/horrordeath.nss
Normal file
142
_module/nss/horrordeath.nss
Normal file
@@ -0,0 +1,142 @@
|
||||
#include "NW_I0_GENERIC"
|
||||
void main()
|
||||
{
|
||||
location lDeath = GetLocation(OBJECT_SELF);
|
||||
switch (d4()) {
|
||||
case 1: SpeakString("It will take some time to reconstruct."); break;
|
||||
case 2: SpeakString("Do you know no fear?"); break;
|
||||
case 3: SpeakString("I am defeated!"); break;
|
||||
case 4: SpeakString("Next time you will know fear!");
|
||||
}
|
||||
|
||||
|
||||
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,EffectVisualEffect( VFX_IMP_HARM ), lDeath, 10.0f);
|
||||
object oKiller = GetLastKiller();
|
||||
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectBeam(VFX_BEAM_EVIL,OBJECT_SELF,BODY_NODE_CHEST) , oKiller, 7.0f);
|
||||
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(1), DAMAGE_TYPE_NEGATIVE, DAMAGE_POWER_NORMAL) , oKiller);
|
||||
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(2), DAMAGE_TYPE_NEGATIVE, DAMAGE_POWER_NORMAL) , oKiller));
|
||||
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(2), DAMAGE_TYPE_NEGATIVE, DAMAGE_POWER_NORMAL) , oKiller));
|
||||
DelayCommand(3.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(2), DAMAGE_TYPE_NEGATIVE, DAMAGE_POWER_NORMAL) , oKiller));
|
||||
DelayCommand(4.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(2), DAMAGE_TYPE_NEGATIVE, DAMAGE_POWER_NORMAL) , oKiller));
|
||||
DelayCommand(5.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(2), DAMAGE_TYPE_NEGATIVE, DAMAGE_POWER_NORMAL) , oKiller));
|
||||
DelayCommand(6.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d6(2), DAMAGE_TYPE_NEGATIVE, DAMAGE_POWER_NORMAL) , oKiller));
|
||||
|
||||
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.75)+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;
|
||||
}
|
||||
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))
|
||||
{
|
||||
|
||||
GiveXPToCreature(oPartyMember, SFEint);
|
||||
if (GetIsDead(oPartyMember)){
|
||||
int a = GetXP(oPartyMember);
|
||||
int b = ( a-SFEint);
|
||||
SetXP(oPartyMember, b);
|
||||
SendMessageToPC(oPartyMember, "You cannot gain experience while dead. Your XP has been reset.");
|
||||
|
||||
}
|
||||
|
||||
if ((GetHitDice(oPartyMember)) <= (noleech - 5)){
|
||||
int a = GetXP(oPartyMember);
|
||||
int b = ( a-SFEint);
|
||||
SetXP(oPartyMember, b);
|
||||
SendMessageToPC(oPartyMember, "You are partying with someone much more powerfull than you. Your XP has been reset.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
oPartyMember = GetNextFactionMember(oKiller, TRUE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user