I keep getting things to duplicate or quadruplicate

I have a gem socketing crafting system I use. I have had this issue for a couple of years and have tried to find out why I keep getting +1 gems for example to duplicate or quadruplicate to either +2 or +4 when socketed on a weapon.

Now I have other similar issues where I drink a potion (two potions in my module seem to be affected by this bug) where it dies the effect (loops) four times too.

Or some spells I have introduced too…for example the blink spell causes me to blink non-stop…I have to exit the game…or a congregate spell causes everyone to teleport to me over and over again.

Regenerating creatures when killed I get 4x the xps for the kill

250xps
250xps
250xps
250 xps

sometimes it does this 8 times…sigh

I looked at the script I thought might be causing this…on the module event script but I can’t find the issue. I am no scripter here…can someone please help? I add my onactivateitem script below…Like I said I am no scripter and over the years I had several people help me…so please don’t judge…lol

PART 1 of Script due to word limit:

//the following is the verbatim wrapper script as used in the SoU:OC Ch 1
// -Merentha

// x1_itemactivate
//:://////////////////////////////////////////////////
/*
Common script to be used as OnActivateItem script for
all modules. Executes the script with a name matching
the tag of the item being activated. Functions like
GetItemActivator() and GetItemActivatedTarget() will
work in these scripts, since they are being executed
from the perspective of the module itself. ???

Credit for this idea belongs to tjm, who posted it to
nwvault.ign.com.

*/
//:://////////////////////////////////////////////////
//:: Created By: Naomi Novik
//:: Created On: 09/27/2002
//:://////////////////////////////////////////////////
#include “lilarcor_include”
#include “x2_inc_switches”
//#include “horse_inc_h”
#include “pjr_chat_inc”
#include “xs_detonate_loc”
#include “x3_inc_horse”
#include “zep_inc_phenos”
#include “nw_i0_generic”
#include “sd_portable_inc”
#include “blsg_h”
#include “JS_I0_DMTCHK”
#include “cs_activate”
#include “x0_inc_portal”
#include “x2_inc_plot”
#include “_town_crier_inc”
#include “x2_inc_itemprop”

void main()
{
BladeSingerModuleOnActivated();
ExecuteScript(“fly_mod_activate”,OBJECT_SELF);
ExecuteScript(“cr_onact”, GetItemActivator());
ExecuteScript(“dmfi_activate”, GetItemActivator());
ExecuteScript(“dreamscape_onac”,OBJECT_SELF);
CSact();
//:://////////////////////////////////////////////////
//:: Prototypes
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oActivator = GetItemActivator();
object oTarget = GetItemActivatedTarget();
location lActivator = GetLocation(oActivator);
string sItemTag = GetTag(oItem);
object oPlayer = GetItemActivator();
string sPlayer = GetPCPlayerName(oPlayer);

//fudge time item …found in custom misc. other…made it so PC’s now can use this rather than just DM

object oUser=GetItemActivator();
location lLoc=GetItemActivatedTargetLocation();
string sTag=GetTag(oItem);

if(sTag=="FudgeTime")
{
 AssignCommand(oUser, ActionStartConversation(oUser, "ld_con_fudge", TRUE));
}

// Global Economy Tool …found in custom misc. other…made it so PC’s now can use this rather than just DM… this script is also below for DM

if(sTag==“kpbwand”)
{
AssignCommand(oUser, ActionStartConversation(oUser, “kpb_wand”, TRUE));
}

// Item Advancement …found in custom misc. other…made it so PC’s now can use this rather than just DM … this script is also below for DM

if(sTag=="kpb_timetool")
{
 AssignCommand(oUser, ActionStartConversation(oUser, "kpb_timetool", TRUE));
}

else if(sTag==“OtherItemsYouWantToActivate”)
{
ExecuteScript(“sTag”,oUser);
}

//---------------------------------START DLA DM HORSE WIDGETS-----------------------------

if (GetTag(oItem) == "horse_dismt2")
{
    AssignCommand(oActivator, ActionStartConversation(oActivator, "horse_dismnt_dla", TRUE));
    return;
}

// Paladin Unsummon//
if (GetTag(oItem) == “horse_unsummon”)
{
object oPaladin = GetItemActivator();
AssignCommand(oPaladin, HorseUnsummonPaladinMount());
return;
}

//---------------------------------START CEP HORSE WIDGETS-------------------------------

///////////////////////////////////////////////////////////////////////////////
// Summon White Pony
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonHorse”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_pony”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Pony”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Pony"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Spotted Pony
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonHorse2”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_ponysp”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Pony”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Pony"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Brown Pony
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonHorse3”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_ponybn”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Pony”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Pony"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Black Horse
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonHorse4”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_horsebk”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Brown Horse
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonHorse5”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_horse2”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Nightmare
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonHorse6”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_horsenm”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon White Horse
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonHorse7”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_horsewt”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Aurenthil Horse
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonHorse8”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_horseau”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// CEP widget dismount
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “horse_dismt”)
{
object oPC = GetItemActivator();
//if (GetTag (GetItemActivated ()) == “horse_dismt”) {zep_Dismount (oPC, “horse_dismt”);}
string sResRef = GetLocalString(oPC,“PONY_ID”);
zep_Dismount (oPC, “horse_dismt”);
SetLocalInt(oPC,“bX3_IS_MOUNTED”,FALSE);
DeleteLocalString(oPC,“X3_HORSE_SCRIPT_DISMOUNT”);
SetLocalInt(oPC, “VAR_HORSEMOUNT”, 0);//horselord class variable

//remove horse support DLA Style
object oRider=GetItemActivator();
DelayCommand(1.0, HORSE_SupportOriginalSpeed(oRider));
DelayCommand(1.0, HORSE_SupportRemoveMountedSkillDecreases(oRider));
DelayCommand(1.0, HORSE_SupportRemoveACBonus(oRider));
DelayCommand(1.0, HORSE_SupportRemoveHPBonus(oRider));

object oTarget;
location lPc = GetLocation(oPC);
location lWyrmling = GetItemActivatedTargetLocation();

object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, sResRef, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPC, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPC, ActionSpeakString("Invalid Horse/Pony"));
}/* end else (valid owyrmling) */


    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon CEP/DLA Horse Managemet to dismiss a Horse
