Aschbourne_PRC8/_module/nss/toolbox_quests.nss
GetOffMyYarn 69879d6957 Areas and Fixes
Added CCOH and missing areas
Changed some areas to be craftable,
Fixed some on death issues,
Fixed the Gaurd
2024-08-30 11:38:44 -04:00

460 lines
19 KiB
Plaintext

//////////////////////////////////////////////////////////////
// QUEST WRITERS TOOLBOX
//
//////////////////////////////////////////////////////////////
// DEFINING FUNCTIONS
//////////////////////////////////////////////////////////////
// Update the Fame level with a specific faction
void UpdateFame(object oPC, string sFame_Type, int nFame);
/////////////////////////////////////////
// UpdateQuestCount
// Increases the variable used to count how many quests the player
// has completed. Must be added to the rewards script of the quest.
void UpdateQuestCount(object oPC);
//////////////////////////////////////////////////////////////
// SetQst_Kills
// Stores the number of kills required
void SetQst_Kills(object oPlayer, int Kill_Count, string sQst_Name);
///////////////////////////////////////////////////////////////
// GetQstName
// When Creatures are marked as being part of a kill quest, this
// script compares the name of the creature with the currently
// available quests to see which one it is part of.
string GetQstName(string sCreature);
///////////////////////////////////////////////////////////////
// QstChk_OnDth
// Gives quest credit when the proper creatures are killed via
// a kill-quest
void QstChk_OnDth(object oCreature);
///////////////////////////////////////////////////////////////
// SW_SetQuestLocation
// Stores the location on the Quest Stone
void SW_SetQuestLocation(object oPC, string Quest_Name, location lValue);
///////////////////////////////////////////////////////////////
// SW_SetQuestInt
// Stores the Int on the Quest Stone
void SW_SetQuestInt(object oPC, string Quest_Name, int nValue);
///////////////////////////////////////////////////////////////
// SW_SetQuestString
// Stores the String on the Quest Stone
void SW_SetQuestString(object oPC, string Quest_Name, string sValue);
//////////////////////////////////////////////////////////////
// SW_SetQuestFloat
// Storess the float on the Quest Stone
void SW_SetQuestFloat(object oPC, string Quest_Name, float fValue);
//////////////////////////////////////////////////////////////
// SW_SetQuestObject
// Stores the Object on the Quest Stone
void SW_SetQuestObject(object oPC, string Quest_Name, object oValue);
//////////////////////////////////////////////////////////////
// SW_GetQuestInt
// Gets an integer from the Quest Stone
int SW_GetQuestInt(object oPC, string Quest_Name);
//////////////////////////////////////////////////////////////
// SW_GetQuestString
// Gets a String from the Quest Stone
string SW_GetQuestString(object oPC, string Quest_Name);
/////////////////////////////////////////////////////////////
// SW_GetQuestObject
// Gets an Object from the Quest Stone
object SW_GetQuestObject(object oPC, string Quest_Name);
/////////////////////////////////////////////////////////////
// SW_GetQuestFloat
// Gets a Float from the Quest Stone
float SW_GetQuestFloat(object oPC, string Quest_Name);
////////////////////////////////////////////////////////////
// SW_GetQuestLocation
// Gets a Location from the Quest Stone
location SW_GetQuestLocation(object oPC, string Quest_Name);
///////////////////////////////////////////////////////////
// Start Code HERE
///////////////////////////////////////////////////////////
// Quest Check - Kill Quests
//
/////////////////////////////////////////////////
// This function stores values on the Warehouse for quests
// when the player is given a Kill quest.
// The values stored are the Creature Name, number to Kill
// and the name of the quest.
// //////////////////////////////////////////////
void SetQst_Kills(object oPlayer, int Kill_Count, string sQst_Name)
////////////////////////////////////////////////
// Remember that the Creature Name must be set in the GetQstName
// function below.
{
/////////////////////////////////////////////////////////
// Store Quest information
// Quest Name + _On = Defines if PC has the quest
// Quest Name + _Cnt = Intializes number of mobs a player has to kill
object oPC = oPlayer;
string sQst_Name1 = sQst_Name + "_On";
string sQst_Name2 = sQst_Name + "_Cnt";
int nTest_Quest = SW_GetQuestInt(oPC, sQst_Name1);
////////////////////////////////////////////////////////
// Check to see if quest already exists
if (nTest_Quest == 99) SendMessageToPC(oPlayer, "You have already completed this quest.");
if (nTest_Quest == 98) SendMessageToPC(oPlayer, "You have already completed this quest.");
if (nTest_Quest != 0) return;
SendMessageToPC(oPlayer, "Debug: Storing Quest: " + sQst_Name1);
SW_SetQuestInt(oPC, sQst_Name1, 1);
SW_SetQuestInt(oPC, sQst_Name2, Kill_Count);
}
/////////////////////////////////////////////
/////////////////////////////////////////////
// Get Quest Name Function
//
// Checks to see if the creature killed is part of a "Kill Creature"
// type quest. Returns the name of the quest if true.
// Builder must add Creature Name and Qst name here for script to
// work.
////////////////////////////////////////////
string GetQstName(string sCreature)
{
string Qst_Name = "";
Qst_Name = "NoQuestName";
if (sCreature == "Ant Worker" ) Qst_Name = "Foreman_HuntAnts";
if (sCreature == "Fire Ant Hive Queen" ) Qst_Name = "Foreman_HuntQueen";
if (sCreature == "Bubbling Goo" ) Qst_Name = "Celest_HuntGoos";
//if (sCreature == "Monster_Name" ) Qst_Name = "";
//if (sCreature == "Monster_Name" ) Qst_Name = "";
//if (sCreature == "Monster_Name" ) Qst_Name = "";
//if (sCreature == "Monster_Name" ) Qst_Name = "";
//if (sCreature == "Monster_Name" ) Qst_Name = "";
//if (sCreature == "Monster_Name" ) Qst_Name = "";
//if (sCreature == "Monster_Name" ) Qst_Name = "";
return Qst_Name;
}
///////////////////////////////////////////////////
///////////////////////////////////////////////////
// Quest Check OnDeath
//
// Function is placed in the OnDeath script of creatures
// that are part of the quest.
//
// A specific creature type can only be used once.
///////////////////////////////////////////////////
void QstChk_OnDth(object oCreature)
{
//////////////////////////////////////////////////
// Make sure Last Killer was a PC
// Should make a check to see if the killer is a pet
// but have no idea how to code that.
/////////////////////////////////////////////////
object oPlayer = GetLastKiller();
if (GetIsPC(oPlayer) == FALSE) return;
object oPC = oPlayer;
////////////////////////////////////////////////
// The creature killed is not a Kill Quest mob
// Check seperate function for current Kill quests
///////////////////////////////////////////////
string sCreature = GetName(oCreature);
string sQst_Name = GetQstName(sCreature);
string sQst_Name1 = sQst_Name + "_On";
string sQst_Name2 = sQst_Name + "_Cnt";
int nChkMobCount = SW_GetQuestInt(oPC, sQst_Name2);
string sChkMobCount = IntToString(nChkMobCount);
//SendMessageToPC(oPlayer, "Debug: Quest Name is " + sQst_Name);
//SendMessageToPC(oPlayer, "Debug: Slain Creature is " + sCreature);
if (sQst_Name == "NoQuestName")
{
SendMessageToPC(oPlayer, "Debug: Creature not part of your quest");
SendMessageToPC(oPlayer, "Debug: This creature is a " + sQst_Name);
return; //This creature is not part of a kill quest
}
//SendMessageToPC(oPlayer, "Number left to kill is " + sChkMobCount);
///////////////////////////////////////////////////////
// Check to see if the player has the quest
//////////////////////////////////////////////////////
int ChkIfOnQst = SW_GetQuestInt(oPC, sQst_Name1);
if (ChkIfOnQst == FALSE) return;
/////////////////////////////////////////////////////
// Check to see how many creatures the player needs to kill
/////////////////////////////////////////////////////
if (nChkMobCount == 0) return; //Quest already complete
if (nChkMobCount == 1)
{
nChkMobCount = nChkMobCount - 1;
SendMessageToPC(oPlayer, "You have finished your Mission!");
SW_SetQuestInt(oPC, sQst_Name1, 99); // Setting quest variable to 99 to close quest
SW_SetQuestInt(oPC, sQst_Name2, nChkMobCount);
}
if (nChkMobCount > 1)
{
nChkMobCount = nChkMobCount - 1;
string sChkMobCount = IntToString(nChkMobCount);
SendMessageToPC(oPlayer, "You need " + sChkMobCount + " kills to complete your Mission!");
SW_SetQuestInt(oPC, sQst_Name2, nChkMobCount);
}
return;
}
//////////////////////////////////////////////////////////
// UpdateQuestCount
// Increases the variable used to count how many quests the player
// has completed. Must be added to the rewards script of the quest.
void UpdateQuestCount(object oPC)
{
int Quest_Count = SW_GetQuestInt(oPC, "Quest_Count");
Quest_Count = Quest_Count + 1;
SendMessageToPC(oPC, "Your Mission Count has been Increased!");
SW_SetQuestInt(oPC, "Quest_Count", Quest_Count);
}
//////////////////////////////////////////////////////////
// Increases Fame with a certain entity by the amounted
// noted in the parameters.
////////////////////////////////////////
void UpdateFame(object oPC, string sFame_Type, int nFame)
{
string sFame_Type2 = "Fame_" + sFame_Type;
int CurrentFame = SW_GetQuestInt(oPC, sFame_Type2);
CurrentFame = CurrentFame + nFame;
SendMessageToPC(oPC, "Your Fame Type is: " + sFame_Type);
SendMessageToPC(oPC, "Your Fame with " + sFame_Type + " has Increased!");
SendMessageToPC(oPC, "You Gained " + IntToString(nFame) + " fame with: " + sFame_Type);
SendMessageToPC(oPC, "Your current fame with: " + sFame_Type + " is " + IntToString(CurrentFame));
SW_SetQuestInt(oPC, sFame_Type2, CurrentFame);
}
///////////////////////////////////////////////////////////////////
// Generic Quest Creation Functions
///////////////////////////////////////////////////////////////////
void SW_SetQuestInt(object oPC, string Quest_Name, int nValue)
{
SetCampaignInt("Segal_Quests", Quest_Name, nValue, oPC);
}
void SW_SetQuestString(object oPC, string Quest_Name, string sValue)
{
SetCampaignString("Segal_Quests", Quest_Name, sValue, oPC);
}
void SW_SetQuestFloat(object oPC, string Quest_Name, float fValue)
{
SetCampaignFloat("Segal_Quests", Quest_Name, fValue, oPC);
}
//void SW_SetQuestObject(object oPC, string Quest_Name, object oValue)
// {
// StoreCampaignObject("Segal_Quests", Quest_Name, oValue, oPC);
// }
void SW_SetQuestLocation(object oPC, string Quest_Name, location lValue)
{
SetCampaignLocation("Segal_Quests", Quest_Name, lValue, oPC);
}
int SW_GetQuestInt(object oPC, string Quest_Name)
{
int Quest_Value = GetCampaignInt("Segal_Quests", Quest_Name, oPC);
return Quest_Value;
}
string SW_GetQuestString(object oPC, string Quest_Name)
{
string Quest_Value = GetCampaignString("Segal_Quests", Quest_Name, oPC);
return Quest_Value;
}
//object SW_GetQuestObject(object oPC, string Quest_Name)
// {
// object Quest_Value = RetrieveCampaignObject("Segal_Quests", Quest_Name, oPC);
// return Quest_Value;
// }
float SW_GetQuestFloat(object oPC, string Quest_Name)
{
float Quest_Value = GetCampaignFloat("Segal_Quests", Quest_Name, oPC);
return Quest_Value;
}
location SW_GetQuestLocation(object oPC, string Quest_Name)
{
location Quest_Value = GetCampaignLocation("Segal_Quests", Quest_Name, oPC);
return Quest_Value;
}
/////////////////////////////////////////////////////////////////////
// Tome of Testament Toolbox
//
////////////////////////////////////////////////////////////////////
// The Tome of Testament is used to store indicative data about the
// player including number of quests completed, number and types of
// creatures killed, titles, fame, and status.
//
// The functions used to make the Tome work are here.
///////////////////////////////////////////////////////////////////
// Hero Title List Quest#
//
// 0 - Refugee 0-2
// 1 - Novice Quester 3-5
// 2 - Established Quester 6-10
// 3 - Talented Quester 11-15
// 4 - Elite Quester 16-20
// 5 - Champion Quester 21-30
// 6 - Adept Adventurer 31-40
// 7 - Established Adventurer 41-50
// 8 - Talented Adventurer 51-75
// 9 - Elite Adventurer 76-100
// 10- Champion Adventurer 101-150
// 11- Adept Hero 151-200
// 12- Established Hero 201-300
// 13- Talented Hero 301-400
// 14- Elite Hero 401-500
// 15- Champion Hero 501-600
// 16- Hero of the Realm 601-700
// 17- Protector of the Realm 701-800
// 18- Legendary Adventurer 801-900
// 19- Legendary Hero 901-1000
// 20- Legendary Champion 1001+
//void SetTitlesToTome(object oPC)
//{
////////////////////////////////////
// Initilize the values on the Tome of Testament
//
//}
void Tome_Output(object oPC)
{
object oTome = GetItemPossessedBy(oPC, "title_tome");
if (oTome == OBJECT_INVALID)
{
SendMessageToPC(oPC, "Debug: Warehouse not found.");
}
int Fame_Class = SW_GetQuestInt(oPC, "EverClear");
int Fame_Class2 = GetLocalInt(oTome, "Everclear");
Fame_Class = Fame_Class + Fame_Class2;
string sFame_Everclear = IntToString(Fame_Class);
int Quest_Count = GetLocalInt(oPC, "Quest_Count");
int Quest_Count2 = GetLocalInt(oTome, "Quest_Count");
Quest_Count = Quest_Count + Quest_Count2;
string sQuest_Count = IntToString(Quest_Count);
string Hero_Title = "Refugee";
if (Quest_Count > 2) Hero_Title = "Novice Quester";
if (Quest_Count > 5) Hero_Title = "Established Quester";
if (Quest_Count > 10) Hero_Title = "Talented Quester";
if (Quest_Count > 15) Hero_Title = "Elite Quester";
if (Quest_Count > 20) Hero_Title = "Champion Quester";
if (Quest_Count > 30) Hero_Title = "Adept Adventurer";
if (Quest_Count > 40) Hero_Title = "Established Adventurer";
if (Quest_Count > 50) Hero_Title = "Talented Adventurer";
if (Quest_Count > 75) Hero_Title = "Elite Adventurer";
if (Quest_Count > 100) Hero_Title = "Champion Adventurer";
if (Quest_Count > 150) Hero_Title = "Adept Hero";
if (Quest_Count > 200) Hero_Title = "Established Hero";
if (Quest_Count > 300) Hero_Title = "Talented Hero";
if (Quest_Count > 400) Hero_Title = "Elite Hero";
if (Quest_Count > 500) Hero_Title = "Champion Hero";
if (Quest_Count > 600) Hero_Title = "Hero of the Realm";
if (Quest_Count > 700) Hero_Title = "Protector of the Realm";
if (Quest_Count > 800) Hero_Title = "Legendary Adventurer";
if (Quest_Count > 900) Hero_Title = "Legendary Hero";
if (Quest_Count > 1000) Hero_Title = "Legendary Champion";
string sRace_Aberration = "RACIAL_TYPE_ABERRATION";
string sRace_Animal= "RACIAL_TYPE_ANIMAL";
string sRace_Beast = "RACIAL_TYPE_BEAST";
string sRace_Construct = "RACIAL_TYPE_CONSTRUCT";
string sRace_Dragon = "RACIAL_TYPE_DRAGON";
string sRace_Elemental = "RACIAL_TYPE_ELEMENTAL";
string sRace_Fey = "RACIAL_TYPE_FEY";
string sRace_Giant = "RACIAL_TYPE_GIANT";
string sRace_Goblin = "RACIAL_TYPE_HUMANOID_GOBLINOID";
string sRace_Monstrous = "RACIAL_TYPE_HUMANOID_MONSTROUS";
string sRace_Orc = "RACIAL_TYPE_HUMANOID_ORC";
string sRace_Reptile = "RACIAL_TYPE_HUMANOID_REPTILIAN";
string sRace_MagicalBeast = "RACIAL_TYPE_MAGICAL_BEAST";
string sRace_Ooze = "RACIAL_TYPE_OOZE";
string sRace_Outsider = "RACIAL_TYPE_OUTSIDER";
string sRace_Shapechanger = "RACIAL_TYPE_SHAPECHANGER";
string sRace_Undead = "RACIAL_TYPE_UNDEAD";
string sRace_Vermin = "RACIAL_TYPE_VERMIN";
int nRace_Aberration = GetLocalInt(oTome, sRace_Aberration);
int nRace_Animal = GetLocalInt(oTome, sRace_Animal);
int nRace_Beast = GetLocalInt(oTome, sRace_Beast);
int nRace_Construct = GetLocalInt(oTome, sRace_Construct);
int nRace_Dragon = GetLocalInt(oTome, sRace_Dragon);
int nRace_Elemental = GetLocalInt(oTome, sRace_Elemental);
int nRace_Fey = GetLocalInt(oTome, sRace_Fey);
int nRace_Giant = GetLocalInt(oTome, sRace_Giant);
int nRace_Goblin = GetLocalInt(oTome, sRace_Goblin);
int nRace_Monstrous = GetLocalInt(oTome, sRace_Monstrous);
int nRace_Orc = GetLocalInt(oTome, sRace_Orc);
int nRace_Reptile = GetLocalInt(oTome, sRace_Reptile);
int nRace_MagicalBeast = GetLocalInt(oTome, sRace_MagicalBeast);
int nRace_Ooze = GetLocalInt(oTome, sRace_Ooze);
int nRace_Outsider = GetLocalInt(oTome, sRace_Outsider);
int nRace_Shapechanger = GetLocalInt(oTome, sRace_Shapechanger);
int nRace_Undead = GetLocalInt(oTome, sRace_Undead);
int nRace_Vermin = GetLocalInt(oTome, sRace_Vermin);
int nTotal_Kills = nRace_Vermin + nRace_Undead + nRace_Shapechanger + nRace_Outsider + nRace_Ooze +
nRace_MagicalBeast + nRace_Reptile + nRace_Orc + nRace_Monstrous + nRace_Goblin +
nRace_Giant + nRace_Fey + nRace_Elemental + nRace_Dragon + nRace_Construct +
nRace_Beast + nRace_Animal + nRace_Aberration;
string sTotal_Kills = IntToString(nTotal_Kills);
sRace_Aberration = IntToString(nRace_Aberration);
sRace_Animal= IntToString(nRace_Animal);
sRace_Beast = IntToString(nRace_Beast);
sRace_Construct = IntToString(nRace_Construct);
sRace_Dragon = IntToString(nRace_Dragon);
sRace_Elemental = IntToString(nRace_Elemental);
sRace_Fey = IntToString(nRace_Fey);
sRace_Giant = IntToString(nRace_Giant);
sRace_Goblin = IntToString(nRace_Goblin);
sRace_Monstrous = IntToString(nRace_Monstrous);
sRace_Orc = IntToString(nRace_Orc);
sRace_Reptile = IntToString(nRace_Reptile);
sRace_MagicalBeast = IntToString(nRace_MagicalBeast);
sRace_Ooze = IntToString(nRace_Ooze);
sRace_Outsider = IntToString(nRace_Outsider);
sRace_Shapechanger = IntToString(nRace_Shapechanger);
sRace_Undead = IntToString(nRace_Undead);
sRace_Vermin = IntToString(nRace_Vermin);
//////////////////////////////////////////////////////
// Output starts here
/////////////////////////////////////////////////////
SendMessageToPC(oPC," **** Tome of Testament ****");
SendMessageToPC(oPC,"");
SendMessageToPC(oPC,"Fame (Everclear) : " + sFame_Everclear);
SendMessageToPC(oPC,"Total Quests Completed : " + sQuest_Count);
SendMessageToPC(oPC,"Hero Status : " + Hero_Title);
SendMessageToPC(oPC," ");
SendMessageToPC(oPC,"**** Kill Totals ****");
SendMessageToPC(oPC,"Aberration Slain : " + sRace_Aberration);
SendMessageToPC(oPC,"Animals Slain : " + sRace_Animal);
SendMessageToPC(oPC,"Beasts Slain : " + sRace_Beast);
SendMessageToPC(oPC,"Contructs Slain : " + sRace_Construct);
SendMessageToPC(oPC,"Dragons Slain : " + sRace_Dragon);
SendMessageToPC(oPC,"Elementals Slain : " + sRace_Elemental);
SendMessageToPC(oPC,"Fey Slain : " + sRace_Fey);
SendMessageToPC(oPC,"Giants Slain : " + sRace_Giant);
SendMessageToPC(oPC,"Goblins Slain : " + sRace_Goblin);
SendMessageToPC(oPC,"Monstrous Slain : " + sRace_Monstrous);
SendMessageToPC(oPC,"Orcs Slain : " + sRace_Orc);
SendMessageToPC(oPC,"Reptiles Slain : " + sRace_Reptile);
SendMessageToPC(oPC,"Magical Beasts Slain : " + sRace_MagicalBeast);
SendMessageToPC(oPC,"Oozes Slain : " + sRace_Ooze);
SendMessageToPC(oPC,"Shapechangers Slain : " + sRace_Shapechanger);
SendMessageToPC(oPC,"Undead Slain : " + sRace_Undead);
SendMessageToPC(oPC,"Vermin Slain : " + sRace_Vermin);
SendMessageToPC(oPC," ");
SendMessageToPC(oPC,"Total Slain : " + sTotal_Kills);
}