Problem with spell casting trigger.

Status
Not open for further replies.
Level 1
Joined
Jan 17, 2010
Messages
3
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:
Level 12
Joined
Aug 22, 2008
Messages
911
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.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
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.
Top