///////////////////////////////////////////////////////////////////////////////
if (GetTag(oItem) == “Horse_Management”)
{
AssignCommand(oActivator, ActionStartConversation(oActivator, “horse_magmt”, TRUE));
return;
}
///////////////////////////////////////////////////////////////////////////////
// Summon Pack Camel
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonCamel”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_pkcamel”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Camel”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Camel"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Pack Horse
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonpkHorse”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_pkhorse”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Pack Ox
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “SummonpkOx”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_pkox”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Ox”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Ox"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Pack Pony
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “Summonpkpony”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “henchman_pkpony”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Pony”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Pony"));
}/* end else (valid owyrmling) */
    return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon CEP Flying System
///////////////////////////////////////////////////////////////////////////////
if (GetTag(oItem) == “fly_widget”)
{
AssignCommand(oActivator, ActionStartConversation(oActivator, “fly_control”, TRUE));
return;
}

//---------------------------------START DLA HORSE WIDGETS-------------------------------
///////////////////////////////////////////////////////////////////////////////
// Summon Walnut Horse Scale Barding
///////////////////////////////////////////////////////////////////////////////
if (sItemTag == “Horse_1”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_hvywarhorse2”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Walnut Horse Leather Barding
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_2”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_hvywarhorse3”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Walnut Horse Red Barding
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_3”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_hvywarhorse4”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Walnut Horse Chain Barding
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_4”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_hvywarhorse”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Walnut Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_5”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_horse001”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Purple Jousting Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_6”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_jousthorse1”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Blue & Gold Jousting Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_7”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_jousthorse2”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Black & White Jousting Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_8”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_jousthorse3”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Red & Gold Jousting Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_9”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_jousthorse4”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Red & Black Jousting Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_10”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_jousthorse5”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Gunpowder Grey Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_11”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “horse002”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Green Jousting Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_12”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “jousthorse002”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon White Jousting Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_13”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “jousthorse003”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

PART 2 of script

///////////////////////////////////////////////////////////////////////////////
// Summon pink & Blue Jousting Horse
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_14”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “jousthorse004”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Horse”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Horse"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon White Unicorn
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_15”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “cep_unicorn”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Unicorn”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Unicorn"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Nightmare with Barding
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_16”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_nightmare001”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Nightmare”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Nightmare"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Nightmare Saddled
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_17”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “dla_nightmare003”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Nightmare”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Nightmare"));
}/* end else (valid owyrmling) */
  return;
}

