Author Topic: Destroy Casted item  (Read 324 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Destroy Casted item
« on: July 09, 2012, 11:24:01 pm »


               I have an item that a player can cast. When they do, it sets a variable to 1. If said variable is already 1, it does nothing.
What I would like to do is have the item destroy itself if var != 1. i.e. when it sets var to 1.

I've tried using DestroyObject(OBJECT_SELF, 0.0); , and that was the only option I thought I had. 

So I guess my question is, what function can I use to destroy the item a player just casted without the risk of destroying another item in the players inventory with the same resref/tag?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Destroy Casted item
« Reply #1 on: July 09, 2012, 11:29:44 pm »


               in spellscript, casted item is GetSpellCastItem();OBJECT_SELF is player using this item
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Destroy Casted item
« Reply #2 on: July 10, 2012, 10:24:24 pm »


               For the item property, set the item to "single use", rather than unlimited uses, uses per day, or charges per use.  

Such an item will function once and be destroyed in the process.  It affects only that single item, and even works for items in a stack (such as potions, scrolls, etc.), removing a single one each time.  No special scripting required.