Aller au contenu

Photo

Create item in chest. ** SOLVED **


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Supreme_Pizza

Supreme_Pizza
  • Members
  • 45 messages
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 .


#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
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);
}

#3
Supreme_Pizza

Supreme_Pizza
  • Members
  • 45 messages
Thanks! :)