68 lines
1.6 KiB
Plaintext
68 lines
1.6 KiB
Plaintext
//Script Name: icontain
|
|
//////////////////////////////////////////
|
|
//Created by: Genisys / Guile
|
|
//ON: 7/29/08
|
|
/////////////////////////////////////////
|
|
/* **Notes**
|
|
Give the PC All the Undroppable items
|
|
back, as we cannot bag these!!!
|
|
|
|
*/
|
|
////////////////////////////////////////
|
|
|
|
/////REDUNDANT PROTOTYPES DECLARED/////////////////////////////////
|
|
|
|
// Return the number of items oTarget possesses in thier inventory
|
|
int GetNum(object oTarget);
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
//Main Script///
|
|
void main()
|
|
{
|
|
object oPC = OBJECT_SELF;
|
|
object oBox = GetObjectByTag("ibox");
|
|
object oMine;
|
|
object oNPC = GetObjectByTag("itoolnpc");
|
|
|
|
//If there aren't any items in the box stop here!!!
|
|
if(GetNum(oBox)==0)
|
|
{
|
|
return; //stop here!!
|
|
}
|
|
//This else is critical or bugs will happen!
|
|
else
|
|
{
|
|
//Give the NPC a Bag to store items in!
|
|
CreateItemOnObject("NW_IT_CONTAIN006", oNPC, 1, "sobag");
|
|
|
|
//Now start bagging the items in the box..
|
|
DelayCommand(0.2, ExecuteScript("iarrange", oPC));
|
|
|
|
//Continue to loop this script till all items are gone!!
|
|
DelayCommand(0.6, ExecuteScript("icontain", oPC));
|
|
}
|
|
|
|
//Main Script End//////////
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
//REDUNDANT PROTOTYPES DEFINED
|
|
////////////////////////////
|
|
|
|
//PROTOTYPE DEFINED///////
|
|
int GetNum(object oTarget)
|
|
{
|
|
int nNum = 0;
|
|
object oItem = GetFirstItemInInventory(oTarget);
|
|
|
|
while (GetIsObjectValid(oItem)==TRUE)
|
|
{
|
|
|
|
nNum = nNum +1;
|
|
|
|
oItem = GetNextItemInInventory(oTarget);
|
|
}
|
|
return nNum;
|
|
}
|