129 lines
4.8 KiB
Plaintext
129 lines
4.8 KiB
Plaintext
//Created by Guile 5/1/07
|
||
// Adjust Player Stats function
|
||
|
||
void AdjustPlayerStats()
|
||
{
|
||
// Get the last player that died
|
||
object oDied = GetLastPlayerDied();
|
||
// Increment or set the death variable
|
||
int iDied = GetLocalInt (oDied, "iDied");
|
||
++iDied;
|
||
SetLocalInt(oDied, "iDied", iDied);
|
||
|
||
object oKiller = GetLastHostileActor(oDied);
|
||
// Is this object a PC?
|
||
if (GetIsPC(oKiller) == TRUE)
|
||
{
|
||
// Increment or set the killer var
|
||
int iKilled = GetLocalInt (oKiller,"iKilled");
|
||
++iKilled;
|
||
SetLocalInt(oKiller, "iKilled", iKilled);
|
||
}
|
||
}
|
||
|
||
// Raise OnDeath 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
|
||
// Optionally you can create the waypoints described to send the dead player
|
||
// to their respective locations.
|
||
void Respawn(object oPlayer)
|
||
{
|
||
|
||
string waiting = "<c <20> >Shroud shows you favor, your life is restored.";
|
||
if (GetIsDead(oPlayer))
|
||
{
|
||
object oPC = GetLastPlayerDied();
|
||
object oTarget = GetWaypointByTag("home2");
|
||
effect eTeleport = EffectVisualEffect(VFX_FNF_HOWL_WAR_CRY);
|
||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport, oPlayer);
|
||
Raise(oPlayer);
|
||
AssignCommand(oPlayer, ActionSpeakString(waiting, TALKVOLUME_TALK));
|
||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
|
||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPC)), oPC);
|
||
|
||
|
||
}
|
||
}
|
||
|
||
void main()
|
||
{
|
||
|
||
//Count up the kills and deaths
|
||
AdjustPlayerStats();
|
||
|
||
//Standard Ondeath stuff
|
||
object oPlayer = GetLastPlayerDied();
|
||
// * 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);
|
||
}
|
||
|
||
//Begin kill/death messages
|
||
object oVictor = GetLastHostileActor(oPlayer);
|
||
object oPC = GetFirstPC();
|
||
int count = 0;
|
||
int nVictims = GetLocalInt(oVictor, "iKilled");
|
||
string sKilled = GetName(oPlayer);
|
||
//Send Message to all PC's
|
||
sKilled += "<c<> > was slain by ";
|
||
sKilled += GetName(oVictor);
|
||
sKilled += "<c<> >\n";
|
||
sKilled += GetName(oVictor);
|
||
sKilled += "<c<> > has ";
|
||
sKilled += IntToString(nVictims);
|
||
sKilled += "<c<> > kills.";
|
||
|
||
while (GetIsPC(oPC) == TRUE)
|
||
{
|
||
SendMessageToPC(oPC, sKilled);
|
||
oPC = GetNextPC();
|
||
}
|
||
|
||
//Respawn in 1/2 of a second
|
||
DelayCommand(0.5, Respawn(oPlayer));
|
||
}
|