casting an ability with an item

Whisp_Rush

Active Member
Reaction score
0
Hi! I´m new here... I´d like to do a thing, but I don´t know how should I do it: A unit should cast a spell only, if it has an item, htan the Item should disappear...
Please help me if u can :)
 

draist

Active Member
Reaction score
1
Hi and welcome to TheHelper.net

I assume that you want the unit to cast a spell (Example: Holy Light) but only if the unit has an item (Example: Holy Candles) and then after the unit casts Holy Light, the Holy Candles should be removed, yes?

Trigger:
  • Holy Light
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Ability being cast) Equal to Holy Light) and (((Casting unit) has an item of type Holy Candles) Equal to True)
        • Then - Actions
          • Item - Remove (Item carried by (Casting unit) of type Holy Candles)
          • Unit - Order (Casting unit) to Human Paladin - Holy Light (Target unit of ability being cast)
        • Else - Actions


I think that should work.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you can either give the item the ability and make it a charged ability... like healing potions, the ability on those is a self heal, or you can make a trigger, event: a unit casts an ability; condition: ability being cast equal to (your spell); action: remove (your item) from (casting unit inventory) and remove ability from the unit and just give the unit the ability when it gets the item... or if you want it to be reduced the ammount of times left on a cast, reduce the charges by one...
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
draist urs would work but id make it finishes casting not begins, cuz it could remove the item before the ability is finished casting and if the ability is attached to the item it would stop him from casting the ability... we posted our solutions at the same time lol
 

tommerbob

Minecraft. :D
Reaction score
110
draist urs would work but id make it finishes casting not begins, cuz it could remove the item before the ability is finished casting and if the ability is attached to the item it would stop him from casting the ability... we posted our solutions at the same time lol

He does not use "begins casting", he uses "starts the effect", they are very different events. "Starts the effect" event fires after the effect of the ability and mana cost are done.
 

Whisp_Rush

Active Member
Reaction score
0
Thanks draist, it works well :) an other thing I´d like to do, is make a custom error message, so if I want the use the ability, but I don´t have that item, I´d like to make appear an error message, (like if you want to build a building, but you doesn't have enough gold) which says: you don´t have the item to cast the spell... orsomething like that
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
read it wrong woops...

uhmmm theres an action u can put in the same trigger: game - text message

if u want them to not cast the spell thats different... ull need to make another trigger that detects when the unit is issued an order and if that order is the one for your spell then stop the unit...
 

tommerbob

Minecraft. :D
Reaction score
110
There are ways of "faking" an error message. Search around, there are several tutorials around.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top