so i've been doing some thinking about how to make a script set for creating an item in a container. I need certain requirements to be met in order for the items to appear in the chest, need the same requirements for when they take the item, this will give a journal update, and need something for the OnClose to match the other two scripts. so far, this is what i have:
OnOpen:
#include "pqj_inc"
void main()
{
object oPC = GetLastOpenedBy();
if(!GetIsPC(oPC))
{
return;
}
object oNPC = OBJECT_SELF;
if(GetLocalInt(oPC,GetTag(oNPC)))
{
return;
}
int nInt = RetrieveQuestState("q_ezra",GetLastOpenedBy());
if (nInt != 10)
{
return;
}
CreateItemOnObject("ezra_book", OBJECT_SELF);
}
OnDisturbed:
#include "pqj_inc"
void main()
{
int iType = GetInventoryDisturbType();
object oPC = GetLastDisturbed();
object oItem = GetInventoryDisturbItem();
if (!GetIsPC(oPC)) return;
if(iType == INVENTORY_DISTURB_TYPE_REMOVED && GetTag(oItem) == "ezra_book")
{
FloatingTextStringOnCreature("** Your Journal Has Been Updated **", oPC);
AddPersistentJournalQuestEntry("q_ezra",20,oPC,FALSE);
}
}
and OnClosed:
**script goes here**
i have also been told this way:
place the item in the chest in the toolset, then in the OnDisturbed slot, ad this:
#include "pqj_inc"
void main()
{
int iType = GetInventoryDisturbType();
object oPC = GetLastDisturbed();
object oItem = GetInventoryDisturbItem();
if(RetrieveQuestState("q_ezra",oPC) == 10)
{
CopyItem(oItem,OBJECT_SELF);
DestroyObject(oItem);
return;
}
if(iType == INVENTORY_DISTURB_TYPE_REMOVED && GetTag(oItem) == "ezra_book")
{
FloatingTextStringOnCreature("** Your Journal Has Been Updated **", oPC);
AddPersistentJournalQuestEntry("q_ezra",10,oPC,FALSE);
DestroyObject(OBJECT_SELF,5.0);
}
}
... so if theres a better way, one that won't allow exploits, i'd appreciate the help.
thanks.