Added Skullkeep's dynamic loot generation system
Added Skullkeep's PRC8 compatible dynamic loot generation system. Full compile. Updated release archive.
This commit is contained in:
@@ -44,6 +44,7 @@ const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
|
||||
#include "ms_name_inc"
|
||||
#include "x2_inc_switches"
|
||||
|
||||
|
||||
void Embiggen(object oNPC, float fIncrease);
|
||||
|
||||
void Embiggen(object oNPC, float fIncrease)
|
||||
@@ -597,6 +598,7 @@ void main()
|
||||
|
||||
//:: Set or Randomize name
|
||||
ms_Nomenclature(OBJECT_SELF);
|
||||
|
||||
|
||||
//:: Post Spawn event requested
|
||||
if (nSpecEvent == 2 || nSpecEvent == 3)
|
||||
|
7
_module/nss/inc_colorstring.nss
Normal file
7
_module/nss/inc_colorstring.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
const string COLORTOKEN =" ##################$%&'()*+,-./0123456789:;;==?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[]^_`abcdefghijklmnopqrstuvwxyz{|}~~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
|
||||
string ColorString(string sText, int nRed=255, int nGreen=255, int nBlue=255)
|
||||
{
|
||||
return "<c" + GetSubString(COLORTOKEN, nRed, 1) + GetSubString(COLORTOKEN, nGreen, 1) + GetSubString(COLORTOKEN, nBlue, 1) + ">" + sText + "</c>";
|
||||
}
|
||||
|
228
_module/nss/inc_itm_appear.nss
Normal file
228
_module/nss/inc_itm_appear.nss
Normal file
@@ -0,0 +1,228 @@
|
||||
//:://////////////////////////////////////////////
|
||||
// Common Loot Generator Script
|
||||
// Created By: Scott Milliorn
|
||||
// Module - A Carpathian Nightmare
|
||||
// Date: June 13th, 2018
|
||||
//
|
||||
// Additional help with donation of code from Dorrian of Trials of Newcastle
|
||||
//
|
||||
// If any code is used from this script please give credit to both -
|
||||
// Milliorn of A Carpathian Nightmare
|
||||
// Dorrian of Trials of Newcastle
|
||||
//:://////////////////////////////////////////////
|
||||
#include "prc_x2_itemprop"
|
||||
|
||||
//:: Randomize the color of Weapons.
|
||||
void ColorWeapon(object oItem, int iBottom, int iMiddle ,int iTop, object oPC);
|
||||
|
||||
//:: Randomize the color of Armor. (By Dorrian & Milliorn)
|
||||
void ColorArmor(object oItem, int cloth1, int cloth2, int leather1, int leather2, int metal1, int metal2, object oPC);
|
||||
|
||||
//:: Randomize the appearance of Rings, Amulets & Belts.
|
||||
void ChangeRingAmuBelt(object oItem, int appearance, object oPC);
|
||||
|
||||
//:: Random Weapon parts.
|
||||
void ChangeWeaponAppearance(object oItem, int iBottom, int iMiddle ,int iTop, int iBottomC, int iMiddleC ,int iTopC, object oPC);
|
||||
|
||||
//:: Random Helm & Cloak color and/or appearance.
|
||||
void ColorHelmClk(object oItem, int cloth1, int cloth2, int leather1, int leather2, int metal1, int metal2, int appearance, object oPC);
|
||||
|
||||
//:: Random Armor parts.
|
||||
void ChangeArmor(object oItem,
|
||||
int iRandomShoulder,
|
||||
int iRandomBicep,
|
||||
int iRandomForearm,
|
||||
int iRandomHand,
|
||||
int iRandomThigh,
|
||||
int iRandomShins,
|
||||
int iRandomFeet,
|
||||
int iRandomPelvis,
|
||||
int iRandomBelt,
|
||||
int iRandomNeck,
|
||||
int iRandomChest,
|
||||
int cloth1,
|
||||
int cloth2,
|
||||
int leather1,
|
||||
int leather2,
|
||||
int metal1,
|
||||
int metal2,
|
||||
object oPC);
|
||||
|
||||
void ChangeArmor(object oItem,
|
||||
int iRandomShoulder,
|
||||
int iRandomBicep,
|
||||
int iRandomForearm,
|
||||
int iRandomHand,
|
||||
int iRandomThigh,
|
||||
int iRandomShins,
|
||||
int iRandomFeet,
|
||||
int iRandomPelvis,
|
||||
int iRandomBelt,
|
||||
int iRandomNeck,
|
||||
int iRandomChest,
|
||||
int cloth1,
|
||||
int cloth2,
|
||||
int leather1,
|
||||
int leather2,
|
||||
int metal1,
|
||||
int metal2,
|
||||
object oPC)
|
||||
{
|
||||
object oCopyBox = GetObjectByTag("LOOT_GENERATOR");
|
||||
|
||||
object oCopy = CopyItem(oItem,oCopyBox, TRUE);
|
||||
DestroyObject(oItem); // remove old item
|
||||
object oCopy1 = CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RFOOT, iRandomFeet, TRUE);
|
||||
DestroyObject(oCopy); // remove old item
|
||||
object oCopy2 = CopyItemAndModify(oCopy1, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LFOOT, iRandomFeet, TRUE);
|
||||
DestroyObject(oCopy1); // remove old item
|
||||
object oCopy3 = CopyItemAndModify(oCopy2, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RSHIN, iRandomShins, TRUE);
|
||||
DestroyObject(oCopy2); // remove old item
|
||||
object oCopy4 = CopyItemAndModify(oCopy3, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LSHIN, iRandomShins, TRUE);
|
||||
DestroyObject(oCopy3); // remove old item
|
||||
object oCopy5 = CopyItemAndModify(oCopy4, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LTHIGH, iRandomThigh, TRUE);
|
||||
DestroyObject(oCopy4); // remove old item
|
||||
object oCopy6 = CopyItemAndModify(oCopy5, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RTHIGH, iRandomThigh, TRUE);
|
||||
DestroyObject(oCopy5); // remove old item
|
||||
object oCopy7 = CopyItemAndModify(oCopy6, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_PELVIS, iRandomPelvis, TRUE);
|
||||
DestroyObject(oCopy6); // remove old item
|
||||
object oCopy8 = CopyItemAndModify(oCopy7, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_TORSO, iRandomChest, TRUE);
|
||||
DestroyObject(oCopy7); // remove old item
|
||||
object oCopy9 = CopyItemAndModify(oCopy8, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_BELT, iRandomBelt, TRUE);
|
||||
DestroyObject(oCopy8); // remove old item
|
||||
object oCopy10 = CopyItemAndModify(oCopy9, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_NECK, iRandomNeck, TRUE);
|
||||
DestroyObject(oCopy9); // remove old item
|
||||
object oCopy11 = CopyItemAndModify(oCopy10, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RFOREARM, iRandomForearm, TRUE);
|
||||
DestroyObject(oCopy10); // remove old item
|
||||
object oCopy12 = CopyItemAndModify(oCopy11, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LFOREARM, iRandomForearm, TRUE);
|
||||
DestroyObject(oCopy11); // remove old item
|
||||
object oCopy13 = CopyItemAndModify(oCopy12, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RBICEP, iRandomBicep, TRUE);
|
||||
DestroyObject(oCopy12); // remove old item
|
||||
object oCopy14 = CopyItemAndModify(oCopy13, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LBICEP, iRandomBicep, TRUE);
|
||||
DestroyObject(oCopy13); // remove old item
|
||||
object oCopy15 = CopyItemAndModify(oCopy14, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RSHOULDER, iRandomShoulder, TRUE);
|
||||
DestroyObject(oCopy14); // remove old item
|
||||
object oCopy16 = CopyItemAndModify(oCopy15, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LSHOULDER, iRandomShoulder, TRUE);
|
||||
DestroyObject(oCopy15); // remove old item
|
||||
object oCopy17 = CopyItemAndModify(oCopy16, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RHAND, iRandomHand, TRUE);
|
||||
DestroyObject(oCopy16); // remove old item
|
||||
object oCopy18 = CopyItemAndModify(oCopy17, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LHAND, iRandomHand, TRUE);
|
||||
DestroyObject(oCopy17); // remove old item
|
||||
object oCopy19 = CopyItemAndModify(oCopy18, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH1, cloth1, TRUE);
|
||||
DestroyObject(oCopy18); // remove old item
|
||||
object oCopy20 = CopyItemAndModify(oCopy19, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH2, cloth2, TRUE);
|
||||
DestroyObject(oCopy19); // remove old item
|
||||
object oCopy21 = CopyItemAndModify(oCopy20, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER1, leather1, TRUE);
|
||||
DestroyObject(oCopy20); // remove old item
|
||||
object oCopy22 = CopyItemAndModify(oCopy21, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER2, leather2, TRUE);
|
||||
DestroyObject(oCopy21); // remove old item
|
||||
object oCopy23 = CopyItemAndModify(oCopy22, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL1, metal1, TRUE);
|
||||
DestroyObject(oCopy22); // remove old item
|
||||
object oCopy24 = CopyItemAndModify(oCopy23, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL2, metal2, TRUE);
|
||||
DestroyObject(oCopy23); // remove old item
|
||||
object oCopy25 = CopyItem(oCopy24,oPC, TRUE);
|
||||
DestroyObject(oCopy24); // remove old item
|
||||
|
||||
}
|
||||
|
||||
void ColorArmor(object oItem, int cloth1, int cloth2, int leather1, int leather2, int metal1, int metal2, object oPC)
|
||||
{
|
||||
object oCopyBox = GetObjectByTag("LOOT_GENERATOR");
|
||||
|
||||
object oCopy = CopyItem(oItem,oCopyBox, TRUE);
|
||||
DestroyObject(oItem); // remove old item
|
||||
object oCopy1 = CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH1, cloth1, TRUE);
|
||||
DestroyObject(oCopy); // remove old item
|
||||
object oCopy2 = CopyItemAndModify(oCopy1, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH2, cloth2, TRUE);
|
||||
DestroyObject(oCopy1); // remove old item
|
||||
object oCopy3 = CopyItemAndModify(oCopy2, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER1, leather1, TRUE);
|
||||
DestroyObject(oCopy2); // remove old item
|
||||
object oCopy4 = CopyItemAndModify(oCopy3, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER2, leather2, TRUE);
|
||||
DestroyObject(oCopy3); // remove old item
|
||||
object oCopy5 = CopyItemAndModify(oCopy4, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL1, metal1, TRUE);
|
||||
DestroyObject(oCopy4); // remove old item
|
||||
object oCopy6 = CopyItemAndModify(oCopy5, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL2, metal2, TRUE);
|
||||
DestroyObject(oCopy5); // remove old item
|
||||
object oCopy7 = CopyItem(oCopy6,oPC, TRUE);
|
||||
DestroyObject(oCopy6); // remove old item
|
||||
}
|
||||
|
||||
void ColorHelmClk(object oItem, int cloth1, int cloth2, int leather1, int leather2, int metal1, int metal2, int appearance, object oPC)
|
||||
{
|
||||
object oCopyBox = GetObjectByTag("LOOT_GENERATOR");
|
||||
|
||||
object oCopy = CopyItem(oItem,oCopyBox, TRUE);
|
||||
DestroyObject(oItem); // remove old item
|
||||
object oCopy1 = CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH1, cloth1, TRUE);
|
||||
DestroyObject(oCopy); // remove old item
|
||||
object oCopy2 = CopyItemAndModify(oCopy1, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH2, cloth2, TRUE);
|
||||
DestroyObject(oCopy1); // remove old item
|
||||
object oCopy3 = CopyItemAndModify(oCopy2, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER1, leather1, TRUE);
|
||||
DestroyObject(oCopy2); // remove old item
|
||||
object oCopy4 = CopyItemAndModify(oCopy3, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER2, leather2, TRUE);
|
||||
DestroyObject(oCopy3); // remove old item
|
||||
object oCopy5 = CopyItemAndModify(oCopy4, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL1, metal1, TRUE);
|
||||
DestroyObject(oCopy4); // remove old item
|
||||
object oCopy6 = CopyItemAndModify(oCopy5, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL2, metal2, TRUE);
|
||||
DestroyObject(oCopy5); // remove old item
|
||||
object oCopy7 = CopyItemAndModify(oCopy6, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, appearance, TRUE);
|
||||
DestroyObject(oCopy6); // remove old item
|
||||
object oCopy8 = CopyItem(oCopy7,oPC, TRUE);
|
||||
DestroyObject(oCopy7); // remove old item
|
||||
}
|
||||
|
||||
void ChangeRingAmuBelt(object oItem, int appearance, object oPC)
|
||||
{
|
||||
object oCopyBox = GetObjectByTag("LOOT_GENERATOR");
|
||||
|
||||
object oCopy = CopyItem(oItem,oCopyBox, TRUE);
|
||||
DestroyObject(oItem); // remove old item
|
||||
object oCopy1 = CopyItemAndModify(oCopy, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, appearance, TRUE);
|
||||
DestroyObject(oCopy); // remove old item
|
||||
object oCopy2 = CopyItem(oCopy1,oPC, TRUE);
|
||||
DestroyObject(oCopy1); // remove old item
|
||||
}
|
||||
|
||||
void ChangeWeaponAppearance(object oItem, int iBottom, int iMiddle ,int iTop, int iBottomC, int iMiddleC, int iTopC, object oPC)
|
||||
{
|
||||
object oCopyBox = GetObjectByTag("LOOT_GENERATOR");
|
||||
|
||||
object oCopy = CopyItem(oItem,oCopyBox, TRUE);
|
||||
DestroyObject(oItem); // remove old item
|
||||
object oCopy1 = CopyItemAndModify(oCopy, ITEM_APPR_TYPE_WEAPON_MODEL, ITEM_APPR_WEAPON_MODEL_BOTTOM, iBottom, TRUE);
|
||||
DestroyObject(oCopy); // remove old item
|
||||
object oCopy2 = CopyItemAndModify(oCopy1, ITEM_APPR_TYPE_WEAPON_MODEL, ITEM_APPR_WEAPON_MODEL_MIDDLE, iMiddle, TRUE);
|
||||
DestroyObject(oCopy1); // remove old item
|
||||
object oCopy3 = CopyItemAndModify(oCopy2, ITEM_APPR_TYPE_WEAPON_MODEL, ITEM_APPR_WEAPON_MODEL_TOP, iTop, TRUE);
|
||||
DestroyObject(oCopy2); // remove old item
|
||||
object oCopy4 = CopyItemAndModify(oCopy3, ITEM_APPR_TYPE_WEAPON_COLOR, ITEM_APPR_WEAPON_COLOR_BOTTOM, iBottomC, TRUE);
|
||||
DestroyObject(oCopy3); // remove old item
|
||||
object oCopy5 = CopyItemAndModify(oCopy4, ITEM_APPR_TYPE_WEAPON_COLOR, ITEM_APPR_WEAPON_COLOR_MIDDLE, iMiddleC, TRUE);
|
||||
DestroyObject(oCopy4); // remove old item
|
||||
object oCopy6 = CopyItemAndModify(oCopy5, ITEM_APPR_TYPE_WEAPON_COLOR, ITEM_APPR_WEAPON_COLOR_TOP, iTopC, TRUE);
|
||||
DestroyObject(oCopy5); // remove old item
|
||||
object oCopy7 = CopyItem(oCopy6,oPC, TRUE);
|
||||
DestroyObject(oCopy6); // remove old item
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ColorWeapon(object oItem, int iBottom, int iMiddle ,int iTop, object oPC)
|
||||
{
|
||||
object oCopyBox = GetObjectByTag("LOOT_GENERATOR");
|
||||
|
||||
object oCopy = CopyItem(oItem,oCopyBox, TRUE);
|
||||
DestroyObject(oItem); // remove old item
|
||||
object oCopy1 = CopyItemAndModify(oCopy, ITEM_APPR_TYPE_WEAPON_COLOR, ITEM_APPR_WEAPON_COLOR_BOTTOM, iBottom, TRUE);
|
||||
DestroyObject(oCopy); // remove old item
|
||||
object oCopy2 = CopyItemAndModify(oCopy1, ITEM_APPR_TYPE_WEAPON_COLOR, ITEM_APPR_WEAPON_COLOR_MIDDLE, iMiddle, TRUE);
|
||||
DestroyObject(oCopy1); // remove old item
|
||||
object oCopy3 = CopyItemAndModify(oCopy2, ITEM_APPR_TYPE_WEAPON_COLOR, ITEM_APPR_WEAPON_COLOR_TOP, iTop, TRUE);
|
||||
DestroyObject(oCopy2); // remove old item
|
||||
object oCopy4 = CopyItem(oCopy3,oPC, TRUE);
|
||||
DestroyObject(oCopy3); // remove old item
|
||||
}
|
||||
|
||||
//::void main () {}
|
||||
|
||||
|
@@ -32,6 +32,8 @@
|
||||
#include "x2_inc_switches"
|
||||
#include "nwnx_webhook"
|
||||
#include "nwnx_util"
|
||||
#include "sd_lootsystem"
|
||||
#include "ms_name_inc"
|
||||
|
||||
const int EVENT_USER_DEFINED_PRESPAWN = 1510;
|
||||
const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
|
||||
@@ -85,6 +87,12 @@ void main()
|
||||
// Execute default OnSpawn script.
|
||||
ExecuteScript("nw_c2_default9", OBJECT_SELF);
|
||||
|
||||
//:: Set or Randomize name
|
||||
ms_Nomenclature(OBJECT_SELF);
|
||||
|
||||
//:: Testing OnSpawn loot system.
|
||||
sd_droploot(OBJECT_SELF, OBJECT_SELF);
|
||||
|
||||
|
||||
//Post Spawn event requeste
|
||||
if (nSpecEvent == 2 || nSpecEvent == 3)
|
||||
|
249
_module/nss/pqj_inc.nss
Normal file
249
_module/nss/pqj_inc.nss
Normal file
@@ -0,0 +1,249 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Persistent Quests & Journal Entries / Beta
|
||||
//:: pqj_inc
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
|
||||
Persistent Quests and Journal Entries
|
||||
|
||||
This is a compact set of scripts (4 public functions, 2 private functions) to help you get
|
||||
a persistent journal and to generally manage quests without much overhead.
|
||||
|
||||
it works like this:
|
||||
|
||||
you prepare your journal in the toolbox, assigning proper tags/ids, then you normally use
|
||||
AddJournalQuestEntry() and RemoveJournalQuestEntry() to manage them via scripting.
|
||||
|
||||
now, you just have to use AddPersistentJournalQuestEntry() and RemovePersistentJournalQuestEntry()
|
||||
with exact the same parameters (bAllPlayer, bAllPartyMembers and bAllowOverrideHigher still work like
|
||||
in the original bioware functions). this means no restrictions, it's fully transparent.
|
||||
|
||||
now add the following line of code to your Module OnClientEnter script (don't forget to include this script):
|
||||
RebuildJournalQuestEntries(GetEnteringObject());
|
||||
|
||||
that's all, now you have a persistent journal... you can basically use CTRL-R to find/replace the
|
||||
original functions with the persistent ones and add the OnClientEnter code.
|
||||
|
||||
furthermore, you can use RetrieveQuestState() to get the current state of a
|
||||
quest for the specified player/quest-tag. this means you can manage your conversations with
|
||||
this function and control quest-flow. you won't need to store additional LocalInts somewhere, just
|
||||
use the DB information.
|
||||
|
||||
technical blabla:
|
||||
|
||||
minimized DB usage: stores all quest states in a single string
|
||||
|
||||
i'm using a combo of tokenized + padded string to get maximum parsing efficiency.
|
||||
tokenized: i can find & change a single quest entry with only a few string commands
|
||||
padded: i can browse through a large string (100+ quest entries) with minimal need of string manipulation
|
||||
so this won't slow down your server during journal rebuilds even with tons of quests
|
||||
|
||||
this is beta code and pretty much un-optimized ..still needs some bug hunting
|
||||
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Knat
|
||||
//:: Created On: 19.06.2003
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
// database filename
|
||||
const string PQJ_DATABASE = "JOURNALS";
|
||||
// database fieldname
|
||||
const string PQJ_PLAYER_VARNAME = "QUESTJOURNAL";
|
||||
|
||||
//
|
||||
//void main (){}
|
||||
//
|
||||
//
|
||||
// transparent wrapper to AddJournalQuestEntry
|
||||
// use this function instead of the original one to store quest/journal data
|
||||
// persistently using the bio DB. all function parameters work similar to the original function
|
||||
//
|
||||
// Add a journal quest entry to oCreature.
|
||||
// - szPlotID: the plot identifier used in the toolset's Journal Editor
|
||||
// - nState: the state of the plot as seen in the toolset's Journal Editor
|
||||
// - oCreature
|
||||
// - bAllPartyMembers: If this is TRUE, the entry will show up in the journal of
|
||||
// everyone in the party
|
||||
// - bAllPlayers: If this is TRUE, the entry will show up in the journal of
|
||||
// everyone in the world
|
||||
// - bAllowOverrideHigher: If this is TRUE, you can set the state to a lower
|
||||
// number than the one it is currently on
|
||||
void AddPersistentJournalQuestEntry(string szPlotID, int nState, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE, int bAllowOverrideHigher=FALSE);
|
||||
|
||||
// transparent wrapper to RemoveJournalQuestEntry()
|
||||
// use this function instead of the original one to remove quest/journal data
|
||||
// persistently using the bio DB. all function parameters work similar to the original function
|
||||
//
|
||||
// Remove a journal quest entry from oCreature.
|
||||
// - szPlotID: the plot identifier used in the toolset's Journal Editor
|
||||
// - oCreature
|
||||
// - bAllPartyMembers: If this is TRUE, the entry will be removed from the
|
||||
// journal of everyone in the party
|
||||
// - bAllPlayers: If this is TRUE, the entry will be removed from the journal of
|
||||
// everyone in the world
|
||||
void RemovePersistentJournalQuestEntry(string szPlotID, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE);
|
||||
|
||||
// use this function to rebuild the journal on oCreature using the bio DB
|
||||
// a good place is the Module OnClientEnter() event
|
||||
void RebuildJournalQuestEntries(object oCreature);
|
||||
|
||||
// retrieve persistent quest state from the DB
|
||||
// - szPlotID: the plot identifier used in the toolset's Journal Editor
|
||||
int RetrieveQuestState(string szPlotID, object oCreature);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void RebuildJournalQuestEntries(object oCreature)
|
||||
{
|
||||
if(GetIsPC(oCreature))
|
||||
{
|
||||
string sEntries = GetCampaignString(PQJ_DATABASE,PQJ_PLAYER_VARNAME,oCreature);
|
||||
int i, nCount = GetStringLength(sEntries) / 44;
|
||||
|
||||
string sQuest;
|
||||
for(i=0;i < nCount;i++)
|
||||
{
|
||||
// get quest
|
||||
sQuest = GetSubString(sEntries,(i*44),32);
|
||||
// remove padding
|
||||
sQuest = GetStringLeft(sQuest, FindSubString(sQuest, " "));
|
||||
// add journal entry
|
||||
AddJournalQuestEntry(sQuest, StringToInt(GetSubString(sEntries,(i*44) + 33,8)), oCreature, FALSE, FALSE, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int RetrieveQuestState(string szPlotID, object oCreature)
|
||||
{
|
||||
// retrieve all quest entries
|
||||
string sEntries = GetCampaignString(PQJ_DATABASE,PQJ_PLAYER_VARNAME,oCreature);
|
||||
// get quest we search for and add padding
|
||||
string sQuest = (GetStringLength(szPlotID) < 32) ? szPlotID + GetStringLeft(" ",32 - GetStringLength(szPlotID)) : GetStringLeft(szPlotID,32);
|
||||
|
||||
// find target quest
|
||||
int nPos = FindSubString(sEntries, sQuest + ">");
|
||||
|
||||
if( nPos != -1) // success ?? get & return value
|
||||
return StringToInt(GetStringLeft(GetStringRight(sEntries,GetStringLength(sEntries)-nPos-GetStringLength(sQuest)-1),10));
|
||||
|
||||
// quest not started yet
|
||||
return 0;
|
||||
}
|
||||
|
||||
void StoreQuestEntry(string szPlotID, int nState, object oCreature, int bAllowOverrideHigher=FALSE)
|
||||
{
|
||||
// retrieve all quest entries
|
||||
string sEntries = GetCampaignString(PQJ_DATABASE,PQJ_PLAYER_VARNAME,oCreature);
|
||||
|
||||
// pad quest
|
||||
string sQuest = (GetStringLength(szPlotID) < 32) ? szPlotID + GetStringLeft(" ",32 - GetStringLength(szPlotID)) : GetStringLeft(szPlotID,32);
|
||||
// pad state
|
||||
string sState = IntToString(nState);
|
||||
sState = (GetStringLength(sState) < 10) ? sState + GetStringLeft(" ",10 - GetStringLength(sState)) : GetStringLeft(sState,10);
|
||||
|
||||
// find target quest
|
||||
int nPos = FindSubString(sEntries, sQuest + ">");
|
||||
|
||||
if( nPos != -1) // success ?
|
||||
{
|
||||
|
||||
// check for override flag
|
||||
if(!bAllowOverrideHigher) // new state < old state ? return
|
||||
if(nState < StringToInt(GetStringRight(sEntries,GetStringLength(sEntries)-nPos-GetStringLength(sQuest)-1)))
|
||||
return;
|
||||
|
||||
// replace old quest state with new one
|
||||
string sL = GetStringLeft(sEntries, nPos + GetStringLength(sQuest) + 1);
|
||||
sEntries = sL + sState + GetStringRight(sEntries, GetStringLength(sEntries) - GetStringLength(sL) - 10);
|
||||
}
|
||||
else // add quest
|
||||
sEntries += sQuest + ">" + sState + "|";
|
||||
|
||||
// store quest entries
|
||||
SetCampaignString(PQJ_DATABASE,PQJ_PLAYER_VARNAME,sEntries,oCreature);
|
||||
}
|
||||
|
||||
void DeleteQuestEntry(string szPlotID, object oCreature)
|
||||
{
|
||||
// retrieve all quest entries
|
||||
string sEntries = GetCampaignString(PQJ_DATABASE,PQJ_PLAYER_VARNAME,oCreature);
|
||||
// pad quest
|
||||
string sQuest = (GetStringLength(szPlotID) < 32) ? szPlotID + GetStringLeft(" ",32 - GetStringLength(szPlotID)) : GetStringLeft(szPlotID,32);
|
||||
// find target quest
|
||||
int nPos = FindSubString(sEntries, sQuest + ">");
|
||||
|
||||
if( nPos != -1) // success ?
|
||||
{
|
||||
|
||||
// replace old quest state with new one
|
||||
string sL = GetStringLeft(sEntries, nPos);
|
||||
sEntries = sL + GetStringRight(sEntries, GetStringLength(sEntries) - GetStringLength(sL) - 44);
|
||||
|
||||
// store quest entries
|
||||
SetCampaignString(PQJ_DATABASE,PQJ_PLAYER_VARNAME,sEntries,oCreature);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RemovePersistentJournalQuestEntry(string szPlotID, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE)
|
||||
{
|
||||
RemoveJournalQuestEntry(szPlotID, oCreature, bAllPartyMembers, bAllPlayers);
|
||||
// store data
|
||||
if(bAllPlayers)
|
||||
{
|
||||
// all players
|
||||
object oPC = GetFirstPC();
|
||||
while(GetIsObjectValid(oPC))
|
||||
{
|
||||
if(GetIsPC(oPC)) DeleteQuestEntry(szPlotID, oPC);
|
||||
oPC = GetNextPC();
|
||||
}
|
||||
}
|
||||
else if(bAllPartyMembers)
|
||||
{
|
||||
// whole group
|
||||
object oPartyMember = GetFirstFactionMember(oCreature, TRUE);
|
||||
while (GetIsObjectValid(oPartyMember))
|
||||
{
|
||||
DeleteQuestEntry(szPlotID, oPartyMember);
|
||||
oPartyMember = GetNextFactionMember(oCreature, TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// player only
|
||||
DeleteQuestEntry(szPlotID, oCreature);
|
||||
}
|
||||
}
|
||||
|
||||
void AddPersistentJournalQuestEntry(string szPlotID, int nState, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE, int bAllowOverrideHigher=FALSE)
|
||||
{
|
||||
AddJournalQuestEntry(szPlotID, nState, oCreature, bAllPartyMembers, bAllPlayers, bAllowOverrideHigher);
|
||||
// store data
|
||||
if(bAllPlayers)
|
||||
{
|
||||
// all players
|
||||
object oPC = GetFirstPC();
|
||||
while(GetIsObjectValid(oPC))
|
||||
{
|
||||
if(GetIsPC(oPC)) StoreQuestEntry(szPlotID, nState, oPC, bAllowOverrideHigher);
|
||||
oPC = GetNextPC();
|
||||
}
|
||||
}
|
||||
else if(bAllPartyMembers)
|
||||
{
|
||||
//SendMessageToPC(oCreature, "PARTY");
|
||||
object oPartyMember = GetFirstFactionMember(oCreature, TRUE);
|
||||
while (GetIsObjectValid(oPartyMember))
|
||||
{
|
||||
StoreQuestEntry(szPlotID, nState, oPartyMember, bAllowOverrideHigher);
|
||||
oPartyMember = GetNextFactionMember(oCreature, TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StoreQuestEntry(szPlotID, nState, oCreature, bAllowOverrideHigher);
|
||||
}
|
||||
}
|
@@ -10,6 +10,9 @@
|
||||
#include "nw_i0_plot"
|
||||
#include "rd_level"
|
||||
#include "inc_sqlite_time"
|
||||
#include "inc_debug"
|
||||
#include "prc_inc_racial"
|
||||
#include "sd_lootsystem"
|
||||
|
||||
void ReallyEquipItemInSlot(object oNPC, object oItem, int nSlot);
|
||||
|
||||
@@ -31,6 +34,7 @@ void main()
|
||||
int nTotalPCs;
|
||||
int nTotalPCLevel;
|
||||
int nAveragePCLevel;
|
||||
int iRacial = GetRacialType(OBJECT_SELF);
|
||||
int nCommoner = GetLevelByClass(CLASS_TYPE_COMMONER, OBJECT_SELF);
|
||||
|
||||
string sCurrentDate = SQLite_GetSystemDate();
|
||||
@@ -39,7 +43,22 @@ void main()
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
object oSkelly;
|
||||
object oPC = GetFirstObjectInArea(oArea);
|
||||
|
||||
|
||||
//:: Testing OnSpawn loot system.
|
||||
if (iRacial == RACIAL_TYPE_ANIMAL ||
|
||||
iRacial == RACIAL_TYPE_BEAST ||
|
||||
iRacial == RACIAL_TYPE_CONSTRUCT ||
|
||||
iRacial == RACIAL_TYPE_OOZE ||
|
||||
iRacial == RACIAL_TYPE_PLANT ||
|
||||
iRacial == RACIAL_TYPE_VERMIN)
|
||||
{
|
||||
if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure", GetFirstPC(), FALSE);}
|
||||
}
|
||||
else
|
||||
{
|
||||
sd_droploot(OBJECT_SELF, OBJECT_SELF);
|
||||
}
|
||||
|
||||
//:: Get average PC level for area
|
||||
//:: Cycle through PCs in Area
|
||||
|
||||
|
10
_module/nss/sd_area_purge.nss
Normal file
10
_module/nss/sd_area_purge.nss
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "sd_reset_inc"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetExitingObject();
|
||||
if (!(GetIsPC(oPC)))return;
|
||||
|
||||
AREA_CLEAR(oPC);
|
||||
|
||||
}
|
100
_module/nss/sd_chest_lever.nss
Normal file
100
_module/nss/sd_chest_lever.nss
Normal file
@@ -0,0 +1,100 @@
|
||||
void SD_NAMECHEST(object oChest, string sChestRange)
|
||||
{
|
||||
SetName(oChest, sChestRange);
|
||||
}
|
||||
|
||||
void SPAWN_CHESTS(int iLevel)
|
||||
{
|
||||
|
||||
object oMod = GetModule();
|
||||
object oPC = GetFirstPC();
|
||||
|
||||
int iWC = iLevel+0;
|
||||
int iSC = iLevel+5;
|
||||
int iAC = iLevel+10;
|
||||
int iMC = iLevel+15;
|
||||
int iGC = iLevel+20;
|
||||
int iGM = iLevel+25;
|
||||
|
||||
string sLevel = IntToString(iLevel);
|
||||
|
||||
|
||||
string sWLev = IntToString(iWC);
|
||||
string sSLev = IntToString(iSC);
|
||||
string sALev = IntToString(iAC);
|
||||
string sMLev = IntToString(iMC);
|
||||
string sGLev = IntToString(iGC);
|
||||
string sGMLev = IntToString(iGM);
|
||||
|
||||
|
||||
object oWP1 = GetWaypointByTag("sd_weap");
|
||||
object oWP2 = GetWaypointByTag("sd_shield");
|
||||
object oWP3 = GetWaypointByTag("sd_arm");
|
||||
object oWP4 = GetWaypointByTag("sd_magi");
|
||||
object oWP5 = GetWaypointByTag("sd_gloves");
|
||||
object oWP6 = GetWaypointByTag("sd_gems");
|
||||
|
||||
effect eDiss = EffectVisualEffect(VFX_FNF_DISPEL_GREATER);
|
||||
effect eApp = EffectVisualEffect(VFX_FNF_LOS_HOLY_10);
|
||||
|
||||
object oCH1 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP1), FALSE, sWLev);
|
||||
DelayCommand(0.1, SD_NAMECHEST(oCH1, "Weapon Chest: Range "+sLevel));
|
||||
DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eApp, oCH1));
|
||||
object oCH2 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP2), FALSE, sSLev);
|
||||
DelayCommand(0.1, SD_NAMECHEST(oCH2, "Shield Chest: Range "+sLevel));
|
||||
DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eApp, oCH2));
|
||||
object oCH3 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP3), FALSE, sALev);
|
||||
DelayCommand(0.1, SD_NAMECHEST(oCH3, "Armor Chest: Range "+sLevel));
|
||||
DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eApp, oCH3));
|
||||
object oCH4 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP4), FALSE, sMLev);
|
||||
DelayCommand(0.1, SD_NAMECHEST(oCH4, "Mag Item Chest: Range "+sLevel));
|
||||
DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eApp, oCH4));
|
||||
object oCH5 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP5), FALSE, sGLev);
|
||||
DelayCommand(0.1, SD_NAMECHEST(oCH5, "Monk Gloves Chest: Range "+sLevel));
|
||||
DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eApp, oCH5));
|
||||
object oCH6 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP6), FALSE, sGMLev);
|
||||
DelayCommand(0.1, SD_NAMECHEST(oCH6, "Gem Chest: Range "+sLevel));
|
||||
DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eApp, oCH6));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oMod = GetModule();
|
||||
object oPC = GetFirstPC();
|
||||
int iLevel = GetLocalInt(oMod, "range");
|
||||
|
||||
++iLevel;
|
||||
|
||||
if (iLevel>=6)iLevel=1;
|
||||
|
||||
SetLocalInt(oMod, "range", iLevel);
|
||||
|
||||
|
||||
effect eDiss = EffectVisualEffect(VFX_FNF_DISPEL_GREATER);
|
||||
effect eApp = EffectVisualEffect(VFX_FNF_LOS_HOLY_10);
|
||||
|
||||
int iSafe = GetLocalInt(OBJECT_SELF, "switched");
|
||||
if (iSafe==1){FloatingTextStringOnCreature("You must wait 5 seconds", oPC);return;}
|
||||
|
||||
AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE));
|
||||
AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
|
||||
|
||||
SetLocalInt(OBJECT_SELF, "switched", 1);
|
||||
DelayCommand(6.0, SetLocalInt(OBJECT_SELF, "switched", 0));
|
||||
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
object oItem = GetFirstObjectInArea(oArea);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (GetObjectType(oItem)==OBJECT_TYPE_PLACEABLE &&
|
||||
GetHasInventory(oItem) && GetName(oItem)!="Socketed Items")
|
||||
{
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDiss, oItem);
|
||||
DestroyObject(oItem, 0.2f);
|
||||
}
|
||||
oItem = GetNextObjectInArea(oArea);
|
||||
}
|
||||
|
||||
|
||||
DelayCommand(4.0, SPAWN_CHESTS(iLevel));
|
||||
}
|
62
_module/nss/sd_chest_loot.nss
Normal file
62
_module/nss/sd_chest_loot.nss
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "sd_lootsystem"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastOpenedBy();
|
||||
string sTag = GetTag(OBJECT_SELF);
|
||||
int iLoot = StringToInt(sTag);
|
||||
|
||||
switch (iLoot)
|
||||
{
|
||||
case 1: DropWeapon(oPC, OBJECT_SELF, 1, 0, 1); break;
|
||||
case 2: DropWeapon(oPC, OBJECT_SELF, 2, 0, 1); break;
|
||||
case 3: DropWeapon(oPC, OBJECT_SELF, 3, 0, 1); break;
|
||||
case 4: DropWeapon(oPC, OBJECT_SELF, 4, 0, 1); break;
|
||||
case 5: DropWeapon(oPC, OBJECT_SELF, 5, 0, 1); break;
|
||||
|
||||
case 6: DropShield(oPC, OBJECT_SELF, 1, 0, 1); break;
|
||||
case 7: DropShield(oPC, OBJECT_SELF, 2, 0, 1); break;
|
||||
case 8: DropShield(oPC, OBJECT_SELF, 3, 0, 1); break;
|
||||
case 9: DropShield(oPC, OBJECT_SELF, 4, 0, 1); break;
|
||||
case 10: DropShield(oPC, OBJECT_SELF, 5, 0, 1); break;
|
||||
|
||||
case 11: DropArmor(oPC, OBJECT_SELF, 1, 0, 1); break;
|
||||
case 12: DropArmor(oPC, OBJECT_SELF, 2, 0, 1); break;
|
||||
case 13: DropArmor(oPC, OBJECT_SELF, 3, 0, 1); break;
|
||||
case 14: DropArmor(oPC, OBJECT_SELF, 4, 0, 1); break;
|
||||
case 15: DropArmor(oPC, OBJECT_SELF, 5, 0, 1); break;
|
||||
|
||||
case 16: DropMagicItem(oPC, OBJECT_SELF, 1, 0, 1); break;
|
||||
case 17: DropMagicItem(oPC, OBJECT_SELF, 2, 0, 1); break;
|
||||
case 18: DropMagicItem(oPC, OBJECT_SELF, 3, 0, 1); break;
|
||||
case 19: DropMagicItem(oPC, OBJECT_SELF, 4, 0, 1); break;
|
||||
case 20: DropMagicItem(oPC, OBJECT_SELF, 5, 0, 1); break;
|
||||
|
||||
case 21: DropMonkGloves(oPC, OBJECT_SELF, 1, 0, 1); break;
|
||||
case 22: DropMonkGloves(oPC, OBJECT_SELF, 2, 0, 1); break;
|
||||
case 23: DropMonkGloves(oPC, OBJECT_SELF, 3, 0, 1); break;
|
||||
case 24: DropMonkGloves(oPC, OBJECT_SELF, 4, 0, 1); break;
|
||||
case 25: DropMonkGloves(oPC, OBJECT_SELF, 5, 0, 1); break;
|
||||
|
||||
case 26: DropGem(oPC, OBJECT_SELF, 1); break;
|
||||
case 27: DropGem(oPC, OBJECT_SELF, 2); break;
|
||||
case 28: DropGem(oPC, OBJECT_SELF, 3); break;
|
||||
case 29: DropGem(oPC, OBJECT_SELF, 4); break;
|
||||
case 30: DropGem(oPC, OBJECT_SELF, 5); break;
|
||||
|
||||
case 31: {
|
||||
DropWeapon(oPC, OBJECT_SELF, 1, 100, 1);
|
||||
DropShield(oPC, OBJECT_SELF, 1, 100, 1);
|
||||
DropArmor(oPC, OBJECT_SELF, 1, 100, 1);
|
||||
DropMagicItem(oPC, OBJECT_SELF, 1, 100, 1);
|
||||
DropMonkGloves(oPC, OBJECT_SELF, 1, 100, 1);}break;
|
||||
}
|
||||
|
||||
object oItem = GetFirstItemInInventory(OBJECT_SELF);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (GetIdentified(oItem)==FALSE)SetIdentified(oItem, TRUE);
|
||||
oItem = GetNextItemInInventory(OBJECT_SELF);
|
||||
}
|
||||
|
||||
}
|
56
_module/nss/sd_chestspwn_ent.nss
Normal file
56
_module/nss/sd_chestspwn_ent.nss
Normal file
@@ -0,0 +1,56 @@
|
||||
void SD_NAMECHEST(object oChest, string sChestRange)
|
||||
{
|
||||
SetName(oChest, sChestRange);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
object oMod = GetModule();
|
||||
object oPC = GetFirstPC();
|
||||
object oEnter = GetEnteringObject();
|
||||
|
||||
if (oEnter!=oPC)return;
|
||||
|
||||
int iLevel = 1;
|
||||
|
||||
SetLocalInt(oMod, "range", 1);
|
||||
|
||||
string sLevel = IntToString(iLevel);
|
||||
|
||||
int iWC = iLevel+0;
|
||||
int iSC = iLevel+5;
|
||||
int iAC = iLevel+10;
|
||||
int iMC = iLevel+15;
|
||||
int iGC = iLevel+20;
|
||||
int iGM = iLevel+25;
|
||||
|
||||
|
||||
string sWLev = IntToString(iWC);
|
||||
string sSLev = IntToString(iSC);
|
||||
string sALev = IntToString(iAC);
|
||||
string sMLev = IntToString(iMC);
|
||||
string sGLev = IntToString(iGC);
|
||||
string sGMLev = IntToString(iGM);
|
||||
|
||||
|
||||
object oWP1 = GetWaypointByTag("sd_weap");
|
||||
object oWP2 = GetWaypointByTag("sd_shield");
|
||||
object oWP3 = GetWaypointByTag("sd_arm");
|
||||
object oWP4 = GetWaypointByTag("sd_magi");
|
||||
object oWP5 = GetWaypointByTag("sd_gloves");
|
||||
object oWP6 = GetWaypointByTag("sd_gems");
|
||||
|
||||
object oCH1 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP1), FALSE, sWLev);
|
||||
DelayCommand(0.2, SD_NAMECHEST(oCH1, "Weapon Chest: Range "+sLevel));
|
||||
object oCH2 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP2), FALSE, sSLev);
|
||||
DelayCommand(0.2, SD_NAMECHEST(oCH2, "Shield Chest: Range "+sLevel));
|
||||
object oCH3 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP3), FALSE, sALev);
|
||||
DelayCommand(0.2, SD_NAMECHEST(oCH3, "Armor Chest: Range "+sLevel));
|
||||
object oCH4 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP4), FALSE, sMLev);
|
||||
DelayCommand(0.2, SD_NAMECHEST(oCH4, "Mag Item Chest: Range "+sLevel));
|
||||
object oCH5 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP5), FALSE, sGLev);
|
||||
DelayCommand(0.2, SD_NAMECHEST(oCH5, "Monk Gloves Chest: Range "+sLevel));
|
||||
object oCH6 = CreateObject(OBJECT_TYPE_PLACEABLE, "sd_lootchest", GetLocation(oWP6), FALSE, sGMLev);
|
||||
DelayCommand(0.2, SD_NAMECHEST(oCH6, "Gem Chest: Range "+sLevel));
|
||||
}
|
10
_module/nss/sd_clear_sok_chs.nss
Normal file
10
_module/nss/sd_clear_sok_chs.nss
Normal file
@@ -0,0 +1,10 @@
|
||||
void main()
|
||||
{
|
||||
object oItem = GetFirstItemInInventory(OBJECT_SELF);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
oItem = GetNextItemInInventory(OBJECT_SELF);
|
||||
}
|
||||
|
||||
}
|
19
_module/nss/sd_creature_kill.nss
Normal file
19
_module/nss/sd_creature_kill.nss
Normal file
@@ -0,0 +1,19 @@
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastUsedBy();
|
||||
object oArea = GetArea(oPC);
|
||||
effect eBlood = EffectVisualEffect(VFX_COM_CHUNK_RED_LARGE);
|
||||
effect eDeath = EffectDeath(TRUE, FALSE);
|
||||
|
||||
object oCreature = GetFirstObjectInArea(oArea);
|
||||
while (GetIsObjectValid(oCreature))
|
||||
{
|
||||
if (GetObjectType(oCreature)==OBJECT_TYPE_CREATURE&&
|
||||
GetIsEnemy(oPC, oCreature))
|
||||
{
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eBlood, oCreature);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oCreature);
|
||||
}
|
||||
oCreature = GetNextObjectInArea(oArea);
|
||||
}
|
||||
}
|
39
_module/nss/sd_destroy_lbag.nss
Normal file
39
_module/nss/sd_destroy_lbag.nss
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "prc_inc_racial"
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastClosedBy();
|
||||
object oItem;
|
||||
object oCorpse = GetLocalObject(OBJECT_SELF, "oHostBody");
|
||||
object oBlood = GetLocalObject(OBJECT_SELF, "oBlood");
|
||||
object oBones;
|
||||
location lLoc = GetLocation(oCorpse);
|
||||
int iCount;
|
||||
|
||||
AssignCommand(oPC, ClearAllActions());
|
||||
|
||||
oItem = GetFirstItemInInventory(OBJECT_SELF);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
++iCount;
|
||||
oItem = GetNextItemInInventory(OBJECT_SELF);
|
||||
}
|
||||
if (iCount==0){
|
||||
AssignCommand(oCorpse, SetIsDestroyable(TRUE, FALSE, FALSE));
|
||||
DestroyObject(oBlood);
|
||||
DestroyObject(oCorpse);
|
||||
if ((MyPRCGetRacialType(oCorpse) != RACIAL_TYPE_CONSTRUCT) &&
|
||||
(MyPRCGetRacialType(oCorpse) != RACIAL_TYPE_ELEMENTAL)&&
|
||||
(MyPRCGetRacialType(oCorpse) != RACIAL_TYPE_DRAGON)&&
|
||||
(MyPRCGetRacialType(oCorpse) != RACIAL_TYPE_ANIMAL))
|
||||
|
||||
{
|
||||
oBones = CreateObject(OBJECT_TYPE_PLACEABLE,
|
||||
"plc_bones",
|
||||
lLoc, FALSE);
|
||||
ExecuteScript("sd_destroyself", oBones);
|
||||
}
|
||||
DestroyObject(OBJECT_SELF, 0.2f);
|
||||
}
|
||||
|
||||
|
||||
}
|
4
_module/nss/sd_destroyself.nss
Normal file
4
_module/nss/sd_destroyself.nss
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
DelayCommand(30.0, DestroyObject(OBJECT_SELF));
|
||||
}
|
6
_module/nss/sd_dth.nss
Normal file
6
_module/nss/sd_dth.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastUsedBy();
|
||||
effect eLos = EffectDeath(TRUE);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eLos, oPC);
|
||||
}
|
16
_module/nss/sd_loot_anim.nss
Normal file
16
_module/nss/sd_loot_anim.nss
Normal file
@@ -0,0 +1,16 @@
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastUsedBy();
|
||||
|
||||
// Play crouch animation only if PC just opened the corpse inventory GUI
|
||||
// EXCEPTION: If the PC opens the corpse inventory, then quickly presses
|
||||
// the "I" key (to open the PC inventory), a BioWare software bug will
|
||||
// trick the software into permanently thinking the corpse inventory is
|
||||
// open (even though the GUI can be opened and closed normally). This will
|
||||
// cause the animation to play when corpse is opened or closed (a minor
|
||||
// bug).
|
||||
if (GetIsOpen(OBJECT_SELF))
|
||||
{
|
||||
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, 1.2f));
|
||||
}
|
||||
}
|
56
_module/nss/sd_loot_corpse.nss
Normal file
56
_module/nss/sd_loot_corpse.nss
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "sd_lootsystem"
|
||||
#include "prc_inc_racial"
|
||||
void BodyFade(object oHostBody, object oBlood)
|
||||
{
|
||||
object oBones;
|
||||
location lLoc = GetLocation(oHostBody);
|
||||
SetPlotFlag(oHostBody, FALSE);
|
||||
AssignCommand(oHostBody, SetIsDestroyable(TRUE,FALSE,FALSE));
|
||||
if ((MyPRCGetRacialType(oHostBody) != RACIAL_TYPE_CONSTRUCT) &&
|
||||
(MyPRCGetRacialType(oHostBody) != RACIAL_TYPE_ELEMENTAL)&&
|
||||
(MyPRCGetRacialType(oHostBody) != RACIAL_TYPE_DRAGON)&&
|
||||
(MyPRCGetRacialType(oHostBody) != RACIAL_TYPE_ANIMAL))
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
DestroyObject(oBlood);
|
||||
if (GetIsDead(oHostBody))DestroyObject(oHostBody, 0.2f);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float lsDelay = 60.0; // Corpse & loot fade delay
|
||||
object oHostBody = OBJECT_SELF; //Get the Dead Creature Object
|
||||
object oBlood;
|
||||
object oSaveBlood;
|
||||
string sBaseTag = GetTag(oHostBody); //Get that TAG of the dead creature
|
||||
string sPrefix = GetStringLeft(sBaseTag, 4); //Look for Dead Prefix
|
||||
location lLoc = GetLocation(oHostBody);
|
||||
|
||||
if ((MyPRCGetRacialType(oHostBody) != RACIAL_TYPE_UNDEAD) &&
|
||||
(MyPRCGetRacialType(oHostBody) != RACIAL_TYPE_CONSTRUCT) &&
|
||||
(MyPRCGetRacialType(oHostBody) != RACIAL_TYPE_ELEMENTAL)&&
|
||||
(MyPRCGetRacialType(oHostBody) != RACIAL_TYPE_DRAGON))
|
||||
{
|
||||
oBlood = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_bloodstain", lLoc, FALSE);
|
||||
}
|
||||
DelayCommand(lsDelay, BodyFade(oHostBody, oBlood));
|
||||
|
||||
|
||||
//Sink the lootbag into the ground a little
|
||||
float fSinkCorpseObj = 0.1f; //depth
|
||||
vector vHostBodyLoc = GetPosition(oHostBody);
|
||||
float fCorpseFacing = GetFacing(oHostBody);
|
||||
vector vCorpseLoc = Vector(vHostBodyLoc.x, vHostBodyLoc.y, vHostBodyLoc.z - fSinkCorpseObj);
|
||||
location lCorpseLoc = Location(GetArea(oHostBody), vCorpseLoc, fCorpseFacing);
|
||||
|
||||
//Create the lootbag
|
||||
object oLootCorpse = CreateObject(OBJECT_TYPE_PLACEABLE, "rr_sack", lCorpseLoc, FALSE); //Spawn our lootable object
|
||||
|
||||
SetLocalObject(oLootCorpse, "oHostBody", oHostBody); //Set Local for deletion later if needed
|
||||
SetLocalObject(oLootCorpse, "oBlood", oBlood);
|
||||
NameSack(oLootCorpse);
|
||||
DelayCommand(0.1,sd_droploot(oHostBody, oLootCorpse));
|
||||
DelayCommand(lsDelay, LootClear(oLootCorpse));
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
#include "x2_inc_itemprop"
|
||||
#include "prc_x2_itemprop"
|
||||
//#include "nw_i0_generic"
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
@@ -84,7 +84,7 @@ void DropScroll(object oMob, object oSack, int iRange);
|
||||
// oMob = the creature that just died
|
||||
// oSack = the object into which you will spawn the potion
|
||||
// iStack = Stacksize
|
||||
void DropPot(object oMob, object oSack, int iStack);
|
||||
void DropPotion(object oMob, object oSack, int iStack);
|
||||
|
||||
// Generates a random misc item (i.e. bag)
|
||||
// =======================================
|
||||
@@ -122,7 +122,11 @@ void sd_droploot (object oMob, object oSack);
|
||||
void DropAlchemyRecipe(object oMob, object oSack, int iRange);
|
||||
|
||||
|
||||
|
||||
void SetEyes(int iType, object oMob)
|
||||
{
|
||||
effect eVis = EffectVisualEffect(iType);
|
||||
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oMob);
|
||||
}
|
||||
|
||||
|
||||
const string COLORTOKEN =" ##################$%&'()*+,-./0123456789:;;==?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[]^_`abcdefghijklmnopqrstuvwxyz{|}~~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
@@ -652,7 +656,7 @@ object oRecipe = CreateItemOnObject(sType, oSack, 1);
|
||||
SetIdentified(oRecipe, FALSE);
|
||||
}
|
||||
|
||||
void DropPot(object oMod, object oSack, int iStack)
|
||||
void DropPotion(object oMod, object oSack, int iStack)
|
||||
{
|
||||
string sPotion;
|
||||
|
||||
@@ -1401,7 +1405,7 @@ void MeleeImbue(object oItem)
|
||||
IPSafeAddItemProperty(oItem, ipAdd);
|
||||
}
|
||||
|
||||
void MCimbue(object oItem, int iRange)
|
||||
void MassCritImbue(object oItem, int iRange)
|
||||
{
|
||||
itemproperty ipAdd;
|
||||
int iDam;
|
||||
@@ -1523,7 +1527,7 @@ int sd_GetAbil()
|
||||
return iType;
|
||||
}
|
||||
|
||||
void DAMimbue(object oItem, int iRange)
|
||||
void DamageTypeImbue(object oItem, int iRange)
|
||||
{
|
||||
itemproperty ipAdd;
|
||||
itemproperty ipVis;
|
||||
@@ -1893,7 +1897,7 @@ ipAdd = ItemPropertyRegeneration(iRegen);
|
||||
IPSafeAddItemProperty(oItem, ipAdd);
|
||||
}
|
||||
|
||||
void VRimbue(object oItem, int iRange)
|
||||
void VampRegenImbue(object oItem, int iRange)
|
||||
{
|
||||
int iRegen;
|
||||
itemproperty ipAdd;
|
||||
|
7202
_module/nss/sd_lootsystem.nss
Normal file
7202
_module/nss/sd_lootsystem.nss
Normal file
File diff suppressed because it is too large
Load Diff
97
_module/nss/sd_oncliententer.nss
Normal file
97
_module/nss/sd_oncliententer.nss
Normal file
@@ -0,0 +1,97 @@
|
||||
#include "x0_i0_campaign"
|
||||
#include "inc_colorstring"
|
||||
#include "pqj_inc"
|
||||
//#include "aa_i_main"
|
||||
//#include "sk_ethos"
|
||||
//#include "sk_factions"
|
||||
//#include "sk_deity"
|
||||
//#include "inc_award_lang"
|
||||
//#include "gz_inc_db"
|
||||
|
||||
void main()
|
||||
{
|
||||
/* ExecuteScript("sd_soc_install", OBJECT_SELF);
|
||||
RebuildJournalQuestEntries(GetEnteringObject());
|
||||
object oPC = GetEnteringObject();
|
||||
location locPC = GetCampaignDBLocation(oPC, "LOC");
|
||||
if(!GetIsPC(oPC))
|
||||
return;
|
||||
SetLocalString(oPC,"PC_CD_KEY",GetPCPublicCDKey(oPC));
|
||||
|
||||
if (GetXP(oPC)<1)
|
||||
{
|
||||
|
||||
GiveXPToCreature(oPC,1);
|
||||
GiveGoldToCreature(oPC,3500);
|
||||
CreateItemOnObject("NW_IT_CONTAIN006",oPC);
|
||||
SendMessageToPC(oPC, ColorString("++ Welcome to Skullkeep ++", 1, 255, 1));
|
||||
SendMessageToPC(oPC, ColorString("Please check your journal for helpful information for new players.", 1, 255, 1));
|
||||
CreateItemOnObject("portalscroll",oPC);
|
||||
CreateItemOnObject("tinkerstoolset",oPC);
|
||||
AwardLanguages(oPC);
|
||||
AddPersistentJournalQuestEntry("WELCOME_JOURNAL",1,oPC);
|
||||
AddPersistentJournalQuestEntry("CRAFTING_JOURNAL",1,oPC);
|
||||
AddPersistentJournalQuestEntry("COMMANDS_JOURNAL",1,oPC);
|
||||
AddPersistentJournalQuestEntry("HOUSING_RULE",1,oPC);
|
||||
AddPersistentJournalQuestEntry("ENTRY_DEITIES",1,oPC);
|
||||
SetDeity (oPC, "Faithless");
|
||||
string deity = GetDeity(oPC);
|
||||
SendMessageToPC(oPC, "Deity: " + deity);
|
||||
SK_Faction_Display(oPC);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPC, ColorString("++ Welcome back to Skullkeep ++", 1, 255, 1));
|
||||
SendMessageToPC(oPC, ColorString("Thanks for playing!", 1, 255, 1));
|
||||
|
||||
string deity = GetDeity(oPC);
|
||||
if (deity != "Faithless")
|
||||
{
|
||||
SK_Deity(oPC);
|
||||
}
|
||||
SK_Faction_Display(oPC);
|
||||
SK_Ethos(oPC);
|
||||
SendMessageToPC(oPC, "Deity: " + deity);
|
||||
}
|
||||
//Test to see if PC has a skill book.. if not, then create one.
|
||||
if (GetItemPossessedBy(oPC,"NoDrop_SkillLogBook")==OBJECT_INVALID)
|
||||
{
|
||||
CreateItemOnObject("skilllogbook",oPC,1);
|
||||
}
|
||||
//Delete persistent hooks which need to be 'gone' to begin with
|
||||
//**this added due to HoTU effects on servervault characters
|
||||
DeleteLocalInt(oPC,"iSkillGain");
|
||||
DeleteLocalInt(oPC,"iPCUsedMap");
|
||||
DeleteLocalInt(oPC,"iAmFollowingMap");
|
||||
DeleteLocalInt(oPC,"iAmDiggingMap");
|
||||
DeleteLocalInt(oPC,"iAmFishing");
|
||||
DeleteLocalInt(oPC,"iCancelFishing");
|
||||
DeleteLocalInt(oPC,"iAmInField");
|
||||
DeleteLocalInt(oPC,"iAmInWaterField");
|
||||
DeleteLocalInt(oPC,"iAmInCommodityArea");
|
||||
DeleteLocalString(oPC,"sKillMe");
|
||||
DeleteLocalInt(oPC,"iAmDigging");
|
||||
DeleteLocalLocation(oPC,"lIWasHere");
|
||||
|
||||
if (GetHasFeat(FEAT_PRESTIGE_IMBUE_ARROW))
|
||||
{
|
||||
//Destroy imbued arrows.
|
||||
AADestroyAllImbuedArrows(oPC);
|
||||
}
|
||||
|
||||
if (OBJECT_INVALID != GetAreaFromLocation(locPC))
|
||||
{
|
||||
AssignCommand(oPC, ActionJumpToLocation(locPC));
|
||||
}
|
||||
|
||||
|
||||
if (GetIsDM(oPC) == TRUE && GetItemPossessedBy(oPC,"hh_dm_tool")==OBJECT_INVALID)
|
||||
{
|
||||
CreateItemOnObject("hh_dm_tool",oPC,1);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
12
_module/nss/sd_onrespawn.nss
Normal file
12
_module/nss/sd_onrespawn.nss
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "nw_i0_plot"
|
||||
#include "sd_set_item_inc"
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oRespawner = GetLastRespawnButtonPresser();
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
|
||||
RemoveEffects(oRespawner);
|
||||
ApplySetBonus(oRespawner);
|
||||
}
|
138
_module/nss/sd_reset_inc.nss
Normal file
138
_module/nss/sd_reset_inc.nss
Normal file
@@ -0,0 +1,138 @@
|
||||
//////////////////////////////////////////////////////////
|
||||
//::use: #include"sd_reset_inc"
|
||||
//::
|
||||
//::
|
||||
//:: Slayers of Darkmoon
|
||||
//:: Dungeon Resetting Toolkit
|
||||
//::
|
||||
//::
|
||||
//:: Commche 2014
|
||||
//::
|
||||
|
||||
const string COLORTOKEN = " ##################$%&'()*+,-./0123456789:;;==?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[]^_`abcdefghijklmnopqrstuvwxyz{|}~~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
string ColorString(string sText, int nRed=255, int nGreen=255, int nBlue=255)
|
||||
{
|
||||
return "<c" + GetSubString(COLORTOKEN, nRed, 1) + GetSubString(COLORTOKEN, nGreen, 1) + GetSubString(COLORTOKEN, nBlue, 1) + ">" + sText + "</c>";
|
||||
}
|
||||
|
||||
|
||||
int GetIsEmpty() // empty chest check routine
|
||||
{
|
||||
int iCount;
|
||||
object oItem = GetFirstItemInInventory();
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
++iCount;
|
||||
oItem = GetNextItemInInventory();
|
||||
}
|
||||
if (iCount==0)return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void SD_PURGE(string sCont, int iName = 0)
|
||||
{
|
||||
int iCount;
|
||||
|
||||
object oItem;
|
||||
object oArea = OBJECT_SELF;
|
||||
object oCont = GetFirstObjectInArea(oArea);
|
||||
while (GetIsObjectValid(oCont))
|
||||
{
|
||||
if (iName==1)
|
||||
{
|
||||
if (GetName(oCont)=="Remains")
|
||||
{
|
||||
oItem = GetFirstItemInInventory(oCont);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
oItem = GetNextItemInInventory(oCont);
|
||||
}
|
||||
DestroyObject(oCont);
|
||||
}
|
||||
oCont = GetNextObjectInArea(oArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetTag(oCont)==sCont)
|
||||
{
|
||||
oItem = GetFirstItemInInventory(oCont);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
oItem = GetNextItemInInventory(oCont);
|
||||
}
|
||||
DestroyObject(oCont);
|
||||
}
|
||||
oCont = GetNextObjectInArea(oArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SD_DESTROY(string sTag)
|
||||
{
|
||||
object oArea = OBJECT_SELF;
|
||||
object oPlc = GetFirstObjectInArea(oArea);
|
||||
while (GetIsObjectValid(oPlc))
|
||||
{
|
||||
if (GetTag(oPlc)==sTag)
|
||||
{
|
||||
DestroyObject(oPlc);
|
||||
}
|
||||
oPlc =GetNextObjectInArea(oArea);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SD_CLEAN(object oPC)
|
||||
{
|
||||
object oItem;
|
||||
object oArea = OBJECT_SELF;
|
||||
object oCont = GetFirstObjectInArea(oArea);
|
||||
while (GetIsObjectValid(oCont))
|
||||
{
|
||||
if (GetObjectType(oCont)==OBJECT_TYPE_CREATURE)
|
||||
{
|
||||
if (GetIsEnemy(oCont, oPC))
|
||||
{
|
||||
AssignCommand(oCont, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oCont);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetTag(oCont)=="Bloodstain")DestroyObject(oCont);
|
||||
|
||||
oCont = GetNextObjectInArea(oArea);
|
||||
}
|
||||
}
|
||||
|
||||
void AREA_CLEAR(object oPC)
|
||||
{
|
||||
|
||||
effect eDeath = EffectDeath(TRUE);
|
||||
|
||||
object oMob, oArea, oTrig;
|
||||
oArea = GetArea(OBJECT_SELF);
|
||||
oMob = GetFirstObjectInArea(oArea);
|
||||
while (GetIsObjectValid(oMob))
|
||||
{
|
||||
if (GetObjectType(oMob)== OBJECT_TYPE_CREATURE)
|
||||
{
|
||||
if (GetIsEnemy(oMob, oPC) && GetIsDead(oMob)==FALSE)
|
||||
{
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oMob);
|
||||
AssignCommand(oMob, SetIsDestroyable(TRUE));
|
||||
DestroyObject(oMob, 60.0);
|
||||
}
|
||||
}
|
||||
oMob = GetNextObjectInArea(oArea);
|
||||
}
|
||||
|
||||
SD_PURGE("rr_sack");
|
||||
SD_CLEAN(oPC);
|
||||
}
|
||||
|
||||
|
||||
//void main() {}
|
311
_module/nss/sd_set_item.nss
Normal file
311
_module/nss/sd_set_item.nss
Normal file
@@ -0,0 +1,311 @@
|
||||
///////////////////////////////
|
||||
//: Set Script
|
||||
//:
|
||||
//: Universal
|
||||
//:
|
||||
//:
|
||||
//: === in onrespawn script ===
|
||||
//: #include "sd_set_item_inc"
|
||||
//: ApplySetBonus(oRespawner);
|
||||
//:
|
||||
#include "sd_set_item_inc"
|
||||
#include "sd_lootsystem"
|
||||
#include "x2_inc_switches"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//:General Constants
|
||||
//:
|
||||
//:
|
||||
|
||||
const int COLOR_R = 255;
|
||||
const int COLOR_G = 100; // Pink
|
||||
const int COLOR_B = 200;
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//:General Utilities
|
||||
//:
|
||||
//:
|
||||
//:
|
||||
|
||||
int SD_UNIQUE_CHECK(object oPC, object oSetPiece)
|
||||
{
|
||||
int iFlag=0;
|
||||
string sRes, sString, sIname;
|
||||
object oItem;
|
||||
sRes = GetResRef(oSetPiece);
|
||||
|
||||
// check inventory
|
||||
|
||||
object oCheck = GetFirstItemInInventory(oPC);
|
||||
while (GetIsObjectValid(oCheck))
|
||||
{
|
||||
if (GetResRef(oCheck)==sRes)++iFlag;
|
||||
oCheck = GetNextItemInInventory(oPC);
|
||||
}
|
||||
|
||||
// check equipped items
|
||||
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_ARMS, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_BELT, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_HEAD, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_NECK, oPC);
|
||||
if (GetResRef(oItem)==sRes) iFlag+=1;
|
||||
|
||||
if (iFlag>=2)
|
||||
{
|
||||
sIname = GetName(oSetPiece);
|
||||
sString = ColorString("You can only have one of these at a time", 255, 0, 0);
|
||||
FloatingTextStringOnCreature(sString, oPC);
|
||||
DestroyObject(oSetPiece);
|
||||
|
||||
SendMessageToPC(oPC,"DM: "+sIname+" destroyed");
|
||||
SendMessageToPC(oPC,"DM: Compensatory gold awarded");
|
||||
GiveGoldToCreature(oPC, 3000);
|
||||
AssignCommand(oPC, PlaySound("it_coins"));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void UpdateName(object oPC, object oItem, int iPieces, int iSetNum, string sNameOfSet)
|
||||
{
|
||||
// Update Current Item
|
||||
string sName, sIName;
|
||||
|
||||
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")",
|
||||
COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
|
||||
// Update InventoryItems
|
||||
|
||||
oItem = GetFirstItemInInventory(oPC);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
|
||||
// Update Slotted Items
|
||||
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_ARMS, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_BELT, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_HEAD, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_NECK, oPC);
|
||||
if (GetTag(oItem)=="sd_set_item" && GetLocalString(oItem, "sSet")==sNameOfSet)
|
||||
{
|
||||
sIName = GetLocalString(oItem, "sName");
|
||||
sName = ColorString(sIName+" ("+IntToString(iPieces)+"/"+IntToString(iSetNum)+")", COLOR_R, COLOR_G, COLOR_B);
|
||||
SetName(oItem, sName);
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//:End of General Utilities
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//: MAIN SCRIPT
|
||||
//:
|
||||
//:
|
||||
|
||||
void main()
|
||||
{
|
||||
int nEvent =GetUserDefinedItemEventNumber();
|
||||
|
||||
object oPC, oEquip, oUnEquip, oItem;
|
||||
string sName, sIName, sID, sNameOfSet;
|
||||
int iPieces, iLength, iSetNum;
|
||||
effect eImbue, eVis, eFinal;
|
||||
|
||||
|
||||
|
||||
if (nEvent ==X2_ITEM_EVENT_EQUIP)
|
||||
{
|
||||
oPC = GetPCItemLastEquippedBy();
|
||||
oEquip = GetPCItemLastEquipped();
|
||||
sID = GetLocalString(oEquip, "sSet")+"_equ";
|
||||
sNameOfSet = GetLocalString(oEquip, "sSet");
|
||||
|
||||
iPieces = GetLocalInt(oPC, sID);
|
||||
++iPieces;
|
||||
SetLocalInt(oPC, sID, iPieces);
|
||||
|
||||
if (sNameOfSet=="Dorian's Battlegear")DoriansBattlegearEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Mystra's Rainment")MystrasRainmentEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Thera's Vestments")TherasVestmentsEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Shinobi's Garb")ShinobisGarbEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Benedict's Herald")BenedictsHeraldEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Armor of Divinity")ArmorOfDivinityEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Soothsayer's Regalia")SoothsayersRegaliaEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Robes of Enlightenment")RobesOfEnlightenmentEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Vestments of Rage")VestmentsofRageEquip(oPC, iPieces, 0);
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
//: Debugging
|
||||
//: FloatingTextStringOnCreature(IntToString(iPieces), oPC);
|
||||
}
|
||||
else if (nEvent ==X2_ITEM_EVENT_UNEQUIP)
|
||||
{
|
||||
oPC = GetPCItemLastUnequippedBy();
|
||||
oUnEquip = GetPCItemLastUnequipped();
|
||||
sID = GetLocalString(oUnEquip, "sSet")+"_equ";
|
||||
sNameOfSet = GetLocalString(oUnEquip, "sSet");
|
||||
|
||||
iPieces = GetLocalInt(oPC, sID);
|
||||
--iPieces;
|
||||
SetLocalInt(oPC, sID, iPieces);
|
||||
|
||||
if (sNameOfSet=="Dorian's Battlegear")DoriansBattlegearUnEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Mystra's Rainment")MystrasRainmentUnEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Thera's Vestments")TherasVestmentsUnEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Shinobi's Garb")ShinobisGarbUnEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Benedict's Herald")BenedictsHeraldUnEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Armor of Divinity")ArmorOfDivinityUnEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Soothsayer's Regalia")SoothsayersRegaliaUnEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Robes of Enlightenment")RobesOfEnlightenmentUnEquip(oPC, iPieces, 0);
|
||||
if (sNameOfSet=="Vestments of Rage")VestmentsofRageUnEquip(oPC, iPieces, 0);
|
||||
|
||||
////////////////////////////////////
|
||||
//: Debugging
|
||||
//: FloatingTextStringOnCreature(IntToString(iPieces), oPC);
|
||||
}
|
||||
else if (nEvent == X2_ITEM_EVENT_ACQUIRE)
|
||||
{
|
||||
oPC = GetModuleItemAcquiredBy();
|
||||
oItem = GetModuleItemAcquired();
|
||||
|
||||
if (SD_UNIQUE_CHECK(oPC, oItem)==TRUE)return;
|
||||
|
||||
sID = GetLocalString(oItem, "sSet")+"_acq";
|
||||
iSetNum = GetLocalInt(oItem, "iSetNum");
|
||||
sNameOfSet = GetLocalString(oItem, "sSet");
|
||||
|
||||
iPieces = GetLocalInt(oPC, sID);
|
||||
++iPieces;
|
||||
SetLocalInt(oPC, sID, iPieces);
|
||||
|
||||
UpdateName(oPC, oItem, iPieces, iSetNum, sNameOfSet);
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
//: Debugging
|
||||
//: FloatingTextStringOnCreature(IntToString(iPieces), oPC);
|
||||
|
||||
}
|
||||
else if (nEvent == X2_ITEM_EVENT_UNACQUIRE)
|
||||
{
|
||||
oPC = GetModuleItemLostBy();
|
||||
oItem = GetModuleItemLost();
|
||||
sID = GetLocalString(oItem, "sSet")+"_acq";
|
||||
iSetNum = GetLocalInt(oItem, "iSetNum");
|
||||
sNameOfSet = GetLocalString(oItem, "sSet");
|
||||
iPieces = GetLocalInt(oPC, sID);
|
||||
--iPieces;
|
||||
SetLocalInt(oPC, sID, iPieces);
|
||||
|
||||
UpdateName(oPC, oItem, iPieces, iSetNum, sNameOfSet);
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
//: Debugging
|
||||
//: FloatingTextStringOnCreature(IntToString(iPieces), oPC);
|
||||
}
|
||||
}
|
1380
_module/nss/sd_set_item_inc.nss
Normal file
1380
_module/nss/sd_set_item_inc.nss
Normal file
File diff suppressed because it is too large
Load Diff
17
_module/nss/sd_setdrop.nss
Normal file
17
_module/nss/sd_setdrop.nss
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "sd_lootsystem"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastOpenedBy();
|
||||
|
||||
DropSetItem(oPC, OBJECT_SELF);
|
||||
|
||||
|
||||
object oItem = GetFirstItemInInventory(OBJECT_SELF);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (GetIdentified(oItem)==FALSE)SetIdentified(oItem, TRUE);
|
||||
oItem = GetNextItemInInventory(OBJECT_SELF);
|
||||
}
|
||||
|
||||
}
|
4
_module/nss/sd_setplot.nss
Normal file
4
_module/nss/sd_setplot.nss
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
SetPlotFlag(OBJECT_SELF, 1);
|
||||
}
|
224
_module/nss/sd_soc_install.nss
Normal file
224
_module/nss/sd_soc_install.nss
Normal file
@@ -0,0 +1,224 @@
|
||||
const string COLORTOKEN = " ##################$%&'()*+,-./0123456789:;;==?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[]^_`abcdefghijklmnopqrstuvwxyz{|}~~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
|
||||
string ColorString(string sText, int nRed=255, int nGreen=255, int nBlue=255)
|
||||
{
|
||||
return "<c" + GetSubString(COLORTOKEN, nRed, 1) + GetSubString(COLORTOKEN, nGreen, 1) + GetSubString(COLORTOKEN, nBlue, 1) + ">" + sText + "</c>";
|
||||
}
|
||||
|
||||
|
||||
void RE_SOCKET(object oPC, object oItem)
|
||||
{
|
||||
int iLength, iStart, iVal, iAmt;
|
||||
string sSocks, sGem, i1, i2, i3, i4, i5, i6, i7, i8;
|
||||
string sName = GetName(oItem);
|
||||
|
||||
iLength = GetStringLength(sName);
|
||||
sSocks = GetSubString(sName, iLength-6, 1);
|
||||
//SendMessageToPC(oPC, sName + " has " + sSocks + " sockets");
|
||||
iVal = StringToInt(sSocks);
|
||||
SetLocalInt(oItem, "SOCKETS",iVal);
|
||||
}
|
||||
|
||||
void RE_GEM(object oPC, object oItem)
|
||||
{
|
||||
string sName, sType1;
|
||||
int rVal;
|
||||
|
||||
sName = GetName(oItem);
|
||||
|
||||
// Misc ability gems
|
||||
|
||||
if (FindSubString(sName, "Vengeful")>=0) sType1 = "HOLY_AVENGER";
|
||||
if (FindSubString(sName, "Deadly")>=0) sType1 = "KEEN";
|
||||
if (FindSubString(sName, "Unstoppable")>=0) sType1 = "FREEDOM";
|
||||
if (FindSubString(sName, "Slippery")>=0) sType1 = "IMPROVED_EVASION";
|
||||
if (FindSubString(sName, "Speedy")>=0) sType1 = "HASTE";
|
||||
if (FindSubString(sName, "Ocular")>=0) sType1 = "TRUE_SEEING";
|
||||
|
||||
|
||||
// Attack Gems
|
||||
|
||||
if (FindSubString(sName,"Enhancement")>=0){sType1 = "ENHANCEMENT_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Attack")>=0){sType1 = "ATTACK_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"AC")>=0){sType1 = "AC_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Brutal")>=0){sType1 = "MASSIVE_CRITICAL";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
|
||||
// Ability bonus gems
|
||||
|
||||
if (FindSubString(sName,"Mighty")>=0){sType1 = "STRENGTH_ABILITY_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Deft")>=0){sType1 = "DEXTERITY_ABILITY_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Wise")>=0){sType1 = "WISDOM_ABILITY_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Hardy")>=0){sType1 = "CONSTITUTION_ABILITY_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Clever")>=0){sType1 = "INTELLIGENCE_ABILITY_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Charming")>=0){sType1 = "CHARISMA_ABILITY_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
|
||||
|
||||
// Damage bonus gems
|
||||
|
||||
if (FindSubString(sName,"Corrosive")>=0){sType1 = "ACID_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Thumping")>=0){sType1 = "BLUDGEONING_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Ice")>=0){sType1 = "COLD_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Holy")>=0){sType1 = "DIVINE_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Zapping")>=0){sType1 = "ELECTIRCAL_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Scorching")>=0){sType1 = "FIRE_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Magical")>=0){sType1 = "MAGICAL_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Evil")>=0){sType1 = "NEGATIVE_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Impaling")>=0){sType1 = "PIERCING_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Benevolent")>=0){sType1 = "POSITIVE_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Slicing")>=0){sType1 = "SLASHING_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Booming")>=0){sType1 = "SONIC_DAMAGE_BONUS";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Regeneration")>=0){sType1 = "REGENERATION";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
if (FindSubString(sName,"Vamp Regen")>=0){sType1 = "VAMPIRIC_REGENERATION";
|
||||
rVal = StringToInt(GetSubString(sName, 7, 1));}
|
||||
|
||||
// Damage Res Gems
|
||||
|
||||
if (FindSubString(sName, "Alkaline")>=0)
|
||||
{sType1 = "ACID_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Solid")>=0)
|
||||
{sType1 = "BLUDGEONING_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Warm")>=0)
|
||||
{sType1 = "COLD_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Absolvsion")>=0)
|
||||
{sType1 = "DIVINE_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Grounding")>=0)
|
||||
{sType1 = "ELECTRICAL_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Cool")>=0)
|
||||
{sType1 = "FIRE_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Mantle")>=0)
|
||||
{sType1 = "MAGICAL_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Bright")>=0)
|
||||
{sType1 = "NEGATIVE_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Shell")>=0)
|
||||
{sType1 = "PIERCING_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Malevolent")>=0)
|
||||
{sType1 = "POSITIVE_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Mesh")>=0)
|
||||
{sType1 = "SLASHING_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
if (FindSubString(sName, "Dampening")>=0)
|
||||
{sType1 = "SONIC_DAMAGE_RESISTANCE";
|
||||
if (GetSubString(sName, 9, 1)==" ")rVal = StringToInt(GetSubString(sName, 8, 1));
|
||||
else rVal = StringToInt(GetSubString(sName, 8, 2));}
|
||||
|
||||
|
||||
SetLocalString(oItem, "GEM_TYPE", sType1);
|
||||
SetLocalInt(oItem, "AMOUNT", rVal);
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem;
|
||||
int iLength, iStart, iVal, iAmt;
|
||||
string sSocks, sName;
|
||||
|
||||
// check item slots for socketed items
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_CHEST, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_HEAD, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_HEAD, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_NECK, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_NECK, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_BELT, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_BELT, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_BOLTS, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_BOLTS, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_ARROWS, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_ARROWS, oPC));
|
||||
|
||||
if (GetTag(GetItemInSlot(INVENTORY_SLOT_ARMS, oPC))== "sf_socket_item")
|
||||
RE_SOCKET(oPC, GetItemInSlot(INVENTORY_SLOT_ARMS, oPC));
|
||||
|
||||
// check inventory for socketed items
|
||||
oItem = GetFirstItemInInventory(oPC);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (GetTag(oItem)=="sf_socket_item")
|
||||
{
|
||||
RE_SOCKET(oPC, oItem);
|
||||
}
|
||||
if (GetResRef(oItem)=="sd_rune"||
|
||||
GetResRef(oItem)=="sd_rune2"||
|
||||
GetResRef(oItem)=="sd_rune3")
|
||||
{
|
||||
RE_GEM(oPC, oItem);
|
||||
}
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
string sMess = ColorString("Socketed items system ", 255, 215, 0);
|
||||
sMess += ColorString("[loaded successfully]", 0, 255, 255);
|
||||
|
||||
SendMessageToPC(oPC, sMess);
|
||||
return;
|
||||
}
|
||||
|
@@ -570,7 +570,7 @@ void main()
|
||||
|
||||
//:: Set or Randomize name
|
||||
ms_Nomenclature(OBJECT_SELF);
|
||||
|
||||
|
||||
//:: Post Spawn event requested
|
||||
if (nSpecEvent == 2 || nSpecEvent == 3)
|
||||
{
|
||||
|
Reference in New Issue
Block a user