I'm making a custom spell control system, which will work off of the following include script below...
I need help to ensure it's quality & am asking for any tips you may have, I want this to be the best it can be, for it will be a community resource when I'm all done...
The idea behind this system is it will give builders excellent control over All Spells, so they can either turn things up or down as they see fit, for often balance can be maintained through spells..
It appears that this include may be causing some lag too, before the acutal casting..
Here is the include that I will be using, thus far..
// include script: gen_spell_inc
/////////////////////////////////////////////////////////////
//created by Genisys (Guile)
//created on 8-28-10
////////////////////////////////////////////////////////////
/*
The whole point of this include is to allow you to adjust
ALL SPELLS with one simple script! The switches below
will control how spells will work in your module only!
Make sure you BUILD THE MODULE (Scripts Only)
after you are done editing this script!
NOTE: DMs always cast at level 40 with this script
& Monsters / NPCs controlled by a DM cast at 5 levels higher!
*/
/////////////////////////////////////////////////////////////
//IMPORTANT SETTINGS FOR ALL SPELLS!!! (That are effected)
/////////////////////////////////////////////////////////////
//Set the # below to the minimum caster level spells are cast at
//This switch has some uses, and that being Bards / Rangers / Paladins..
//USE WITH CAUTION as low level casters will automatically cast at this level!
const int MINIMUM_CASTER_LEVEL = 1; //Default = 1 (Minimum 1 Caster Level)
//Set the # below to the maximum level used for damage for
//all spells level 1 - 3
const int MAX_DMG_LVL_1_3 = 20; //Default = 20 (20 max Damage Dice Used)
//Set the # below to the maximum level used for damage for all spells
//level 4 - 6
const int MAX_DMG_LVL_4_5 = 25; //Default = 25 (25 max damage dice used)
//Set the # below to the maximum level used for damage for all spells
//level 4 - 6
const int MAX_DMG_LVL_6_7 = 30; //Default = 30 (30 max damage dice used)
//Set the # below to the maximum level used for damage for all spells
//level 4 - 6
const int MAX_DMG_LVL_8_9 = 35; //Default = 35 (Damage capped at level 35 max)
//Set this to FALSE if you don't want to allow Pale Master & RDD to be
//figured in as caster levels for ALL casters (bards included)
const int PRESTIGE_CASTER_LVL = TRUE; //Default = TRUE (Use Prestige Levels)
//Set this to FALSE if you don't want to use EPIC DC for Spells..
const int EPIC_DC_USAGE = TRUE; //Default = TRUE (Use Epic Levels for DC)
//Set this to the # of levels the DC is figured, e.g., if you set it to 3
//then every 3 levels a caster gains an epic DC bonus (after level 20),
//if 2, then every 2 levels beyond level 20 they will get a +1 DC bonus..
const int EPIC_DC_LEVEL_BONUS = 3; //Default = 3 (+1 DC every 3 Levels beyond 20!)
//Set this to the Global Bonus for ALL SPELLS reguardless of caster level!
//You can set this to 0 if you want (diabled) (BE CAREFUL HERE - This is UBER!)
const int BONUS_DC_ALL_SPELLS = 0; //Default = 0 (NO DC Bonus to all Spells)
//Set this to FALSE, if you do NOT wish to use Bonus Damages
const int USE_BONUS_DAMAGE = TRUE; //default = TRUE (Use Bonus Damage For ALL SPELLS)
//BE CAREFUL HERE, this is very powerful!! (TEST IT THOROUGHLY!)
//NOTE: This is NOT CAPPED By Spell Level!
//Set this to how much additional damage / level you wish to apply to ALL SPELLS!
//This only applies to spells which cause damage (Except Missle Spells)
const int SPELL_BONUS_DAMAGE = 0; //Default = 0 (No bonus damage added)
///////////////////////////////////////////////////////////////////
///WARNING DON'T TOUCH ANYTHING BELOW THIS LINE!!!
///////////////////////////////////////////////////////////////////
//Declare all Prototypes
int CasterLvl(object oPC);
int GetEpicLvlDC(object oPC);
int GetDamageBonus(object oPC);
///////////////////////////////////////////////////////////////////
//Define all Prototypes
//Define Prototype
int CasterLvl(object oPC)
{
int i = 0;
int n1, n2, n3, nCL;
if(PRESTIGE_CASTER_LVL)
{
n1 = GetLevelByclass(class_TYPE_PALE_MASTER, oPC);
n2 = GetLevelByclass(class_TYPE_DRAGON_DISCIPLE, oPC);
n3 = GetCasterLevel(oPC);
nCL = n1 + n2 + n3; //Combine all 3..
i = nCL;
}
else
{
nCL = GetCasterLevel(oPC);
i = nCL;
return i;
}
//Hook for DMs, they automatically cast at level 40 EVERYTIME...
if(GetIsDM(oPC))
{
i = 40;
return i;
}
//Hook for DM controlled Monsters / NPCs..
if(GetIsDMPossessed(oPC))
{
n1 = GetCasterLevel(oPC);
n2 = 5;
i = n1 + n2; //DM possessed Monsters/NPCs get a + 5 Caster Level Bonus...
return i;
}
//Prevent a return of 0 as Caster Level.. NO MATTER WHAT!!! (Sanity Check)
if(i <=0)
{
i = MINIMUM_CASTER_LEVEL;
return i;
}
return i; //Just in case...
}
/////////////////////////////////////////////////////////////////////////////
//Define Prototype
int GetEpicLvlDC(object oPC)
{
int i = BONUS_DC_ALL_SPELLS;
int nCL = CasterLvl(oPC);
int nDC1, nDC2, nDC3;
int nODC = GetSpellSaveDC();
string sBonus;
//If we are using Epic DCs, then figure them up...
if(EPIC_DC_USAGE == TRUE)
{
//Only check epic DC
if(nCL >20)
{
nDC2 = nCL - 20;
//If there is in fact a bonus possible..
if(nDC2 > EPIC_DC_LEVEL_BONUS)
{
nDC3 = nDC2/EPIC_DC_LEVEL_BONUS;
if(nDC3>=1)
{
sBonus = IntToString(nDC3);
SendMessageToPC(oPC, "Your Epic DC Bonus = " + sBonus);
nDC1 = nODC + nDC3;
i = nDC1 + BONUS_DC_ALL_SPELLS;
}
else
{
i = nODC + BONUS_DC_ALL_SPELLS;
}
}
//Otherwise just use the base bonus...
else
{
nDC1 = GetSpellSaveDC();
nDC2 = BONUS_DC_ALL_SPELLS;
i = nDC1 + nDC2; //Add the all spells DC bonus in...
}
}
//Otherwise just use the base bonus...
else
{
nDC1 = GetSpellSaveDC();
nDC2 = BONUS_DC_ALL_SPELLS;
i = nDC1 + nDC2; //Add the all spells DC bonus in...
}
}
//Otherwise just use the base bonus...
else
{
nDC1 = GetSpellSaveDC();
nDC2 = BONUS_DC_ALL_SPELLS;
i = nDC1 + nDC2; //Add the all spells DC bonus in...
}
return i; //Always return +1 unless told differently..
}
//////////////////////////////////////////////////////////////////////////////
//Define PROTOTYPE
int GetDamageBonus(object oPC)
{
int i = 0;
int nCLvl = CasterLvl(oPC);
int nDmgBon;
if(USE_BONUS_DAMAGE == TRUE)
{
nDmgBon = SPELL_BONUS_DAMAGE * nCLvl;
if(nDmgBon==0)
{
i = 1;
}
else
{
i = nDmgBon;
}
}
else
{
i = 1; //1 bonus damage is a nominal bonus (for sanity)
}
return i;
}
Modifié par Genisys, 06 septembre 2010 - 06:19 .