• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Problem with spell casting trigger.

Status
Not open for further replies.

Push

P

Push

casting an ability with item charges instead of mana.

how can i make a unit only be able to cast a spell when they have the right item in there inventory, and then reduce the charges of that item?
 
Last edited by a moderator:
You'll have to create a shitload of items, all the same but for the number of charges in them, and you'll have to change items in decreasing order of charges. In short, a charges system. Also, each time you have to refer to that item you'll need a function of "item1 or item2", with all the different items.
There's bound to be one in the Hive... Look in the spells section.
Sounds like tough work? Well, it is.
 
Here's how to make it for Holy Light:

  • Untitled Trigger 094
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Holy Light
    • 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 Scroll of Restoration)) Greater than 1
        • Then - Actions
          • Item - Set charges remaining in (Item carried by (Triggering unit) of type Scroll of Restoration) to ((Charges remaining in (Item carried by (Triggering unit) of type Scroll of Restoration)) - 1)
        • Else - 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 Scroll of Restoration)) Equal to 1
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) of type Scroll of Restoration)
            • Else - Actions
              • Unit - Order (Triggering unit) to Stop
              • Wait 0.00 seconds
              • Animation - Play (Triggering unit)'s stand animation
 
Status
Not open for further replies.
Back
Top