//Created by Genisys / Guile 6/7/08 //This cool tagbased scripted item throws a boulder at the target //The item should be single use and look like a boulder (if possible) //Also, the item should weight 100 lbs! void RockDamage(location lImpact); object oPC = GetItemActivator(); #include "x0_i0_spells" void main() { object oUser = GetItemActivator(); object oCaster; oCaster = oPC; if(GetLocalInt(GetAreaFromLocation(GetLocation(oUser)), "NOCAST")==2) { return; } object oTarget; oTarget = GetItemActivatedTarget(); location lImpact = GetLocation(oTarget); int nSpell = 775; if(GetObjectType(oTarget)!=OBJECT_TYPE_CREATURE) { FloatingTextStringOnCreature("You must target a creature!", oUser); return; } if(GetAbilityScore(oPC, ABILITY_STRENGTH, TRUE) >19) { AssignCommand(oPC, ActionCastSpellAtObject( nSpell, oTarget, METAMAGIC_ANY, TRUE, 20, PROJECTILE_PATH_TYPE_DEFAULT , TRUE)); RockDamage(lImpact); } } void RockDamage(location lImpact) { float fDelay; int nDamage; effect eDam; //Declare the spell shape, size and the location. Capture the first target object in the shape. object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_SMALL, lImpact, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); //Cycle through the targets within the spell shape until an invalid object is captured. int nDamageAdjustment = GetAbilityModifier (ABILITY_STRENGTH,OBJECT_SELF); while (GetIsObjectValid(oTarget)) { if (spellsIsTarget(oTarget,SPELL_TARGET_STANDARDHOSTILE,OBJECT_SELF)) { //Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(oPC, 775)); //Get the distance between the explosion and the target to calculate delay fDelay = GetDistanceBetweenLocations(lImpact, GetLocation(oTarget))/20; //Roll damage for each target, but doors are always killed nDamage = d6(7) + nDamageAdjustment; //Set the damage effect eDam = EffectDamage(nDamage, DAMAGE_TYPE_BLUDGEONING,DAMAGE_POWER_PLUS_ONE); // Apply effects to the currently selected target. DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget)); } //Select the next target within the spell shape. oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lImpact, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); } }