Jaysyn904 499aba4eb3 Initial upload
Initial upload
2023-09-25 18:13:22 -04:00

66 lines
2.1 KiB
Plaintext

#include "nw_i0_plot"
string sBluePrint = GetLocalString(OBJECT_SELF,"ASG_BUILDITEM_BLUEPRINT");
int rMISC_COPYOBJECT = GetLocalInt(GetModule(),"ASG_MICS_COPYOBJECT");
int rMISC_TIME = GetLocalInt(GetModule(),"ASG_MICS_BUILDTIME");
//
void main()
{
object oPC = GetPCSpeaker();
object oCChest = GetNearestObjectByTag("ASG_CCHEST",OBJECT_SELF);
if (GetIsObjectValid(oCChest))
{
string sTag;
int iGPTotal = 0;
object oItem = GetFirstItemInInventory(oCChest);
while (GetIsObjectValid(oItem))
{
if (GetLocalInt(oItem,"ASG_SETTODESTROY")==TRUE)
{
DelayCommand(0.25,DestroyObject(oItem));
}
oItem = GetNextItemInInventory(oCChest);
}
}
int iNum = 1;
object oNewItem;
if (rMISC_COPYOBJECT==TRUE)
{
oNewItem = CopyObject(oNewItem,GetLocation(oPC),oPC);
}
else
{
oNewItem = CreateItemOnObject(sBluePrint,oPC,iNum);
// Check to see if worked if not Try & Copy the item..
if (GetIsObjectValid(oNewItem)==FALSE)
{
oNewItem = CopyObject(oNewItem,GetLocation(oPC),oPC);
if (GetIsObjectValid(oNewItem)==FALSE)
{
SendMessageToPC(oPC,"ERROR: Was unable to create item via ResRef & Unable to CopyObject - Please Contact Module Builder.");
return;
}
}
SetIdentified(oNewItem,TRUE);
int iType = GetBaseItemType(oNewItem);
SetIdentified(oNewItem,TRUE);
if (iType == BASE_ITEM_ARROW || iType==BASE_ITEM_BOLT || iType == BASE_ITEM_DART || iType ==BASE_ITEM_BULLET )
{
iNum = 49;
oNewItem = CreateItemOnObject(sBluePrint,oPC,iNum);
SetIdentified(oNewItem,TRUE);
}
}
SetIdentified(oNewItem,TRUE);
ExecuteScript("asg_rul_micscfx",OBJECT_SELF);
if (rMISC_TIME>0)
{
int iNow = (GetCalendarYear()*10000) + (GetCalendarMonth() * 1000) + (GetCalendarDay() * 100) + GetTimeHour();
SetLocalInt(OBJECT_SELF,"ASG_ALTARANVILTIME",iNow+rMISC_TIME);
}
}