44 lines
878 B
Plaintext
44 lines
878 B
Plaintext
void main()
|
|
{
|
|
object o = OBJECT_SELF;
|
|
object oPC = GetLastClosedBy();
|
|
object oTarget, oSpawn;
|
|
location lTarget;
|
|
int nUse = GetLocalInt(o, "IN_USE");
|
|
int i;
|
|
|
|
object oItem = GetFirstItemInInventory(o);
|
|
while(GetIsObjectValid(oItem))
|
|
{
|
|
if(GetIsObjectValid(oItem))
|
|
{
|
|
i +=1;
|
|
}
|
|
oItem = GetNextItemInInventory(o);
|
|
}
|
|
|
|
if(i==1)
|
|
{
|
|
if(nUse!=1)
|
|
{
|
|
//Set that the PC who used it last is the person spawning in the scribe!
|
|
SetLocalInt(oPC, "ITEM_USER", 1);
|
|
SetLocalInt(o, "IN_USE", 1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(GetLocalInt(oPC, "ITEM_USER")==1)
|
|
{
|
|
//Set that the user is now done!
|
|
SetLocalInt(oPC, "ITEM_USER", 0);
|
|
SetLocalInt(o, "IN_USE", 0);
|
|
}
|
|
//If it's not the original user, then tell them how to use it!
|
|
else
|
|
{
|
|
AssignCommand(o, ActionSpeakString("You must place 1 item in the chest to use this device!", TALKVOLUME_TALK));
|
|
}
|
|
}
|
|
}
|