Author Topic: Create item in chest. ** SOLVED **  (Read 323 times)

Legacy_Supreme_Pizza

  • Jr. Member
  • **
  • Posts: 90
  • Karma: +0/-0
Create item in chest. ** SOLVED **
« on: January 21, 2013, 08:58:47 am »


               I am having issues with creat item.

I want to use the tag as the location. I think you can do that but I can't remember how.
               
               

               


                     Modifié par Supreme_Pizza, 29 janvier 2013 - 07:45 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Create item in chest. ** SOLVED **
« Reply #1 on: January 21, 2013, 11:05:33 am »


               It sounds like you'll be wanting to use these two functions:

// Get the nNth object with the specified tag.
// - sTag
// - nNth: the nth object with this tag may be requested
// * Returns OBJECT_INVALID if the object cannot be found.
// Note: The module cannot be retrieved by GetObjectByTag(), use GetModule() instead.
object GetObjectByTag(string sTag, int nNth=0) 

// Create an item with the template sItemTemplate in oTarget's inventory.
// - nStackSize: This is the stack size of the item to be created
// - sNewTag: If this string is not empty, it will replace the default tag from the template
// * Return value: The object that has been created.  On error, this returns
//   OBJECT_INVALID.
// If the item created was merged into an existing stack of similar items,
// the function will return the merged stack object. If the merged stack
// overflowed, the function will return the overflowed stack that was created.
object CreateItemOnObject(string sItemTemplate, object oTarget=OBJECT_SELF, int nStackSize=1, string sNewTag="")


  Something like:

void main()
{
object oChest = GetObjectByTag ("CHEST_TAG_HERE");
CreateItemOnObject ("item_resref_here", oChest);
}
               
               

               
            

Legacy_Supreme_Pizza

  • Jr. Member
  • **
  • Posts: 90
  • Karma: +0/-0
Create item in chest. ** SOLVED **
« Reply #2 on: January 23, 2013, 12:00:57 am »


               Thanks! '<img'>