FANDOM


 
m (+rephrase, +wikify)
 
Line 1: Line 1:
[[category:Script_directory:Spells and Potions]]
+
This is a [[script]] for '''making a spell cast at an object return to the spellcaster'''. The target still takes damage, however. Great for making sure spellcasters don't blast every [[container|chest]] in sight.
== Making a spell cast at an object return to the spellcaster ==
+
This is a script for making a spell cast at an object return to the spellcaster. The target still takes damage, however. Great for making sure spellcasters don't blast every chest in sight.
+
==The Script==
This script is for chests, as it checks to see if the chest is trapped or not, and only fires the spell back if the trap is activated. This is pretty easily edited though to not check for any traps and be more like spell turning.
+
This script is for chests; it checks to see if the chest is trapped or not, and only fires the [[spell]] back if the [[trap]] is activated. This script can be easily edited so that it does not check for any traps, and act more like spell turning.
   
 
<pre>
 
<pre>
Line 17: Line 17:
 
}
 
}
 
</pre>
 
</pre>
  +
  +
[[category:Script_directory:Spells and Potions]]

Latest revision as of 03:41, June 24, 2007

This is a script for making a spell cast at an object return to the spellcaster. The target still takes damage, however. Great for making sure spellcasters don't blast every chest in sight.

The ScriptEdit

This script is for chests; it checks to see if the chest is trapped or not, and only fires the spell back if the trap is activated. This script can be easily edited so that it does not check for any traps, and act more like spell turning.

void main()
{
int trapflag = GetIsTrapped(OBJECT_SELF);
int spell = GetLastSpell();
int spellflag = GetLastSpellHarmful();
object oCaster = GetLastSpellCaster();
if ((trapflag == TRUE) && (spellflag == TRUE))
{
 ActionCastSpellAtObject(spell, oCaster, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
}
}
Community content is available under CC-BY-SA unless otherwise noted.