Author Topic: Bury gold and retreiving it  (Read 1498 times)

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Bury gold and retreiving it
« Reply #45 on: October 19, 2010, 04:07:34 am »


               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 .
                     
                  


            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Bury gold and retreiving it
« Reply #46 on: October 19, 2010, 04:11:40 am »


               Just retested, and it worked but did notice there is a need to add an empty string spot in front of the "The treasure is near ", it should be " The treasure is near ". So that it is not right up against the previous string in the description. Lol, it said the treasure was near the Dirt Patch, cause that is the nearest placeable. Kinda neat seeing that work like that.
               
               

               
            

Legacy_Builder_Anthony

  • Hero Member
  • *****
  • Posts: 786
  • Karma: +0/-0
Bury gold and retreiving it
« Reply #47 on: October 19, 2010, 04:25:17 am »


               Ill have to check every tag and resref then.I take it you received the man then if you have that text pop up because i havent seen it.I souppose its from useing the map.Oh....yes it is a item for the map i am usen.
               
               

               


                     Modifié par Builder_Anthony, 19 octobre 2010 - 03:27 .
                     
                  


            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Bury gold and retreiving it
« Reply #48 on: October 19, 2010, 04:32:41 am »


               Well that text actually becomes the description of the map.

IE: You "examine" the map item in your inventory and the description says

"This map leads to a treasure in the area know as Blah.The treasure is near Dirt Patch."

That is the description that my map(book) has now. I did notice that some of the campaign int settings may be off. I will have to check on that some more. Let us know what you come  up with, If need be I can send you the lil module I am using to develop this. Tomorrow morn I have to go fix some windshield wipers for a man. I will check in after that.

Blah is the name of the area I am testing in.
               
               

               


                     Modifié par Baragg, 19 octobre 2010 - 03:33 .
                     
                  


            

Legacy_Builder_Anthony

  • Hero Member
  • *****
  • Posts: 786
  • Karma: +0/-0
Bury gold and retreiving it
« Reply #49 on: October 19, 2010, 09:14:16 pm »


               Please send the mod to boulderopalhunter2008@gmail.com
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Bury gold and retreiving it
« Reply #50 on: October 19, 2010, 10:44:34 pm »


               Sent.