I wrote these sets of scripts for a module I was working on. Players were in a village heading to "The City of the Dead" where there would be no merchants. So I created this system in which they have a chest on the docks that they put as much stuff as they want into it, and when it is shut it is "virtually" stored aboard a ship they will be taking to the new area. Once they take the ship there are 8 chests on the dock on the other side. The first chest they open has all the stuff the stored and a key. If they take the key then the chest is locked and no one can get to their stuff. If they leave the key in the chest then it does not lock and can be used by someone else. I just listed the scripts for the actually "provisions", but can post the "Locker" scripts if anyone is interested.
First script goes on the OnClose event on the First Chest:
void main()
{
object oPC=GetLastOpenedBy();
int ProvisionNumber=GetLocalInt(oPC,"ProvisionNumber");
object oItem=GetFirstItemInInventory(OBJECT_SELF);
while(GetIsObjectValid(oItem))
{
SetLocalString(oPC,"Provision"+IntToString(ProvisionNumber),GetTag(oItem));
SetLocalInt(oPC,"ProvisionQty"+IntToString(ProvisionNumber),GetNumStackedItems(oItem));
SetLocalInt(oPC,"ProvisionIdent"+IntToString(ProvisionNumber),GetIdentified(oItem));
ProvisionNumber++;
DestroyObject(oItem,0.0);
oItem=GetNextItemInInventory(OBJECT_SELF);
}
SetLocalInt(oPC,"ProvisionNumber",ProvisionNumber);
}
The next script goes on the OnOpen event of the chest in a new area (or Module I think):
void main()
{
object oPC=GetLastOpenedBy();
int ProvisionNumber=GetLocalInt(oPC,"ProvisionNumber");
if(ProvisionNumber!=0 && GetIsObjectValid(oPC))
{
int nX;
for(nX=0; nX<=(ProvisionNumber-1); nX++)
{
string sItemTemplate=GetLocalString(oPC,"Provision"+IntToString(nX));
int nStackSize=GetLocalInt(oPC,"ProvisionQty"+IntToString(nX));
object oItem=CreateItemOnObject(sItemTemplate, OBJECT_SELF, nStackSize);
SetIdentified(oItem, GetLocalInt(oPC,"ProvisionIdent"+IntToString(nX)) );
}
SetLocalInt(oPC,"ProvisionNumber",0);
}
}
Provisions Chest
Moderator: Event DM
-
- Newbie
- Posts: 8
- Joined: Thu Jan 16, 2003 1:42 am
- Contact:
-
- Newbie
- Posts: 8
- Joined: Thu Jan 16, 2003 1:42 am
- Contact:
It should be noted that in cases where the tag does not match the Blueprint ResRef, the item will be effectively destroyed, so it is recommended for just provisions not plot items. This is an old script so I am sure this shortcoming can be fixed by using the new GetResRef() command that was added in 1.25, but I have not had time to test that.
I simply have a conversation with the "Ferry attendant" that indicates that his employee's can be a little on the shady side and may steal any "unique" items placed in the chest (just like at major airports) so those are best left on their person.
I simply have a conversation with the "Ferry attendant" that indicates that his employee's can be a little on the shady side and may steal any "unique" items placed in the chest (just like at major airports) so those are best left on their person.