//This is the tagbased item on_activate_item script for the item Crystal Shard //This script is fired by the crystalshard script, which operates on the //Tag Based System, this is my first tested script as a scripter in the new //tagbased system. #include "x2_inc_switches" void main() { // Check if we have the correct event firing the script if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return; object oPC; //Check if target is a creature or not. if ((GetObjectType(GetItemActivatedTarget())!=OBJECT_TYPE_CREATURE) ){ SendMessageToPC(GetItemActivator(), "Improper use of item!"); return;} object oTarget; oTarget = GetItemActivatedTarget(); //Visual effects can't be applied to waypoints, so if it is a WP //the VFX will be applied to the WP's location instead int nInt; nInt = GetObjectType(oTarget); if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_PULSE_COLD), oTarget); else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_PULSE_COLD), GetLocation(oTarget)); effect eEffect; //Apply 3d100 dmg to the target creature eEffect = EffectDamage(d100(2) + 80, DAMAGE_TYPE_COLD, DAMAGE_POWER_ENERGY); //Delay the damage so the visual effects fire before damage is applied. DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, GetItemActivatedTarget())); }