///////////////////////////////////////////////////////////////////////////////
// Summon Dark Unicorn
///////////////////////////////////////////////////////////////////////////////
else if (sItemTag == “Horse_18”)
{
object oPc = GetItemActivator();
location lPc = GetLocation(oPc);
location lWyrmling = GetItemActivatedTargetLocation();
object oWyrmling = CreateObject(OBJECT_TYPE_CREATURE, “cep_unicorn001”, lPc, TRUE);

/////////////////////////////////////// name the horse //////////////
SetName (oWyrmling, GetName(GetItemActivator()) + “'s " + " Unicorn”);
/////////////////////////////////////////////////////////////////////

if (GetIsObjectValid(oWyrmling))
{
    AddHenchman(oPc, oWyrmling);
}/* end then (valid owyrmling) */
else
{
    AssignCommand(oPc, ActionSpeakString("Invalid Unicorn"));
}/* end else (valid owyrmling) */
  return;
}

/////////////////////END DLA HORSE WIDGETS////////////////////
//X2 Tag based system code

ExecuteScript(sItemTag, OBJECT_SELF);

 //object oItem = GetItemActivated();

 // * Generic Item Script Execution Code
 // * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,
 // * it will execute a script that has the same name as the item's tag
 // * inside this script you can manage scripts for all events by checking against
 // * GetUserDefinedItemEventNumber(). See x2_it_example.nss
 if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
 {
    SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACTIVATE);
    int nRet =   ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
    if (nRet == X2_EXECUTE_SCRIPT_END)
    {
       return;
}

//string sTag = GetTag(oItem);
//:://////////////////////////////////////////////////

//HorseActivate(GetItemActivated(), GetItemActivator());
//IsLilarcor();

/////////////////////////////Begin language changes
if(GetStringLeft(sItemTag, 8) == "hlslang_")
{
    int bSpeaking=GetLocalInt(oPC,"pr_speaking");
    if (!bSpeaking)
    {
        string sTag=GetTag(oItem);
        int iLan=GetLanguageNumber(sTag);
        string sSpeaking=GetLanguageName(iLan);
        SetLocalInt(oPC,"pr_language",iLan);
        SetLocalInt(oPC,"pr_speaking",TRUE);
        SendMessageToPC(oPC,sTag);
        FloatingTextStringOnCreature(TMESSAGE_TEXT+"You are now speaking "+sSpeaking+". To return to speaking common, use this widget again."+COLOR_END,oPC,FALSE);
        return;
    }
    DeleteLocalInt(oPC,"pr_speaking");
    DeleteLocalInt(oPC,"pr_language");
    FloatingTextStringOnCreature(TMESSAGE_TEXT+"You are now speaking common."+COLOR_END,oPC,FALSE);
    return;
}
//////////////////////////End language changes

//:://////////////////////////////////////////////////

///////////////////////////////////////////////////
//                     **                        //
// OnItemActivate Event for the Placeable System //
//                  by Hunt3R                    //
//                     **                        //
///////////////////////////////////////////////////
if (sItemTag == "ab_control")
{
    location lTarget = GetItemActivatedTargetLocation();

    //Comment to myself: "Hm. So the nearest Object to the location MUST be
    //                    an ambient one. Well no other way though..."
    object oAmbObj = GetNearestObjectToLocation(OBJECT_TYPE_PLACEABLE, lTarget);
    string sCheck = GetSubString(GetTag(oAmbObj), 0, 3);
    //Check if oAmbObj has a correct tag with which we can work -
    if (sCheck == "pl_")
    {
        //Start the Ambient Conversation
        DelayCommand(1.0, AssignCommand(oAmbObj, ActionStartConversation(oPC, "amb_dlg", TRUE, FALSE)));
        //Set Custom Token to make conversation more clear
        SetCustomToken(1456, GetName(oAmbObj));
    }
    //if not, tell activator to place his targetlocation nearer to the ambient object
    else
    {
        FloatingTextStringOnCreature("The Ambient Object MUST be the nearest Placeable to the Target Location!", oPC);
    }
}

//:://////////////////////////////////////////////////
/*
    Generic Tag based events for items
 */
//:://////////////////////////////////////////////////

/* //* not sure why this section is here. perhaps from pre HotU system???
if(oItem!=OBJECT_INVALID)
{
    if(GetStringLength(sItemTag)>16)
    sItemTag=GetStringLeft(sItemTag,16);
    ExecuteScript(sItemTag,oItem);

*/

if (sItemTag == "dmt_keg")
{
    location lTarget    = GetItemActivatedTargetLocation();
    float fDistance     = GetDistanceBetweenLocations(GetLocation(oPlayer), lTarget);
    object oKeg         = CreateObject(OBJECT_TYPE_PLACEABLE, "gunpowderkeg", lTarget);

    // Rather cheesy script to try and make the player get closer to where he placed the barrel.
    if (fDistance >= 3.0)
    {
        AssignCommand(oPlayer, ActionMoveToLocation(lTarget, TRUE));
    }
}
//* throwing weapon section?
if(GetStringLowerCase(GetStringLeft(sItemTag,2))=="t_")
{
    AssignCommand(oPC, ExecuteScript("throwing_main", OBJECT_SELF));
}
//* Rogues Garrote
if(sItemTag =="ROGUE_GARROTE")
{
    SetLocalInt(GetItemActivator(),"ROGUE_ITEM",1);
    SetLocalObject(GetItemActivator(),"ROGUE_ITEM",GetItemActivatedTarget());
    ExecuteScript("rogue_inc",GetItemActivator());
    return;
}
//*  grin_hole_it_xxx
if (GetStringLeft(sItemTag,12) == "grin_hole_it")
{
    string sHoleNum = GetStringRight(sItemTag,3);

    DestroyObject(oItem);
    AssignCommand(oPC,ActionMoveToLocation(GetItemActivatedTargetLocation()));
    CreateObject(OBJECT_TYPE_PLACEABLE,"grin_hole_pl_" + sHoleNum,GetItemActivatedTargetLocation());
    CreateObject(OBJECT_TYPE_PLACEABLE,"grin_hole_ex_" + sHoleNum,GetLocation(GetObjectByTag("Grin_Hole_" + sHoleNum)));
}
//* Rope section
if (GetResRef(oItem)=="rope")
{
    ExecuteScript("rope_use", OBJECT_SELF);
}
//* Use Telescope:
if(sItemTag == "Telescope")
{
    SetLocalObject(GetModule(), "user", oPC);
    SetLocalObject(GetModule(), "target", oTarget);
    ExecuteScript("use_tscope", OBJECT_SELF);
}
//* Use Marked Telescope:
if(sItemTag == "MarkedTelescope")
{
    SetLocalObject(GetModule(), "user", oPC);
    SetLocalObject(GetModule(), "target", oTarget);
    ExecuteScript("use_mtscope", OBJECT_SELF);
}
//* Gladiator Net?
if(sItemTag == "it_netfight"  && GetObjectType(oTarget)==OBJECT_TYPE_CREATURE )
     {
      if(GetDistanceBetween(oPC,oTarget) > 10.0)
       {
        //SendMessageToPC(oPC,"Ihr seid zu weit entfernt.");
        SendMessageToPC(oPC,"You are too far away.");
        return;
       }
      ExecuteScript("sp_netfight", OBJECT_SELF);
   }
//* Panther figurine section
if(sItemTag == "panthersummoner" && GetLocalInt(oPC, "panthersummoned")==0)
{
    object oKitty = CreateObject(OBJECT_TYPE_CREATURE, "drizztpanther", GetLocation(oPC), FALSE);
    AddHenchman(oPC, oKitty);
    SetLocalInt(oPC, "panthersummoned", 1);
    return;
}
if(sItemTag == "panthersummoner" && GetLocalInt(oPC, "panthersummoned")==1)
{
    object oKitty = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC);
    if(GetTag(oKitty)=="drizztpanther")
    {
        RemoveSummonedAssociate(oPC, oKitty);
        effect eSummon = EffectVisualEffect(VFX_IMP_UNSUMMON);
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSummon, oKitty, 2.1);
        DestroyObject(oKitty, 2.0);
    }
    SetLocalInt(oPC, "panthersummoned", 0);
    return;
}

