I am not sure this will store the items in the container out, but here is a shot at a shovel script, you would target the item you wish to bury with the "shovel". It then creats a map on the pc, there are two options as to the storing of the object, one is setlocalobject, that sets it to the map, the other stores it to the database. Tagbased script:
#include "x2_inc_switches"
const string MAP_OBJECT = "map_resref_here";
const string INVIS_OBJECT = "invisible_object_tag_here";
const string NEAR_OBJECT = "This map leads to a buried treasure, near ";
const string AREA_OBJECT = "In the area know as ";
void main()
{
int nChk = GetUserDefinedItemEventNumber();
if(nChk != X2_ITEM_EVENT_ACTIVATE) return;
object oTar = GetItemActivatedTarget();
location lLoc = GetLocation(GetItemActivator());
object oMap = CreateItemOnObject(MAP_OBJECT, GetItemActivator());
string sArea = GetName(GetArea(GetItemActivator()));
object oNear = GetNearestObject(OBJECT_TYPE_PLACEABLE, GetItemActivator());
object o1 = GetFirstItemInInventory(oTar);
string sName = GetName(GetItemActivator());
int nCount = GetCampaignInt(sName+"_MAPS", "NUM_O_MAPS", GetItemActivator());
if(GetTag(oNear) == INVIS_OBJECT) oNear = GetNearestObject(OBJECT_TYPE_PLACEABLE,
oNear);
SetCampaignInt(sName+"_MAPS", "NUM_O_MAPS", nCount++);
SetLocalLocation(oMap, "TREASURE", lLoc);
SetName(oMap, sName+"s' Map #"+IntToString(nCount++));
SetDescription(oMap, NEAR_OBJECT+GetName(oNear)+"."+AREA_OBJECT+GetName(GetArea(GetItemActivator())));
SetLocalObject(oMap, "TREASURE_CHEST", oTar);
//comment out the above setlocalobject and comment in the following to use
//the database functions
//SetLocalInt(oMap, "MAP#", nCount++);
//StoreCampaignObject(sName+"MAPS", "MAP#"+IntToString(nCount++), oTar);
while(GetIsObjectValid(o1))
{
DestroyObject(o1);
o1 = GetNextItemInInventory(oTar);
}
DestroyObject(oTar);
}
Modifié par Baragg, 11 octobre 2010 - 06:29 .