Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

198 lines
5.2 KiB
Plaintext

///::///////////////////////////////////////////////
//:: Name mod_respawn
//:: mod_respawn.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This goes in OnPlayerRespawn in Module Properties Events
It checks to see if the player has a god, and if so whether or
not he feels like listening to them. As is now, they can pray
as often as they want, with a 3% chance. (May set time limit or
bad effect for annoying your God later). To go to normal respawn
just comment out the section as noted below.
*/
//::///////////////////////////////////////////////
//:: Created By: Pad O'Lion
//:: Created On: 06/29/2002
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
#include "nw_i0_plot"
#include "rpo_inc"
void Wolfres (object oPlayer)
{
if ((GetIsNight())&&(GetIsObjectValid(GetItemPossessedBy(oPlayer,"jw_wolf_item"))))
{
// he is a wolf
AssignCommand(oPlayer,ClearAllActions());
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
AssignCommand(oPlayer, JumpToLocation(GetLocation(GetWaypointByTag("WP_jw_ra2id"))));
RemoveEffects(oPlayer);
}
}
void Ressurect(object oRespawner)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
UnequipPlayer (oRespawner, TRUE);
SendMessageToPC(oRespawner, "You awake with blurred vision, as your sight begins to clear you can make out your surroundings.");
BlackScreen(oRespawner);
DelayCommand(10.0,FadeFromBlack(oRespawner, FADE_SPEED_SLOW));
SetLocalInt(oRespawner, "PlayerState",PWS_PLAYER_STATE_ALIVE);
object oAmulet=GetItemPossessedBy(oRespawner,"deathamulet");
if (GetIsObjectValid(oAmulet))
{
DestroyObject(oAmulet);
}
}
void Frost_Ressurect(object oPlayer)
{
AssignCommand(oPlayer,ClearAllActions());
{
AssignCommand(oPlayer, ActionPlayAnimation( ANIMATION_LOOPING_DEAD_FRONT, 1.0, 1000.0));
}
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
AssignCommand(oPlayer, JumpToLocation(GetLocation(GetWaypointByTag("frost_prisoncell"))));
RemoveEffects(oPlayer);
UnequipPlayer (oPlayer, TRUE);
AssignCommand(oPlayer,PlayVoiceChat(VOICE_CHAT_PAIN1));
}
void ApplyPenalty(object oDead)
{
int nGoldToTake;
int nXP = GetXP(oDead);
int nPenalty = 50 * GetHitDice(oDead);
int nHD = GetHitDice(oDead);
// * You can not lose a level with this respawning
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
int nNewXP = nXP - nPenalty;
if (nNewXP < nMin)
{
nNewXP = nMin;
}
if (nHD==1)
{
nNewXP = (nXP-10);
}
if (nNewXP < (nXP/10*9))
{
nNewXP = (nXP/10*9);
}
if (nNewXP < 1)
{
nNewXP = 1;
}
SetXP(oDead, nNewXP);
if (nHD>3)
{
nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
}
else
{
nGoldToTake = FloatToInt(0.05 * GetGold(oDead));
}
// * a cap of 10 000gp taken from you
if (nGoldToTake > 10000)
{
nGoldToTake = 10000;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
}
void main()
{
//REMOVE THIS!!!
//return;
object oRespawner = GetLastRespawnButtonPresser();
if(BLEEDSYSTEM)
SetLocalInt(oRespawner,"PlayerState",PWS_PLAYER_STATE_ALIVE);
// At this point they are respawned where they stand. If you want to move them
// to safety, you should do so here.
// Check for and remove Death Amulet if used, if not used, can remove all below
object oDeathAmulet;
oDeathAmulet = GetFirstItemInInventory(oRespawner);
while(GetIsObjectValid(oDeathAmulet))
{
if(GetTag(oDeathAmulet) == "deathamulet")
{
DestroyObject(oDeathAmulet);
}
oDeathAmulet = GetNextItemInInventory(oRespawner);
}
object oSpawnPoint = GetObjectByTag("WP_RessPoint");
if (GetStringLeft(GetTag(GetArea(oRespawner)),4)=="iwd_")
{
oSpawnPoint = GetObjectByTag("fr_iwd_death");
}
ApplyPenalty(oRespawner);
if (GetStringLeft(GetTag(GetArea(oRespawner)),10)=="Frost_area")
{
Frost_Ressurect(oRespawner);
return;
}
if ((GetIsNight()||GetIsDusk())&&(GetIsObjectValid(GetItemPossessedBy(oRespawner,"jw_wolf_item"))))
{
Wolfres(oRespawner);
return;
}
Ressurect(oRespawner);
// MUST PUT JUMP TO LOCATION BACK IN
AssignCommand(oRespawner, JumpToLocation(GetLocation(oSpawnPoint)));
SendMessageToPC(oRespawner, "You find yourself in " + GetName(GetArea(oSpawnPoint)));
}