//*End custom script based events
//:://////////////////////////////////////////////////
// * Generic Item Script Execution Code
// * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,
// * it will execute a script that has the same name as the item's tag
// * inside this script you can manage scripts for all events by checking against
// * GetUserDefinedItemEventNumber(). See x2_it_example.nss
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
    SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACTIVATE);
    int nRet =   ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
    if (nRet == X2_EXECUTE_SCRIPT_END)
    {
       return;
    }

}

{
///////////////////////////////////////////
}

 object oUser=GetItemActivator();
 location lLoc=GetItemActivatedTargetLocation();
 string sTag=GetTag(oItem);

 // * Generic Item Script Execution Code
 // * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,
 // * it will execute a script that has the same name as the item's tag
 // * inside this script you can manage scripts for all events by checking against
 // * GetUserDefinedItemEventNumber(). See x2_it_example.nss
 if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
 {
    SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACTIVATE);
    int nRet =   ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
    if (nRet == X2_EXECUTE_SCRIPT_END)
    {
       return;
    }

 }

if(sTag=="kpbwand")
{
    if (GetIsDM(oUser) == TRUE)
    {
    AssignCommand(oUser, ActionStartConversation(oUser, "kpb_wand", TRUE));
    }
    else
    {
    DestroyObject(oItem);
    SendMessageToPC(oUser, "I am not an immortal, and I cannot use that item!");
    }
}

