UW2_PRC8/_module/nss/onaquireditem.nss
Jaysyn904 f69e979e53 Updated event system
Added caller scripts to the PC events.  Full compile.  Updated release.
2023-11-13 13:16:17 -05:00

79 lines
2.3 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Example XP2 OnItemAcquireScript
//:: x2_mod_def_aqu
//:: (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Put into: OnItemAcquire Event
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:: Modified by Genisys / Guile 5/20/08
//:://////////////////////////////////////////////
#include "x2_inc_switches"
void main()
{
//IMPORTANT THIS MUST BE IN YOUR OnAcquireItem Module Event Script
//This is a fix for the Inventory Organizing System!
object oPC = GetModuleItemAcquiredBy();
if(!GetIsPC(oPC))
return;
object oRobbed = GetModuleItemLostBy();
object oItem = GetModuleItemAcquired();
object oTaken = GetModuleItemLost();
string sTaken = GetName(oTaken);
string sRecieved = GetName(oItem);
string sRob = GetName(oRobbed);
string sPC = GetName(oPC);
if(GetIsDM(oPC))
return;
if(GetLocalInt(oPC, "ORGANIZING")==1)
{ return; }
string sCDKey = GetPCPublicCDKey(oPC, FALSE);
int nCheck = GetLocalInt(oPC, "CHECKING_ROGUE");
if(nCheck !=1)
{
//Watch the rogues..
if(GetIsPC(oPC) && GetHasSkill(SKILL_PICK_POCKET, oPC))
{
SetLocalInt(oPC, "CHECKING_ROGUE", 1);
DelayCommand(3.0, SetLocalInt(oPC, "CHECKING_ROGUE", 0));
if((GetIsPC(oRobbed)) && (!GetIsDM(oRobbed)) && (!GetIsDMPossessed(oRobbed)))
{
if(sRob == sPC)
{
if(sTaken == sRecieved)
{
SendMessageToAllDMs("Pick Pocket Check on " + GetName(oPC));
}
}
}
}
}
// * 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_ACQUIRE);
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
if (nRet == X2_EXECUTE_SCRIPT_END)
{
return;
}
}
}