Jaysyn904 151d074880 Added "Removed Files" folder
Added "Removed Files" folder in case we needed to review any of them.
2022-10-10 10:39:34 -04:00

703 lines
22 KiB
Plaintext
Raw Permalink Blame History

//Script Name: everpcdeath
/////////////////////////////////////////
//Created By: Genisys / Guile
//Created On: 1/11/08 (Updated_8/10/08)
/////////////////////////////////////////
/*
This is my premier OnPlayerDeath Module Event Script which I designed
specifically for all my modules, it's rather nice and is part of
multiple systems, so do not edit ANYTHING you do not know what it's for!
*/
////////////////////////////////////////////////////////////////////////
//Rquired Includes.. (Don't touch!)
#include "nw_i0_plot"
#include "x2_inc_compon"
#include "setxp_inc"
///////////////////////////////////////////////////////////////////////////
/////////////////IMPORTANT OPTIONAL SETTINGS///////////////////////////////
//The constant intergal below allows you to choose where or not to utilize
//the PVP Death System I have scripted, please read below to learn more..
//FALSE = Disabled / TRUE = Enabled
const int nPVP = TRUE;
//This constant will decide whether or not you want to send a PVP message
//to all players when PVP transpires (This is for PVP Servers)
//FALSE = Disabled / TRUE = Enabled
const int nPVPMessage = TRUE;
//If you wish to restrict PVP to the arena only, then..
//Set the below setting to TRUE / FALSE = Deactivated (Default)
const int nArenaOnly = FALSE;
//This determines the level difference allowed in PVP (default 5)
//If set to 5 players within 4 levels of each other will not be
//Penalized for Killing one another. (Works both ways!)
//Add +1 for the level you want so if you want 8 level difference make it 9!
//(Set this whether you allow PVP or not!)
const int nDif = 5; //(Between 5 - 40) / (40 = Disabled)
//This is how you set the reward for XP given to the player for
//fair PVP Kills, this # is multiplied by the level difference!
const int nReward1 = 80; //(ie. if 3 Levels difference / 80 X 3)
//This is how ytou set the reward for Gold given to the player for
//fair PVP Kills, this # is multiplied by the level difference!
const int nReward2 = 800;
/////////OPTIONS END//////////////////////////////////////////////////
////DO NOT TOUCH ANYTHING BELOW UNLESS IT SAYS - ///OPTION////
//////////////////////////////////////////////////////////////////////
///// This Part was Created by: bushido
///// Developed by: Wouter Dhondt
///// Modified by: Genisys / Guile For Persistency..
////////////////////////////////////////////////////////
//This is the PVP Stats (Used to keep track of PVP Activity)
//This allows DMs and Players to see PVP Activity.
void AdjustPlayerStats()
{
//Delare Variables
object oDied = GetLastPlayerDied();
object oAttacker = GetLastHostileActor(oDied);
object oKiller;
//Only if the player who died is a PC
if(GetIsPC(GetLastPlayerDied()))
{
//Let's make sure we properly identify who the Attacker is...
if (GetIsPC(GetMaster(oAttacker)))
{
oKiller = GetMaster(oAttacker);
}
else
{
//Let's make sure the Killer is a PC
if(GetIsPC(oAttacker))
{
oKiller = oAttacker;
}
}
// Increment or set the death variable
int iDied = GetCampaignInt("PVP_SCORE", "iDied", oDied);
int nCount = iDied + 1;
SetCampaignInt("PVP_SCORE", "iDied", nCount, oDied);
// Is this object a PC?
if (GetIsPC(oKiller) == TRUE)
{
// Increment or set the killer var
int iKilled = GetCampaignInt("PVP_SCORE", "iKilled", oKiller);
int nDeaths = iKilled + 1;
SetCampaignInt("PVP_SCORE", "iKilled", nDeaths, oKiller);
}
}
//AdjustPlayerStats End..
}
///////////////////////////////////////////////////////////////
// Raise OnDeath function (Standard Bioware Function)
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))
{
if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
{
//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);
}
// Respawn/Teleporter OnDeath function (By Bushido / Modified By Genisys)
// Optionally you can create the waypoints described to send the dead player
// to that location. You must create an item named arenatoken (tag & resref name)
//Then you must use give it to them & take it away from them on enter/exit of
//an area by a script, this will deem that area as the arena.
void Respawn(object oPlayer)
{
string waiting = "<c B+>The gods show you favor, your life is restored.";
if (GetIsDead(oPlayer))
{
object oPC = GetLastPlayerDied();
if (GetItemPossessedBy(oPC, "arenatoken")!= OBJECT_INVALID)
{
//Create a way point and tagname it "arenawp"
object oTarget = GetWaypointByTag("arenawp");
effect eTeleport = EffectVisualEffect(VFX_FNF_HOWL_WAR_CRY);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport, oPlayer);
//Tell the player why they are being restored.
FloatingTextStringOnCreature(waiting, oPC);
//Resurrect the player
Raise(oPlayer);
//Teleport the raised player to the arena spawn point.
DelayCommand(0.1, AssignCommand(oPlayer, ClearAllActions()));
DelayCommand(0.2, AssignCommand(oPlayer, JumpToObject(oTarget)));
}
else
{
CreateItemOnObject("death", oPC);
}
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////Main Script/////////////////////////////////////
////////////////////////////////////////////////////////////////////////
void main()
{
//Declare Major Variables...
object oPlayer = GetLastPlayerDied();
object oPC = GetLastPlayerDied();
object oTarget = oPlayer;
object oToken = GetItemPossessedBy(oPlayer, "death");
object oItem;
object oPP = oPlayer;
string sArea = GetTag(GetArea(oPlayer));
string sName = GetName(GetModule());
location lDead = GetLocation(oPlayer);
//If the player is being tortured, ressurect them...
object hell = GetArea(oPlayer);
object helltest = GetArea(GetObjectByTag("satan1"));
if (hell == helltest)
{
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oPlayer));
return;
}
object oInfo = GetItemPossessedBy(oPP, "pcidname");
string sID = GetStringRight(GetName(oInfo), 14);
//PVP Variables..
object oDead = GetLastPlayerDied();
object oKiller = GetLastHostileActor(oDead);
object oVictor;
object oDied;
int nInt;
int kLvl = GetHitDice(oKiller);
int pLvl = GetHitDice(oDead);
int dLvl = kLvl - pLvl;
int aLvl = pLvl - kLvl;
effect eKill = EffectDeath(TRUE);
effect eVis = EffectVisualEffect(VFX_FNF_MYSTICAL_EXPLOSION);
//Define who oKiller is..
//Define the attacker& dead guy
object oAttacker = GetLastHostileActor(oDied);
oDied = oPlayer;
//Let's make sure we properly identify who the Attacker is...
if (GetIsPC(GetMaster(oAttacker)))
{
oKiller = GetMaster(oAttacker);
}
else
{
//Let's make sure the Killer is a PC
if(GetIsPC(oAttacker))
{
oKiller = oAttacker;
}
}
//Count up & Store in Database the kills and deaths
AdjustPlayerStats();
///////////LOCATION SAVING OPTION/////////////////////////////////
//Type: // Below this line to activate location saving on death
/*(Before this!)
//Store the PC's location, because if they are ressurected they can
//come back to this place when they logg back on..(unless location changed)
SetCampaignLocation(sName, "SAVED_LOC", lDead, oPlayer);
//Tell the PC thier location was saved..
SendMessageToPC(oPC, "Location Saved.");
//(leave this alone) */
//////////////////////////////////////////////////////////////
//Lets auto ressurect anyone in the arena and give death tokens to the others.
Respawn(oPlayer);
// * make friendly to Each of the 3 common factions
AssignCommand(oPlayer, ClearAllActions());
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
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);
}
//////////////////////////////////////////////////////////////////////////
//Fancy death visual effect when they die.
location lSelf = GetLocation(oPC);
effect eVis2 = EffectVisualEffect(234);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis2, lSelf);
/////////////////////////////////////////////////////////////////////////////
//Have the player tell everyone around them he is dying (actually dead)
AssignCommand(oPlayer, ActionSpeakString("I'm dying, help!",
TALKVOLUME_TALK));
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//Pop up the Death GUI Panel only if they don't meet the following..
//If the player is not immortal
if(GetItemPossessedBy(oPC, "immotoken") == OBJECT_INVALID)
{
//If the player does not have an arena token
if(GetItemPossessedBy(oPC, "arenatoken") == OBJECT_INVALID)
{
//Show the player the Death Panel
DelayCommand(2.0, PopUpGUIPanel(oPlayer,GUI_PANEL_PLAYER_DEATH));
}
}
////////////////////////PVP MESSAGE//////////////////////////////////////
///////See the const int nPVPMessage above to turn on/off)///////////////
if(nPVPMessage == TRUE)
{
////Send PVP Stats Messages to all PCs./////////
//This shouts whever a player has died, who killed them and also
//alerts DMs of any pvp action going on! (Though done below as well.)
//This can also alert DM's not playing as a DM as well too!
oPC = GetFirstPC();
int count = 0;
int nVictims = GetCampaignInt("PVP_SCORE", "iKilled", oKiller);
int vLvl = GetHitDice(oVictor);
int dLvl = GetHitDice(oPlayer);
string sKilled;
//Send Message to all PC's
sKilled = "<cá >";
sKilled += GetName(oPlayer);
sKilled += "<c <20><>> ";
sKilled += "Lvl ";
sKilled += IntToString(dLvl);
sKilled += "<c r<>> Was slain by - ";
sKilled += "<c<> >";
sKilled += GetName(oVictor);
sKilled += "<c <20><>> ";
sKilled += "Lvl - ";
sKilled += IntToString(vLvl);
sKilled += "<c<> > ";
sKilled += GetName(oVictor);
sKilled += "<cP<63> > has ";
sKilled += IntToString(nVictims);
sKilled += "<c<> > kills. </c>";
//Lets make sure the killer is a PC
if(GetIsPC(oVictor))
{
//Write the PVP Information in the log file. (For those not allowing PVP)
WriteTimestampedLogEntry("**The Following Player: ");
WriteTimestampedLogEntry(GetPCPlayerName(oVictor));
WriteTimestampedLogEntry(" - ");
WriteTimestampedLogEntry(GetPCPublicCDKey(oVictor));
WriteTimestampedLogEntry(" - ");
WriteTimestampedLogEntry(GetPCIPAddress(oVictor));
WriteTimestampedLogEntry(" ** Has Killed This Player: ");
WriteTimestampedLogEntry(GetName(oPlayer));
WriteTimestampedLogEntry(" - ");
WriteTimestampedLogEntry(GetPCPlayerName(oPlayer));
while (GetIsPC(oPC) == TRUE)
{
SendMessageToPC(oPC, sKilled);
oPC = GetNextPC();
}
}
//end PVP message function
}
////////////NO PVP ON SERVER ALLOWED!///////////
//IF PVP IS NOT ALLOWED!
if(nPVP == FALSE)
{
object oDumbo;
//If it's not a PC let's make sure an associate of a PC has not killed the PC
if(!GetIsPC(oKiller))
{
//Let's get the master of the asscoiate..
if(GetIsPC(GetMaster(oKiller)))
{
oDumbo = GetMaster(oKiller);
}
}
//Otherwise let's make sure the Attacker is a PC..
else
{
if(GetIsPC(oKiller))
{
oDumbo = oKiller;
}
}
//Let's Double Check to make sure it's a PC who killed the PC.
if(GetIsPC(oDumbo))
{
//Apply the respawn penalty to the Killer instead!!
ApplyRespawnPenalty(oDumbo);
//Raise the Player Who Died without a penalty
//Note these must be delayed because of GUI Panel!
DelayCommand(2.1,
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oDead));
DelayCommand(2.2, Raise(oDead));
//Remove the death token from the dead guy
oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem)=="death") DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
string sBadPC = GetName(oDumbo);
sBadPC += " / ";
sBadPC += GetPCPlayerName(oDumbo);
sBadPC += " / ";
sBadPC += GetPCPublicCDKey(oDumbo);
sBadPC += " Has killed - ";
sBadPC += GetName(oPC);
sBadPC += " In the ";
sBadPC += GetName(GetArea(oPC));
sBadPC += " Area.";
//Send Message to All DMs about the Attack..
SendMessageToAllDMs(sBadPC);
}
//End No PVP Check..
}
//////////IF PVP IS RESTRICTED TO THE ARENA//////////////
if(nArenaOnly == TRUE)
{
//If a PC kills a PC outside of the arena..
if(GetItemPossessedBy(oDead, "arenatoken")==OBJECT_INVALID)
{
//Raise the Player Who Died
DelayCommand(2.3,
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oDead));
DelayCommand(2.4, Raise(oDead));
//Remove the death token from the dead guy
oItem = GetFirstItemInInventory(oDead);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem)=="death") DestroyObject(oItem);
oItem = GetNextItemInInventory(oDead);
}
//Kill the offender and alert the DMs!
//Type // below at the start of the line to deactivate!
ApplyEffectToObject(DURATION_TYPE_INSTANT,eKill,oKiller);
//Apply the respawn penalty to the Killer instead!!
ApplyRespawnPenalty(oKiller);
//Send Message to All DMs about the Attack..
string sArena;
sArena = GetName(oKiller);
sArena += " / ";
sArena += GetPCPlayerName(oKiller);
sArena += " ";
sArena += "Has killed - ";
sArena += GetName(oDead);
sArena += "Outside of the Arena!";
SendMessageToAllDMs(sArena);
}
}
///////////////////////////////////////////////////////////////////////////
//////////////////PVP SCRIPT FUNCTIONS/////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////PVP Option (See the const int nPVP above to turn on/off)///////
if (nPVP == TRUE)
{
//////Start PVP Reward/Penalty Function//////
//Only continue if the killer is a PC!
if(GetIsPC(oKiller) == TRUE)
{
//More PVP Variables
//Get the Killer's HD + nDif + 1
int nAdj = GetHitDice(oKiller) + 1;
int nCheck = nAdj + nDif;
//Will return 1 or less if they are more than nDif levels
//lower than the person they killed
int nDeed = nCheck - pLvl;
//Ok, this part rewards players for killing players who kill low
//level players, if they are flagged for killing low level players,
//and anyone can easially recognized them by the flag on thier back.
if(GetLocalInt(oDead, "effer") >=1)
{
//Lower their effy score by one.
nInt = GetLocalInt(oDead, "effer");
nInt -= 1;
//Decrement thier effer status (because they got killed)
SetLocalInt(oDead, "effer", nInt);
//If they are at 0 Effy Kills, Remove the flag from them
//Otherwise they can be killed again!!! (After it's been lowered!)
if (GetLocalInt(oDead, "effer") <=0)
{
effect eEffect;
eEffect = GetFirstEffect(oDead);
while (GetIsEffectValid(eEffect))
{
if (GetEffectType(eEffect)==EFFECT_TYPE_VISUALEFFECT)
{
//Note sure about this one!
if (EFFECT_TYPE_VISUALEFFECT == VFX_DUR_FLAG_RED)
{
RemoveEffect(oDead, eEffect);
eEffect = GetNextEffect(oDead);
}
}
}
//Now reward the Killer of the bad player with the flag.
//Adjust to your likings.
GiveGoldToCreature(oKiller, 5000);
GiveXPToCreature(oKiller, 500);
}
}
//If the player is too low of a level
//Punish them for killing a much high level player.
//This is to prevent lower level players from killing higher
//level players (which allows the higher levels to ignore them!)
if (nDeed <=1)
{
//Flag them as an Effy Killer (Because they are picking fights!)
nInt = GetLocalInt(oKiller, "effer");
nInt += 1;
int nKind;
nKind = GetObjectType(oKiller);
if (nKind != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_FLAG_RED), oKiller);
else ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_FLAG_RED), GetLocation(oKiller));
SetLocalInt(oKiller, "effer", nInt);
//Raise the Player Who Died without a penalty
//Note these must be delayed because of GUI Panel!
DelayCommand(2.1,
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oDead));
DelayCommand(2.2, Raise(oDead));
//Remove the death token from the dead guy
oItem = GetFirstItemInInventory(oDead);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem)=="death") DestroyObject(oItem);
oItem = GetNextItemInInventory(oDead);
}
//Kill the offender & take xp/gold
//Type // below at the start of the line to deactivate!
ApplyEffectToObject(DURATION_TYPE_INSTANT,eKill,oKiller);
//Penalize the killer Gold / XP
ApplyRespawnPenalty(oKiller);
AssignCommand(oKiller, ClearAllActions());
AssignCommand(oKiller, ActionSpeakString("I have offended the Gods and must be punished!!!", TALKVOLUME_SHOUT));
//Notify the DMs
SendMessageToAllDMs("We have an effy kill in progress, please investigate"
+ GetName(oKiller) + ". Has Killed Player " + GetName(oDead));
//end low level check.
}
//If the killer is 5 levels higher than the player they kill
int aCheck = dLvl;
if(aCheck >= nDif)
{
//Flag them as an Effy Killer
int nInt;
nInt = GetLocalInt(oKiller, "effer");
nInt += 1;
int nKind;
nKind = GetObjectType(oKiller);
if (nKind != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_FLAG_RED), oKiller);
else ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_FLAG_RED), GetLocation(oKiller));
SetLocalInt(oDead, "effer", nInt);
//Raise the Player Who Died
//This must be delayed due to the GUI Panel that pops up.
DelayCommand(2.1,
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oDead));
DelayCommand(2.2, Raise(oDead));
//Remove the death token from the dead guy
object oItem;
oItem = GetFirstItemInInventory(oDead);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem)=="death") DestroyObject(oItem);
oItem = GetNextItemInInventory(oDead);
}
//Kill the offender & take xp/gold
//Type // below at the start of the line to deactivate!
ApplyEffectToObject(DURATION_TYPE_INSTANT,eKill,oKiller);
//Take XP & Gold from the Offending Killer
if (GetHitDice(oKiller)<40)//Only if less than level 40
{
SetXP(oKiller,GetXP(oKiller)-1000);//NOTE: They can Lose a Level!
}
//Remove Gold / XP from the Offender
ApplyRespawnPenalty(oKiller);
//Make them shout that they have been bad...
AssignCommand(oKiller, ClearAllActions());
AssignCommand(oKiller, ActionSpeakString
("I have offended the Gods and must be punished!!!", TALKVOLUME_SHOUT));
//Notify the DMs
SendMessageToAllDMs("We have a low level bashing in progress, please investigate"
+ GetName(oKiller) + ". Has Killed Player " + GetName(oPlayer));
//End Effy Check..
}
//This is the reward of fair PVP
//Lets make sure the killer is at least 1 level
//lower than the player they kill
else if(aLvl >= 1)
{
//award xp/gold by level difference,
//If the player is 1 to nDif levels lower than the player they kill
if (aLvl <=nDif)
{
//Adjust this to your likings..
int nXP = aLvl * nReward1;
int nGold = aLvl * nReward2;
GiveXPToCreature(oKiller,nXP);
GiveGoldToCreature(oKiller,nGold);
//The dead guy shouts how he lost badly. :)
AssignCommand(oDead, ActionSpeakString("I got pwned!!", TALKVOLUME_SHOUT));
}
}
//If the killer is at least 1 level higher than the player they kill
else if (dLvl <=nDif)
{
//Lets make sure the killer is within 1-4 Level difference
if (dLvl >=1)
{
int nXP = dLvl * nReward1;
int nGold = dLvl * nReward2;
GiveXPToCreature(oKiller,nXP);
GiveGoldToCreature(oKiller,nGold);
//The dead guy shouts how he lost badly. :)
AssignCommand(oDead, ActionSpeakString("I got pwned!!", TALKVOLUME_SHOUT));
}
}
//end pc check
}
//end pvp function
}
/////////////////////////////////////////////////////////////////////////
//Script End WOOSH!!
}