• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[General] Cancel item being used

Status
Not open for further replies.
Level 1
Joined
Oct 16, 2019
Messages
4
In my map, heroes use wands to cast spells. A wand is an item with an assigned integer number from 1 to 100, that number indicates the percentage probability of a wand spell being cast successfully. If the cast roll is high enough, the spell casts as usual; if the cast fails, the spell must be cancelled.

My problem is that I can't order my hero to cancel the cast, because I'm using the "item is being used" event.

I tried:
1) to remove and add again the item being used
2) to drop the item being used
3) to order hero to stop

None of these worked. Please help me, I would be very grateful.
 
Level 28
Joined
Feb 18, 2014
Messages
3,581
Don't use the event "A unit Uses an item", use the event "A unit Starts the effect of an ability" instead and then order the triggering unit to stop if the roll fails.
  • Item Interrupt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Teleport Item
    • Actions
      • Set RollChance = (Random integer number between 1 and 100)
      • Game - Display to (All players) the text: (String(RollChance))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RollChance Lesser than or Equal to 50
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
          • Do nothing
 
Last edited:
Status
Not open for further replies.
Top