Tested using the following, I did change the definition of nCamp a bit so as to clarify a bit, but the following did spawn a book on my PC upon closing the chest, I use a book resref cause I did not have a map item. Are you sure you are using an item resref and not a placeable? If so are you 100% sure you have the resref right they are case sensitive.
const string CRITTER = "nw_malekid01";
const string WAYPOINT = "test";
const string MAP = "nw_it_book022";
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 = "NW_IT_BOOK010";
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;
nCamp = nCamp++;
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, oPC);
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);
}
}
}
I only tested this script, and not the rest of them using the resrefs and such that are listed in here.
Modifié par Baragg, 19 octobre 2010 - 03:08 .