73 lines
1.7 KiB
Plaintext
73 lines
1.7 KiB
Plaintext
|
void CreateAnItem(object oPC, string sResRef, int iStack);
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
object oPC = GetPCSpeaker();
|
||
|
object oDeed = GetLocalObject(oPC,"oDeed");
|
||
|
DeleteLocalObject(oPC,"oDeed");
|
||
|
|
||
|
string sItemTag = GetLocalString(oDeed,"sItemTag");
|
||
|
string sItemResRef = GetLocalString(oDeed,"sItemResRef");
|
||
|
string sItemName = GetLocalString(oDeed,"sItemName");
|
||
|
int iTotal = GetLocalInt(oDeed,"iNumberStored");
|
||
|
int iStack = GetLocalInt(oDeed,"iStack");
|
||
|
|
||
|
int iCounter;
|
||
|
int iCounter2=10;
|
||
|
float fDelay=0.1;
|
||
|
if (iTotal>iStack)
|
||
|
{
|
||
|
for (iCounter2; iCounter2>0; iCounter2--)
|
||
|
{
|
||
|
if (iCounter+iStack<=iTotal)
|
||
|
{
|
||
|
fDelay=fDelay+0.1;
|
||
|
iCounter = iCounter+iStack;
|
||
|
DelayCommand(fDelay,CreateAnItem(oPC,sItemResRef,iStack));
|
||
|
}
|
||
|
}
|
||
|
iTotal=iTotal-iCounter;
|
||
|
}
|
||
|
|
||
|
fDelay=fDelay+0.1;
|
||
|
|
||
|
if (iCounter2==10)
|
||
|
{
|
||
|
if (iTotal==iStack)
|
||
|
{
|
||
|
DelayCommand(fDelay,CreateAnItem(oPC,sItemResRef,iStack));
|
||
|
iTotal=iTotal-iStack;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (iTotal>0)
|
||
|
{
|
||
|
if (iStack>iTotal)
|
||
|
{
|
||
|
DelayCommand(fDelay,CreateAnItem(oPC,sItemResRef,iTotal));
|
||
|
DestroyObject(oDeed);
|
||
|
iCounter = iCounter+iTotal;
|
||
|
DelayCommand(2.0,SendMessageToPC(oPC,"You remove "+IntToString(iCounter)+" "+sItemName+" from the bundle."));
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
SetLocalInt(oDeed,"iNumberStored",iTotal);
|
||
|
DelayCommand(2.0,SendMessageToPC(oPC,"You remove "+IntToString(iCounter)+" "+sItemName+" from the bundle."));
|
||
|
if (iTotal==0)
|
||
|
{
|
||
|
DestroyObject(oDeed);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
DelayCommand(2.1,SendMessageToPC(oPC,"This leaves "+IntToString(iTotal)+" "+sItemName+" left in the bundle."));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
void CreateAnItem(object oPC, string sResRef, int iStack)
|
||
|
{
|
||
|
CreateItemOnObject(sResRef,oPC,iStack);
|
||
|
return;
|
||
|
}
|