Initial upload
Initial upload
This commit is contained in:
143
_module/nss/ondeath_od.nss
Normal file
143
_module/nss/ondeath_od.nss
Normal file
@@ -0,0 +1,143 @@
|
||||
////////////////////
|
||||
///// Created by: bushido
|
||||
//////////////////////////////////////
|
||||
|
||||
////////////////////
|
||||
// AdjustPlayerStats()
|
||||
// Developed by: Wouter Dhondt
|
||||
// Slightly modified by: bushido
|
||||
//////////////////////////////////////
|
||||
// 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)
|
||||
{
|
||||
int nAorB = d4();
|
||||
string waiting = "<c <20> >The gods show you favor, your life is restored.";
|
||||
if (GetIsDead(oPlayer))
|
||||
{
|
||||
if (nAorB > 2)
|
||||
{
|
||||
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));
|
||||
DelayCommand(0.5, AssignCommand(oPlayer, JumpToObject(oTarget)));
|
||||
}
|
||||
else
|
||||
{
|
||||
object oTarget = GetWaypointByTag("home");
|
||||
effect eTeleport = EffectVisualEffect(VFX_FNF_HOWL_WAR_CRY);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport, oPlayer);
|
||||
Raise(oPlayer);
|
||||
AssignCommand(oPlayer, ActionSpeakString(waiting, TALKVOLUME_TALK));
|
||||
DelayCommand(0.5, AssignCommand(oPlayer, JumpToObject(oTarget)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 if noone rez'd the poor guy
|
||||
DelayCommand(15.0, Respawn(oPlayer));
|
||||
}
|
Reference in New Issue
Block a user