Is there anyway of controlling how many spells a player can cast at anyone time. as players are hording monsters and casting off all there spells and causing server lag.
Thanks
Spell Spamming
Débuté par
Madasahatter
, juin 15 2011 10:41
#1
Posté 15 juin 2011 - 10:41
#2
Posté 16 juin 2011 - 12:36
I would first suggest asking your players to not do that if they can help it, being sure to explain the reasoning. Then figure out which lag-inducing spells they're using most and optimize the scripts so they run more efficiently. After that, perhaps adjust encounter numbers (and/or spawn locations) so that it's more of a hassle to round up all the enemies.
If you wanted to go the enforcement route, you could alter your module's spellhook script to have the caster run a slightly delayed (perhaps 2.5 seconds) ClearAllActions(), which should immediately clear their action queue after casting each spell. This is a very heavy-handed approach though (which I don't recommend), since technically the queue is still only firing off spells at once per round (or twice if hasted)...the casting just restarts the next round instead of forcing the player to pace out the casting themselves.
If you wanted to go the enforcement route, you could alter your module's spellhook script to have the caster run a slightly delayed (perhaps 2.5 seconds) ClearAllActions(), which should immediately clear their action queue after casting each spell. This is a very heavy-handed approach though (which I don't recommend), since technically the queue is still only firing off spells at once per round (or twice if hasted)...the casting just restarts the next round instead of forcing the player to pace out the casting themselves.
#3
Posté 16 juin 2011 - 06:19
I might be wrong, but NPC AI requires a lot of server attention. I'd guess that some or a large part of the lag is due to having so many NPC all in one place: especially if the players are in parties and or a DM is present... or the areas have placeables all over the gridlines that the NPCs have trouble navigating around. The spells probably just push things over-the-top.
Like Amethyst Dragon said, adjust the encounter numbers. If you can replace 3 weaker NPCs with 1 stronger NPC, it's a lot less server work.
Like Amethyst Dragon said, adjust the encounter numbers. If you can replace 3 weaker NPCs with 1 stronger NPC, it's a lot less server work.
#4
Posté 22 juin 2011 - 11:31
Encounters are just fine and its not just about lag. I need a way to limit the muber of spells cast at anyone time
#5
Posté 23 juin 2011 - 12:56
Madasahatter wrote...
Is there anyway of controlling how many spells a player can cast at anyone time. as players are hording monsters and casting off all there spells and causing server lag.
Thanks
I wasn't going to speak up, but since no one else has had much to say, I will. This is a classic problem, and you're looking for a quick fix. The better solution is to properly balance xp with risk, and, failing that, to implement a spawn system that prevents massing.
Since you're set on a quick fix, though, you either want to prevent casters from using haste items, which double their casting rate, or just put in a shunt via module spellhook to block casting of a second spell, using a timestamp, within a set amount of time.
Funky
Modifié par FunkySwerve, 23 juin 2011 - 12:56 .
#6
Posté 23 juin 2011 - 12:33
Funky,
Thanks for the help, Block casting of a second spell using a timestamp within a set amount of time is exactly what i need. problem is i need a step by step if you can this would be great.
Many thanks
Mad
Thanks for the help, Block casting of a second spell using a timestamp within a set amount of time is exactly what i need. problem is i need a step by step if you can this would be great.
Many thanks
Mad
#7
Posté 23 juin 2011 - 01:03
no spamming prevention will help with this
there is no matter if the PC can cast one or two spells per 6seconds, if your spawn are overfiled with monsters then you can expect a 20+second lag when someone mass them and cast single aoe spell like fireball.
Your spawns are definitely not right. Its perfectly fine to horde up to 30mobs, but if you got more of them, then this can happen. The only fix is to reduce mob counts per spawn/spawns per area.
there is no matter if the PC can cast one or two spells per 6seconds, if your spawn are overfiled with monsters then you can expect a 20+second lag when someone mass them and cast single aoe spell like fireball.
Your spawns are definitely not right. Its perfectly fine to horde up to 30mobs, but if you got more of them, then this can happen. The only fix is to reduce mob counts per spawn/spawns per area.
#8
Posté 23 juin 2011 - 01:38
The spawns are fine and dont get any lag, I just dont want casters casting more than a certain amount of spells at anyone time, as Funky said ( block casting of a second spell, using a timestamp, within a set amount of time.)
Thanks
Thanks
#9
Posté 23 juin 2011 - 03:01
You're going to need to to track module uptime. The simplest way to do this is in the mod heartbeat, using a local int. You would have to figure out how far apart your module heartbeats are by running the module for a fixed time and seeing what count you reach at the end. This will actually vary with OS and with load - I've seen between 5.2 seconds and 8+. The simplest way to do it is just to increment the module heartbeat by that amount, like so (I'll assume a 6 second delay here):
SetLocalInt(OBJECT_SELF, "Uptime", GetLocalInt(OBJECT_SELF, "Uptime") + 6);
Bear in mind that that's the smallest increment your timer will increment if you do this. If you do a 9 second forced cast delay using this, it will mean a 12 second wait.
A more nuanced approach would be to fire an incrementing second-by-second recursive function from modload, so you could fine-tune the wait time. Like so:
void TrackTime() {
SetLocalInt(OBJECT_SELF, "Uptime", GetLocalInt(OBJECT_SELF, "Uptime") + 1);
DelayCommand(1.0, TrackTime());
}
You would just need to fire off the first TrackTime(); call from modload, and would then have a more granular uptime counter.
Once you've established an Uptime count, you would then just have to compare last casting time with uptime in the spellhook. I'm not interested in teaching you spellhooking - there's a tutorial in the Lexicon for that. You can read it here:
Spellhooking Tutorial
A sample spellhook script that would force a 9 second wait between ALL PC spell casts, using the module "Uptime" count:
I'd only recommend using the 'wait x more seconds' part if you're doing a second-by-second count. LMK if you have any questions.
Funky
SetLocalInt(OBJECT_SELF, "Uptime", GetLocalInt(OBJECT_SELF, "Uptime") + 6);
Bear in mind that that's the smallest increment your timer will increment if you do this. If you do a 9 second forced cast delay using this, it will mean a 12 second wait.
A more nuanced approach would be to fire an incrementing second-by-second recursive function from modload, so you could fine-tune the wait time. Like so:
void TrackTime() {
SetLocalInt(OBJECT_SELF, "Uptime", GetLocalInt(OBJECT_SELF, "Uptime") + 1);
DelayCommand(1.0, TrackTime());
}
You would just need to fire off the first TrackTime(); call from modload, and would then have a more granular uptime counter.
Once you've established an Uptime count, you would then just have to compare last casting time with uptime in the spellhook. I'm not interested in teaching you spellhooking - there's a tutorial in the Lexicon for that. You can read it here:
Spellhooking Tutorial
A sample spellhook script that would force a 9 second wait between ALL PC spell casts, using the module "Uptime" count:
#include "x2_inc_switches"
const int SECONDS_BETWEEN_SPELLS = 9;
void main()
{
if (GetIsPC(OBJECT_SELF)) {//this check is only here in case the wild magic int is set
int nTime = GetLocalInt(OBJECT_SELF, "LastCastTime");
int nUptime = GetLocalInt(GetModule(), "Uptime");
if (nTime) {
/* because LastCastTime was set, they've cast a spell, and we need to check how long ago that was */
int nDiff = nUptime-nTime;
if (nDiff < SECONDS_BETWEEN_SPELLS) {
SetModuleOverrideSpellScriptFinished();
SendMessageToPC(OBJECT_SELF, "Spells must be cast at least " +
IntToString(SECONDS_BETWEEN_SPELLS) + " seconds apart. Wait " +
IntToString(SECONDS_BETWEEN_SPELLS-nDiff) + "more seconds.");
} else
SetLocalInt(OBJECT_SELF, "LastCastTime", nUptime);
} else
SetLocalInt(OBJECT_SELF, "LastCastTime", nUptime);
}
}
I'd only recommend using the 'wait x more seconds' part if you're doing a second-by-second count. LMK if you have any questions.
Funky
Modifié par FunkySwerve, 23 juin 2011 - 03:04 .
#10
Posté 23 juin 2011 - 03:27
Funky,
I appreciate your fast response, Im a script noob and dont really know where to start with this, Im using a spellhooking script that was done for me and a mod heartbeat script. im guessing the above has to be merged with what im currently using.
Mad
I appreciate your fast response, Im a script noob and dont really know where to start with this, Im using a spellhooking script that was done for me and a mod heartbeat script. im guessing the above has to be merged with what im currently using.
Mad
#11
Posté 23 juin 2011 - 03:49
You'll have to merge the spellhooking script for sure. I'd recommend using the mod load script rather than the hearbeat. I can merge them if you post them.
Funky
Funky
#12
Posté 23 juin 2011 - 04:07
Funky
I have created a test mod and am able to get this working using the modheartbeat but not modload script, If i post you my spellhook script is that all you need ?
This was exactly what I was looking for :-)
Message sent
Mad
I have created a test mod and am able to get this working using the modheartbeat but not modload script, If i post you my spellhook script is that all you need ?
This was exactly what I was looking for :-)
Message sent
Mad
Modifié par Madasahatter, 23 juin 2011 - 04:15 .
#13
Posté 23 juin 2011 - 04:16
I would also recommend using a DelayCommand(AssignCommand()) in the above code.
eg - If you try to cast a spell, do you really want the spell to be cancelled if the player has not waited long enough?
Would it not be better to Delay the spell casting, until the next spell cast time has approached.
eg - Work out the LastSpellCast time, get the CurrentTime
int iDiff = CurrentTime - LastSpellCast
if(iDiff <= 9)
DelayCommand(IntToFloat(iDiff),ActionCastSpell(YourArgs));
This way, if you are needing to wait 9 seconds, and you have waited 8 seconds, your spell wont be cancelled, with you having to reselect the spell.
Instead your character would automagically wait the 1 second required, before being able to cast the spell.
Sort of like a combat round modification for spells.
eg - If you try to cast a spell, do you really want the spell to be cancelled if the player has not waited long enough?
Would it not be better to Delay the spell casting, until the next spell cast time has approached.
eg - Work out the LastSpellCast time, get the CurrentTime
int iDiff = CurrentTime - LastSpellCast
if(iDiff <= 9)
DelayCommand(IntToFloat(iDiff),ActionCastSpell(YourArgs));
This way, if you are needing to wait 9 seconds, and you have waited 8 seconds, your spell wont be cancelled, with you having to reselect the spell.
Instead your character would automagically wait the 1 second required, before being able to cast the spell.
Sort of like a combat round modification for spells.
#14
Posté 23 juin 2011 - 04:33
A problem, Casters cannot buff, This is affecting buff spells to.
#15
Posté 23 juin 2011 - 05:04
Funky,
Hear is my script as requested, could you please merge the above code and as Baaleos mentioned above would it be possible to wait until time is up rather than loose the spell if cast before time is up, It would also be good if this did not affect there buff spells.
Thanks
////////////////////////////////////////////
/*
I created this base spellhooking script to give builders a resource for
a quality spell hook script which will include quite a few options for
all spells cast, and a variety of options for scripters. NOTE: At the
bottom of this script are examples codes you can use to modify a particular
spell to your likings, the codes are there for fast use and a referrence
on how to utilize this system. I tried to comment this script the best I
could to ensure nobody got confused when reading the code below..
//NOTE: Configuration Settings are in the script "spellfunc_inc"
To ensure there were no conflicts or errors between nw_i0_spells and this
script (and the include attached) I changed names of int / floats / strings
to make sure that no errors kicked out, if you find an error within nw_i0_spells
it's because you changed something here which is most likely used there..
(Simply change the name of your int / float / or string to correct this.)
(IMPORTANT, DO NOT SAVE nw_i0_spells script ever!, if you do delete it!)
The best part about this system is, even with updates to your main game
this script will still work normally!! If you edit a particular spell script
then it might be changed when you update nwn to a new version.. ie. 1.69 etc.
NOTE: This script requires intermediate to advanced scripting skills to edit
properly, if you want to edit it, but aren't a good scripter, you may want
to save it under a different name and keep this script as a reference! All you
will need to do is change the string on the module variable (edit/mod properties
advanced tab), change the string myhook to the name of your script.
// */
////////////////IMPORTANT PLEASE READ/////////////////////////////
/*
//If you do NOT want to run the original spell script simply place
//the function below within the case statement {} of the spell you do
//not wish to allow to execute (ie. the spell does only what you script here!)
SetModuleOverrideSpellScriptFinished();
// */
///////////////////////////////////////////////////////////////////
// NO CASTING AREAS //////// OPTIONAL SETTING/////////////////////
/*
If you wish to dissallow casting of any spell (even from items) in a particular
area, simply open up the area, click edit at the top / then area properties,
select the advanced tab, select the variable button [...], then add the
the following int to the area.. (as shown below..)
Name: NOCAST Type: Int Value: 2
Then click add.. and your done! (Make sure the int is there at the top!)
Open up the No Casting Area and edit the area to see how it's set up properly.
For Jail Areas Set this Int in the Advanced Tab / Variables Box..
Name: JAIL Type: Int Value: 1
This will prevent all speech and item use in those areas!
*/
///////////////////////////////////////////////////////////////////////////
//Do not delete any of these includes! (They are vital for this script)
#include "x2_inc_switches"
#include "nw_i0_spells"
#include "check_host_spell"
//See this script to learn premade functions to use in this script
//Those functions save you time as this script is rather long!
//Also you can configure important settings to this script in that script!
//#include "spellfunc_inc"
///////////////////////////////////////////////////////////////////////////////
//Main Script..
void main()
{
//First check who the caster is!
object oCaster = OBJECT_SELF;
//This doesn't run on DMs or NPCs!
if(GetIsDM(oCaster) || !GetIsPC(oCaster))
{ return; }
//Declare Major Variables;
int nSpell=GetSpellId();
int nNonHostile = GetIsNonHostileSpell(nSpell);
int nNonHostileItem;
int nCastLevel = GetCasterLevel(OBJECT_SELF);
int zInt;
object sTarget = GetSpellTargetObject();
object sItem = GetSpellCastItem();
object oArea = GetArea(oCaster);
int nJail = GetLocalInt(oArea, "JAIL");
int nPVP = GetLocalInt(oArea, "PVP");
location sLocation = GetSpellTargetLocation();
int sclass = GetLastSpellCastclass();
string sTN = GetTag(sItem);
int nType;
int a;
//Manual override...
if(GetLocalInt(oCaster, "OVERRIDE_SPELL")==1)
{
//Stop them cold!
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("That item is too powerful for you to use!", oCaster, FALSE);
return;
}
//Let's get the area of the PC
//string cArea = GetTag(GetArea(oCaster));
//This is here to dissallow the script to run if it's not a PC casting spells
//ie. monsters don't get to use the changed effects, only PCs, though if you
//this script to run always no matter who is casting simply type // before if
//to comment out the line below..
if(!GetIsPC(OBJECT_SELF) || GetIsDM(OBJECT_SELF) || GetIsDMPossessed(OBJECT_SELF))
{return;} //Stop the script here..
///////////////////////////////////////////////////////////////////////////////
//Handle Jail...
//NOTHING WORK IN JAIL!!!
if(nJail==1)
{
//If it's an item!
if(sItem!=OBJECT_INVALID)
{
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
return;
}
//Otherwise stop the spell COLD!
else
{
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
return;
}
}
//////////////////No Spells Allowed In Area///////////////////////////////////
//If the PC is in a no casting area, no spell will be cast (even from items!)
//To set up see the above outline
if(GetLocalInt(GetArea(OBJECT_SELF), "NOCAST")==2)
{
a = 0;
//If the spell is NOT Hostile then don't stop the spell!
//Note this code allows the rest of the spell hook to run on the
//non-hostile spell being cast (in town!)
if(nNonHostile!=1)
{
a = 1;
}
if(a==1)
{
//If using a special power or spell from an item...
//If it's not the listed special item..
//& it is in fact a valid object!
if(sItem!=OBJECT_INVALID && sTN != "ammo_maker" &&
sTN != "namingtool" && sTN != "colorwand")
{
nType = GetBaseItemType(GetSpellCastItem());
if(nType != BASE_ITEM_POTIONS &&
nType != BASE_ITEM_ENCHANTED_POTION)
{
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("All spells fizzle in town.", oCaster);
return;
}
}
//Make them stop what they are doing instantly!
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("You cannot cast that spell in this area.", oCaster);
return;
}
}
///////////////Handling Spells Cast From Items/////////////////////////////////
//This is what will happen if the spell was cast from an item..
if(GetSpellCastItem()!=OBJECT_INVALID)
{
//If the PC uses an item on a PC, and it's one of the following spells
//Then the spell will not work on the PC, note you can add other effects
//like if you don't like the spell level restriction of a spell on an item
//you could add aditional changes to the spell here to boost power. Or, if you
//don't like some aspect of a spell and don't want players abusing it, you could
//modify the spell here to run your edited version instead. (copy/paste original)
//Don't forget to add SetModuleOverrideSpellScriptFinished(); at the end
//to stop the original script from running.
//NO ITEMS WORK IN JAIL!!!
if(GetLocalInt(GetArea(oCaster), "JAIL")==1)
{
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
return;
}
////////////////////////////////////////////////////////////////////////////
//Main Script for handling spells
//Spells that will not be allowed to target other players..
switch (nSpell)
{
//Feel free to copy/paste a case function and rename the spell to the
//name of the spell you don't want PC's targeting PCs with from items only!
//case SPELL_NAME: (Like So)
case SPELL_EPIC_RUIN:
{
if(GetIsPC(sTarget))
{
//Don't Cast the original spell
AssignCommand(oCaster, ClearAllActions());
SetModuleOverrideSpellScriptFinished();
}
}break;
//Copy everything above this line if you wish to add more case statements
//simply paste below this line and edit it to fit the spell
//PLEASE NOTE: You should have the spell names filed in alpahbetical order!
case SPELL_HARM:
{
if(GetIsPC(sTarget))
{
//Don't cast the original spell at all
AssignCommand(oCaster, ClearAllActions());
SetModuleOverrideSpellScriptFinished();
}
}break;
case SPELL_DROWN:
{
if(GetIsPC(GetSpellTargetObject()))
{
//Stop the original spell from running..
AssignCommand(oCaster, ClearAllActions());
SetModuleOverrideSpellScriptFinished();
}
}break;
//End switch statement
}
//End if statment
}
///////////Modifications For All Individual Spells////////////////////////
//Switch/Case Statments (for all spells)
switch(nSpell)
{
case SPELL_ACID_FOG:
{
//Code Goes Here..
}break;
case SPELL_ACID_SPLASH:
{
//Code Goes Here..
}break;
case SPELL_AID:
{
//Code Goes Here..
}break;
case SPELL_AMPLIFY:
{
//Code Goes Here..
}break;
case SPELL_ANIMATE_DEAD:
{
//Code Goes Here..
}break;
case SPELL_AURA_OF_VITALITY:
{
//Code Goes Here..
}break;
case SPELL_AURAOFGLORY:
{
//Code Goes Here..
}break;
case SPELL_AWAKEN:
{
//Code Goes Here..
}break;
case SPELL_BALAGARNSIRONHORN:
{
//Code Goes Here..
}break;
case SPELL_BALL_LIGHTNING:
{
//Code Goes Here..
}break;
case SPELL_BANE:
{
//Code Goes Here..
}break;
case SPELL_BANISHMENT:
{
//Code Goes Here..
}break;
case SPELL_BARKSKIN:
{
//Code Goes Here..
}break;
case SPELL_BATTLETIDE:
{
//Code Goes Here..
}break;
case SPELL_BESTOW_CURSE:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_CLENCHED_FIST:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_CRUSHING_HAND:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_FORCEFUL_HAND:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_GRASPING_HAND:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_INTERPOSING_HAND:
{
//Code Goes Here..
}break;
case SPELL_BLACK_BLADE_OF_DISASTER:
{
//Code Goes Here..
}break;
case SPELL_BLACKSTAFF:
{
//Code Goes Here..
}break;
case SPELL_BLADE_BARRIER:
{
//Code Goes Here..
}break;
case SPELL_BLADE_THIRST:
{
//Code Goes Here..
}break;
case SPELL_BLESS:
{
//Code Goes Here..
}break;
case SPELL_BLESS_WEAPON:
{
//Code Goes Here..
}break;
case SPELL_BLINDNESS_AND_DEAFNESS:
{
//Code Goes Here..
}break;
case SPELL_BLOOD_FRENZY:
{
//Code Goes Here..
}break;
case SPELL_BOMBARDMENT:
{
//Code Goes Here..
}break;
case SPELL_BULLS_STRENGTH:
{
//Code Goes Here..
}break;
case SPELL_BURNING_HANDS:
{
//Code Goes Here..
}break;
case SPELL_CALL_LIGHTNING:
{
//Code Goes Here..
}break;
case SPELL_CAMOFLAGE:
{
//Code Goes Here..
}break;
case SPELL_CATS_GRACE:
{
//Code Goes Here..
}break;
case SPELL_CHAIN_LIGHTNING:
{
//Code Goes Here..
}break;
case SPELL_CHARM_MONSTER:
{
//Code Goes Here..
}break;
case SPELL_CHARM_PERSON:
{
//Code Goes Here..
}break;
case SPELL_CHARM_PERSON_OR_ANIMAL:
{
//Code Goes Here..
}break;
case SPELL_CIRCLE_OF_DEATH:
{
//Code Goes Here..
}break;
case SPELL_CIRCLE_OF_DOOM:
{
//Code Goes Here..
}break;
case SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE:
{
//Code Goes Here..
}break;
case SPELL_CLARITY:
{
//Code Goes Here..
}break;
case SPELL_CLOUD_OF_BEWILDERMENT:
{
//Code Goes Here..
}break;
case SPELL_CLOUDKILL:
{
//Code Goes Here..
}break;
case SPELL_COLOR_SPRAY:
{
//Code Goes Here..
}break;
case SPELL_COMBUST:
{
//Code Goes Here..
}break;
case SPELL_CONE_OF_COLD:
{
//Code Goes Here..
}break;
case SPELL_CONFUSION:
{
//Code Goes Here..
}break;
case SPELL_CONTAGION:
{
//Code Goes Here..
}break;
case SPELL_CONTINUAL_FLAME:
{
//Code Goes Here..
}break;
case SPELL_CONTROL_UNDEAD:
{
//Code Goes Here..
}break;
case SPELL_CREATE_GREATER_UNDEAD:
{
//Code Goes Here..
}break;
case SPELL_CREATE_UNDEAD:
{
//Code Goes Here..
}break;
case SPELL_CREEPING_DOOM:
{
//Code Goes Here..
}break;
case SPELL_CRUMBLE:
{
//Code Goes Here..
}break;
case SPELL_CURE_CRITICAL_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_CURE_LIGHT_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_CURE_MINOR_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_CURE_MODERATE_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_CURE_SERIOUS_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_DARKFIRE:
{
//Code Goes Here..
}break;
case SPELL_DARKNESS:
{
//Code Goes Here..
}break;
case SPELL_DAZE:
{
//Code Goes Here..
}break;
case SPELL_DEAFENING_CLANG:
{
//Code Goes Here..
}break;
case SPELL_DEATH_ARMOR:
{
//Code Goes Here..
}break;
case SPELL_DEATH_WARD:
{
//Code Goes Here..
}break;
case SPELL_DELAYED_BLAST_FIREBALL:
{
//Code Goes Here..
}break;
case SPELL_DESTRUCTION:
{
//Code Goes Here..
}break;
case SPELL_DIRGE:
{
//Code Goes Here..
}break;
case SPELL_DISMISSAL:
{
//Code Goes Here..
}break;
case SPELL_DISPEL_MAGIC:
{
//Code Goes Here..
}break;
case SPELL_DISPLACEMENT:
{
//Code Goes Here..
}break;
case SPELL_DIVINE_FAVOR:
{
//Code Goes Here..
}break;
case SPELL_DIVINE_MIGHT:
{
//Code Goes Here..
}break;
case SPELL_DIVINE_POWER:
{
//Code Goes Here..
}break;
case SPELL_DOMINATE_ANIMAL:
{
//Code Goes Here..
}break;
case SPELL_DOMINATE_MONSTER:
{
//Code Goes Here..
}break;
case SPELL_DOMINATE_PERSON:
{
//Code Goes Here..
}break;
case SPELL_DOOM:
{
//Code Goes Here..
}break;
case SPELL_DROWN:
{
//Code Goes Here..
}break;
case SPELL_EAGLE_SPLEDOR:
{
//Code Goes Here..
}break;
case SPELL_EARTHQUAKE:
{
//Code Goes Here..
}break;
case SPELL_ELECTRIC_JOLT:
{
//Code Goes Here..
}break;
case SPELL_ELEMENTAL_SHIELD:
{
//Code Goes Here..
}break;
case SPELL_ELEMENTAL_SWARM:
{
//Code Goes Here..
}break;
case SPELL_ENDURANCE:
{
//Code Goes Here..
}break;
case SPELL_ENDURE_ELEMENTS:
{
//Code Goes Here..
}break;
case SPELL_ENERGY_BUFFER:
{
//Code Goes Here..
}break;
case SPELL_ENERGY_DRAIN:
{
//Code Goes Here..
}break;
case SPELL_ENERVATION:
{
//Code Goes Here..
}break;
case SPELL_ENTANGLE:
{
//Code Goes Here..
}break;
case SPELL_ENTROPIC_SHIELD:
{
//Code Goes Here..
}break;
case SPELL_EPIC_DRAGON_KNIGHT:
{
//Code Goes Here..
}break;
case SPELL_EPIC_HELLBALL:
{
//Code Goes Here..
}break;
case SPELL_EPIC_MAGE_ARMOR:
{
//Code Goes Here..
}break;
case SPELL_EPIC_MUMMY_DUST:
{
//Code Goes Here..
}break;
case SPELL_EPIC_RUIN:
{
//Code Goes Here..
}break;
case SPELL_ETHEREAL_VISAGE:
{
//Code Goes Here..
}break;
case SPELL_ETHEREALNESS:
{
if(nPVP>=1)
{
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("Greater Sanctuary is an illegal spell in PVP Areas.", oCaster);
return;
}
}break;
case SPELL_EVARDS_BLACK_TENTACLES:
{
//Code Goes Here..
}break;
case SPELL_EXPEDITIOUS_RETREAT:
{
//Code Goes Here..
}break;
case SPELL_FEAR:
{
//Code Goes Here..
}break;
case SPELL_FEEBLEMIND:
{
//Code Goes Here..
}break;
case SPELL_FIND_TRAPS:
{
//Code Goes Here..
}break;
case SPELL_FINGER_OF_DEATH:
{
//Code Goes Here..
}break;
case SPELL_FIRE_STORM:
{
//Code Goes Here..
}break;
case SPELL_FIREBALL:
{
//Code Goes Here..
}break;
case SPELL_FIREBRAND:
{
//Code Goes Here..
}break;
case SPELL_FLAME_ARROW:
{
//Code Goes Here..
}break;
case SPELL_FLAME_LASH:
{
//Code Goes Here..
}break;
case SPELL_FLAME_STRIKE:
{
//Code Goes Here..
}break;
case SPELL_FLAME_WEAPON:
{
//Code Goes Here..
}break;
case SPELL_FLARE:
{
//Code Goes Here..
}break;
case SPELL_FLESH_TO_STONE:
{
//Code Goes Here..
}break;
case SPELL_FOXS_CUNNING:
{
//Code Goes Here..
}break;
case SPELL_FREEDOM_OF_MOVEMENT:
{
//Code Goes Here..
}break;
case SPELL_GATE:
{
//Code Goes Here..
}break;
case SPELL_GEDLEES_ELECTRIC_LOOP:
{
//Code Goes Here..
}break;
case SPELL_GHOSTLY_VISAGE:
{
//Code Goes Here..
}break;
case SPELL_GHOUL_TOUCH:
{
//Code Goes Here..
}break;
case SPELL_GLOBE_OF_INVULNERABILITY:
{
//Code Goes Here..
}break;
case SPELL_GLYPH_OF_WARDING:
{
//Code Goes Here..
}break;
case SPELL_GREASE:
{
//Code Goes Here..
}break;
case SPELL_GREAT_THUNDERCLAP:
{
//Code Goes Here..
}break;
case SPELL_GREATER_MAGIC_FANG:
{
//Code Goes Here..
}break;
case SPELL_GREATER_MAGIC_WEAPON:
{
//Code Goes Here..
}break;
case SPELL_GREATER_PLANAR_BINDING:
{
//Code Goes Here..
}break;
case SPELL_GREATER_RESTORATION:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_ACID_ARROW:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_MINOR_GLOBE:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_MIRROR_IMAGE:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_SUMMON_SHADOW:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_WEB:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SPELL_BREACH:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SPELL_MANTLE:
{
//Code Goes Here..
}break;
case SPELL_GREATER_STONESKIN:
{
//Code Goes Here..
}break;
case SPELL_GUST_OF_WIND:
{
//Code Goes Here..
}break;
case SPELL_HAMMER_OF_THE_GODS:
{
//Code Goes Here..
}break;
case SPELL_HARM:
{
//Code Goes Here..
}break;
case SPELL_HASTE:
{
//Code Goes Here..
}break;
case SPELL_HEAL:
{
//Code Goes Here..
}break;
case SPELL_HEALING_CIRCLE:
{
//Code Goes Here..
}break;
case SPELL_HEALING_STING:
{
//Code Goes Here..
}break;
case SPELL_HOLD_ANIMAL:
{
//Code Goes Here..
}break;
case SPELL_HOLD_MONSTER:
{
//Code Goes Here..
}break;
case SPELL_HOLD_PERSON:
{
//Code Goes Here..
}break;
case SPELL_HOLY_AURA:
{
//Code Goes Here..
}break;
case SPELL_HOLY_SWORD:
{
//Code Goes Here..
}break;
case SPELL_HORIZIKAULS_BOOM:
{
//Code Goes Here..
}break;
case SPELL_HORRID_WILTING:
{
//Code Goes Here..
}break;
case SPELL_ICE_DAGGER:
{
//Code Goes Here..
}break;
case SPELL_ICE_STORM:
{
//Code Goes Here..
}break;
case SPELL_IDENTIFY:
{
//Code Goes Here..
}break;
case SPELL_IMPLOSION:
{
//Code Goes Here..
}break;
case SPELL_IMPROVED_INVISIBILITY:
{
//Code Goes Here..
}break;
case SPELL_INCENDIARY_CLOUD:
{
//Code Goes Here..
}break;
case SPELL_INFERNO:
{
//Code Goes Here..
}break;
case SPELL_INFESTATION_OF_MAGGOTS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_CRITICAL_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_LIGHT_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_MINOR_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_MODERATE_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_SERIOUS_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INVISIBILITY:
{
//Code Goes Here..
}break;
case SPELL_INVISIBILITY_PURGE:
{
//Code Goes Here..
}break;
case SPELL_INVISIBILITY_SPHERE:
{
//Code Goes Here..
}break;
case SPELL_IRONGUTS:
{
//Code Goes Here..
}break;
case SPELL_ISAACS_GREATER_MISSILE_STORM:
{
//Code Goes Here..
}break;
case SPELL_ISAACS_LESSER_MISSILE_STORM:
{
//Code Goes Here..
}break;
case SPELL_KEEN_EDGE:
{
//Code Goes Here..
}break;
case SPELL_KNOCK:
{
//Code Goes Here..
}break;
case SPELL_LEGEND_LORE:
{
//Code Goes Here..
}break;
case SPELL_LESSER_DISPEL:
{
//Code Goes Here..
}break;
case SPELL_LESSER_MIND_BLANK:
{
//Code Goes Here..
}break;
case SPELL_LESSER_PLANAR_BINDING:
{
//Code Goes Here..
}break;
case SPELL_LESSER_RESTORATION:
{
//Code Goes Here..
}break;
case SPELL_LESSER_SPELL_BREACH:
{
//Code Goes Here..
}break;
case SPELL_LESSER_SPELL_MANTLE:
{
//Code Goes Here..
}break;
case SPELL_LIGHT:
{
//Code Goes Here..
}break;
case SPELL_LIGHTNING_BOLT:
{
//Code Goes Here..
}break;
case SPELL_MAGE_ARMOR:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_CIRCLE_AGAINST_CHAOS:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_CIRCLE_AGAINST_EVIL:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_CIRCLE_AGAINST_GOOD:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_CIRCLE_AGAINST_LAW:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_FANG:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_MISSILE:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_VESTMENT:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_WEAPON:
{
//Code Goes Here..
}break;
case SPELL_MASS_BLINDNESS_AND_DEAFNESS:
{
//Code Goes Here..
}break;
case SPELL_MASS_CAMOFLAGE:
{
//Code Goes Here..
}break;
case SPELL_MASS_CHARM:
{
//Code Goes Here..
}break;
case SPELL_MASS_HASTE:
{
//Code Goes Here..
}break;
case SPELL_MASS_HEAL:
{
//Code Goes Here..
}break;
case SPELL_MELFS_ACID_ARROW:
{
//Code Goes Here..
}break;
case SPELL_MESTILS_ACID_BREATH:
{
//Code Goes Here..
}break;
case SPELL_MESTILS_ACID_SHEATH:
{
//Code Goes Here..
}break;
case SPELL_METEOR_SWARM:
{
//Code Goes Here..
}break;
case SPELL_MIND_BLANK:
{
//Code Goes Here..
}break;
case SPELL_MIND_FOG:
{
//Code Goes Here..
}break;
case SPELL_MINOR_GLOBE_OF_INVULNERABILITY:
{
//Code Goes Here..
}break;
case SPELL_MONSTROUS_REGENERATION:
{
//Code Goes Here..
}break;
case SPELL_MORDENKAINENS_DISJUNCTION:
{
//Code Goes Here..
}break;
case SPELL_MORDENKAINENS_SWORD:
{
//Code Goes Here..
}break;
case SPELL_NATURES_BALANCE:
{
//Code Goes Here..
}break;
case SPELL_NEGATIVE_ENERGY_BURST:
{
//Code Goes Here..
}break;
case SPELL_NEGATIVE_ENERGY_PROTECTION:
{
//Code Goes Here..
}break;
case SPELL_NEGATIVE_ENERGY_RAY:
{
//Code Goes Here..
}break;
case SPELL_NEUTRALIZE_POISON:
{
//Code Goes Here..
}break;
case SPELL_ONE_WITH_THE_LAND:
{
//Code Goes Here..
}break;
case SPELL_OWLS_INSIGHT:
{
//Code Goes Here..
}break;
case SPELL_OWLS_WISDOM:
{
//Code Goes Here..
}break;
case SPELL_PHANTASMAL_KILLER:
{
//Code Goes Here..
}break;
case SPELL_PLANAR_ALLY:
{
//Code Goes Here..
}break;
case SPELL_PLANAR_BINDING:
{
//Code Goes Here..
}break;
case SPELL_POISON:
{
//Code Goes Here..
}break;
case SPELL_POLYMORPH_SELF:
{
//Code Goes Here..
}break;
case SPELL_POWER_WORD_KILL:
{
//Code Goes Here..
}break;
case SPELL_POWER_WORD_STUN:
{
//Code Goes Here..
}break;
case SPELL_PRAYER:
{
//Code Goes Here..
}break;
case SPELL_PREMONITION:
{
//Code Goes Here..
}break;
case SPELL_PRISMATIC_SPRAY:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION__FROM_CHAOS:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_ELEMENTS:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_EVIL:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_GOOD:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_LAW:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_SPELLS:
{
//Code Goes Here..
}break;
case SPELL_QUILLFIRE:
{
//Code Goes Here..
}break;
case SPELL_RAISE_DEAD:
{
//Code Goes Here..
}break;
case SPELL_RAY_OF_ENFEEBLEMENT:
{
//Code Goes Here..
}break;
case SPELL_RAY_OF_FROST:
{
//Code Goes Here..
}break;
case SPELL_REGENERATE:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_BLINDNESS_AND_DEAFNESS:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_CURSE:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_DISEASE:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_FEAR:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_PARALYSIS:
{
//Code Goes Here..
}break;
case SPELL_RESIST_ELEMENTS:
{
//Code Goes Here..
}break;
case SPELL_RESISTANCE:
{
//Code Goes Here..
}break;
case SPELL_RESTORATION:
{
//Code Goes Here..
}break;
case SPELL_RESURRECTION:
{
//Code Goes Here..
}break;
case SPELL_SANCTUARY:
{
if(nPVP>0)
{
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("Sanctuary is an illegal spell in PVP Areas.", oCaster);
return;
}
//Code Goes Here..
}break;
case SPELL_SCARE:
{
//Code Goes Here..
}break;
case SPELL_SCINTILLATING_SPHERE:
{
//Code Goes Here..
}break;
case SPELL_SEARING_LIGHT:
{
//Code Goes Here..
}break;
case SPELL_SEE_INVISIBILITY:
{
//Code Goes Here..
}break;
case SPELL_SHADES_CONE_OF_COLD:
{
//Code Goes Here..
}break;
case SPELL_SHADES_FIREBALL:
{
//Code Goes Here..
}break;
case SPELL_SHADES_STONESKIN:
{
//Code Goes Here..
}break;
case SPELL_SHADES_SUMMON_SHADOW:
{
//Code Goes Here..
}break;
case SPELL_SHADES_WALL_OF_FIRE:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_DARKNESS:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_INIVSIBILITY:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_MAGE_ARMOR:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_MAGIC_MISSILE:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_SUMMON_SHADOW:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_DAZE:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_SHIELD:
{
//Code Goes Here..
}break;
case SPELL_SHAPECHANGE:
{
//Code Goes Here..
}break;
case SPELL_SHELGARNS_PERSISTENT_BLADE:
{
//Code Goes Here..
}break;
case SPELL_SHIELD:
{
//Code Goes Here..
}break;
case SPELL_SHIELD_OF_FAITH:
{
//Code Goes Here..
}break;
case SPELL_SHIELD_OF_LAW:
{
//Code Goes Here..
}break;
case SPELL_SILENCE:
{
//Code Goes Here..
}break;
case SPELL_SLAY_LIVING:
{
//Code Goes Here..
}break;
case SPELL_SLEEP:
{
//Code Goes Here..
}break;
case SPELL_SLOW:
{
//Code Goes Here..
}break;
case SPELL_SOUND_BURST:
{
//Code Goes Here..
}break;
case SPELL_SPELL_MANTLE:
{
//Code Goes Here..
}break;
case SPELL_SPELL_RESISTANCE:
{
//Code Goes Here..
}break;
case SPELL_SPELLSTAFF:
{
//Code Goes Here..
}break;
case SPELL_SPHERE_OF_CHAOS:
{
//Code Goes Here..
}break;
case SPELL_SPIKE_GROWTH:
{
//Code Goes Here..
}break;
case SPELL_STINKING_CLOUD:
{
//Code Goes Here..
}break;
case SPELL_STONE_BONES:
{
//Code Goes Here..
}break;
case SPELL_STONE_TO_FLESH:
{
//Code Goes Here..
}break;
case SPELL_STONEHOLD:
{
//Code Goes Here..
}break;
case SPELL_STONESKIN:
{
//Code Goes Here..
}break;
case SPELL_STORM_OF_VENGEANCE:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_I:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_II:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_III:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_IV:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_IX:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_V:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_VI:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_VII:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_VIII:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_SHADOW:
{
//Code Goes Here..
}break;
case SPELL_SUNBEAM:
{
//Code Goes Here..
}break;
case SPELL_SUNBURST:
{
//Code Goes Here..
}break;
case SPELL_TASHAS_HIDEOUS_LAUGHTER:
{
//Code Goes Here..
}break;
case SPELL_TENSERS_TRANSFORMATION:
{
//Code Goes Here..
}break;
case SPELL_TIME_STOP:
{
if(nPVP>=1)
{
FloatingTextStringOnCreature("Timestop is not allowed in PVP Areas.", OBJECT_SELF, TRUE);
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
}
}break;
case SPELL_TRUE_SEEING:
{
//Code Goes Here..
}break;
case SPELL_TRUE_STRIKE:
{
//Code Goes Here..
}break;
case SPELL_TYMORAS_SMILE:
{
//Code Goes Here..
}break;
case SPELL_UNDEATH_TO_DEATH:
{
//Code Goes Here..
}break;
case SPELL_UNDEATHS_ETERNAL_FOE:
{
//Code Goes Here..
}break;
case SPELL_UNHOLY_AURA:
{
//Code Goes Here..
}break;
case SPELL_VAMPIRIC_TOUCH:
{
//Code Goes Here..
}break;
case SPELL_VINE_MINE:
{
//Code Goes Here..
}break;
case SPELL_VINE_MINE_CAMOUFLAGE:
{
//Code Goes Here..
}break;
case SPELL_VINE_MINE_ENTANGLE:
{
//Code Goes Here..
}break;
case SPELL_VINE_MINE_HAMPER_MOVEMENT:
{
//Code Goes Here..
}break;
case SPELL_VIRTUE:
{
//Code Goes Here..
}break;
case SPELL_WAIL_OF_THE_BANSHEE:
{
//Code Goes Here..
}break;
case SPELL_WALL_OF_FIRE:
{
//Code Goes Here..
}break;
case SPELL_WAR_CRY:
{
//Code Goes Here..
}break;
case SPELL_WEB:
{
//Code Goes Here..
}break;
case SPELL_WEIRD:
{
//Code Goes Here..
}break;
case SPELL_WORD_OF_FAITH:
{
//Code Goes Here..
}break;
case SPELL_WOUNDING_WHISPERS:
{
//Code Goes Here..
}break;
//Default happens when a normal spell not listed here is cast...
//Feel free to add any code you wish to apply to all spells not listed
default:
{
//Code goes here
}break;
//End Switch Statement
}
//End Script
}
///////////////////////////////////////////////////
/*
///////////////////EXAMPLE SCRIPTS FUNCTIONS/////////////////////////
//The script functions below are for you to copy / paste if you want to utilize
//They are actual script functions that work and were predone to save you time.
/* (Commenting out, do not touch this line!) / (Copy / Paste below here)
////////////////////////////////////////////////////////////////////////
//Case Statment Examples..
//Example of Generic Code for an Area of Effect Spell
//Note: (The Spell name constant below must be valid!)
case SPELL_WHATEVER: //Change this to the actual spell being cast..
{
//Note if the spell does area damage use this always!
DoAreaBonusDmg(GetSpellTargetLocation());
//Do a generic visual (see the "spellfunc_inc" script)
DoAVisual(GetSpellTargetLocation());
//Do Positive Damage to all in area (if not resisted or saved)
DoAreaDmg();
//Don't run the original script at all!
SetModuleOverrideSpellScriptFinished();
}
break;
//Example Generic Code for a Spell that only targets one target..
case SPELL_BLAHZAM: //Change the SPELL_NAME to the actual spell being cast.
{
//Note if the spell does target damage use this always!
DoBonusDmg(GetSpellTargetObject());
//Do a generic targeted visual (see the "spellfunc_inc" script)
DoTVisual();
//Do Positive Damage to the target of the spell (if not resisted or saved)
DoTDmg();
//Don't run the original script at all!
SetModuleOverrideSpellScriptFinished();
}
break;
//Example of code for modifying a spell for an additional effect..
//Replace SPELL_SHAZAM with the actual name of the spell being cast..
//ie. SPELL_ICE_STORM for icestorm ...etc...
case SPELL_SHAZAM:
{
//Note sTarget is defined at the top after void main()
//This script happens to do no dmg so we won't use bonus dmg..
effect eEffect;
eEffect = EffectParalysis(sTarget);
eEffect = SupernaturalEffect(eEffect);
//Apply paralysis to the target for 6 seconds if save failed..
if(!WillSave(aTarget, GetSpellDC(), SAVING_THROW_TYPE_NONE, OBJECT_SELF)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, sTarget, 6.0f)
}
//Note this effect would be in addition to the spell's normal effects!
//Because the line below is commented out.. (Delete the // below to activate)
//SetModuleOverrideSpellScriptFinished();
}
break;
/////////////////////////////////////////////////////////////////////////
(Copy / Paste above this line only)
// (commenting out end, do not touch this line!) */
Hear is my script as requested, could you please merge the above code and as Baaleos mentioned above would it be possible to wait until time is up rather than loose the spell if cast before time is up, It would also be good if this did not affect there buff spells.
Thanks
////////////////////////////////////////////
/*
I created this base spellhooking script to give builders a resource for
a quality spell hook script which will include quite a few options for
all spells cast, and a variety of options for scripters. NOTE: At the
bottom of this script are examples codes you can use to modify a particular
spell to your likings, the codes are there for fast use and a referrence
on how to utilize this system. I tried to comment this script the best I
could to ensure nobody got confused when reading the code below..
//NOTE: Configuration Settings are in the script "spellfunc_inc"
To ensure there were no conflicts or errors between nw_i0_spells and this
script (and the include attached) I changed names of int / floats / strings
to make sure that no errors kicked out, if you find an error within nw_i0_spells
it's because you changed something here which is most likely used there..
(Simply change the name of your int / float / or string to correct this.)
(IMPORTANT, DO NOT SAVE nw_i0_spells script ever!, if you do delete it!)
The best part about this system is, even with updates to your main game
this script will still work normally!! If you edit a particular spell script
then it might be changed when you update nwn to a new version.. ie. 1.69 etc.
NOTE: This script requires intermediate to advanced scripting skills to edit
properly, if you want to edit it, but aren't a good scripter, you may want
to save it under a different name and keep this script as a reference! All you
will need to do is change the string on the module variable (edit/mod properties
advanced tab), change the string myhook to the name of your script.
// */
////////////////IMPORTANT PLEASE READ/////////////////////////////
/*
//If you do NOT want to run the original spell script simply place
//the function below within the case statement {} of the spell you do
//not wish to allow to execute (ie. the spell does only what you script here!)
SetModuleOverrideSpellScriptFinished();
// */
///////////////////////////////////////////////////////////////////
// NO CASTING AREAS //////// OPTIONAL SETTING/////////////////////
/*
If you wish to dissallow casting of any spell (even from items) in a particular
area, simply open up the area, click edit at the top / then area properties,
select the advanced tab, select the variable button [...], then add the
the following int to the area.. (as shown below..)
Name: NOCAST Type: Int Value: 2
Then click add.. and your done! (Make sure the int is there at the top!)
Open up the No Casting Area and edit the area to see how it's set up properly.
For Jail Areas Set this Int in the Advanced Tab / Variables Box..
Name: JAIL Type: Int Value: 1
This will prevent all speech and item use in those areas!
*/
///////////////////////////////////////////////////////////////////////////
//Do not delete any of these includes! (They are vital for this script)
#include "x2_inc_switches"
#include "nw_i0_spells"
#include "check_host_spell"
//See this script to learn premade functions to use in this script
//Those functions save you time as this script is rather long!
//Also you can configure important settings to this script in that script!
//#include "spellfunc_inc"
///////////////////////////////////////////////////////////////////////////////
//Main Script..
void main()
{
//First check who the caster is!
object oCaster = OBJECT_SELF;
//This doesn't run on DMs or NPCs!
if(GetIsDM(oCaster) || !GetIsPC(oCaster))
{ return; }
//Declare Major Variables;
int nSpell=GetSpellId();
int nNonHostile = GetIsNonHostileSpell(nSpell);
int nNonHostileItem;
int nCastLevel = GetCasterLevel(OBJECT_SELF);
int zInt;
object sTarget = GetSpellTargetObject();
object sItem = GetSpellCastItem();
object oArea = GetArea(oCaster);
int nJail = GetLocalInt(oArea, "JAIL");
int nPVP = GetLocalInt(oArea, "PVP");
location sLocation = GetSpellTargetLocation();
int sclass = GetLastSpellCastclass();
string sTN = GetTag(sItem);
int nType;
int a;
//Manual override...
if(GetLocalInt(oCaster, "OVERRIDE_SPELL")==1)
{
//Stop them cold!
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("That item is too powerful for you to use!", oCaster, FALSE);
return;
}
//Let's get the area of the PC
//string cArea = GetTag(GetArea(oCaster));
//This is here to dissallow the script to run if it's not a PC casting spells
//ie. monsters don't get to use the changed effects, only PCs, though if you
//this script to run always no matter who is casting simply type // before if
//to comment out the line below..
if(!GetIsPC(OBJECT_SELF) || GetIsDM(OBJECT_SELF) || GetIsDMPossessed(OBJECT_SELF))
{return;} //Stop the script here..
///////////////////////////////////////////////////////////////////////////////
//Handle Jail...
//NOTHING WORK IN JAIL!!!
if(nJail==1)
{
//If it's an item!
if(sItem!=OBJECT_INVALID)
{
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
return;
}
//Otherwise stop the spell COLD!
else
{
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
return;
}
}
//////////////////No Spells Allowed In Area///////////////////////////////////
//If the PC is in a no casting area, no spell will be cast (even from items!)
//To set up see the above outline
if(GetLocalInt(GetArea(OBJECT_SELF), "NOCAST")==2)
{
a = 0;
//If the spell is NOT Hostile then don't stop the spell!
//Note this code allows the rest of the spell hook to run on the
//non-hostile spell being cast (in town!)
if(nNonHostile!=1)
{
a = 1;
}
if(a==1)
{
//If using a special power or spell from an item...
//If it's not the listed special item..
//& it is in fact a valid object!
if(sItem!=OBJECT_INVALID && sTN != "ammo_maker" &&
sTN != "namingtool" && sTN != "colorwand")
{
nType = GetBaseItemType(GetSpellCastItem());
if(nType != BASE_ITEM_POTIONS &&
nType != BASE_ITEM_ENCHANTED_POTION)
{
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("All spells fizzle in town.", oCaster);
return;
}
}
//Make them stop what they are doing instantly!
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("You cannot cast that spell in this area.", oCaster);
return;
}
}
///////////////Handling Spells Cast From Items/////////////////////////////////
//This is what will happen if the spell was cast from an item..
if(GetSpellCastItem()!=OBJECT_INVALID)
{
//If the PC uses an item on a PC, and it's one of the following spells
//Then the spell will not work on the PC, note you can add other effects
//like if you don't like the spell level restriction of a spell on an item
//you could add aditional changes to the spell here to boost power. Or, if you
//don't like some aspect of a spell and don't want players abusing it, you could
//modify the spell here to run your edited version instead. (copy/paste original)
//Don't forget to add SetModuleOverrideSpellScriptFinished(); at the end
//to stop the original script from running.
//NO ITEMS WORK IN JAIL!!!
if(GetLocalInt(GetArea(oCaster), "JAIL")==1)
{
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
return;
}
////////////////////////////////////////////////////////////////////////////
//Main Script for handling spells
//Spells that will not be allowed to target other players..
switch (nSpell)
{
//Feel free to copy/paste a case function and rename the spell to the
//name of the spell you don't want PC's targeting PCs with from items only!
//case SPELL_NAME: (Like So)
case SPELL_EPIC_RUIN:
{
if(GetIsPC(sTarget))
{
//Don't Cast the original spell
AssignCommand(oCaster, ClearAllActions());
SetModuleOverrideSpellScriptFinished();
}
}break;
//Copy everything above this line if you wish to add more case statements
//simply paste below this line and edit it to fit the spell
//PLEASE NOTE: You should have the spell names filed in alpahbetical order!
case SPELL_HARM:
{
if(GetIsPC(sTarget))
{
//Don't cast the original spell at all
AssignCommand(oCaster, ClearAllActions());
SetModuleOverrideSpellScriptFinished();
}
}break;
case SPELL_DROWN:
{
if(GetIsPC(GetSpellTargetObject()))
{
//Stop the original spell from running..
AssignCommand(oCaster, ClearAllActions());
SetModuleOverrideSpellScriptFinished();
}
}break;
//End switch statement
}
//End if statment
}
///////////Modifications For All Individual Spells////////////////////////
//Switch/Case Statments (for all spells)
switch(nSpell)
{
case SPELL_ACID_FOG:
{
//Code Goes Here..
}break;
case SPELL_ACID_SPLASH:
{
//Code Goes Here..
}break;
case SPELL_AID:
{
//Code Goes Here..
}break;
case SPELL_AMPLIFY:
{
//Code Goes Here..
}break;
case SPELL_ANIMATE_DEAD:
{
//Code Goes Here..
}break;
case SPELL_AURA_OF_VITALITY:
{
//Code Goes Here..
}break;
case SPELL_AURAOFGLORY:
{
//Code Goes Here..
}break;
case SPELL_AWAKEN:
{
//Code Goes Here..
}break;
case SPELL_BALAGARNSIRONHORN:
{
//Code Goes Here..
}break;
case SPELL_BALL_LIGHTNING:
{
//Code Goes Here..
}break;
case SPELL_BANE:
{
//Code Goes Here..
}break;
case SPELL_BANISHMENT:
{
//Code Goes Here..
}break;
case SPELL_BARKSKIN:
{
//Code Goes Here..
}break;
case SPELL_BATTLETIDE:
{
//Code Goes Here..
}break;
case SPELL_BESTOW_CURSE:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_CLENCHED_FIST:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_CRUSHING_HAND:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_FORCEFUL_HAND:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_GRASPING_HAND:
{
//Code Goes Here..
}break;
case SPELL_BIGBYS_INTERPOSING_HAND:
{
//Code Goes Here..
}break;
case SPELL_BLACK_BLADE_OF_DISASTER:
{
//Code Goes Here..
}break;
case SPELL_BLACKSTAFF:
{
//Code Goes Here..
}break;
case SPELL_BLADE_BARRIER:
{
//Code Goes Here..
}break;
case SPELL_BLADE_THIRST:
{
//Code Goes Here..
}break;
case SPELL_BLESS:
{
//Code Goes Here..
}break;
case SPELL_BLESS_WEAPON:
{
//Code Goes Here..
}break;
case SPELL_BLINDNESS_AND_DEAFNESS:
{
//Code Goes Here..
}break;
case SPELL_BLOOD_FRENZY:
{
//Code Goes Here..
}break;
case SPELL_BOMBARDMENT:
{
//Code Goes Here..
}break;
case SPELL_BULLS_STRENGTH:
{
//Code Goes Here..
}break;
case SPELL_BURNING_HANDS:
{
//Code Goes Here..
}break;
case SPELL_CALL_LIGHTNING:
{
//Code Goes Here..
}break;
case SPELL_CAMOFLAGE:
{
//Code Goes Here..
}break;
case SPELL_CATS_GRACE:
{
//Code Goes Here..
}break;
case SPELL_CHAIN_LIGHTNING:
{
//Code Goes Here..
}break;
case SPELL_CHARM_MONSTER:
{
//Code Goes Here..
}break;
case SPELL_CHARM_PERSON:
{
//Code Goes Here..
}break;
case SPELL_CHARM_PERSON_OR_ANIMAL:
{
//Code Goes Here..
}break;
case SPELL_CIRCLE_OF_DEATH:
{
//Code Goes Here..
}break;
case SPELL_CIRCLE_OF_DOOM:
{
//Code Goes Here..
}break;
case SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE:
{
//Code Goes Here..
}break;
case SPELL_CLARITY:
{
//Code Goes Here..
}break;
case SPELL_CLOUD_OF_BEWILDERMENT:
{
//Code Goes Here..
}break;
case SPELL_CLOUDKILL:
{
//Code Goes Here..
}break;
case SPELL_COLOR_SPRAY:
{
//Code Goes Here..
}break;
case SPELL_COMBUST:
{
//Code Goes Here..
}break;
case SPELL_CONE_OF_COLD:
{
//Code Goes Here..
}break;
case SPELL_CONFUSION:
{
//Code Goes Here..
}break;
case SPELL_CONTAGION:
{
//Code Goes Here..
}break;
case SPELL_CONTINUAL_FLAME:
{
//Code Goes Here..
}break;
case SPELL_CONTROL_UNDEAD:
{
//Code Goes Here..
}break;
case SPELL_CREATE_GREATER_UNDEAD:
{
//Code Goes Here..
}break;
case SPELL_CREATE_UNDEAD:
{
//Code Goes Here..
}break;
case SPELL_CREEPING_DOOM:
{
//Code Goes Here..
}break;
case SPELL_CRUMBLE:
{
//Code Goes Here..
}break;
case SPELL_CURE_CRITICAL_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_CURE_LIGHT_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_CURE_MINOR_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_CURE_MODERATE_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_CURE_SERIOUS_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_DARKFIRE:
{
//Code Goes Here..
}break;
case SPELL_DARKNESS:
{
//Code Goes Here..
}break;
case SPELL_DAZE:
{
//Code Goes Here..
}break;
case SPELL_DEAFENING_CLANG:
{
//Code Goes Here..
}break;
case SPELL_DEATH_ARMOR:
{
//Code Goes Here..
}break;
case SPELL_DEATH_WARD:
{
//Code Goes Here..
}break;
case SPELL_DELAYED_BLAST_FIREBALL:
{
//Code Goes Here..
}break;
case SPELL_DESTRUCTION:
{
//Code Goes Here..
}break;
case SPELL_DIRGE:
{
//Code Goes Here..
}break;
case SPELL_DISMISSAL:
{
//Code Goes Here..
}break;
case SPELL_DISPEL_MAGIC:
{
//Code Goes Here..
}break;
case SPELL_DISPLACEMENT:
{
//Code Goes Here..
}break;
case SPELL_DIVINE_FAVOR:
{
//Code Goes Here..
}break;
case SPELL_DIVINE_MIGHT:
{
//Code Goes Here..
}break;
case SPELL_DIVINE_POWER:
{
//Code Goes Here..
}break;
case SPELL_DOMINATE_ANIMAL:
{
//Code Goes Here..
}break;
case SPELL_DOMINATE_MONSTER:
{
//Code Goes Here..
}break;
case SPELL_DOMINATE_PERSON:
{
//Code Goes Here..
}break;
case SPELL_DOOM:
{
//Code Goes Here..
}break;
case SPELL_DROWN:
{
//Code Goes Here..
}break;
case SPELL_EAGLE_SPLEDOR:
{
//Code Goes Here..
}break;
case SPELL_EARTHQUAKE:
{
//Code Goes Here..
}break;
case SPELL_ELECTRIC_JOLT:
{
//Code Goes Here..
}break;
case SPELL_ELEMENTAL_SHIELD:
{
//Code Goes Here..
}break;
case SPELL_ELEMENTAL_SWARM:
{
//Code Goes Here..
}break;
case SPELL_ENDURANCE:
{
//Code Goes Here..
}break;
case SPELL_ENDURE_ELEMENTS:
{
//Code Goes Here..
}break;
case SPELL_ENERGY_BUFFER:
{
//Code Goes Here..
}break;
case SPELL_ENERGY_DRAIN:
{
//Code Goes Here..
}break;
case SPELL_ENERVATION:
{
//Code Goes Here..
}break;
case SPELL_ENTANGLE:
{
//Code Goes Here..
}break;
case SPELL_ENTROPIC_SHIELD:
{
//Code Goes Here..
}break;
case SPELL_EPIC_DRAGON_KNIGHT:
{
//Code Goes Here..
}break;
case SPELL_EPIC_HELLBALL:
{
//Code Goes Here..
}break;
case SPELL_EPIC_MAGE_ARMOR:
{
//Code Goes Here..
}break;
case SPELL_EPIC_MUMMY_DUST:
{
//Code Goes Here..
}break;
case SPELL_EPIC_RUIN:
{
//Code Goes Here..
}break;
case SPELL_ETHEREAL_VISAGE:
{
//Code Goes Here..
}break;
case SPELL_ETHEREALNESS:
{
if(nPVP>=1)
{
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("Greater Sanctuary is an illegal spell in PVP Areas.", oCaster);
return;
}
}break;
case SPELL_EVARDS_BLACK_TENTACLES:
{
//Code Goes Here..
}break;
case SPELL_EXPEDITIOUS_RETREAT:
{
//Code Goes Here..
}break;
case SPELL_FEAR:
{
//Code Goes Here..
}break;
case SPELL_FEEBLEMIND:
{
//Code Goes Here..
}break;
case SPELL_FIND_TRAPS:
{
//Code Goes Here..
}break;
case SPELL_FINGER_OF_DEATH:
{
//Code Goes Here..
}break;
case SPELL_FIRE_STORM:
{
//Code Goes Here..
}break;
case SPELL_FIREBALL:
{
//Code Goes Here..
}break;
case SPELL_FIREBRAND:
{
//Code Goes Here..
}break;
case SPELL_FLAME_ARROW:
{
//Code Goes Here..
}break;
case SPELL_FLAME_LASH:
{
//Code Goes Here..
}break;
case SPELL_FLAME_STRIKE:
{
//Code Goes Here..
}break;
case SPELL_FLAME_WEAPON:
{
//Code Goes Here..
}break;
case SPELL_FLARE:
{
//Code Goes Here..
}break;
case SPELL_FLESH_TO_STONE:
{
//Code Goes Here..
}break;
case SPELL_FOXS_CUNNING:
{
//Code Goes Here..
}break;
case SPELL_FREEDOM_OF_MOVEMENT:
{
//Code Goes Here..
}break;
case SPELL_GATE:
{
//Code Goes Here..
}break;
case SPELL_GEDLEES_ELECTRIC_LOOP:
{
//Code Goes Here..
}break;
case SPELL_GHOSTLY_VISAGE:
{
//Code Goes Here..
}break;
case SPELL_GHOUL_TOUCH:
{
//Code Goes Here..
}break;
case SPELL_GLOBE_OF_INVULNERABILITY:
{
//Code Goes Here..
}break;
case SPELL_GLYPH_OF_WARDING:
{
//Code Goes Here..
}break;
case SPELL_GREASE:
{
//Code Goes Here..
}break;
case SPELL_GREAT_THUNDERCLAP:
{
//Code Goes Here..
}break;
case SPELL_GREATER_MAGIC_FANG:
{
//Code Goes Here..
}break;
case SPELL_GREATER_MAGIC_WEAPON:
{
//Code Goes Here..
}break;
case SPELL_GREATER_PLANAR_BINDING:
{
//Code Goes Here..
}break;
case SPELL_GREATER_RESTORATION:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_ACID_ARROW:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_MINOR_GLOBE:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_MIRROR_IMAGE:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_SUMMON_SHADOW:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SHADOW_CONJURATION_WEB:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SPELL_BREACH:
{
//Code Goes Here..
}break;
case SPELL_GREATER_SPELL_MANTLE:
{
//Code Goes Here..
}break;
case SPELL_GREATER_STONESKIN:
{
//Code Goes Here..
}break;
case SPELL_GUST_OF_WIND:
{
//Code Goes Here..
}break;
case SPELL_HAMMER_OF_THE_GODS:
{
//Code Goes Here..
}break;
case SPELL_HARM:
{
//Code Goes Here..
}break;
case SPELL_HASTE:
{
//Code Goes Here..
}break;
case SPELL_HEAL:
{
//Code Goes Here..
}break;
case SPELL_HEALING_CIRCLE:
{
//Code Goes Here..
}break;
case SPELL_HEALING_STING:
{
//Code Goes Here..
}break;
case SPELL_HOLD_ANIMAL:
{
//Code Goes Here..
}break;
case SPELL_HOLD_MONSTER:
{
//Code Goes Here..
}break;
case SPELL_HOLD_PERSON:
{
//Code Goes Here..
}break;
case SPELL_HOLY_AURA:
{
//Code Goes Here..
}break;
case SPELL_HOLY_SWORD:
{
//Code Goes Here..
}break;
case SPELL_HORIZIKAULS_BOOM:
{
//Code Goes Here..
}break;
case SPELL_HORRID_WILTING:
{
//Code Goes Here..
}break;
case SPELL_ICE_DAGGER:
{
//Code Goes Here..
}break;
case SPELL_ICE_STORM:
{
//Code Goes Here..
}break;
case SPELL_IDENTIFY:
{
//Code Goes Here..
}break;
case SPELL_IMPLOSION:
{
//Code Goes Here..
}break;
case SPELL_IMPROVED_INVISIBILITY:
{
//Code Goes Here..
}break;
case SPELL_INCENDIARY_CLOUD:
{
//Code Goes Here..
}break;
case SPELL_INFERNO:
{
//Code Goes Here..
}break;
case SPELL_INFESTATION_OF_MAGGOTS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_CRITICAL_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_LIGHT_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_MINOR_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_MODERATE_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INFLICT_SERIOUS_WOUNDS:
{
//Code Goes Here..
}break;
case SPELL_INVISIBILITY:
{
//Code Goes Here..
}break;
case SPELL_INVISIBILITY_PURGE:
{
//Code Goes Here..
}break;
case SPELL_INVISIBILITY_SPHERE:
{
//Code Goes Here..
}break;
case SPELL_IRONGUTS:
{
//Code Goes Here..
}break;
case SPELL_ISAACS_GREATER_MISSILE_STORM:
{
//Code Goes Here..
}break;
case SPELL_ISAACS_LESSER_MISSILE_STORM:
{
//Code Goes Here..
}break;
case SPELL_KEEN_EDGE:
{
//Code Goes Here..
}break;
case SPELL_KNOCK:
{
//Code Goes Here..
}break;
case SPELL_LEGEND_LORE:
{
//Code Goes Here..
}break;
case SPELL_LESSER_DISPEL:
{
//Code Goes Here..
}break;
case SPELL_LESSER_MIND_BLANK:
{
//Code Goes Here..
}break;
case SPELL_LESSER_PLANAR_BINDING:
{
//Code Goes Here..
}break;
case SPELL_LESSER_RESTORATION:
{
//Code Goes Here..
}break;
case SPELL_LESSER_SPELL_BREACH:
{
//Code Goes Here..
}break;
case SPELL_LESSER_SPELL_MANTLE:
{
//Code Goes Here..
}break;
case SPELL_LIGHT:
{
//Code Goes Here..
}break;
case SPELL_LIGHTNING_BOLT:
{
//Code Goes Here..
}break;
case SPELL_MAGE_ARMOR:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_CIRCLE_AGAINST_CHAOS:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_CIRCLE_AGAINST_EVIL:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_CIRCLE_AGAINST_GOOD:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_CIRCLE_AGAINST_LAW:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_FANG:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_MISSILE:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_VESTMENT:
{
//Code Goes Here..
}break;
case SPELL_MAGIC_WEAPON:
{
//Code Goes Here..
}break;
case SPELL_MASS_BLINDNESS_AND_DEAFNESS:
{
//Code Goes Here..
}break;
case SPELL_MASS_CAMOFLAGE:
{
//Code Goes Here..
}break;
case SPELL_MASS_CHARM:
{
//Code Goes Here..
}break;
case SPELL_MASS_HASTE:
{
//Code Goes Here..
}break;
case SPELL_MASS_HEAL:
{
//Code Goes Here..
}break;
case SPELL_MELFS_ACID_ARROW:
{
//Code Goes Here..
}break;
case SPELL_MESTILS_ACID_BREATH:
{
//Code Goes Here..
}break;
case SPELL_MESTILS_ACID_SHEATH:
{
//Code Goes Here..
}break;
case SPELL_METEOR_SWARM:
{
//Code Goes Here..
}break;
case SPELL_MIND_BLANK:
{
//Code Goes Here..
}break;
case SPELL_MIND_FOG:
{
//Code Goes Here..
}break;
case SPELL_MINOR_GLOBE_OF_INVULNERABILITY:
{
//Code Goes Here..
}break;
case SPELL_MONSTROUS_REGENERATION:
{
//Code Goes Here..
}break;
case SPELL_MORDENKAINENS_DISJUNCTION:
{
//Code Goes Here..
}break;
case SPELL_MORDENKAINENS_SWORD:
{
//Code Goes Here..
}break;
case SPELL_NATURES_BALANCE:
{
//Code Goes Here..
}break;
case SPELL_NEGATIVE_ENERGY_BURST:
{
//Code Goes Here..
}break;
case SPELL_NEGATIVE_ENERGY_PROTECTION:
{
//Code Goes Here..
}break;
case SPELL_NEGATIVE_ENERGY_RAY:
{
//Code Goes Here..
}break;
case SPELL_NEUTRALIZE_POISON:
{
//Code Goes Here..
}break;
case SPELL_ONE_WITH_THE_LAND:
{
//Code Goes Here..
}break;
case SPELL_OWLS_INSIGHT:
{
//Code Goes Here..
}break;
case SPELL_OWLS_WISDOM:
{
//Code Goes Here..
}break;
case SPELL_PHANTASMAL_KILLER:
{
//Code Goes Here..
}break;
case SPELL_PLANAR_ALLY:
{
//Code Goes Here..
}break;
case SPELL_PLANAR_BINDING:
{
//Code Goes Here..
}break;
case SPELL_POISON:
{
//Code Goes Here..
}break;
case SPELL_POLYMORPH_SELF:
{
//Code Goes Here..
}break;
case SPELL_POWER_WORD_KILL:
{
//Code Goes Here..
}break;
case SPELL_POWER_WORD_STUN:
{
//Code Goes Here..
}break;
case SPELL_PRAYER:
{
//Code Goes Here..
}break;
case SPELL_PREMONITION:
{
//Code Goes Here..
}break;
case SPELL_PRISMATIC_SPRAY:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION__FROM_CHAOS:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_ELEMENTS:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_EVIL:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_GOOD:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_LAW:
{
//Code Goes Here..
}break;
case SPELL_PROTECTION_FROM_SPELLS:
{
//Code Goes Here..
}break;
case SPELL_QUILLFIRE:
{
//Code Goes Here..
}break;
case SPELL_RAISE_DEAD:
{
//Code Goes Here..
}break;
case SPELL_RAY_OF_ENFEEBLEMENT:
{
//Code Goes Here..
}break;
case SPELL_RAY_OF_FROST:
{
//Code Goes Here..
}break;
case SPELL_REGENERATE:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_BLINDNESS_AND_DEAFNESS:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_CURSE:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_DISEASE:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_FEAR:
{
//Code Goes Here..
}break;
case SPELL_REMOVE_PARALYSIS:
{
//Code Goes Here..
}break;
case SPELL_RESIST_ELEMENTS:
{
//Code Goes Here..
}break;
case SPELL_RESISTANCE:
{
//Code Goes Here..
}break;
case SPELL_RESTORATION:
{
//Code Goes Here..
}break;
case SPELL_RESURRECTION:
{
//Code Goes Here..
}break;
case SPELL_SANCTUARY:
{
if(nPVP>0)
{
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("Sanctuary is an illegal spell in PVP Areas.", oCaster);
return;
}
//Code Goes Here..
}break;
case SPELL_SCARE:
{
//Code Goes Here..
}break;
case SPELL_SCINTILLATING_SPHERE:
{
//Code Goes Here..
}break;
case SPELL_SEARING_LIGHT:
{
//Code Goes Here..
}break;
case SPELL_SEE_INVISIBILITY:
{
//Code Goes Here..
}break;
case SPELL_SHADES_CONE_OF_COLD:
{
//Code Goes Here..
}break;
case SPELL_SHADES_FIREBALL:
{
//Code Goes Here..
}break;
case SPELL_SHADES_STONESKIN:
{
//Code Goes Here..
}break;
case SPELL_SHADES_SUMMON_SHADOW:
{
//Code Goes Here..
}break;
case SPELL_SHADES_WALL_OF_FIRE:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_DARKNESS:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_INIVSIBILITY:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_MAGE_ARMOR:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_MAGIC_MISSILE:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_CONJURATION_SUMMON_SHADOW:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_DAZE:
{
//Code Goes Here..
}break;
case SPELL_SHADOW_SHIELD:
{
//Code Goes Here..
}break;
case SPELL_SHAPECHANGE:
{
//Code Goes Here..
}break;
case SPELL_SHELGARNS_PERSISTENT_BLADE:
{
//Code Goes Here..
}break;
case SPELL_SHIELD:
{
//Code Goes Here..
}break;
case SPELL_SHIELD_OF_FAITH:
{
//Code Goes Here..
}break;
case SPELL_SHIELD_OF_LAW:
{
//Code Goes Here..
}break;
case SPELL_SILENCE:
{
//Code Goes Here..
}break;
case SPELL_SLAY_LIVING:
{
//Code Goes Here..
}break;
case SPELL_SLEEP:
{
//Code Goes Here..
}break;
case SPELL_SLOW:
{
//Code Goes Here..
}break;
case SPELL_SOUND_BURST:
{
//Code Goes Here..
}break;
case SPELL_SPELL_MANTLE:
{
//Code Goes Here..
}break;
case SPELL_SPELL_RESISTANCE:
{
//Code Goes Here..
}break;
case SPELL_SPELLSTAFF:
{
//Code Goes Here..
}break;
case SPELL_SPHERE_OF_CHAOS:
{
//Code Goes Here..
}break;
case SPELL_SPIKE_GROWTH:
{
//Code Goes Here..
}break;
case SPELL_STINKING_CLOUD:
{
//Code Goes Here..
}break;
case SPELL_STONE_BONES:
{
//Code Goes Here..
}break;
case SPELL_STONE_TO_FLESH:
{
//Code Goes Here..
}break;
case SPELL_STONEHOLD:
{
//Code Goes Here..
}break;
case SPELL_STONESKIN:
{
//Code Goes Here..
}break;
case SPELL_STORM_OF_VENGEANCE:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_I:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_II:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_III:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_IV:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_IX:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_V:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_VI:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_VII:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_CREATURE_VIII:
{
//Code Goes Here..
}break;
case SPELL_SUMMON_SHADOW:
{
//Code Goes Here..
}break;
case SPELL_SUNBEAM:
{
//Code Goes Here..
}break;
case SPELL_SUNBURST:
{
//Code Goes Here..
}break;
case SPELL_TASHAS_HIDEOUS_LAUGHTER:
{
//Code Goes Here..
}break;
case SPELL_TENSERS_TRANSFORMATION:
{
//Code Goes Here..
}break;
case SPELL_TIME_STOP:
{
if(nPVP>=1)
{
FloatingTextStringOnCreature("Timestop is not allowed in PVP Areas.", OBJECT_SELF, TRUE);
//Though the player may show animation, nothing happens!
SetModuleOverrideSpellScriptFinished();
}
}break;
case SPELL_TRUE_SEEING:
{
//Code Goes Here..
}break;
case SPELL_TRUE_STRIKE:
{
//Code Goes Here..
}break;
case SPELL_TYMORAS_SMILE:
{
//Code Goes Here..
}break;
case SPELL_UNDEATH_TO_DEATH:
{
//Code Goes Here..
}break;
case SPELL_UNDEATHS_ETERNAL_FOE:
{
//Code Goes Here..
}break;
case SPELL_UNHOLY_AURA:
{
//Code Goes Here..
}break;
case SPELL_VAMPIRIC_TOUCH:
{
//Code Goes Here..
}break;
case SPELL_VINE_MINE:
{
//Code Goes Here..
}break;
case SPELL_VINE_MINE_CAMOUFLAGE:
{
//Code Goes Here..
}break;
case SPELL_VINE_MINE_ENTANGLE:
{
//Code Goes Here..
}break;
case SPELL_VINE_MINE_HAMPER_MOVEMENT:
{
//Code Goes Here..
}break;
case SPELL_VIRTUE:
{
//Code Goes Here..
}break;
case SPELL_WAIL_OF_THE_BANSHEE:
{
//Code Goes Here..
}break;
case SPELL_WALL_OF_FIRE:
{
//Code Goes Here..
}break;
case SPELL_WAR_CRY:
{
//Code Goes Here..
}break;
case SPELL_WEB:
{
//Code Goes Here..
}break;
case SPELL_WEIRD:
{
//Code Goes Here..
}break;
case SPELL_WORD_OF_FAITH:
{
//Code Goes Here..
}break;
case SPELL_WOUNDING_WHISPERS:
{
//Code Goes Here..
}break;
//Default happens when a normal spell not listed here is cast...
//Feel free to add any code you wish to apply to all spells not listed
default:
{
//Code goes here
}break;
//End Switch Statement
}
//End Script
}
///////////////////////////////////////////////////
/*
///////////////////EXAMPLE SCRIPTS FUNCTIONS/////////////////////////
//The script functions below are for you to copy / paste if you want to utilize
//They are actual script functions that work and were predone to save you time.
/* (Commenting out, do not touch this line!) / (Copy / Paste below here)
////////////////////////////////////////////////////////////////////////
//Case Statment Examples..
//Example of Generic Code for an Area of Effect Spell
//Note: (The Spell name constant below must be valid!)
case SPELL_WHATEVER: //Change this to the actual spell being cast..
{
//Note if the spell does area damage use this always!
DoAreaBonusDmg(GetSpellTargetLocation());
//Do a generic visual (see the "spellfunc_inc" script)
DoAVisual(GetSpellTargetLocation());
//Do Positive Damage to all in area (if not resisted or saved)
DoAreaDmg();
//Don't run the original script at all!
SetModuleOverrideSpellScriptFinished();
}
break;
//Example Generic Code for a Spell that only targets one target..
case SPELL_BLAHZAM: //Change the SPELL_NAME to the actual spell being cast.
{
//Note if the spell does target damage use this always!
DoBonusDmg(GetSpellTargetObject());
//Do a generic targeted visual (see the "spellfunc_inc" script)
DoTVisual();
//Do Positive Damage to the target of the spell (if not resisted or saved)
DoTDmg();
//Don't run the original script at all!
SetModuleOverrideSpellScriptFinished();
}
break;
//Example of code for modifying a spell for an additional effect..
//Replace SPELL_SHAZAM with the actual name of the spell being cast..
//ie. SPELL_ICE_STORM for icestorm ...etc...
case SPELL_SHAZAM:
{
//Note sTarget is defined at the top after void main()
//This script happens to do no dmg so we won't use bonus dmg..
effect eEffect;
eEffect = EffectParalysis(sTarget);
eEffect = SupernaturalEffect(eEffect);
//Apply paralysis to the target for 6 seconds if save failed..
if(!WillSave(aTarget, GetSpellDC(), SAVING_THROW_TYPE_NONE, OBJECT_SELF)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, sTarget, 6.0f)
}
//Note this effect would be in addition to the spell's normal effects!
//Because the line below is commented out.. (Delete the // below to activate)
//SetModuleOverrideSpellScriptFinished();
}
break;
/////////////////////////////////////////////////////////////////////////
(Copy / Paste above this line only)
// (commenting out end, do not touch this line!) */
#16
Posté 24 juin 2011 - 02:20
Here's the merged code. I used the GetIsNonHostileSpell to limit the timestamping - no idea how well it'll work, since it's in an include I don't have.
I'll let Baaleos add the ActionCast if he wanst - it's a little more involved than he's making out. You'd have to allow cheat casting to save the spell use, which comes with its own set of issues. My normal recommendation would be to simply return the spell use to the player before aborting the spell, but that'd require NWNX.
The modload code works fine. I'm guessing you only put the function in, and never the actual function call to start the delaycommand sequence.
I'll let Baaleos add the ActionCast if he wanst - it's a little more involved than he's making out. You'd have to allow cheat casting to save the spell use, which comes with its own set of issues. My normal recommendation would be to simply return the spell use to the player before aborting the spell, but that'd require NWNX.
The modload code works fine. I'm guessing you only put the function in, and never the actual function call to start the delaycommand sequence.
#include "x2_inc_switches"
#include "nw_i0_spells"
#include "check_host_spell"
const int SECONDS_BETWEEN_SPELLS = 9;
void main()
{
int nSpell=GetSpellId();
int nNonHostile = GetIsNonHostileSpell(nSpell);
int nNonHostileItem;
int nCastLevel = GetCasterLevel(OBJECT_SELF);
int zInt;
object sTarget = GetSpellTargetObject();
object sItem = GetSpellCastItem();
object oArea = GetArea(oCaster);
int nJail = GetLocalInt(oArea, "JAIL");
int nPVP = GetLocalInt(oArea, "PVP");
location sLocation = GetSpellTargetLocation();
int sclass = GetLastSpellCastclass();
string sTN = GetTag(sItem);
int nType;
int a;
//Manual override...
if(GetLocalInt(oCaster, "OVERRIDE_SPELL")==1) {
//Stop them cold!
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens! :)
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("That item is too powerful for you to use!", oCaster, FALSE);
return;
}
if(!GetIsPC(OBJECT_SELF) || GetIsDM(OBJECT_SELF) || GetIsDMPossessed(OBJECT_SELF))
return; //Stop the script here..
if (!nNonHostile) {
int nTime = GetLocalInt(OBJECT_SELF, "LastCastTime");
int nUptime = GetLocalInt(GetModule(), "Uptime");
if (nTime) {
/* because LastCastTime was set, they've cast a spell, and we need to check how long ago that was */
int nDiff = nUptime-nTime;
if (nDiff < SECONDS_BETWEEN_SPELLS) {
DelayCommand(IntToFloat(nDiff),ActionCastSpellAtLocation(nSpellID, lSpell, METAMAGIC_ANY, TRUE));
SetModuleOverrideSpellScriptFinished();
SendMessageToPC(OBJECT_SELF, "Spells must be cast at least " +
IntToString(SECONDS_BETWEEN_SPELLS) + " seconds apart. Wait " +
IntToString(SECONDS_BETWEEN_SPELLS-nDiff) + "more seconds.");
} else
SetLocalInt(OBJECT_SELF, "LastCastTime", nUptime);
} else
SetLocalInt(OBJECT_SELF, "LastCastTime", nUptime);
}
//Handle Jail...
//NOTHING WORK IN JAIL!!!
if(nJail==1) {
//If it's an item!
if(sItem!=OBJECT_INVALID) {
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens! :)
SetModuleOverrideSpellScriptFinished();
return;
}
//Otherwise stop the spell COLD!
else {
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens! :)
SetModuleOverrideSpellScriptFinished();
return;
}
}
//////////////////No Spells Allowed In Area///////////////////////////////////
//If the PC is in a no casting area, no spell will be cast (even from items!)
//To set up see the above outline
if(GetLocalInt(GetArea(OBJECT_SELF), "NOCAST")==2) {
a = 0;
//If the spell is NOT Hostile then don't stop the spell!
//Note this code allows the rest of the spell hook to run on the
//non-hostile spell being cast (in town!)
if(nNonHostile!=1) {
a = 1;
}
if(a==1) {
//If using a special power or spell from an item...
//If it's not the listed special item..
//& it is in fact a valid object!
if(sItem!=OBJECT_INVALID &&
sTN != "ammo_maker" &&
sTN != "namingtool" && sTN != "colorwand") {
nType = GetBaseItemType(GetSpellCastItem());
if(nType != BASE_ITEM_POTIONS &&
nType != BASE_ITEM_ENCHANTED_POTION) {
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens! :)
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("All spells fizzle in town.", oCaster);
return;
}
}
//Make them stop what they are doing instantly!
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens! :)
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("You cannot cast that spell in this area.", oCaster);
return;
}
}
//This is what will happen if the spell was cast from an item..
if(GetSpellCastItem()!=OBJECT_INVALID) {
//If the PC uses an item on a PC, and it's one of the following spells
//Then the spell will not work on the PC, note you can add other effects
//like if you don't like the spell level restriction of a spell on an item
//you could add aditional changes to the spell here to boost power. Or, if you
//don't like some aspect of a spell and don't want players abusing it, you could
//modify the spell here to run your edited version instead. (copy/paste original)
//Don't forget to add SetModuleOverrideSpellScriptFinished(); at the end
//to stop the original script from running.
//NO ITEMS WORK IN JAIL!!!
if(GetLocalInt(GetArea(oCaster), "JAIL")==1) {
AssignCommand(oCaster, ClearAllActions());
//Though the player may show animation, nothing happens! :)
SetModuleOverrideSpellScriptFinished();
return;
}
////////////////////////////////////////////////////////////////////////////
//Main Script for handling spells
if(GetIsPC(sTarget)) {
switch (nSpell) {
case SPELL_EPIC_RUIN:
case SPELL_HARM:
case SPELL_DROWN:
if(GetIsPC(sTarget)) {
//Don't Cast the original spell
AssignCommand(oCaster, ClearAllActions());
SetModuleOverrideSpellScriptFinished();
}
break;
}
}
} //End if statment for items
///////////Modifications For All Individual Spells////////////////////////
switch(nSpell) {
case SPELL_ETHEREALNESS:
case SPELL_SANCTUARY:
if(nPVP>0) {
SetModuleOverrideSpellScriptFinished();
FloatingTextStringOnCreature("Sanctuary is an illegal spell in PVP Areas.", oCaster);
}
break;
case SPELL_TIME_STOP:
if(nPVP>=1) {
FloatingTextStringOnCreature("Timestop is not allowed in PVP Areas.", OBJECT_SELF, TRUE);
SetModuleOverrideSpellScriptFinished();
}
break;
}
}
#17
Posté 24 juin 2011 - 11:54
Funky,
This does not compile getting error ERROR: PARSING VARIABLE LIST
If it helps I am using NWNX2
This does not compile getting error ERROR: PARSING VARIABLE LIST
If it helps I am using NWNX2
Modifié par Madasahatter, 24 juin 2011 - 11:55 .
#18
Posté 24 juin 2011 - 12:07
hear is the include file - check_host_spell
//PROTOTYPE DEFINED
int GetIsNonHostileSpell(int nSpell)
{
int nNonHostile = 0;
//Spells that will not be allowed to target other players..
switch (nSpell)
{
case SPELL_ACTIVATE_ITEM_SELF2: { nNonHostile = 1; }break;
case SPELL_AID: { nNonHostile = 1; }break;
case SPELL_AMPLIFY: { nNonHostile = 1; }break;
case SPELL_AURA_OF_VITALITY: { nNonHostile = 1; }break;
case SPELL_AWAKEN: { nNonHostile = 1; }break;
case SPELL_AURAOFGLORY: { nNonHostile = 1; }break;
case SPELL_BARKSKIN: { nNonHostile = 1; }break;
case SPELL_BATTLETIDE: { nNonHostile = 1; }break;
case SPELL_BLESS: { nNonHostile = 1; }break;
case SPELL_BLESS_WEAPON: { nNonHostile = 1; }break;
case SPELL_BLOOD_FRENZY: { nNonHostile = 1; }break;
case SPELL_BULLS_STRENGTH: { nNonHostile = 1; }break;
case SPELL_CAMOFLAGE: { nNonHostile = 1; }break;
case SPELL_CATS_GRACE: { nNonHostile = 1; }break;
case SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE: { nNonHostile = 1; }break;
case SPELL_CLARITY: { nNonHostile = 1; }break;
case SPELL_CONTINUAL_FLAME: { nNonHostile = 1; }break;
case SPELL_CRAFT_ADD_ITEM_PROPERTY: { nNonHostile = 1; }break;
case SPELL_CRAFT_HARPER_ITEM: { nNonHostile = 1; }break;
case SPELL_CURE_CRITICAL_WOUNDS: { nNonHostile = 1; }break;
case SPELL_CURE_LIGHT_WOUNDS: { nNonHostile = 1; }break;
case SPELL_CURE_MINOR_WOUNDS: { nNonHostile = 1; }break;
case SPELL_CURE_MODERATE_WOUNDS: { nNonHostile = 1; }break;
case SPELL_CURE_SERIOUS_WOUNDS: { nNonHostile = 1; }break;
case SPELL_DARKFIRE: { nNonHostile = 1; }break;
case SPELL_DARKVISION: { nNonHostile = 1; }break;
case SPELL_DEATH_ARMOR: { nNonHostile = 1; }break;
case SPELL_DEATH_WARD: { nNonHostile = 1; }break;
case SPELL_DISPLACEMENT: { nNonHostile = 1; }break;
case SPELL_DIVINE_FAVOR: { nNonHostile = 1; }break;
case SPELL_DIVINE_MIGHT: { nNonHostile = 1; }break;
case SPELL_DIVINE_POWER: { nNonHostile = 1; }break;
case SPELL_DIVINE_SHIELD: { nNonHostile = 1; }break;
case SPELL_EAGLE_SPLEDOR: { nNonHostile = 1; }break;
case SPELL_ELEMENTAL_SHIELD: { nNonHostile = 1; }break;
case SPELL_ENDURANCE: { nNonHostile = 1; }break;
case SPELL_ENDURE_ELEMENTS: { nNonHostile = 1; }break;
case SPELL_ENERGY_BUFFER: { nNonHostile = 1; }break;
case SPELL_ENTROPIC_SHIELD: { nNonHostile = 1; }break;
case SPELL_EPIC_MAGE_ARMOR: { nNonHostile = 1; }break;
case SPELL_ETHEREAL_VISAGE: { nNonHostile = 1; }break;
case SPELL_ETHEREALNESS: { nNonHostile = 1; }break;
case SPELL_EXPEDITIOUS_RETREAT: { nNonHostile = 1; }break;
case SPELL_FLAME_WEAPON: { nNonHostile = 1; }break;
case SPELL_FOXS_CUNNING: { nNonHostile = 1; }break;
case SPELL_FREEDOM_OF_MOVEMENT: { nNonHostile = 1; }break;
case SPELL_GHOSTLY_VISAGE: { nNonHostile = 1; }break;
case SPELL_GLOBE_OF_INVULNERABILITY: { nNonHostile = 1; }break;
case SPELL_GREATER_BULLS_STRENGTH: { nNonHostile = 1; }break;
case SPELL_GREATER_CATS_GRACE: { nNonHostile = 1; }break;
case SPELL_GREATER_EAGLE_SPLENDOR: { nNonHostile = 1; }break;
case SPELL_GREATER_ENDURANCE: { nNonHostile = 1; }break;
case SPELL_GREATER_FOXS_CUNNING: { nNonHostile = 1; }break;
case SPELL_GREATER_MAGIC_FANG: { nNonHostile = 1; }break;
case SPELL_GREATER_MAGIC_WEAPON: { nNonHostile = 1; }break;
case SPELL_GREATER_OWLS_WISDOM: { nNonHostile = 1; }break;
case SPELL_GREATER_RESTORATION: { nNonHostile = 1; }break;
case SPELL_GREATER_SPELL_MANTLE: { nNonHostile = 1; }break;
case SPELL_GREATER_STONESKIN: { nNonHostile = 1; }break;
case SPELL_HASTE: { nNonHostile = 1; }break;
case SPELL_HEAL: { nNonHostile = 1; }break;
case SPELL_HEALING_CIRCLE: { nNonHostile = 1; }break;
case SPELL_HEALING_STING: { nNonHostile = 1; }break;
case SPELL_HEALINGKIT: { nNonHostile = 1; }break;
case SPELL_HOLY_AURA: { nNonHostile = 1; }break;
case SPELL_HOLY_SWORD: { nNonHostile = 1; }break;
case SPELL_IDENTIFY: { nNonHostile = 1; }break;
case SPELL_IMPROVED_INVISIBILITY: { nNonHostile = 1; }break;
case SPELL_INVISIBILITY: { nNonHostile = 1; }break;
case SPELL_INVISIBILITY_PURGE: { nNonHostile = 1; }break;
case SPELL_INVISIBILITY_SPHERE: { nNonHostile = 1; }break;
case SPELL_IRONGUTS: { nNonHostile = 1; }break;
case SPELL_KEEN_EDGE: { nNonHostile = 1; }break;
case SPELL_LEGEND_LORE: { nNonHostile = 1; }break;
case SPELL_LESSER_MIND_BLANK: { nNonHostile = 1; }break;
case SPELL_LESSER_RESTORATION: { nNonHostile = 1; }break;
case SPELL_LESSER_SPELL_MANTLE: { nNonHostile = 1; }break;
case SPELL_LIGHT: { nNonHostile = 1; }break;
case SPELL_MAGE_ARMOR: { nNonHostile = 1; }break;
case SPELL_MAGIC_CIRCLE_AGAINST_CHAOS: { nNonHostile = 1; }break;
case SPELL_MAGIC_CIRCLE_AGAINST_EVIL: { nNonHostile = 1; }break;
case SPELL_MAGIC_CIRCLE_AGAINST_GOOD: { nNonHostile = 1; }break;
case SPELL_MAGIC_CIRCLE_AGAINST_LAW: { nNonHostile = 1; }break;
case SPELL_MAGIC_FANG: { nNonHostile = 1; }break;
case SPELL_MAGIC_VESTMENT: { nNonHostile = 1; }break;
case SPELL_MASS_CAMOFLAGE: { nNonHostile = 1; }break;
case SPELL_MASS_HASTE: { nNonHostile = 1; }break;
case SPELL_MASS_HEAL: { nNonHostile = 1; }break;
case SPELL_MESTILS_ACID_SHEATH: { nNonHostile = 1; }break;
case SPELL_MIND_BLANK: { nNonHostile = 1; }break;
case SPELL_MINOR_GLOBE_OF_INVULNERABILITY: { nNonHostile = 1; }break;
case SPELL_MONSTROUS_REGENERATION: { nNonHostile = 1; }break;
case SPELL_NEGATIVE_ENERGY_PROTECTION: { nNonHostile = 1; }break;
case SPELL_NEUTRALIZE_POISON: { nNonHostile = 1; }break;
case SPELL_ONE_WITH_THE_LAND: { nNonHostile = 1; }break;
case SPELL_OWLS_INSIGHT: { nNonHostile = 1; }break;
case SPELL_OWLS_WISDOM: { nNonHostile = 1; }break;
case SPELL_PRAYER: { nNonHostile = 1; }break;
case SPELL_PREMONITION: { nNonHostile = 1; }break;
case SPELL_PROTECTION__FROM_CHAOS: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_ELEMENTS: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_EVIL: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_GOOD: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_LAW: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_SPELLS: { nNonHostile = 1; }break;
case SPELL_RAISE_DEAD: { nNonHostile = 1; }break;
case SPELL_REGENERATE: { nNonHostile = 1; }break;
case SPELL_REMOVE_BLINDNESS_AND_DEAFNESS: { nNonHostile = 1; }break;
case SPELL_REMOVE_CURSE: { nNonHostile = 1; }break;
case SPELL_REMOVE_DISEASE: { nNonHostile = 1; }break;
case SPELL_REMOVE_FEAR: { nNonHostile = 1; }break;
case SPELL_REMOVE_PARALYSIS: { nNonHostile = 1; }break;
case SPELL_RESIST_ELEMENTS: { nNonHostile = 1; }break;
case SPELL_RESISTANCE: { nNonHostile = 1; }break;
case SPELL_RESTORATION: { nNonHostile = 1; }break;
case SPELL_RESURRECTION: { nNonHostile = 1; }break;
case SPELL_SANCTUARY: { nNonHostile = 1; }break;
case SPELL_SEE_INVISIBILITY: { nNonHostile = 1; }break;
case SPELL_SHADES_STONESKIN: { nNonHostile = 1; }break;
case SPELL_SHADOW_CONJURATION_INIVSIBILITY: { nNonHostile = 1; }break;
case SPELL_SHADOW_CONJURATION_MAGE_ARMOR: { nNonHostile = 1; }break;
case SPELL_SHADOW_EVADE: { nNonHostile = 1; }break;
case SPELL_SHADOW_SHIELD: { nNonHostile = 1; }break;
case SPELL_SHIELD: { nNonHostile = 1; }break;
case SPELL_SHIELD_OF_FAITH: { nNonHostile = 1; }break;
case SPELL_SHIELD_OF_LAW: { nNonHostile = 1; }break;
case SPELL_SPELL_MANTLE: { nNonHostile = 1; }break;
case SPELL_SPELL_RESISTANCE: { nNonHostile = 1; }break;
case SPELL_SPELLSTAFF: { nNonHostile = 1; }break;
case SPELL_STONE_BONES: { nNonHostile = 1; }break;
case SPELL_STONE_TO_FLESH: { nNonHostile = 1; }break;
case SPELL_STONESKIN: { nNonHostile = 1; }break;
case SPELL_TRUE_SEEING: { nNonHostile = 1; }break;
case SPELL_TRUE_STRIKE: { nNonHostile = 1; }break;
case SPELL_TYMORAS_SMILE: { nNonHostile = 1; }break;
case SPELL_UNDEATHS_ETERNAL_FOE: { nNonHostile = 1; }break;
case SPELL_UNHOLY_AURA: { nNonHostile = 1; }break;
case SPELL_VINE_MINE_CAMOUFLAGE: { nNonHostile = 1; }break;
case SPELL_VIRTUE: { nNonHostile = 1; }break;
case SPELL_WOUNDING_WHISPERS: { nNonHostile = 1; }break;
//End switch statement
}
//Debugging (It worked fine!)
//WriteTimestampedLogEntry("***NON-HOSTILE-SPELL-CHECK*** = " + IntToString(nNonHostile) +
//" / " + IntToString(nSpell));
return nNonHostile;
//END PROTOTYPE
}
//PROTOTYPE DEFINED
int GetIsNonHostileSpell(int nSpell)
{
int nNonHostile = 0;
//Spells that will not be allowed to target other players..
switch (nSpell)
{
case SPELL_ACTIVATE_ITEM_SELF2: { nNonHostile = 1; }break;
case SPELL_AID: { nNonHostile = 1; }break;
case SPELL_AMPLIFY: { nNonHostile = 1; }break;
case SPELL_AURA_OF_VITALITY: { nNonHostile = 1; }break;
case SPELL_AWAKEN: { nNonHostile = 1; }break;
case SPELL_AURAOFGLORY: { nNonHostile = 1; }break;
case SPELL_BARKSKIN: { nNonHostile = 1; }break;
case SPELL_BATTLETIDE: { nNonHostile = 1; }break;
case SPELL_BLESS: { nNonHostile = 1; }break;
case SPELL_BLESS_WEAPON: { nNonHostile = 1; }break;
case SPELL_BLOOD_FRENZY: { nNonHostile = 1; }break;
case SPELL_BULLS_STRENGTH: { nNonHostile = 1; }break;
case SPELL_CAMOFLAGE: { nNonHostile = 1; }break;
case SPELL_CATS_GRACE: { nNonHostile = 1; }break;
case SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE: { nNonHostile = 1; }break;
case SPELL_CLARITY: { nNonHostile = 1; }break;
case SPELL_CONTINUAL_FLAME: { nNonHostile = 1; }break;
case SPELL_CRAFT_ADD_ITEM_PROPERTY: { nNonHostile = 1; }break;
case SPELL_CRAFT_HARPER_ITEM: { nNonHostile = 1; }break;
case SPELL_CURE_CRITICAL_WOUNDS: { nNonHostile = 1; }break;
case SPELL_CURE_LIGHT_WOUNDS: { nNonHostile = 1; }break;
case SPELL_CURE_MINOR_WOUNDS: { nNonHostile = 1; }break;
case SPELL_CURE_MODERATE_WOUNDS: { nNonHostile = 1; }break;
case SPELL_CURE_SERIOUS_WOUNDS: { nNonHostile = 1; }break;
case SPELL_DARKFIRE: { nNonHostile = 1; }break;
case SPELL_DARKVISION: { nNonHostile = 1; }break;
case SPELL_DEATH_ARMOR: { nNonHostile = 1; }break;
case SPELL_DEATH_WARD: { nNonHostile = 1; }break;
case SPELL_DISPLACEMENT: { nNonHostile = 1; }break;
case SPELL_DIVINE_FAVOR: { nNonHostile = 1; }break;
case SPELL_DIVINE_MIGHT: { nNonHostile = 1; }break;
case SPELL_DIVINE_POWER: { nNonHostile = 1; }break;
case SPELL_DIVINE_SHIELD: { nNonHostile = 1; }break;
case SPELL_EAGLE_SPLEDOR: { nNonHostile = 1; }break;
case SPELL_ELEMENTAL_SHIELD: { nNonHostile = 1; }break;
case SPELL_ENDURANCE: { nNonHostile = 1; }break;
case SPELL_ENDURE_ELEMENTS: { nNonHostile = 1; }break;
case SPELL_ENERGY_BUFFER: { nNonHostile = 1; }break;
case SPELL_ENTROPIC_SHIELD: { nNonHostile = 1; }break;
case SPELL_EPIC_MAGE_ARMOR: { nNonHostile = 1; }break;
case SPELL_ETHEREAL_VISAGE: { nNonHostile = 1; }break;
case SPELL_ETHEREALNESS: { nNonHostile = 1; }break;
case SPELL_EXPEDITIOUS_RETREAT: { nNonHostile = 1; }break;
case SPELL_FLAME_WEAPON: { nNonHostile = 1; }break;
case SPELL_FOXS_CUNNING: { nNonHostile = 1; }break;
case SPELL_FREEDOM_OF_MOVEMENT: { nNonHostile = 1; }break;
case SPELL_GHOSTLY_VISAGE: { nNonHostile = 1; }break;
case SPELL_GLOBE_OF_INVULNERABILITY: { nNonHostile = 1; }break;
case SPELL_GREATER_BULLS_STRENGTH: { nNonHostile = 1; }break;
case SPELL_GREATER_CATS_GRACE: { nNonHostile = 1; }break;
case SPELL_GREATER_EAGLE_SPLENDOR: { nNonHostile = 1; }break;
case SPELL_GREATER_ENDURANCE: { nNonHostile = 1; }break;
case SPELL_GREATER_FOXS_CUNNING: { nNonHostile = 1; }break;
case SPELL_GREATER_MAGIC_FANG: { nNonHostile = 1; }break;
case SPELL_GREATER_MAGIC_WEAPON: { nNonHostile = 1; }break;
case SPELL_GREATER_OWLS_WISDOM: { nNonHostile = 1; }break;
case SPELL_GREATER_RESTORATION: { nNonHostile = 1; }break;
case SPELL_GREATER_SPELL_MANTLE: { nNonHostile = 1; }break;
case SPELL_GREATER_STONESKIN: { nNonHostile = 1; }break;
case SPELL_HASTE: { nNonHostile = 1; }break;
case SPELL_HEAL: { nNonHostile = 1; }break;
case SPELL_HEALING_CIRCLE: { nNonHostile = 1; }break;
case SPELL_HEALING_STING: { nNonHostile = 1; }break;
case SPELL_HEALINGKIT: { nNonHostile = 1; }break;
case SPELL_HOLY_AURA: { nNonHostile = 1; }break;
case SPELL_HOLY_SWORD: { nNonHostile = 1; }break;
case SPELL_IDENTIFY: { nNonHostile = 1; }break;
case SPELL_IMPROVED_INVISIBILITY: { nNonHostile = 1; }break;
case SPELL_INVISIBILITY: { nNonHostile = 1; }break;
case SPELL_INVISIBILITY_PURGE: { nNonHostile = 1; }break;
case SPELL_INVISIBILITY_SPHERE: { nNonHostile = 1; }break;
case SPELL_IRONGUTS: { nNonHostile = 1; }break;
case SPELL_KEEN_EDGE: { nNonHostile = 1; }break;
case SPELL_LEGEND_LORE: { nNonHostile = 1; }break;
case SPELL_LESSER_MIND_BLANK: { nNonHostile = 1; }break;
case SPELL_LESSER_RESTORATION: { nNonHostile = 1; }break;
case SPELL_LESSER_SPELL_MANTLE: { nNonHostile = 1; }break;
case SPELL_LIGHT: { nNonHostile = 1; }break;
case SPELL_MAGE_ARMOR: { nNonHostile = 1; }break;
case SPELL_MAGIC_CIRCLE_AGAINST_CHAOS: { nNonHostile = 1; }break;
case SPELL_MAGIC_CIRCLE_AGAINST_EVIL: { nNonHostile = 1; }break;
case SPELL_MAGIC_CIRCLE_AGAINST_GOOD: { nNonHostile = 1; }break;
case SPELL_MAGIC_CIRCLE_AGAINST_LAW: { nNonHostile = 1; }break;
case SPELL_MAGIC_FANG: { nNonHostile = 1; }break;
case SPELL_MAGIC_VESTMENT: { nNonHostile = 1; }break;
case SPELL_MASS_CAMOFLAGE: { nNonHostile = 1; }break;
case SPELL_MASS_HASTE: { nNonHostile = 1; }break;
case SPELL_MASS_HEAL: { nNonHostile = 1; }break;
case SPELL_MESTILS_ACID_SHEATH: { nNonHostile = 1; }break;
case SPELL_MIND_BLANK: { nNonHostile = 1; }break;
case SPELL_MINOR_GLOBE_OF_INVULNERABILITY: { nNonHostile = 1; }break;
case SPELL_MONSTROUS_REGENERATION: { nNonHostile = 1; }break;
case SPELL_NEGATIVE_ENERGY_PROTECTION: { nNonHostile = 1; }break;
case SPELL_NEUTRALIZE_POISON: { nNonHostile = 1; }break;
case SPELL_ONE_WITH_THE_LAND: { nNonHostile = 1; }break;
case SPELL_OWLS_INSIGHT: { nNonHostile = 1; }break;
case SPELL_OWLS_WISDOM: { nNonHostile = 1; }break;
case SPELL_PRAYER: { nNonHostile = 1; }break;
case SPELL_PREMONITION: { nNonHostile = 1; }break;
case SPELL_PROTECTION__FROM_CHAOS: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_ELEMENTS: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_EVIL: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_GOOD: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_LAW: { nNonHostile = 1; }break;
case SPELL_PROTECTION_FROM_SPELLS: { nNonHostile = 1; }break;
case SPELL_RAISE_DEAD: { nNonHostile = 1; }break;
case SPELL_REGENERATE: { nNonHostile = 1; }break;
case SPELL_REMOVE_BLINDNESS_AND_DEAFNESS: { nNonHostile = 1; }break;
case SPELL_REMOVE_CURSE: { nNonHostile = 1; }break;
case SPELL_REMOVE_DISEASE: { nNonHostile = 1; }break;
case SPELL_REMOVE_FEAR: { nNonHostile = 1; }break;
case SPELL_REMOVE_PARALYSIS: { nNonHostile = 1; }break;
case SPELL_RESIST_ELEMENTS: { nNonHostile = 1; }break;
case SPELL_RESISTANCE: { nNonHostile = 1; }break;
case SPELL_RESTORATION: { nNonHostile = 1; }break;
case SPELL_RESURRECTION: { nNonHostile = 1; }break;
case SPELL_SANCTUARY: { nNonHostile = 1; }break;
case SPELL_SEE_INVISIBILITY: { nNonHostile = 1; }break;
case SPELL_SHADES_STONESKIN: { nNonHostile = 1; }break;
case SPELL_SHADOW_CONJURATION_INIVSIBILITY: { nNonHostile = 1; }break;
case SPELL_SHADOW_CONJURATION_MAGE_ARMOR: { nNonHostile = 1; }break;
case SPELL_SHADOW_EVADE: { nNonHostile = 1; }break;
case SPELL_SHADOW_SHIELD: { nNonHostile = 1; }break;
case SPELL_SHIELD: { nNonHostile = 1; }break;
case SPELL_SHIELD_OF_FAITH: { nNonHostile = 1; }break;
case SPELL_SHIELD_OF_LAW: { nNonHostile = 1; }break;
case SPELL_SPELL_MANTLE: { nNonHostile = 1; }break;
case SPELL_SPELL_RESISTANCE: { nNonHostile = 1; }break;
case SPELL_SPELLSTAFF: { nNonHostile = 1; }break;
case SPELL_STONE_BONES: { nNonHostile = 1; }break;
case SPELL_STONE_TO_FLESH: { nNonHostile = 1; }break;
case SPELL_STONESKIN: { nNonHostile = 1; }break;
case SPELL_TRUE_SEEING: { nNonHostile = 1; }break;
case SPELL_TRUE_STRIKE: { nNonHostile = 1; }break;
case SPELL_TYMORAS_SMILE: { nNonHostile = 1; }break;
case SPELL_UNDEATHS_ETERNAL_FOE: { nNonHostile = 1; }break;
case SPELL_UNHOLY_AURA: { nNonHostile = 1; }break;
case SPELL_VINE_MINE_CAMOUFLAGE: { nNonHostile = 1; }break;
case SPELL_VIRTUE: { nNonHostile = 1; }break;
case SPELL_WOUNDING_WHISPERS: { nNonHostile = 1; }break;
//End switch statement
}
//Debugging (It worked fine!)
//WriteTimestampedLogEntry("***NON-HOSTILE-SPELL-CHECK*** = " + IntToString(nNonHostile) +
//" / " + IntToString(nSpell));
return nNonHostile;
//END PROTOTYPE
}
#19
Posté 24 juin 2011 - 02:59
Unless you give me the whole check_host_spell include and any other scripts that one includes, you'll have to compile this yourself, by reading the errors and fixing them accordingly. It's likely a missing semicolon, double quote, paren, or something of the like.
Funky
Funky
Modifié par FunkySwerve, 24 juin 2011 - 03:00 .
#20
Posté 24 juin 2011 - 09:50
I seem to have this working through Modload and all compiled, I will test for a bit and let you all know how I get on. Had to change sclass to sCalss and comment out DelayCommand(IntToFloat(nDiff),ActionCastSpellAtLocation(nSpellID, to get it to compile. seems to be working so far.
Thanks Funky
Thanks Funky
#21
Posté 24 juin 2011 - 10:19
Oh, sorry, I forgot to mention, I put that in as a partial example of Baaleos' idea, but accidentally removed some of the needed vars during cleanup and indenting of the function.
To make it fully work, you would need to distinguish first whether the spell had an object target, and CastAtObject, otherwise at Location. You would also have to decide how to handle items, deal with any Cheat casting issues, and various other minutiae.
Whoever gave you that sample spellhook...eh. It had, shall we say, some issues. I cleaned it up as best I could - having a ton of switches you aren't using makes no sense - just add them as you need them. If I was doing it for my mod, I would've taken a lot more time and restructured it. The way he treats item casting at present is fairly poor from a flow-control perspective, even after my minor restructuring. More specifically, it makes handling item casting with respect to cast-blocking awkward, as well as potential future modifications.
Funky
To make it fully work, you would need to distinguish first whether the spell had an object target, and CastAtObject, otherwise at Location. You would also have to decide how to handle items, deal with any Cheat casting issues, and various other minutiae.
Whoever gave you that sample spellhook...eh. It had, shall we say, some issues. I cleaned it up as best I could - having a ton of switches you aren't using makes no sense - just add them as you need them. If I was doing it for my mod, I would've taken a lot more time and restructured it. The way he treats item casting at present is fairly poor from a flow-control perspective, even after my minor restructuring. More specifically, it makes handling item casting with respect to cast-blocking awkward, as well as potential future modifications.
Funky
Modifié par FunkySwerve, 24 juin 2011 - 10:21 .





Retour en haut







