consume an item from the inventory or an item placed on the ground?
and what do you mean mean by consume? Destroys it, or destroys and gains some powers?
Generally... like this. If I understand you correctly though.
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Animate Dead
- (Charges remaining in (Item carried by (Triggering unit) of type Tome of Experience)) Greater than 0
- Actions
- Item - Set charges remaining in (Item carried by (Triggering unit) of type Tome of Experience) to ((Charges remaining in (Item carried by (Triggering unit) of type Tome of Experience)) - 1)
Generally... like this. If I understand you correctly though.
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Animate Dead
- (Charges remaining in (Item carried by (Triggering unit) of type Tome of Experience)) Greater than 0
- Actions
- Item - Set charges remaining in (Item carried by (Triggering unit) of type Tome of Experience) to ((Charges remaining in (Item carried by (Triggering unit) of type Tome of Experience)) - 1)
If you reduce the charges remaining from 1 to 0, the item would be made infinite and just hang in the inventory with no charges. The hero probably needs to be unable to cast the spell without the item as well, so here is an example of 2 triggers that do the job cleanly - using Healing Salves:
First trigger checks if you have the item, and stops you before you cast if you don't, displaying a message to the player. Don't worry, the spell doesn't have to have cast time or be a channel spell. 'Begins channeling' (in most cases) refers to as soon as the unit meets the conditions to cast the spell it was ordered to.
- Ability Cancel No Item
- Events
- Unit - A unit Begins channeling an ability
- Conditions
- (Ability being cast) Equal to Animate Dead
- (Charges remaining in (Item carried by (Triggering unit) of type Healing Salve)) Less than 1
- Actions
- Unit - Order (Triggering unit) to Stop
- Game - Display to (Player group((Owner of (Triggering unit)))) the text: You do not have a Healing Salve, toolface!
Second trigger takes away a charge after the ability is started. If the item has 1 charge, it will be removed. If it has more, it will be reduced by 1.
- Ability Cast Item Consume
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Animate Dead
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Charges remaining in (Item carried by (Triggering unit) of type Healing Salve)) Equal to 1
- Then - Actions
- Item - Remove (Item carried by (Triggering unit) of type Healing Salve)
- Else - Actions
- Item - Set charges remaining in (Item carried by (Triggering unit) of type Healing Salve) to ((Charges remaining in (Item carried by (Triggering unit) of type Healing Salve)) - 1)
Hope I've helped!