This is the latest on close of the bury chest:
const string CRITTER = "nw_ac_pant01";
const string WAYPOINT = "tag_of_waypoint_to_spawn_at";
const string MAP = "MAP";
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";
const string INVIS = "tag_of_invisible_object_here";
const int DEBUG = 1;
void main()
{
location lP1 = GetLocation(GetWaypointByTag(WAYPOINT));
object oChest = OBJECT_SELF;
object oItem = GetFirstItemInInventory(oChest);
object oInvis = GetNearestObjectByTag(INVIS);
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; string sChk;
if(oInvis == OBJECT_INVALID)
{
if(DEBUG == 1)
{
SpeakString("Area is invalid for burying loot.", TALKVOLUME_SHOUT);
}
SendMessageToPC(oPC, "You may not bury treasure in this area.");
return;
}
while(GetIsObjectValid(oItem))
{
CopyItem(oItem, oCritter, TRUE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oChest);
}
if(DEBUG == 1)
{
SpeakString("Items should now be copied to storage critter.", TALKVOLUME_SHOUT);
}
SetCampaignInt("TREASURE_CHEST", sName, nCamp++);
StoreCampaignObject(sName+"TREASURE", "MAP#"+IntToString(nCamp++), oCritter);
oMap = CreateItemOnObject(MAP, oPC);
sChk = GetTag(oMap);
SetName(oMap, sName+" Map #"+IntToString(nCamp++));
SetDescription(oMap, LEADS+sArea+NEAR+sNear);
SetLocalInt(oMap, "MAP#", nCamp++);
SetLocalLocation(oMap, "LOCATION", GetLocation(oChest));
SetLocalString(oMap, "MAKER", sName);
SetLocalString(oMap, "AREA", GetTag(GetArea(oPC)));
DestroyObject(oHole);
DestroyObject(oChest);
if(DEBUG == 1)
{
SpeakString("Treasure maps made by this pc, "+IntToString(GetCampaignInt("TREASURE_CHEST", sName)), TALKVOLUME_SHOUT);
if(GetItemPossessedBy(oPC, sChk) != OBJECT_INVALID)
{
SpeakString("Map is on the PC.", TALKVOLUME_SHOUT);
SpeakString("Map marker int is, "+IntToString(GetLocalInt(oMap, "MAP#")), TALKVOLUME_SHOUT);
SpeakString("The area tag on the map is, "+GetLocalString(oMap,"AREA"), TALKVOLUME_SHOUT);
}
else
{
SpeakString("For some reason the map is not created on the map.", TALKVOLUME_SHOUT);
}
}
}
The strings that you will need to define are:
//waypoint for critter to spawn at
const string WAYPOINT = "tag_of_waypoint_to_spawn_at";
//resref of map here, should have better noted that sorry
const string MAP = "MAP";
//tag of hole here
const string HOLE = "hole_tag_here";
//tag of invis object here
const string INVIS = "tag_of_invisible_object_here";
Modifié par Baragg, 18 octobre 2010 - 07:39 .