This would go on the "leave" node of the convo. Also I would clarify on the bury treasure node that upon closing the chest the chest will be buried, so don't close it till your done. Oh, and we will need a waypoint to spawn at in that area, sorry for asking for the area tag.
const string HOLE_OBJECT = "hole_resref_here";
const string CHEST_OBJECT = "chest_resref_here";
void main()
{
object oPC = GetPCSpeaker();
object oHole = GetNearestObjectByTag(HOLE_OBJECT, oPC);
object oChest = GetNearestObjectByTag(CHEST_OBJECT, oPC);
DestroyObject(oHole);
DestroyObject(oChest);
}
This would be the chest onclose script
const string CRITTER = "nw_ac_pant01";
const string WAYPOINT = "tag_of_waypoint_to_spawn_at";
const string MAP = "map_resref_here";
const string LEADS = "This map leads to a treasure, in the area known as ";
const string NEAR = "The treasure is near ";
const string HOLE = "hole_tag_here";
void main()
{
location lP1 = GetLocation(GetWaypointByTag(WAYPOINT));
object oChest = OBJECT_SELF;
object oItem = GetFirstItemInInventory(oChest);
object oPC = GetLastUsedBy();
string sName = GetName(oPC);
int nCamp = GetCampaignInt("TREASURE_CHEST", sName, oPC);
object oCritter = CreateObject(OBJECT_TYPE_CREATURE, CRITTER, lP1);
string sArea = GetName(GetArea(oPC));
location lPC = GetLocation(oPC);
string sNear = GetName(GetNearestObject(OBJECT_TYPE_PLACEABLE, oPC, 2));
object oHole = GetNearestObjectByTag(HOLE);
object oMap;
while(GetIsObjectValid(oItem))
{
CopyItem(oItem, oCritter, TRUE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oChest);
}
SetCampaignInt("TREASURE_CHEST", sName, nCamp++);
StoreCampaignObject(sName+"TREASURE", "MAP#"+IntToString(nCamp++), oCritter);
oMap = CreateItemOnObject(MAP, oPC);
SetName(oMap, sName+" Map #"+IntToString(nCamp++));
SetDescription(oMap, LEADS+sArea+NEAR+sNear);
SetLocalInt(oMap, "MAP#", nCamp++);
SetLocalString(oMap, "MAKER", sName);
DestroyObject(oHole);
DestroyObject(oChest);
}
Still working on this, gotta come up with the map thing.
Modifié par Baragg, 13 octobre 2010 - 01:49 .