Initial Upload
Initial Upload
This commit is contained in:
135
_module/nss/m_onplayerdeath.nss
Normal file
135
_module/nss/m_onplayerdeath.nss
Normal file
@@ -0,0 +1,135 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Death Script
|
||||
//:: NW_O0_DEATH.NSS
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This script handles the default behavior
|
||||
that occurs when a player dies.
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Brent Knowles
|
||||
//:: Created On: November 6, 2001
|
||||
//:: Modified By: Ba'alzamon
|
||||
//:: Modified On: 8.8.2004
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "lod_include"
|
||||
|
||||
void Raise(object oPlayer)
|
||||
{
|
||||
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
|
||||
|
||||
effect eBad = GetFirstEffect(oPlayer);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
|
||||
|
||||
//Search for negative effects
|
||||
while(GetIsEffectValid(eBad))
|
||||
{
|
||||
{
|
||||
//Remove effect if it is negative.
|
||||
RemoveEffect(oPlayer, eBad);
|
||||
}
|
||||
eBad = GetNextEffect(oPlayer);
|
||||
}
|
||||
//Fire cast spell at event for the specified target
|
||||
SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer);
|
||||
}
|
||||
|
||||
void lootDrop (object oPlayer)
|
||||
{
|
||||
/********************************************************************
|
||||
* This script basically drops all items with a stolen flag when the person
|
||||
holding them dies. It's ideally suited for when a PC pickpockets another PC.
|
||||
This way, the Thief can be killed and drop any/all items they have stolen from any/all PC's.
|
||||
This script should be placed in your module OnDeath script.
|
||||
Please note: Your item ResRefs and Tags must match, or it will not create the stolen item.
|
||||
*********************************************************************/
|
||||
location lPlayer = GetLocation(oPlayer);
|
||||
object oStolen = GetFirstItemInInventory(oPlayer);
|
||||
string sStolen = GetTag(oStolen);
|
||||
while (oStolen != OBJECT_INVALID)
|
||||
{
|
||||
if (GetStolenFlag(oStolen) == TRUE)
|
||||
{
|
||||
DestroyObject(oStolen);
|
||||
CreateObject(OBJECT_TYPE_ITEM, sStolen, lPlayer, FALSE);
|
||||
}
|
||||
oStolen = GetNextItemInInventory(oPlayer);
|
||||
sStolen = GetTag(oStolen);
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPlayer = GetLastPlayerDied();
|
||||
object oKiller = GetLastHostileActor(oPlayer);
|
||||
string sArea = GetTag(GetArea(oPlayer));
|
||||
int nHeal;
|
||||
|
||||
if (GetIsPC(oKiller))
|
||||
{
|
||||
lootDrop(oPlayer);
|
||||
}
|
||||
|
||||
AssignCommand(oPlayer, ClearAllActions());
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
|
||||
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
|
||||
}
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
|
||||
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
|
||||
}
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
|
||||
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
|
||||
}
|
||||
DeleteLocalInt(oPlayer, "dying");
|
||||
SetCampaignInt("p_death","is_dead",TRUE,oPlayer);
|
||||
|
||||
//Made it resurrect player if he was in arena of Bane arena.
|
||||
if ((GetTag(GetArea(oPlayer)) == "LODArena") || (GetTag(GetArea(oPlayer)) == "sf_banehg_train"))
|
||||
{
|
||||
nHeal = GetMaxHitPoints(oPlayer);
|
||||
DelayCommand(2.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oPlayer));
|
||||
DelayCommand(2.7, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nHeal), oPlayer));
|
||||
// Remove player's Death status from the database
|
||||
DelayCommand(2.5, SetCampaignInt("p_death", "is_dead", FALSE, oPlayer));
|
||||
}
|
||||
else
|
||||
{
|
||||
string sDeath = "You have died. Please choose to respawn or wait for your parties aid.";
|
||||
DelayCommand(2.0, PopUpDeathGUIPanel(oPlayer, TRUE, TRUE, 0, sDeath));
|
||||
FloatingTextStringOnCreature(GetName(oPlayer) + " has died, and could use a rez!", oPlayer, TRUE);
|
||||
}
|
||||
|
||||
if (GetIsPC(oKiller) && !GetIsDMPossessed(oKiller) && !GetIsDM(oKiller) && GetTag(GetArea(oKiller)) != "LODArena")
|
||||
{
|
||||
|
||||
int iKiller = (GetLevelByPosition(1, oKiller) + GetLevelByPosition(2, oKiller) + GetLevelByPosition(3, oKiller));
|
||||
int iPlayer = (GetLevelByPosition(1, oPlayer) + GetLevelByPosition(2, oPlayer) + GetLevelByPosition(3, oPlayer));
|
||||
|
||||
if(iKiller > (iPlayer +4))
|
||||
{
|
||||
string sLowKill = GetName(oKiller) + " has shamefully killed over 4 levels lower player " + GetName(oPlayer);
|
||||
object oPC = GetFirstPC();
|
||||
SendMessageToAllDMs(sLowKill);
|
||||
|
||||
while(oPC != OBJECT_INVALID)
|
||||
{
|
||||
SendMessageToPC(oPC, sLowKill);
|
||||
oPC = GetNextPC();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//This creates guild auras
|
||||
string sActName = GetPCPlayerName(oPlayer);
|
||||
|
||||
if(!GetIsDM(oPlayer))
|
||||
ApplyGuildAura(sActName, oPlayer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user