PGCC_PRC8/_module/nss/vat_stripflags.nss
Jaysyn904 e51634d39b Initial upload
Initial upload.
2024-10-09 14:17:22 -04:00

61 lines
1.8 KiB
Plaintext

#include "inc_levelset"
void main()
{
object oTarget = GetPCSpeaker();
int iFoundItemFlag = 0;
int i = 0;
//for testing
//AssignCommand(oTarget, SpeakString("stripInventory fired"));
//valid only for creatures
//if ( GetObjectType(oTarget) != OBJECT_TYPE_CREATURE) return;
// set the variables
object oItem = GetFirstItemInInventory(oTarget);
// unflag unequipped items in inventory
while ( GetIsObjectValid(oItem) )
{
//SendMessageToPC(oTarget, "Evaluating " + GetName(oItem));
if (GetPlotFlag(oItem) == TRUE)
{
SetPlotFlag(oItem, FALSE);
SendMessageToPC(oTarget, "Plot flag removed from " + GetName(oItem));
iFoundItemFlag = 1;
}
if (GetStolenFlag(oItem) == TRUE)
{
SetStolenFlag(oItem, FALSE);
SendMessageToPC(oTarget, "Stolen flag removed from " + GetName(oItem));
iFoundItemFlag = 1;
}
//else SendMessageToPC(oTarget, GetName(oItem) + " was not changed.");
oItem = GetNextItemInInventory(oTarget);
}
//unflag equipped items in slots
for ( i = 0; i < NUM_INVENTORY_SLOTS; i++ )
{
oItem = GetItemInSlot(i, oTarget);
if (GetPlotFlag(oItem) == TRUE)
{
SetPlotFlag(oItem, FALSE);
SendMessageToPC(oTarget, "Plot flag removed from " + GetName(oItem));
iFoundItemFlag = 1;
}
if (GetStolenFlag(oItem) == TRUE)
{
SetStolenFlag(oItem, FALSE);
SendMessageToPC(oTarget, "Stolen flag removed from " + GetName(oItem));
iFoundItemFlag = 1;
}
}
if (iFoundItemFlag == 0) SendMessageToPC(oTarget, "No Plot or Stolen items found.");
}