778 lines
23 KiB
Plaintext
778 lines
23 KiB
Plaintext
|
/*--------------------------------------------------------
|
|||
|
|
|||
|
Script Name: inv_system3_ou
|
|||
|
----------------------------------------------------------
|
|||
|
Created By: Genisys(Guile)
|
|||
|
Created On: 3/21/09
|
|||
|
----------------------------------------------------------
|
|||
|
|
|||
|
This is a revision of my original system that works specifically
|
|||
|
with server modules. I have reworked the system so that
|
|||
|
it's won't have errors, and it checks for variables on
|
|||
|
the inventory organizer to tell the PC what to do and when
|
|||
|
to do it, it's also error proof, so there is nothing to worry
|
|||
|
about as far as losing items! I have playtest this system
|
|||
|
on a working server it works flawlessly everytime with a lot
|
|||
|
of different players using it across multiple restarts!
|
|||
|
|
|||
|
----------------------------------------------------------*/
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////
|
|||
|
//DON'T TOUCH ANYTHING BELOW UNLESS YOUR AN ADVANCED SCRIPTER!!!////////
|
|||
|
///////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
//Delcare all prototypes
|
|||
|
///////////////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPES DECLARED
|
|||
|
int GetNum(object oTarget);
|
|||
|
void CheckBox(object oTarget, object oReciever);
|
|||
|
void Seperate(object oTarget);
|
|||
|
void ReturnUndroppables(object oTarget, object oReciever);
|
|||
|
void SortContainer(object oTarget, object oReciever);
|
|||
|
void SortBox(object oTarget, object oReciever);
|
|||
|
void SortBoxes(object oReciever);
|
|||
|
void ClearBag(object oTarget, object oReciever);
|
|||
|
void StartSorting(object oTarget, object oReciever);
|
|||
|
void SortHoldingTank(object oTarget, object oReciever);
|
|||
|
void GiveAll(object oTarget, object oReciever);
|
|||
|
void ClearAll(object oTarget);
|
|||
|
///////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
//Main Script
|
|||
|
void main()
|
|||
|
{
|
|||
|
//Declare all major variables..
|
|||
|
object oPC = GetLastUsedBy();
|
|||
|
object oNPC = GetObjectByTag("ihold4u2");
|
|||
|
object oPBox = GetObjectByTag("plotbox2");
|
|||
|
object oMe = OBJECT_SELF;
|
|||
|
object oItem;
|
|||
|
string sMsg;
|
|||
|
string sPass;
|
|||
|
int nProcess = GetLocalInt(oMe, "PROCESS");
|
|||
|
string sCD = GetPCPublicCDKey(oPC, FALSE);
|
|||
|
string sUser = GetLocalString(oMe, "USER");
|
|||
|
|
|||
|
////////////////////////////////////////////////////////////////////////
|
|||
|
//First let's make sure that it's not a DM using the organizer..
|
|||
|
if(GetIsDM(oPC)||GetIsDMPossessed(oPC))
|
|||
|
{
|
|||
|
SendMessageToAllDMs("DMs Cannot Use The Inventory Organizer, Sorry!");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
|
|||
|
//This is an important fix for Module Events OnAcquire / OnUnAcquire
|
|||
|
//A lot of items are beinging taken / given, so it would fire
|
|||
|
//these Module Event Scripts repeatedly, which is REAL bad!
|
|||
|
SetLocalInt(oPC, "ORGANIZING", 1);
|
|||
|
|
|||
|
|
|||
|
////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
//First see if the system is in use or not..
|
|||
|
if(GetLocalInt(oMe, "IS_IN_USE")==1)
|
|||
|
{
|
|||
|
FloatingTextStringOnCreature("This system is busy, please wait..", oPC, FALSE);
|
|||
|
//Stop the script here!
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
///////////////////////////////////////////////////////////////////////////////
|
|||
|
//This is a main else, so it must be all encompassing of all other functions!!
|
|||
|
else
|
|||
|
{
|
|||
|
//If the string is blank...(meaning nobody has used it before)
|
|||
|
if(GetStringLength(sUser) == 0)
|
|||
|
{
|
|||
|
//Set that this system is in use. (Temporarially)
|
|||
|
SetLocalInt(oMe, "IS_IN_USE", 1);
|
|||
|
SetLocalString(oMe, "USER", sCD);
|
|||
|
}
|
|||
|
//Continue if the system is clear for use...
|
|||
|
else if(sUser == "FRESH_START")
|
|||
|
{
|
|||
|
//Set that this system is in use. (Temporarially)
|
|||
|
SetLocalInt(oMe, "IS_IN_USE", 1);
|
|||
|
SetLocalString(oMe, "USER", sCD);
|
|||
|
}
|
|||
|
//Continue if the user is the Original user during use...
|
|||
|
else if(sUser == sCD)
|
|||
|
{
|
|||
|
//Set that this system is in use. (Temporarially)
|
|||
|
SetLocalInt(oMe, "IS_IN_USE", 1);
|
|||
|
SetLocalString(oMe, "USER", sCD);
|
|||
|
}
|
|||
|
//whomever is trying to use this system is not correct!
|
|||
|
else
|
|||
|
{
|
|||
|
//Tell the PC we are taking their items..
|
|||
|
sMsg = "The system is in use or you have encountered an error..";
|
|||
|
AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK));
|
|||
|
}
|
|||
|
|
|||
|
//If we have not started taking item from the PC yet..
|
|||
|
if(GetLocalInt(oMe, "TAKING")!=3 && nProcess ==0)
|
|||
|
{
|
|||
|
//First Clear All Actions FROM ALL Boxes in the room & the PC!
|
|||
|
ClearAll(oPC);
|
|||
|
|
|||
|
//Set that we have done this already...
|
|||
|
SetLocalInt(oMe, "TAKING", 3);
|
|||
|
|
|||
|
//Set that this process was done...
|
|||
|
SetLocalInt(oMe, "PROCESS", 1);
|
|||
|
|
|||
|
//Tell the PC we are taking their items..
|
|||
|
sMsg = "I'm taking your items for sorting, please wait 20 seconds";
|
|||
|
AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK));
|
|||
|
|
|||
|
//Main Fuction....
|
|||
|
|
|||
|
//First take all of the items from the PC, cause this takes
|
|||
|
//the longest it must be delayed the most!
|
|||
|
oItem = GetFirstItemInInventory(oPC);
|
|||
|
while(GetIsObjectValid(oItem))
|
|||
|
{
|
|||
|
|
|||
|
AssignCommand(oNPC, ActionTakeItem(oItem, oPC));
|
|||
|
|
|||
|
oItem = GetNextItemInInventory(oPC);
|
|||
|
//While Loop End
|
|||
|
}
|
|||
|
|
|||
|
//Set that the player can use the system again now...
|
|||
|
DelayCommand(20.0 , SetLocalInt(oMe, "IS_IN_USE", 0));
|
|||
|
|
|||
|
//Set that we are done taking...
|
|||
|
DelayCommand(20.1, SetLocalInt(oMe, "TAKING", 0));
|
|||
|
|
|||
|
//Tell the PC we are done taking and to use the system again...
|
|||
|
sMsg = "I'm finshed, please click on me again.";
|
|||
|
DelayCommand(20.2 , AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK)));
|
|||
|
|
|||
|
}
|
|||
|
////////////////////////////////////////////////////////////////////
|
|||
|
//If we have not started sorting items in the holding tank yet...
|
|||
|
else if(GetLocalInt(oMe, "DE_BAGGING")!=3 && nProcess ==1)
|
|||
|
{
|
|||
|
//First Clear All Actions FROM ALL Things!
|
|||
|
//ClearAll(oPC);
|
|||
|
|
|||
|
//Set that we are debagging now...
|
|||
|
SetLocalInt(oMe, "DE_BAGGING", 3);
|
|||
|
//Set that this process was done...
|
|||
|
SetLocalInt(oMe, "PROCESS", 2);
|
|||
|
|
|||
|
//Tell the PC we are taking their items..
|
|||
|
sMsg = "I'm removing your items out of bags, please wait 25 seconds";
|
|||
|
AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK));
|
|||
|
|
|||
|
//Main Function...
|
|||
|
//Start removing items out of the bags inside the main holding box..
|
|||
|
SortHoldingTank(oNPC, oPC);
|
|||
|
|
|||
|
//Set that the player can use the system again now...
|
|||
|
DelayCommand(25.0 , SetLocalInt(oMe, "IS_IN_USE", 0));
|
|||
|
|
|||
|
//Set that we are done debagging now...
|
|||
|
DelayCommand(25.1, SetLocalInt(oMe, "DE_BAGGING", 0));
|
|||
|
|
|||
|
//Tell the PC we are done taking and to use the system again...
|
|||
|
sMsg = "I'm finshed, please click on me again.";
|
|||
|
DelayCommand(25.2 , AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK)));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//If we have not started removing items out of bags yet...
|
|||
|
else if(GetLocalInt(oMe, "SEPERATING")!=3 && nProcess ==2)
|
|||
|
{
|
|||
|
//First Clear All Actions FROM ALL Things!
|
|||
|
//ClearAll(oPC);
|
|||
|
|
|||
|
//Set that we are sorting now..
|
|||
|
SetLocalInt(oMe, "SEPERATING", 3);
|
|||
|
//Set that this process was done...
|
|||
|
SetLocalInt(oMe, "PROCESS",3);
|
|||
|
|
|||
|
//Tell the PC we are taking their items..
|
|||
|
sMsg = "I'm sorting your items, please wait 20 seconds";
|
|||
|
AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK));
|
|||
|
|
|||
|
//Main Fuction....
|
|||
|
|
|||
|
//Let's make sure all actions are cleared before we start this process!
|
|||
|
ClearAll(oPC);
|
|||
|
|
|||
|
//Start seperating the items in the holding tank and putting them in other boxes.
|
|||
|
Seperate(oPC);
|
|||
|
|
|||
|
//Set that the player can use the system again now...
|
|||
|
DelayCommand(20.0 , SetLocalInt(oMe, "IS_IN_USE", 0));
|
|||
|
|
|||
|
//Set that we are done Seperating..
|
|||
|
DelayCommand(20.1, SetLocalInt(oMe, "SEPERATING", 0));
|
|||
|
|
|||
|
//Tell the PC we are done taking and to use the system again...
|
|||
|
sMsg = "I'm finshed, please click on me again.";
|
|||
|
DelayCommand(20.2 , AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK)));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
else if(GetLocalInt(oMe, "SORTING")!=3 && nProcess ==3)
|
|||
|
{
|
|||
|
//First Clear All Actions FROM ALL Things!
|
|||
|
//ClearAll(oPC);
|
|||
|
|
|||
|
//Set that we are returning the items now..
|
|||
|
SetLocalInt(oMe, "SORTING", 3);
|
|||
|
|
|||
|
//Set that all processes are done!
|
|||
|
SetLocalInt(oMe, "PROCESS", 0);
|
|||
|
|
|||
|
//Tell the PC we are taking their items..
|
|||
|
sMsg = "I'm sorting your items, please wait 20 seconds";
|
|||
|
AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK));
|
|||
|
|
|||
|
//Main Fuction....
|
|||
|
//Return all the undroppable items from the plot box back to the PC..
|
|||
|
//ReturnUndroppables(GetObjectByTag("plotbox"));
|
|||
|
|
|||
|
StartSorting(oNPC, oPC);
|
|||
|
|
|||
|
//Make sure the PC has all of the items back...
|
|||
|
DelayCommand(19.0, GiveAll(oNPC, oPC));
|
|||
|
|
|||
|
//Set that the player can use the system again now...
|
|||
|
DelayCommand(20.0 , SetLocalInt(oMe, "IS_IN_USE", 0));
|
|||
|
|
|||
|
//Set that we are done Seperating..
|
|||
|
DelayCommand(20.2, SetLocalInt(oMe, "SORTING", 0));
|
|||
|
|
|||
|
//Tell the PC we are done taking and to use the system again...
|
|||
|
sMsg = "Organizing is complete, make sure you check your inventory BEFORE leaving!";
|
|||
|
DelayCommand(20.4 , AssignCommand(oMe, ActionSpeakString(sMsg, TALKVOLUME_TALK)));
|
|||
|
|
|||
|
DelayCommand(20.8, SetLocalString(oMe, "USER", "FRESH_START"));
|
|||
|
DelayCommand(21.0, SetLocalInt(oPC, "ORGANIZING", 0));
|
|||
|
}
|
|||
|
|
|||
|
//Else statement end..
|
|||
|
}
|
|||
|
|
|||
|
//Main Script End
|
|||
|
}
|
|||
|
|
|||
|
////////////////////////////////////////////////////////////////////////////
|
|||
|
///////////////////////////////////////////////////////////////////////////
|
|||
|
////////////////////DEFINE ALL PROTOTYPES/////////////////////////////////
|
|||
|
/////////////////////////////////////////////////////////////////////////
|
|||
|
//DON'T TOUCH ANYTHING BELOW UNLESS YOUR AN ADVANCED SCRIPTER!!!////////
|
|||
|
///////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
// Return the number of items oTarget possesses in thier inventory
|
|||
|
int GetNum(object oTarget)
|
|||
|
{
|
|||
|
int nNum = 0;
|
|||
|
object oItem = GetFirstItemInInventory(oTarget);
|
|||
|
|
|||
|
while (GetIsObjectValid(oItem))
|
|||
|
{
|
|||
|
if(GetIsObjectValid(oItem))
|
|||
|
{ nNum +=1; }
|
|||
|
|
|||
|
oItem = GetNextItemInInventory(oTarget);
|
|||
|
}
|
|||
|
|
|||
|
if(nNum>=1)
|
|||
|
{
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
|
|||
|
//END PROTOTYPE
|
|||
|
}
|
|||
|
|
|||
|
////////////////////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
|
|||
|
void CheckBox(object oTarget, object oReciever)
|
|||
|
{
|
|||
|
|
|||
|
object oBox = oTarget;
|
|||
|
|
|||
|
//We only continue if the box has items!
|
|||
|
if(GetNum(oBox)!=FALSE)
|
|||
|
{
|
|||
|
DelayCommand(0.2, SortBox(oTarget, oReciever));
|
|||
|
}
|
|||
|
|
|||
|
//PROTOTYPE END
|
|||
|
}
|
|||
|
|
|||
|
////////////////////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
void Seperate(object oTarget)
|
|||
|
{
|
|||
|
|
|||
|
//We are going to take items in bags with this function.
|
|||
|
|
|||
|
//NOTE: oTarget = The bag which we identified in Clear Bags
|
|||
|
|
|||
|
//Declare major variables
|
|||
|
object oBox, oBox1, oBox2,oBox3, oBox4, oBox5, oBox6, oBox7, oNPC, oItem;
|
|||
|
int nType;
|
|||
|
|
|||
|
oBox = GetObjectByTag("ibox2");
|
|||
|
oBox1 = GetObjectByTag("plotbox2");
|
|||
|
oBox2 = GetObjectByTag("potbox2");
|
|||
|
oBox3 = GetObjectByTag("wepbox2");
|
|||
|
oBox4 = GetObjectByTag("armbox2");
|
|||
|
oBox5 = GetObjectByTag("obox2");
|
|||
|
oBox6 = GetObjectByTag("ammobox2");
|
|||
|
oBox7 = GetObjectByTag("rswbox2");
|
|||
|
|
|||
|
|
|||
|
//The Main Box...
|
|||
|
oNPC = GetObjectByTag("ihold4u2");
|
|||
|
|
|||
|
//Now lets deal with the items in the bags
|
|||
|
oItem = GetFirstItemInInventory(oNPC);
|
|||
|
while(GetIsObjectValid(oItem))
|
|||
|
{
|
|||
|
nType = GetBaseItemType(oItem);
|
|||
|
|
|||
|
//If in fact the item in Undroppable, then give it back to the PC
|
|||
|
if(GetItemCursedFlag(oItem)==TRUE)
|
|||
|
{
|
|||
|
AssignCommand(oNPC, ActionGiveItem(oItem, oTarget));
|
|||
|
}
|
|||
|
|
|||
|
//Serpate ALL Potions & Scrolls into the potbox
|
|||
|
else if(nType==BASE_ITEM_POTIONS ||
|
|||
|
nType==BASE_ITEM_ENCHANTED_POTION ||
|
|||
|
nType==BASE_ITEM_ENCHANTED_SCROLL ||
|
|||
|
nType==BASE_ITEM_SPELLSCROLL)
|
|||
|
{
|
|||
|
AssignCommand(oBox2, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
|
|||
|
//Put all ammunitions in the ammobox
|
|||
|
else if(nType==BASE_ITEM_ARROW ||nType==BASE_ITEM_BOLT ||
|
|||
|
nType==BASE_ITEM_BULLET || nType==BASE_ITEM_DART ||
|
|||
|
nType==BASE_ITEM_SHURIKEN || nType==BASE_ITEM_THROWINGAXE)
|
|||
|
{
|
|||
|
AssignCommand(oBox6, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
|
|||
|
//Seperate all Rods / Staves / Wands into the srwbox
|
|||
|
else if(nType==BASE_ITEM_MAGICROD ||
|
|||
|
nType==BASE_ITEM_MAGICSTAFF || nType==BASE_ITEM_MAGICWAND)
|
|||
|
{
|
|||
|
AssignCommand(oBox7, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
|
|||
|
/* //Disabled...
|
|||
|
//now let's seperate all the miscellaneous items
|
|||
|
//Grenades, Trapkits, and Thieving Tools into the oBox
|
|||
|
else if(nType==BASE_ITEM_MISCSMALL || nType==BASE_ITEM_MISCMEDIUM ||
|
|||
|
nType==BASE_ITEM_MISCLARGE || nType==BASE_ITEM_MISCTHIN ||
|
|||
|
nType==BASE_ITEM_MISCWIDE || nType==BASE_ITEM_MISCTALL ||
|
|||
|
nType==BASE_ITEM_GRENADE || nType==BASE_ITEM_THIEVESTOOLS ||
|
|||
|
nType==BASE_ITEM_TRAPKIT)
|
|||
|
{
|
|||
|
AssignCommand(oBox5, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
*/
|
|||
|
|
|||
|
//Seperate the Armor & Worn Items into the armbox
|
|||
|
else if(nType==BASE_ITEM_AMULET ||
|
|||
|
nType==BASE_ITEM_ARMOR || nType==BASE_ITEM_BELT ||
|
|||
|
nType==BASE_ITEM_BOOTS || nType==BASE_ITEM_BRACER ||
|
|||
|
nType==BASE_ITEM_CLOAK || nType==BASE_ITEM_GLOVES ||
|
|||
|
nType==BASE_ITEM_HELMET || nType==BASE_ITEM_LARGESHIELD ||
|
|||
|
nType==BASE_ITEM_RING || nType==BASE_ITEM_SMALLSHIELD ||
|
|||
|
nType==BASE_ITEM_TOWERSHIELD)
|
|||
|
{
|
|||
|
AssignCommand(oBox4, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
|
|||
|
//Put all weapons in the weapon box..
|
|||
|
else if(nType== BASE_ITEM_BASTARDSWORD ||
|
|||
|
nType== BASE_ITEM_BATTLEAXE || nType== BASE_ITEM_CLUB ||
|
|||
|
nType== BASE_ITEM_DAGGER || nType== BASE_ITEM_DIREMACE ||
|
|||
|
nType== BASE_ITEM_DOUBLEAXE || nType== BASE_ITEM_DWARVENWARAXE ||
|
|||
|
nType== BASE_ITEM_GREATAXE || nType== BASE_ITEM_GREATSWORD ||
|
|||
|
nType== BASE_ITEM_HALBERD || nType== BASE_ITEM_HANDAXE ||
|
|||
|
nType== BASE_ITEM_HEAVYFLAIL || nType== BASE_ITEM_KAMA ||
|
|||
|
nType== BASE_ITEM_KATANA || nType== BASE_ITEM_KUKRI ||
|
|||
|
nType== BASE_ITEM_LIGHTFLAIL || nType== BASE_ITEM_LIGHTHAMMER)
|
|||
|
{
|
|||
|
AssignCommand(oBox3, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
|
|||
|
//Break up the weapons so it's less search time..
|
|||
|
else if(nType== BASE_ITEM_LIGHTMACE || nType== BASE_ITEM_LONGSWORD ||
|
|||
|
nType== BASE_ITEM_MORNINGSTAR || nType== BASE_ITEM_QUARTERSTAFF ||
|
|||
|
nType== BASE_ITEM_RAPIER || nType== BASE_ITEM_SCIMITAR ||
|
|||
|
nType== BASE_ITEM_SCYTHE || nType== BASE_ITEM_SHORTSPEAR ||
|
|||
|
nType== BASE_ITEM_SHORTSWORD || nType== BASE_ITEM_SICKLE ||
|
|||
|
nType== BASE_ITEM_TRIDENT || nType== BASE_ITEM_TWOBLADEDSWORD ||
|
|||
|
nType== BASE_ITEM_WARHAMMER || nType== BASE_ITEM_WHIP)
|
|||
|
{
|
|||
|
AssignCommand(oBox3, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
|
|||
|
//Ranged Weapons
|
|||
|
else if(nType== BASE_ITEM_HEAVYCROSSBOW || nType== BASE_ITEM_LIGHTCROSSBOW ||
|
|||
|
nType== BASE_ITEM_LONGBOW || nType== BASE_ITEM_SHORTBOW ||
|
|||
|
nType== BASE_ITEM_SLING)
|
|||
|
{
|
|||
|
AssignCommand(oBox3, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
|
|||
|
//Otherwise put the item in the ibox!
|
|||
|
else
|
|||
|
{
|
|||
|
AssignCommand(oBox, ActionTakeItem(oItem, oNPC));
|
|||
|
}
|
|||
|
|
|||
|
//Continue the loop
|
|||
|
oItem = GetNextItemInInventory(oNPC);
|
|||
|
|
|||
|
//While loop end
|
|||
|
}
|
|||
|
|
|||
|
//PROTOTYPE END
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
///////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
|
|||
|
void ReturnUndroppables(object oTarget, object oReciever)
|
|||
|
{
|
|||
|
|
|||
|
//NOTE: oTarget = the plotBox;
|
|||
|
|
|||
|
object oPC = oTarget;
|
|||
|
|
|||
|
object oItem;
|
|||
|
oItem = GetFirstItemInInventory(oTarget);
|
|||
|
while(GetIsObjectValid(oItem))
|
|||
|
{
|
|||
|
//return all containers to the PC!
|
|||
|
if(GetItemCursedFlag(oItem))
|
|||
|
{
|
|||
|
//Give everything to the PC..
|
|||
|
AssignCommand(oTarget, ActionGiveItem(oItem, oPC));
|
|||
|
}
|
|||
|
|
|||
|
oItem = GetNextItemInInventory(oTarget);
|
|||
|
}
|
|||
|
|
|||
|
//PROTOTYPE END
|
|||
|
}
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
void SortContainer(object oTarget, object oReciever)
|
|||
|
{
|
|||
|
|
|||
|
//NOTE: oTarget = The Box assigned to be sorted
|
|||
|
|
|||
|
//Declare Major Variables
|
|||
|
object oPC = oReciever;
|
|||
|
object oNPC = GetObjectByTag("ihold4u2");
|
|||
|
string sTag = GetTag(oTarget);
|
|||
|
object oBox = GetObjectByTag(sTag);
|
|||
|
object oBag = GetItemPossessedBy(oNPC, sTag);
|
|||
|
object oMine;
|
|||
|
string sName;
|
|||
|
|
|||
|
//First Put all the items that will fit into the bag
|
|||
|
//on the NPC into the bag..
|
|||
|
oMine = GetFirstItemInInventory(oTarget);
|
|||
|
while(GetIsObjectValid(oMine)==TRUE)
|
|||
|
{
|
|||
|
|
|||
|
AssignCommand(oTarget, ActionGiveItem(oMine, oBag));
|
|||
|
|
|||
|
oMine = GetNextItemInInventory(oTarget);
|
|||
|
}
|
|||
|
|
|||
|
//Make the bags unsellable and undroppable!!
|
|||
|
SetItemCursedFlag(oBag, FALSE);
|
|||
|
SetPlotFlag(oBag, TRUE);
|
|||
|
|
|||
|
//Determine what to name the Bags based on the box's tagname
|
|||
|
|
|||
|
if(GetTag(oTarget) == "ibox2")
|
|||
|
{
|
|||
|
sName = "<cr<63> >Other Items";
|
|||
|
}
|
|||
|
else if(GetTag(oTarget) == "plotbox2")
|
|||
|
{
|
|||
|
sName = "<c<><63> >Plot Items";
|
|||
|
}
|
|||
|
else if(GetTag(oTarget) == "potbox2")
|
|||
|
{
|
|||
|
sName = "<c <20><>>Potions & Scrolls";
|
|||
|
}
|
|||
|
else if(GetTag(oTarget) == "wepbox2")
|
|||
|
{
|
|||
|
sName = "<c<> >Weapons2";
|
|||
|
}
|
|||
|
else if(GetTag(oTarget) == "armbox2")
|
|||
|
{
|
|||
|
sName = "<c=w<>>Armor & Clothing";
|
|||
|
}
|
|||
|
else if(GetTag(oTarget) == "obox2")
|
|||
|
{
|
|||
|
sName = "<c<><63>~>Miscellaneous Items";
|
|||
|
}
|
|||
|
else if(GetTag(oTarget) == "ammobox2")
|
|||
|
{
|
|||
|
sName = "<c<><63> >Ammunition";
|
|||
|
}
|
|||
|
else if(GetTag(oTarget) == "rswbox2")
|
|||
|
{
|
|||
|
sName = "<c<><63> >Rods/Staves/Wands";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
sName = "<c<><63> >Sorted Items";
|
|||
|
}
|
|||
|
//Give the bag a the proper name with color :)
|
|||
|
DelayCommand(0.4,SetName(oBag, sName));
|
|||
|
|
|||
|
//Give the PC the bag now that it has items in it.
|
|||
|
DelayCommand(0.6, AssignCommand(oNPC, ActionGiveItem(oBag, oPC)));
|
|||
|
|
|||
|
//0.8 Seconds is the miminum delay here!
|
|||
|
DelayCommand(0.8, CheckBox(oTarget, oReciever));
|
|||
|
|
|||
|
//PROTOTYPE END
|
|||
|
}
|
|||
|
|
|||
|
//////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
void SortBox(object oTarget, object oReciever)
|
|||
|
{
|
|||
|
|
|||
|
//NOTE: oTarget = The Box Assigned to be sorted.
|
|||
|
|
|||
|
//Declare Major Variables
|
|||
|
object oPC = oReciever;
|
|||
|
object oNPC = GetObjectByTag("ihold4u2");
|
|||
|
object oBox = GetObjectByTag(GetTag(oTarget));
|
|||
|
object oItem;
|
|||
|
|
|||
|
//We only continue if the box has items!
|
|||
|
if((GetNum(oBox)==TRUE))
|
|||
|
{
|
|||
|
//Give the NPC a Bag to store items in.
|
|||
|
//Give the bag the tagname of the box.
|
|||
|
CreateItemOnObject("NW_IT_CONTAIN006", oNPC, 1, GetTag(oTarget));
|
|||
|
|
|||
|
//Start putting items in the bag on the NPC.
|
|||
|
DelayCommand(0.3, SortContainer(oTarget, oPC));
|
|||
|
}
|
|||
|
|
|||
|
//PROTOTYPES End
|
|||
|
}
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
|
|||
|
void SortBoxes(object oReciever)
|
|||
|
{
|
|||
|
object oBox = GetObjectByTag("ibox2");
|
|||
|
object oBox1 = GetObjectByTag("plotbox2");
|
|||
|
object oBox2 = GetObjectByTag("potbox2");
|
|||
|
object oBox3 = GetObjectByTag("wepbox2");
|
|||
|
object oBox4 = GetObjectByTag("armbox2");
|
|||
|
object oBox5 = GetObjectByTag("obox2");
|
|||
|
object oBox6 = GetObjectByTag("ammobox2");
|
|||
|
object oBox7= GetObjectByTag("rswbox2");
|
|||
|
object oBox8= GetObjectByTag("ihold4u2");
|
|||
|
|
|||
|
//ClearAll();
|
|||
|
|
|||
|
//Start bagging the items in boxes with sorted items..
|
|||
|
//NOTE: This is most resource intensive part, and can be effected
|
|||
|
//by lagg, so.......
|
|||
|
DelayCommand(0.2, SortBox(oBox1, oReciever));
|
|||
|
DelayCommand(0.6, SortBox(oBox2, oReciever));
|
|||
|
DelayCommand(0.8, SortBox(oBox3, oReciever));
|
|||
|
DelayCommand(1.2, SortBox(oBox4, oReciever));
|
|||
|
DelayCommand(1.6, SortBox(oBox5, oReciever));
|
|||
|
DelayCommand(2.0, SortBox(oBox6, oReciever));
|
|||
|
DelayCommand(2.4, SortBox(oBox7, oReciever));
|
|||
|
DelayCommand(2.8, SortBox(oBox, oReciever));
|
|||
|
|
|||
|
//We must delay the reuturn of all items
|
|||
|
//DelayCommand(15.0, GiveAll(oBox));
|
|||
|
//DelayCommand(15.1, GiveAll(oBox1));
|
|||
|
//DelayCommand(15.2, GiveAll(oBox2));
|
|||
|
//DelayCommand(15.3, GiveAll(oBox3));
|
|||
|
//DelayCommand(15.4, GiveAll(oBox4));
|
|||
|
//DelayCommand(15.5, GiveAll(oBox5));
|
|||
|
//DelayCommand(15.6, GiveAll(oBox6));
|
|||
|
//DelayCommand(15.7, GiveAll(oBox7));
|
|||
|
//DelayCommand(15.9, GiveAll(oBox8));
|
|||
|
}
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
|
|||
|
void ClearBag(object oTarget, object oReciever)
|
|||
|
{
|
|||
|
|
|||
|
//NOTE: oTarget = oPC
|
|||
|
//AssignCommand(oTarget, ClearAllActions());
|
|||
|
|
|||
|
object oNPC = GetObjectByTag("ihold4u2");
|
|||
|
object oItem;
|
|||
|
|
|||
|
//First, take all items from inside of bags first!
|
|||
|
oItem = GetFirstItemInInventory(oTarget);
|
|||
|
while(GetIsObjectValid(oItem))
|
|||
|
{
|
|||
|
//Have the NPC (Box) take all of the items out of the bag
|
|||
|
//if(!GetHasInventory(oItem))
|
|||
|
AssignCommand(oNPC, ActionTakeItem(oItem, oTarget));
|
|||
|
|
|||
|
oItem = GetNextItemInInventory(oTarget);
|
|||
|
}
|
|||
|
|
|||
|
//PROTOTYPE END
|
|||
|
}
|
|||
|
|
|||
|
/////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
|
|||
|
//This is the hard core part of the script, where it actually processes the
|
|||
|
//items in the each box, puts it in a bag and then returns it to the PC.
|
|||
|
void StartSorting(object oTarget, object oReciever)
|
|||
|
{
|
|||
|
|
|||
|
//Remove all Action Ques from all boxes FIRST!
|
|||
|
//ClearAll(GetLastUsedBy());
|
|||
|
|
|||
|
//Now sort all the boxes holding the sorted items..
|
|||
|
DelayCommand(0.4, SortBoxes(oReciever));
|
|||
|
|
|||
|
//PROTOTYPE END
|
|||
|
}
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
void SortHoldingTank(object oTarget, object oReciever)
|
|||
|
{
|
|||
|
|
|||
|
//WARNING: DO NOT CHANGE ANY DELAY BELOW!!!!
|
|||
|
SendMessageToAllDMs("ATTENTION: Inventory System is in use!");
|
|||
|
|
|||
|
object oItem;
|
|||
|
oItem = GetFirstItemInInventory(oTarget);
|
|||
|
while(GetIsObjectValid(oItem))
|
|||
|
{
|
|||
|
|
|||
|
//Take all items out of bags and put them in the Holding Box
|
|||
|
if(GetHasInventory(oItem))
|
|||
|
{
|
|||
|
ClearBag(oItem, oReciever);
|
|||
|
|
|||
|
DelayCommand(14.0, DestroyObject(oItem, 0.0f));
|
|||
|
}
|
|||
|
//Otherwise leave the item alone!
|
|||
|
else
|
|||
|
{
|
|||
|
//Do nothing!
|
|||
|
}
|
|||
|
|
|||
|
oItem = GetNextItemInInventory(oTarget);
|
|||
|
}
|
|||
|
//Next, Sort the items in the holding box
|
|||
|
//Need a slight delay to allow clear all actions to finish!
|
|||
|
//DelayCommand(20.5, Seperate(oTarget));
|
|||
|
|
|||
|
//Note, the seperating goes fast above, like within 3 seconds
|
|||
|
//HOWEVER, let's give it 10 seconds just in case!
|
|||
|
//DelayCommand(30.5, StartSorting(oTarget));
|
|||
|
|
|||
|
//PROTOTYPE END..
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
///////////////////////////////////////////////////////
|
|||
|
void GiveAll(object oTarget, object oReciever)
|
|||
|
{
|
|||
|
|
|||
|
object oItem;
|
|||
|
|
|||
|
|
|||
|
oItem = GetFirstItemInInventory(oTarget);
|
|||
|
while(GetIsObjectValid(oItem))
|
|||
|
{
|
|||
|
//Give everything to the PC inside this target box..
|
|||
|
//Note: this function may not work, due to the fact that
|
|||
|
//those items were assigned to bags!
|
|||
|
AssignCommand(oTarget, ActionGiveItem(oItem, oReciever));
|
|||
|
|
|||
|
//Continue to find all of the items in the box..
|
|||
|
oItem = GetNextItemInInventory(oTarget);
|
|||
|
}
|
|||
|
|
|||
|
//PROTOTYPE END
|
|||
|
}
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
//PROTOTYPE DEFINED
|
|||
|
void ClearAll(object oTarget)
|
|||
|
{
|
|||
|
|
|||
|
//Clear the actions of the PC!
|
|||
|
AssignCommand(oTarget, ClearAllActions());
|
|||
|
|
|||
|
//Forgot to remove all action ques from the boxes!
|
|||
|
//This was a very hard error to find!
|
|||
|
|
|||
|
//Otherwise the system would not work 2 times!
|
|||
|
object oBox = GetObjectByTag("ibox2");
|
|||
|
object oBox1 = GetObjectByTag("plotbox2");
|
|||
|
object oBox2 = GetObjectByTag("potbox2");
|
|||
|
object oBox3 = GetObjectByTag("wepbox2");
|
|||
|
object oBox4 = GetObjectByTag("armbox2");
|
|||
|
object oBox5 = GetObjectByTag("obox2");
|
|||
|
object oBox6 = GetObjectByTag("ammobox2");
|
|||
|
object oBox7= GetObjectByTag("rswbox2");
|
|||
|
object oBox8= GetObjectByTag("ihold4u2");
|
|||
|
|
|||
|
AssignCommand(oBox, ClearAllActions());
|
|||
|
AssignCommand(oBox1, ClearAllActions());
|
|||
|
AssignCommand(oBox2, ClearAllActions());
|
|||
|
AssignCommand(oBox3, ClearAllActions());
|
|||
|
AssignCommand(oBox4, ClearAllActions());
|
|||
|
AssignCommand(oBox5, ClearAllActions());
|
|||
|
AssignCommand(oBox6, ClearAllActions());
|
|||
|
AssignCommand(oBox7, ClearAllActions());
|
|||
|
AssignCommand(oBox8, ClearAllActions());
|
|||
|
|
|||
|
//PROTOTYPE END
|
|||
|
}
|
|||
|
|
|||
|
////////////////////////////////////////////////////////////////////////////
|
|||
|
//////////WELCOME TO THE 900 CLUB WITH YOUR HOST GENISYS :p ///////////////
|
|||
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
//THE END, WOOOOOOOSHHH!!!////////////////////FINAL EDITION!/////////////
|
|||
|
////////////////////////////////////////////////////////////////////////
|