• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to make a spell consume an item?

Status
Not open for further replies.
Level 2
Joined
Jan 27, 2014
Messages
12
Hi, im new to moding wc3 and need some help. How can i make a spell consume an item each time i use the spell? Need to be able to cast a magic spell that consume like a "scroll" or "magic rune".
Sorry for my bad english!

/Cajvall
 
Level 5
Joined
Jan 27, 2014
Messages
164
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)
 
Level 2
Joined
Jan 27, 2014
Messages
12
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)

In this trigger, does the spell require the item to be cast in the first place?
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
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:

  • 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!
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 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)
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.


Hope I've helped!
 
Last edited:
Level 2
Joined
Jan 27, 2014
Messages
12
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:

  • 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!
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 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)
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.


Hope I've helped!

Thanks man!
 
Status
Not open for further replies.
Top