void main()
{
object oItem = GetItemActivated();
object oPC = GetItemActivator();
object oTarget = GetItemActivatedTarget();
string sTag = GetTag(oItem);
string sPCName;
string sPlayerName;
// Subrace system: Some player models normally used were changed due to lack of CEP
if(GetLocalInt(GetModule(),"Subraces")==1)
{
ExecuteScript("_cb_activateitem",oPC);
}
// Werewolf System Addon
if(GetLocalInt(GetModule(),"Werewolf")==1)
{
Werewolf_Form(oPC,oItem,oTarget);
Wolf_Form(oPC,oItem,oTarget);
Belladonna(oPC,oItem,oTarget);
}
// Vampire PC subrace Addon
if(GetLocalInt(GetModule(),"Vampire")==1)
{
ExecuteScript("vamp_on_used", OBJECT_SELF);
}
// Bleeding/Death system item activation manager
if (HABDOnActivateItem(oPC, oTarget, oItem)) return;
// Subdual Tool Mode Switch
if(sTag=="pcsubdualtool")
{
int iMode = GetLocalInt(oPC,"SUBDUAL");
int iNextMode;
// Only three possible options
iNextMode = (iMode + 1) % 3;
// Advance the state of the toggle item by setting the state of it up as an INT
SetLocalInt(oItem,"Mode",iNextMode);
// Inform them about the notification switch
switch (iNextMode)
{
case 0:
SetLocalInt(oPC,"SUBDUAL",0);
SendMessageToPC(oPC,"You are currently doing full damage.");
break;
case 1:
SetLocalInt(oPC,"SUBDUAL",1);
SendMessageToPC(oPC,"You are currently doing subdual damage.");
break;
case 2:
SetLocalInt(oPC,"SUBDUAL",2);
SendMessageToPC(oPC,"You are currently in sparring mode.");
break;
}
return;
}
// This handles the canteen for the dehydration system
if (GetStringLeft(sTag,4)=="DH2_") ExecuteScript("vg_source_act",OBJECT_SELF);
// This handles the items for the "PnP" Door system
if (sTag=="IDSBook")
AssignCommand(oPC, ActionStartConversation(oPC,"ids_book_conv",TRUE,FALSE));
else if (sTag=="HoldPortal")
{
if (GetObjectType(oTarget) == OBJECT_TYPE_DOOR)
{
SetLocalInt(oTarget,"Magic Lock",1);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_KNOCK), oTarget);
}
}
//Paladin's Badge of Courage script
if (sTag=="vg_pal_courage")
{
vg_pal_courage(oPC);
return;
}
//Enchant Rod script
if (sTag=="EnchantRod")
{
ExecuteScript("ench_start", oPC);
return;
}
//Soul Stone script
if (sTag=="SoulStone")
{
SetLocalObject(oPC, "SoulStone", oItem);
AssignCommand(oPC, ActionStartConversation(oPC, "SoulStoneConv", TRUE, FALSE));
return;
}
// DM Epic Level Allow Wand
if(sTag=="dm_epic_tool" && GetIsDM(oPC) && oTarget!=oPC && GetIsObjectValid(oTarget) && GetIsPC(oTarget))
{
sPCName = GetName(oTarget);
sPlayerName = GetPCPlayerName(oTarget);
int iMode = GetLocalInt(oTarget,"Allow_Level");
int iNextMode;
// Only two possible options
iNextMode = (iMode + 1) % 2;
// Advance the state of the toggle item by setting the state of it up as an INT
SetLocalInt(oItem,"Mode",iNextMode);
// Inform them about the notification switch
switch (iNextMode)
{
case 0:
SetDBInt("EpicPCs","Allow_Level",0,oTarget);
SetLocalInt(oTarget,"Allow_Level",0);
SendMessageToAllDMs("The PC '"+sPCName+"' belonging to '"+sPlayerName+"' is not currently allowed to take epic levels");
SendMessageToPC(oTarget,"You are not currently allowed to take epic levels");
break;
case 1:
SetDBInt("EpicPCs","Allow_Level",1,oTarget);
SetLocalInt(oTarget,"Allow_Level",1);
SendMessageToAllDMs("The PC '"+sPCName+"' belonging to '"+sPlayerName+"' is allowed to take epic levels");
SendMessageToPC(oTarget,"You are now allowed to take epic levels");
break;
}
return;
}
if (sTag=="dm_epic_tool" && GetIsDM(oPC) && oTarget==oPC && GetIsObjectValid(oTarget))
{
SendMessageToAllDMs("The DM '"+sPCName+"' belonging to '"+sPlayerName+"' is trying to give themselves Epic Level Permission!");
SendMessageToPC(oTarget,"You are not allowed to give yourself Epic Level Permission!!!");
return;
}
if (sTag=="dm_epic_tool" && !GetIsDM(oPC))
{
SendMessageToAllDMs("The PC '"+sPCName+"' belonging to '"+sPlayerName+"' has a DM Epic Level Allow Tool!");
SendMessageToPC(oPC,"Only DMs may use this tool!!!");
return;
}
// DM Item Modifier
if(sTag=="dm_item_manipula"&&GetIsDM(oPC))
{
if(GetIsObjectValid(oTarget) == TRUE && GetObjectType(oTarget) == OBJECT_TYPE_ITEM)
{
SetLocalObject(oPC, "TARGETED_ITEM", oTarget);
AssignCommand(oPC, ActionStartConversation(oPC, "dm_wand_item", TRUE, FALSE));
}
else
SendMessageToPC(oPC, "That is not a valid item");
return;
}
if (sTag=="dm_item_manipula"&&!GetIsDM(oPC))
{
SendMessageToAllDMs("The PC '"+sPCName+"' belonging to '"+sPlayerName+"' has a DM Item Manipulation Tool!");
SendMessageToPC(oPC,"Only DMs may use this tool!!!");
}
// This will allow DMs to clear XP Debts as a VERY special reward.
if (GetTag(oItem)=="xpdebtclearer")
{
if ((oTarget!=oPC)&&GetIsDM(oPC))
{
//to clear out xp via a dm wand
ClearDebt(oTarget);
SendMessageToPC(oTarget,"Your XP Debt has been cleared!");
SendMessageToAllDMs(GetName(oTarget)+" has had their XP Debt cleared by "+GetName(oPC));
}
if ((oTarget==oPC)&&GetIsDM(oPC))
{
//to clear out xp via a dm wand
SendMessageToPC(oPC,"Your XP Debt has NOT been cleared! Do not try to clear your own debt . . . it is just wrong!");
SendMessageToAllDMs(GetName(oPC)+" has tried to clear their own XP Debt! Go smack them!");
}
if ((oTarget==oPC)&&(!GetIsDM(oPC)))
{
//to clear out xp via a dm wand
SendMessageToPC(oPC,"Your XP Debt has NOT been cleared! This tool is for DM use only!");
SendMessageToAllDMs(GetName(oPC)+" has tried to clear their own XP Debt! They are not a DM so go take the tool from them!");
}
}
// * 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;
}
}
ExecuteScript ("cnr_module_onact", OBJECT_SELF);
ExecuteScript ("zep_on_activate", OBJECT_SELF);
}