if (oItem == GetObjectByTag("kpb_timetool"))
AssignCommand(oUser, ActionStartConversation(oUser, "kpb_timetool", FALSE));

if (sItemTag == "BagofCapture")
{
    ExecuteScript("bagofcapture", oUser);
    return;

}

}

{
/////////////////////Portable items////////////////////
}
// Portable Chair
if(GetTag(oItem)==“p_chair”)
{
string sPCCDKey = GetPCPublicCDKey(oActivator);
int iFlag = GetLocalInt(oActivator, “portable_chair” + sPCCDKey);

   if(iFlag == 1)
   {
       removeObject(oActivator, "portable_chair");
   }
   else if(iFlag == 0)
   {
       makeObject(oActivator, "portable_chair");
   }

}
// Portable Powder Keg

if(GetTag(oItem)==“gz_it_pkeg”)
{
string sPCCDKey = GetPCPublicCDKey(oActivator);
int iFlag = GetLocalInt(oActivator, “gz_obj_pkeg” + sPCCDKey);

   if(iFlag == 1)
   {
       removeObject(oActivator, "gz_obj_pkeg");
   }
   else if(iFlag == 0)
   {
       makeObject(oActivator, "gz_obj_pkeg");
   }

}
// Portable Explosives

if(GetTag(oItem)==“explosives”)
{
string sPCCDKey = GetPCPublicCDKey(oActivator);
int iFlag = GetLocalInt(oActivator, “explosives” + sPCCDKey);

   if(iFlag == 1)
   {
       removeObject(oActivator, "explosives");
   }
   else if(iFlag == 0)
   {
       makeObject(oActivator, "explosives");
   }

}

// Portable bench
if(GetTag(oItem)==“p_bench”)
{
string sPCCDKey = GetPCPublicCDKey(oActivator);
int iFlag = GetLocalInt(oActivator, “portable_bench” + sPCCDKey);

   if(iFlag == 1)
   {
       removeObject(oActivator, "portable_bench");
   }
   else if(iFlag == 0)
   {
       makeObject(oActivator, "portable_bench");
  }

}

// common storage ring

if (GetTag(GetItemActivated()) == “CRoS”)
{
ExecuteScript(“cros_onac”, OBJECT_SELF);

// jail system
}
{
if ((GetTag(GetItemActivated()) == “IT_IMPRISONMENTSTONE”))
{
DMItemTeleportActivated(GetItemActivator(), GetItemActivatedTarget());
}

    if (GetTag(GetItemActivated()) == "IT_GUARDSTONE")
    {
        ExecuteScript("exe_guardstone", oPC);
        return;
    }
  }

{
//staff of dancing
}
object oUsed = GetItemActivated();
if (GetTag(oUsed) == “STAFFOFDANCING”)
{
object oUser = GetItemActivator();
if (GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oUser) != oUsed)
{
SendMessageToPC(oUser, “You must equip the staff before you can use its special power.”);
}else{
DestroyObject(oUsed);
location mySummon = GetLocation(oUser);
effect eAppear = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
object oStaff = CreateObject(OBJECT_TYPE_CREATURE, “eas_staffdance”, mySummon, TRUE);
mySummon = GetLocation(oStaff);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAppear, mySummon, 1.5);
SetIsTemporaryFriend(oUser,oStaff,FALSE);
SetLocalInt(oStaff, “TIMER”, 6);
SetLocalObject(oStaff, “OWNER”, oUser);
}

}

}