Initial Commit

Initial Commit [v1.32PRC8]
This commit is contained in:
Jaysyn904
2025-04-03 13:38:45 -04:00
parent 1213977d8c
commit b464d8da05
6922 changed files with 6176025 additions and 2 deletions

289
_module/nss/rd_respawn.nss Normal file
View File

@@ -0,0 +1,289 @@
#include "prc_inc_racial"
#include "nw_i0_plot"
#include "rd_misc"
#include "rd_treasure"
#include "utl_i_sqluuid"
#include "utl_i_sqlocals"
#include "prc_inc_template"
void DestroyAllItems(object oPC);
string GetRace(object oPC);
void main()
{
string sMessage;
string sDestTag;
string sRace;
int iDeaths;
int iLevel;
int iDeathAllowed;
int iChance;
object oArea;
object oRespawner = GetLastRespawnButtonPresser();
object oSpawnPoint;
iDeaths = SQLocalsUUID_GetInt(oRespawner, "PCDeaths");
iDeaths++;
SQLocalsUUID_SetInt(oRespawner,"PCDeaths" ,iDeaths);
iLevel = GetLevelByPosition(1,oRespawner) +
GetLevelByPosition(2,oRespawner) +
GetLevelByPosition(3,oRespawner) +
GetLevelByPosition(4,oRespawner) +
GetLevelByPosition(5,oRespawner) +
GetLevelByPosition(6,oRespawner) +
GetLevelByPosition(7,oRespawner) +
GetLevelByPosition(8,oRespawner);
iDeathAllowed = 3 + iLevel - SQLocalsUUID_GetInt(oRespawner,"PCEnterLevel");
if (SQLocalsUUID_GetInt(oRespawner,"PCHardCoreSpecial") == 1)
iDeathAllowed = (iLevel+5)/10;
if (iDeaths <= iDeathAllowed && SQLocalsUUID_GetInt(oRespawner,"PCHardcore") == 0 && SQLocalsUUID_GetInt(oRespawner,"PCHardCorePNP") == 0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
oArea = GetArea(oRespawner);
sDestTag = SQLocals_GetString(oArea,"Respawn");
if (sDestTag == "")
sDestTag = "EN4_Respawn";
sMessage = "You regain conciousness several hours later. You don't know how you got here, but you do remember waking at some point to see an old man treating your wounds.";
SetLocalString(oRespawner,"Respawn",sDestTag);
if (SQLocalsUUID_GetInt(oRespawner,"Monstrous") == 0 && SQLocalsUUID_GetInt(oRespawner,"EvilPath") == 0)
{
sDestTag="en3_respawning";
oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
SendMessageToPC(oRespawner,sMessage);
}
else
{
if (sDestTag == "AP_Enter")
{
sDestTag="en3_respawning";
}
else
{
if (SQLocalsUUID_GetInt(oRespawner,"EvilPath") == 0)
sDestTag="EN4_Monster";
else
sDestTag="EN4_MERespawn";
}
object oEvil = GetObjectByTag("en3_brotherbob"); //:: Brother Ezekial
AdjustReputation(oRespawner,oEvil,-100);
sMessage="You regain consciousness and find yourself in the caverns beneath Hightop City.";
oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
SendMessageToPC(oRespawner,sMessage);
}
}
else
{
int iSaved = 0;
if (SQLocals_GetString(oArea,"Respawn") == "AP_Enter")
SQLocalsUUID_SetInt(oRespawner,"Saved",1);
if (SQLocalsUUID_GetInt(oRespawner,"Monstrous") == 0 && SQLocalsUUID_GetInt(oRespawner,"EvilPath") == 0)
sDestTag = "EN4_Respawn";
else
sDestTag="EN4_Monster";
iChance = Random(100);
if (SQLocalsUUID_GetInt(oRespawner,"PCHardCorePNP")>0)
iChance = iChance - 3;
//Even better chance for PnP vs racial mob
if (SQLocalsUUID_GetInt(oRespawner,"PCHardCorePNP")>0 && SQLocalsUUID_GetInt(oRespawner,"KillerType") == 1)
iChance = iChance - 5;
if (SQLocalsUUID_GetInt(oRespawner,"Lucky") > 0)
{
if (SQLocalsUUID_GetInt(oRespawner,"PCHardCorePNP") > 0)
iChance = 0;
else
iChance = iChance - 25;
}
if (SQLocalsUUID_GetInt(oRespawner,"Saved") > 0)
iChance = 100;
if (SQLocalsUUID_GetInt(oRespawner,"KillerType") == 1 && iChance < GetHitDice(oRespawner)/4+1)
{
iSaved = 1;
SQLocalsUUID_SetInt(oRespawner,"Saved",1);
DestroyAllItems(oRespawner);
sMessage = "You were taken to a prisoner camp and worked as a slave, but during a freak uprising you were able to make good your escape. Considering yourself lucky, you arrive back at Hightop with only the rags on your back.";
}
if (SQLocalsUUID_GetInt(oRespawner,"KillerType") == 2 && iChance < GetHitDice(oRespawner)/8+1)
{
iSaved = 1;
SQLocalsUUID_SetInt(oRespawner,"Saved",1);
SQLocalsUUID_SetInt(oRespawner,"HasCustomSkin",1);
SQLocalsUUID_SetInt(oRespawner,"SpecialPowers",2);
CreateSpecialPowers(oRespawner);
sRace = GetSubRace(oRespawner);
if (sRace == "")
sRace = GetRace(oRespawner);
sRace = "Undead " + sRace;
SetSubRace(oRespawner,sRace);
ApplyTemplateToObject(TEMPLATE_NECROPOLITAN, oRespawner);
SQLocalsUUID_SetInt(oRespawner,"SuperPowers",8);
CreateSuperPowers(oRespawner);
AdjustAlignment(oRespawner,ALIGNMENT_EVIL,100);
object oGood = GetObjectByTag("en3_good");
AdjustReputation(oRespawner,oGood,-100);
DestroyAllItems(oRespawner);
sMessage = "All was black for a time, but slowly you awoke and you rose from the ground, but it was not life that greeted you. The foul undeath that ended your life had crept into your soul, bringing you back from the brink. In a haze, you made your way back to Hightop City, but with your new life comes new hungers...";
}
if (SQLocalsUUID_GetInt(oRespawner,"KillerType") == 3 && iChance < GetHitDice(oRespawner)/8+1)
{
iSaved = 1;
SQLocalsUUID_SetInt(oRespawner,"Saved",1);
SQLocalsUUID_SetInt(oRespawner,"HasCustomSkin",1);
SQLocalsUUID_SetInt(oRespawner,"SpecialPowers",3);
CreateSpecialPowers(oRespawner);
SQLocalsUUID_SetInt(oRespawner,"WeaponBonus",1);
sRace = GetSubRace(oRespawner);
if (sRace == "")
sRace = GetRace(oRespawner);
sRace = "Fiendish " + sRace;
SetSubRace(oRespawner,sRace);
ApplyTemplateToObject(TEMPLATE_FIENDISH, oRespawner);
AdjustAlignment(oRespawner,ALIGNMENT_EVIL,100);
object oGood = GetObjectByTag("en3_good");
AdjustReputation(oRespawner,oGood,-100);
DestroyAllItems(oRespawner);
sMessage = "It seems a dream now, but you know in your soul it was not a dream, not even a nightmare. After your death, you were drawn into the abyss where a thousand tortures awaited you, but there you did not stay, for after your soul was punished you were sent back into the world to punish mankind as you had been punished...";
}
if (iSaved == 0)
{
sDestTag = "spawn_abyss";
sMessage = "You feel the fires of death run through you.";
}
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
DelayCommand(1.0f,SendMessageToPC(oRespawner,sMessage));
if (!GetIsObjectValid(oSpawnPoint))
SendMessageToPC(oRespawner,"Error respawning at correct location (" + sDestTag + ").");
}
}
void DestroyAllItems(object oPC)
{
object oObject;
oObject = GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_ARMS,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_BELT,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_BOOTS,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_NECK,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_ARROWS,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_BOLTS,oPC);
DestroyObject(oObject,0.1f);
oObject = GetItemInSlot(INVENTORY_SLOT_BULLETS,oPC);
DestroyObject(oObject,0.1f);
oObject = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oObject))
{
DestroyObject(oObject);
oObject = GetNextItemInInventory(oPC);
}
//TakeGoldFromCreature(GetGold(oPC),oPC,TRUE);
AssignCommand(oPC,TakeGold(GetGold(oPC),oPC,TRUE));
DelayCommand(0.1f,GiveGoldToCreature(oPC,5));
oObject = CreateItemOnObject("Tunic",oPC);
DelayCommand(3.0f,AssignCommand(oPC, ActionEquipItem(oObject, INVENTORY_SLOT_CHEST)));
}
string GetRace(object oPC)
{
string sRace = GetSubRace(oPC);
if (sRace == "")
{
sRace = GetStringByStrRef(StringToInt(Get2DAString("racialtypes", "Name", GetRacialType(oPC))));
}
return sRace;
}
/* string GetRace(object oPC)
{
string sRace;
switch (MyPRCGetRacialType(oPC))
{
case RACIAL_TYPE_HUMAN: sRace = "Human"; break;
case RACIAL_TYPE_ELF: sRace = "Elf"; break;
case RACIAL_TYPE_DWARF: sRace = "Dwarf"; break;
case RACIAL_TYPE_HALFELF: sRace = "Half-Elf"; break;
case RACIAL_TYPE_HALFORC: sRace = "Half-Orc"; break;
case RACIAL_TYPE_HALFLING: sRace = "Halfling"; break;
case RACIAL_TYPE_GNOME: sRace = "Gnome"; break;
}
return sRace;
} */