AOC_PRC8/_module/nss/cm_ondeath4.nss
Jaysyn904 5e558169a0 Initial Commit
Initial Commit
2025-04-03 11:24:16 -04:00

340 lines
12 KiB
Plaintext

#include "raise"
#include "x0_i0_petrify"
#include "eradicate"
#include "spawner"
#include "bleeding_config"
#include "nw_i0_plot"
void LastWord(object oMonster)
{
int iDice;
int iVoice;
iDice = d8();
switch (iDice)
{
case 1: {iVoice = VOICE_CHAT_CHEER;}break;
case 2: {iVoice = VOICE_CHAT_NO;}break;
case 3: {iVoice = VOICE_CHAT_TASKCOMPLETE;}break;
case 4: {iVoice = VOICE_CHAT_THREATEN;}break;
case 5: {iVoice = VOICE_CHAT_YES;}break;
case 6: {iVoice = VOICE_CHAT_LAUGH;}break;
case 7: {iVoice = VOICE_CHAT_TAUNT;}break;
case 8: {iVoice = VOICE_CHAT_BORED;}break;
}
AssignCommand(oMonster, PlayVoiceChat(iVoice));
}
void DeitySave(object oPC, int iInsurance)
{
string sDeity = GetDeity(oPC);
if (iInsurance==1){SendMessageToPC(oPC, "You used your life insurance.");}
else {SendMessageToPC(oPC, sDeity+" hears your prayers.");}
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPC)), oPC);
RemoveEffects(oPC);
object oTarget = oPC;
int nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_PWSTUN), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_RESTORATION_GREATER), GetLocation(oTarget));
}
void DeathMSG(object oPC, object oKiller)
{
int iDice;
object oPlayer;
string sAnnounce;
string sVictim = GetName(oPC);
string sKiller = GetName(oKiller);
// generate a random death message
iDice = d8();
switch(iDice)
{
case 1: {sAnnounce = sKiller+" sends "+sVictim+" into early retirement!";}break;
case 2: {sAnnounce = sKiller+" paints the pavement red with "+sVictim+"!";}break;
case 3: {sAnnounce = sKiller+" dices "+sVictim+" into small pieces!";}break;
case 4: {sAnnounce = sKiller+"'s face is the last thing that "+sVictim+" sees!";}break;
case 5: {sAnnounce = sVictim+" doesn't survive "+sKiller+"'s brutal attack!";}break;
case 6: {sAnnounce = sKiller+" decapitates "+sVictim+"!";}break;
case 7: {sAnnounce = sKiller+" cuts "+sVictim+" clean in half!";}break;
case 8: {sAnnounce = sKiller+" helps "+sVictim+" to the pavement!";}break;
}
// send message to all players
oPlayer = GetFirstPC();
while (GetIsObjectValid(oPlayer))
{
SendMessageToPC(oPC, sAnnounce);
oPlayer = GetNextPC();
}
}
void main()
{
object oMod = GetModule();
object oPC = GetLastPlayerDied();
object oKiller = GetLastKiller();
object oMonster;
object oTarget;
location oLoc;
int oGameMode = GetLocalInt(oMod, "gamemode");
int oDuel = GetLocalInt(oMod, "duel_on");
int oLives = GetLocalInt(oPC, "lives");
int iDied = GetLocalInt (oPC,"iDied");
int oPlayers = GetLocalInt(oMod, "num_players");
int oChallenge = GetLocalInt(oMod, "challenge");
int iKilled = GetLocalInt (oKiller,"iKilled");
int iKilled2 = GetLocalInt (oPC,"iKilled");
int oHolyWar = GetLocalInt(oMod, "hwar_on");
int iTurnFlag = GetLocalInt(oMod, "turn_flag");
int iHWPCdeathTot = GetLocalInt(oPC, "iHWPCdeathTot");
string sDeity = GetDeity(oPC);
object oItem;
int iMode = GetLocalInt(oMod, "gamemode");
object iCard = GetItemPossessedBy(oPC, "insurance");
if (iCard!=OBJECT_INVALID)
{
oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (oItem==GetObjectByTag("insurance"))
{DestroyObject(oItem);}
oItem = GetNextItemInInventory(oPC);
}
SetLocalInt(oPC, "haggle", 0);
DeitySave(oPC, 1);
return;
}
int iAdj = GetLocalInt(oPC, "deity_adjust");
//if (d20()>=8){DeitySave(oPC);return;}
if ((sDeity!="")&&(d100()>=94-iAdj)){DeitySave(oPC, 0);return;}
else if (sDeity!=""){SendMessageToPC(oPC, sDeity+" does not hear your prayers.");}
else {SendMessageToPC(oPC, "You have no god to pray to.");}
string sRes = GetResRef(oPC);
sRes+="_HWd";
int iHWdeath = GetLocalInt(oMod, sRes);
string sStfall;
SetLocalInt(oPC, "PlayerHealth", PC_HEALTH_DEAD);
if (oGameMode==1)
{
sStfall="You have been defeated by the mighty Mephisto!";
}
else
{
sStfall="You have been defeated by the mighty Starfall!";
}
string sChallText;
string sNormText = "You are dead! You have died ";
++iDied;
sNormText += IntToString(iDied);
sNormText += " times and killed ";
sNormText += IntToString(iKilled2);
sNormText += " times. You may exit or respawn";
SetLocalInt(oPC,"iDied",iDied);
if (oDuel==1)
{
int iMax = GetMaxHitPoints(GetObjectByTag("starfall"));
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(iMax),GetObjectByTag("starfall"));
SetIsTemporaryFriend(oPC, GetObjectByTag("starfall"));
oTarget = GetObjectByTag("starfall");
oLoc = GetLocation(oTarget);
if (oGameMode==1)
{
DelayCommand(1.0, AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT)));
DelayCommand(2.0, AssignCommand(oPC, PlaySound("vs_nx2mephm_vict")));
}
else
{
AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_FIREFORGET_BOW));
AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_LOOPING_TALK_LAUGHING, 1.0f));
DelayCommand(3.0, AssignCommand(oPC, PlaySound("vs_nx2daelm_haha")));
}
DelayCommand(4.5, AssignCommand(oTarget, ClearAllActions()));
if (oGameMode==1)
{
DelayCommand(5.0, AssignCommand
(oTarget, ActionPlayAnimation(ANIMATION_FIREFORGET_BOW)));
DelayCommand(5.1, AssignCommand(oPC, PlaySound("vs_nx2mephm_haha")));
}
else
{
DelayCommand(5.0, AssignCommand
(oTarget, ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY2)));
}
DelayCommand(6.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT,
EffectVisualEffect(VFX_IMP_REMOVE_CONDITION), oLoc));
DelayCommand(7.0, AssignCommand
(oTarget, JumpToLocation(GetLocation(GetObjectByTag ("starfall_wp")))));
DelayCommand(9.0, Cast(SPELL_GREATER_RESTORATION, oTarget));
DelayCommand(9.5, RemoveEffectOfType(oTarget, EFFECT_TYPE_CONCEALMENT));
DelayCommand(10.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0, sStfall));
return;
}
if (GetIsPC(oKiller) == TRUE)
{
++iKilled;
SetLocalInt(oKiller,"iKilled",iKilled);
}
if (oHolyWar==1)
{
iHWdeath = GetLocalInt(oMod, sRes);
++iHWdeath;
++iHWPCdeathTot;
SetLocalInt(oPC, "iHWPCdeathTot", iHWPCdeathTot);
SetLocalInt(oMod, sRes, iHWdeath);
if (iTurnFlag==1)
{
DeathMSG(oPC, oKiller);
DelayCommand(3.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0, "Your allies were less than satisfied with your effort during the battle. As a result, they've turned on you and killed you."));
return;
}
else
{
DeathMSG(oPC, oKiller);
DelayCommand(3.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0, "You have fallen in the holy war! You feel your lifeforce defiantly returning...have you become immortal?"));
return;
}
}
if (oChallenge==1)
{
//if ((oChallenge==1)&&(oPlayers>=1))
// {
// }
// else
// {
if (oLives>0)
{
--oLives;
sChallText = "You have ";
sChallText += IntToString(oLives);
if (oLives==1) {sChallText += " life left. You may exit or respawn";}
else if (oLives==0){sChallText = "Warning: This is your last life. You may exit or respawn";}
else {sChallText += " lives left. You may exit or respawn";}
oMonster = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, oPC);
DelayCommand(1.5, AssignCommand(oMonster,
ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT)));
DelayCommand(4.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0, sChallText));
SetLocalInt(oPC,"lives",oLives);
return;
}
if (oLives==0)
{
SetLocalInt(oMod, "d1", 0);
SetLocalInt(oMod, "d2", 0);
SetLocalInt(oMod, "d2a", 0);
SetLocalInt(oMod, "d3", 0);
SetLocalInt(oMod, "d4", 0);
SetLocalInt(oMod, "d5", 0);
SetLocalInt(oMod, "sw_hw", 0);
SetLocalInt(oMod, "sw_dr", 0);
SetLocalInt(oMod, "sw_bl", 0);
SetLocalInt(oMod, "sw_pf", 0);
SetLocalInt(oMod, "sw_df", 0);
SetLocalInt(oMod, "sw_pm", 0);
SetLocalInt(oMod, "sw_bm", 0);
SetLocalInt(oMod, "sw_lm", 0);
SetLocalInt(oMod, "sw_ll", 0);
SetLocalInt(oMod, "sw_xx", 0);
SetLocalInt(oMod, "ch_hw", 0);
SetLocalInt(oMod, "ch_dr", 0);
SetLocalInt(oMod, "ch_bl", 0);
SetLocalInt(oMod, "ch_pf", 0);
SetLocalInt(oMod, "ch_df", 0);
SetLocalInt(oMod, "ch_pm", 0);
SetLocalInt(oMod, "ch_bm", 0);
SetLocalInt(oMod, "ch_lm", 0);
SetLocalInt(oMod, "ch_ll", 0);
SetLocalInt(oMod, "ch_xx", 0);
SetLocalInt(oMod, "gr_xx", 0);
SetLocalInt(oMod, "challenge", 0);
AddJournalQuestEntry("death", 1, oPC, FALSE, FALSE);
SetLocalInt(oMod, "xcheck", 1);
AssignCommand(oPC, PlaySound("sps_darkness"));
SetLocked(GetObjectByTag("arena_gate"), FALSE);
object oP1 = GetObjectByTag("pool1");
object oP2 = GetObjectByTag("pool2");
object oP3 = GetObjectByTag("fountain1");
object oP4 = GetObjectByTag("fountain2");
object oLever1 = GetObjectByTag("pool_lever");
object oLever2 = GetObjectByTag("fount_lever");
effect eEffect2 = EffectVisualEffect(VFX_DUR_GLOBE_INVULNERABILITY);
object oBulb = GetObjectByTag("spawner");
AssignCommand(oBulb, ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
AssignCommand(oLever1, ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
AssignCommand(oLever2, ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
RemoveEffectOfType(oP1, GetEffectType(eEffect2));
RemoveEffectOfType(oP2, GetEffectType(eEffect2));
RemoveEffectOfType(oP3, GetEffectType(eEffect2));
RemoveEffectOfType(oP4, GetEffectType(eEffect2));
SetLocalInt(oMod, "fountain_state", 0);
SetLocalInt(oMod, "pool_state", 0);
oMonster = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, oPC);
DelayCommand(1.5, AssignCommand(oMonster,
ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT)));
FloatingTextStringOnCreature("Defeat", oPC);
DelayCommand(7.0, Limbo(oPC));
DelayCommand(5.0, FloatingTextStringOnCreature("You have failed the Arena Challenge!", oPC));
if (GetAlignmentGoodEvil(oPC)== ALIGNMENT_GOOD)
{
DelayCommand(13.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0,
"Your defeat affords you an opportunity to learn. You vow to return more powerful to restore your honour!"));
return;
}
else if (GetAlignmentGoodEvil(oPC)== ALIGNMENT_EVIL)
{
DelayCommand(13.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0,
"Losing is for the weak. You vow to return more powerful and turn their glory into suffering!"));
return;
}
else
{
DelayCommand(13.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0,
"You take the defeat in your stride and hope that you can improve next time!"));
}
}
}
else
{
if (GetLocalInt(oMod, "num_players")>=2)
{
FloatingTextStringOnCreature("Defeat", oPC);
DelayCommand(3.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0, sNormText));
}
else
{
oMonster = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, oPC);
DelayCommand(1.5, AssignCommand(oMonster,
ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT)));
DelayCommand(2.5, LastWord(oMonster));
FloatingTextStringOnCreature("Defeat", oPC);
DelayCommand(8.0, Limbo(oPC));
DelayCommand(12.0, PopUpDeathGUIPanel(oPC, TRUE, TRUE, 0, sNormText));
return;
}
}
}