2022-10-07 14:20:31 -04:00
|
|
|
//Script Name: onunaquireitem
|
|
|
|
//////////////////////////////////////////
|
|
|
|
//Created By: Genisys (Guile)
|
|
|
|
//Created On: 3/05/08 (Update 4/07/09)
|
|
|
|
/////////////////////////////////////////
|
|
|
|
/*
|
|
|
|
This script goes in the OnUnAquireItem
|
|
|
|
Module Event in the Module Properties
|
|
|
|
|
|
|
|
This script kills all items dropped on
|
|
|
|
the ground, unless it's a weapon & they are
|
|
|
|
in combat! (ie. disarmed)
|
|
|
|
|
|
|
|
Bartering & placing items in containers will not
|
|
|
|
destroy the items...
|
|
|
|
|
|
|
|
NOTE: This script does not stop gold from
|
|
|
|
being dropped on the ground!
|
|
|
|
|
|
|
|
The Tag Standard Bioware Tag-Based
|
|
|
|
Scripting will still fire reguardless.
|
|
|
|
*/
|
|
|
|
////////////////////////////////////////
|
|
|
|
|
|
|
|
//Required Includes
|
|
|
|
#include "x2_inc_switches"
|
2023-08-19 21:08:35 -04:00
|
|
|
#include "prc_x2_itemprop"
|
2022-10-07 14:20:31 -04:00
|
|
|
|
|
|
|
//Main Script
|
|
|
|
void main()
|
|
|
|
{
|
2024-03-13 21:52:56 -04:00
|
|
|
ExecuteScript("prc_onunaquire", OBJECT_SELF);
|
|
|
|
|
2022-10-07 14:20:31 -04:00
|
|
|
//Declare major variables..
|
|
|
|
object oPC = GetModuleItemLostBy();
|
|
|
|
object oItem = GetModuleItemLost();
|
|
|
|
object oArea = GetArea(oPC);
|
|
|
|
object oItemArea = GetArea(oItem);
|
|
|
|
int nType = GetBaseItemType(oItem);
|
|
|
|
|
|
|
|
//We only run these checks on PCs ONLY!
|
|
|
|
if (!GetIsPC(oPC) || GetIsDM(oPC) || GetIsDMPossessed(oPC))
|
|
|
|
{ return; }
|
|
|
|
|
|
|
|
//No longer used but left here for future use...
|
|
|
|
if(GetLocalInt(oPC, "ORGANIZING")==1)
|
|
|
|
{ return; }
|
|
|
|
|
|
|
|
string sMsg;
|
|
|
|
|
|
|
|
//This part kills all dropped items which are placed on the ground
|
|
|
|
//if not disarmed during combat...
|
|
|
|
|
|
|
|
//If the item was NOT placed in a container or bartered...
|
|
|
|
if (oItemArea == oArea)
|
|
|
|
{
|
|
|
|
|
|
|
|
//If the item is NOT Invalid!
|
|
|
|
if (oItem != OBJECT_INVALID)
|
|
|
|
{
|
|
|
|
|
|
|
|
//If the player is in combat...
|
|
|
|
if (GetIsInCombat(oPC))
|
|
|
|
{
|
|
|
|
//If it is in fact a weapon...
|
|
|
|
if(IPGetIsRangedWeapon(oItem) || IPGetIsMeleeWeapon(oItem))
|
|
|
|
{
|
|
|
|
//Do nothing, but continue the script..
|
|
|
|
}
|
|
|
|
//Otherwise if it's not a weapon!
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Kill it...
|
2024-03-13 21:52:56 -04:00
|
|
|
//SetPlotFlag(oItem, FALSE);
|
|
|
|
//DestroyObject(oItem);
|
2022-10-07 14:20:31 -04:00
|
|
|
|
2024-03-13 21:52:56 -04:00
|
|
|
//FloatingTextStringOnCreature("The item you dropped was destroyed!!!", oPC);
|
2022-10-07 14:20:31 -04:00
|
|
|
|
|
|
|
return; //no need to continue...
|
|
|
|
|
|
|
|
//Else statement end..
|
|
|
|
}
|
|
|
|
|
|
|
|
//End If in combat statment check..
|
|
|
|
}
|
|
|
|
|
|
|
|
//Otherwise, if not in combat...
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
//kill it...
|
2024-03-13 21:52:56 -04:00
|
|
|
//SetPlotFlag(oItem, FALSE);
|
|
|
|
//DestroyObject(oItem);
|
2022-10-07 14:20:31 -04:00
|
|
|
|
|
|
|
//Inform the PC it was destroyed (so they won't make a mistake later!
|
2024-03-13 21:52:56 -04:00
|
|
|
//FloatingTextStringOnCreature("The item you dropped was destroyed!!!", oPC);
|
2022-10-07 14:20:31 -04:00
|
|
|
|
|
|
|
return; //no need to continue...
|
|
|
|
|
|
|
|
|
|
|
|
//Else statement end..
|
|
|
|
}
|
|
|
|
|
|
|
|
//End if Valid item check...
|
|
|
|
}
|
|
|
|
|
|
|
|
//End if actually on ground check..
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
////Pick Pocket Watch///// Testing...
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
object oRobbed;
|
|
|
|
oRobbed = GetModuleItemLostBy();
|
|
|
|
object oThief;
|
|
|
|
oThief = GetModuleItemAcquiredBy();
|
|
|
|
object oLost;
|
|
|
|
oLost = GetModuleItemLost();
|
|
|
|
object oFound;
|
|
|
|
oFound = GetModuleItemAcquired();
|
|
|
|
|
|
|
|
|
|
|
|
//We do not run this script AT ALL for DMs!
|
|
|
|
if(!GetIsDM(oRobbed))
|
|
|
|
{
|
|
|
|
if(!GetIsDMPossessed(oRobbed))
|
|
|
|
{
|
|
|
|
if(GetObjectType(oRobbed)==OBJECT_TYPE_CREATURE)
|
|
|
|
{
|
|
|
|
//Let's make sure the thief is a PC
|
|
|
|
if (GetIsPC(oThief))
|
|
|
|
{
|
|
|
|
//Lets see if they have Pick Pocket Skills
|
|
|
|
if(GetSkillRank(SKILL_PICK_POCKET, oThief, TRUE)>0)
|
|
|
|
{
|
|
|
|
//Lets make sure they took it from a PC and not an NPC or Monster.
|
|
|
|
if(GetIsPC(oRobbed))
|
|
|
|
{
|
|
|
|
//Let's make sure the thief isn't crafting.
|
|
|
|
if(oRobbed != oThief)
|
|
|
|
{
|
|
|
|
sMsg = GetName(oThief) + " Has pickpocketed - " + GetName(oRobbed);
|
|
|
|
SendMessageToAllDMs(sMsg);
|
|
|
|
WriteTimestampedLogEntry(sMsg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
//Your Code Goes here...
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
///////////STANDARD XP2 TAG BASED SCRIPTING CODE///////////////////////////
|
|
|
|
|
|
|
|
//Tag Based Scripting Check
|
|
|
|
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
|
|
|
|
{
|
|
|
|
SetUserDefinedItemEventNumber(X2_ITEM_EVENT_UNACQUIRE);
|
|
|
|
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
|
|
|
|
if (nRet == X2_EXECUTE_SCRIPT_END)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//Main Script End
|
|
|
|
}
|