• 🏆 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!

Mana Shield Item [ON/OFF]

Status
Not open for further replies.

KPC

KPC

Level 7
Joined
Jun 15, 2018
Messages
178
I prepared 2 triggers. System is based on 2 items:
Mana Shield ON
Mana Shield OFF

When Mana Shield ON is used, it is replaced with Mana Shield OFF and Hero is ordered to use this item. Axiualy Mana Shield ON is doing nothing because it is removed from equipment after useage and it's effect will disapear. So I had to order Hero to use Mana Shield OFF, which axiualy turns it on.

There is another Trigger, which replaces Mana Shield OFF with Mana Shield ON (it causes effect of Mana Shield disapears) But you can easy see that they are mutually exclusive because Mana Shield OFF "has two uses". I had to add exception handling, I mean I turn second Trigger OFF before I order Hero to use Mana Shield OFF in first Trigger. After this usage second Trigger is turned on back.

Well, what is the problem? When Hero is using Mana Shield OFF normally (not in order event) it is not recogenized as Item Usage because it was used before in order event. So second trigger is not working because item usage is not detected.

Extra Info: Both items are based on Wand of the Wind if it matters. I tryed to add second effect to the item, I mean effect of healing potion (which could result in the use of the item would be detected) But it doesn't work.

Do you have any ideas to fix it? Thanks in advance.

First Trigger:
upload_2019-11-6_18-52-43.png


Second Trigger:
upload_2019-11-6_18-53-21.png
 

KPC

KPC

Level 7
Joined
Jun 15, 2018
Messages
178
Click on Item Mana Shield for the first time causes turn on Mana Shield. When you have Mana Shield on you and you click the item it will turn Mana Shield off. (I want to have fully working Mana Shield ability but on the item)
 
Level 19
Joined
Feb 27, 2019
Messages
563
Have you managed to make it work yet? I did something that well.. works at least. The cooldown is glitched but I can imagine it can be worked around by turning off the trigger and using the item again to reset the cooldown then turning it back on. However cooldown is not a must with Mana Shield. Mana cost can be enough. Theres probably a much better way to make that item work. Im just too tired now. Please let me know if you find a better way.

Chronos Clock (5s) is a dummy ability. This will allow the item to be used regardless of Mana Shield being activated or not. Adding this ability to the item will overrule the Mana Shields ability when the item is used. This ability should be present on the item by default.

tired.png
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
Here's a somewhat working system. It will conflict with an Item Indexer/anything else that changes the item's custom value. This could be easily fixed though.
  • Mana Shield Use
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mana Shield
    • Actions
      • Set TempUnit = (Hero manipulating item)
      • Set TempItem = (Item being manipulated)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of TempItem) Equal to 1
          • (Level of Mana Shield (Ability) for TempUnit) Equal to 1
          • (TempUnit has buff Mana Shield (Ability)) Equal to False
        • Then - Actions
          • Game - Display to (All players) for 30.00 seconds the text: On (Fix)
          • Unit - Order TempUnit to Neutral Naga Sea Witch - Activate Mana Shield
          • Item - Set the custom value of TempItem to 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of TempItem) Equal to 0
            • Then - Actions
              • Game - Display to (All players) for 30.00 seconds the text: On
              • Unit - Add Mana Shield (Ability) to TempUnit
              • Unit - Order TempUnit to Neutral Naga Sea Witch - Activate Mana Shield
              • Item - Set the custom value of TempItem to 1
            • Else - Actions
              • Game - Display to (All players) for 30.00 seconds the text: Off
              • Unit - Remove Mana Shield (Ability) from TempUnit
              • Item - Set the custom value of TempItem to 0
  • Mana Shield Drop
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mana Shield
    • Actions
      • Set TempUnit = (Hero manipulating item)
      • Set TempItem = (Item being manipulated)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of TempItem) Equal to 1
        • Then - Actions
          • Game - Display to (All players) for 30.00 seconds the text: Reset
          • Unit - Remove Mana Shield (Ability) from TempUnit
          • Item - Set the custom value of TempItem to 0
        • Else - Actions
Basically, I use the custom value of the item to determine whether it's on or off. Then I add/remove the Mana Shield ability (it's hidden) to the unit depending on the custom value. 1 = On, 0 = Off.

The only issue is that Mana Shield automatically turns off when the unit takes damage that would reduce it's mana to 0, and as far as I know there is no easy way to detect when this happens. The only solution I can think of is to use a Damage Detection System and check to see if the unit still has the buff after taking damage. If it doesn't, then we know that the unit ran out of mana and lost the buff. I can try to add that in if you want. If I did add a DDS then I could also incorporate icon changes/mana cost changes for when you toggle the item on and off to make it work exactly like Mana Shield.

Anyway, there might be a better solution to this than what I'm trying to do.
 
Last edited:
  • Like
Reactions: KPC

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
Here's a version using a Damage Detection System and Unit Indexer. It works flawlessly as far as I can tell.

Edit: Fixed some bugs ("works flawlessly" :p) (v.4)
Edit 2: Re-did the system again (v.5)
Edit 3: Almost got it right (v.6)
Edit 4: Added inventory slot memory (v.7)
 

Attachments

  • Mana Shield v.7.w3x
    54.1 KB · Views: 25
Last edited:

KPC

KPC

Level 7
Joined
Jun 15, 2018
Messages
178
I'm using first version. I just changed icon of the item in triggers so you see this like in second version. This problem with multiple Mana Shields applies to first version?
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
The biggest issue is that mana shield turns off when you take damage that reduces your mana below 0. The versions (I think only v.1) that don't use the Damage Detection System might have problems when this happens, although I did trigger in a fix to it, I just fear that there's some unforeseen bugs.

And yes, the problem with multiple Mana Shields applies to all of the maps before v.5. That problem is much more minor and you might not even care. Test it out for yourself, activate 3 Mana Shields at once and then deactivate one of them and you'll see that you lose the Mana Shield buff even though the other 2 items are still active. It doesn't allow you to cheat or anything, but it just looks/functions weird.
 
Last edited:

KPC

KPC

Level 7
Joined
Jun 15, 2018
Messages
178
Wow man thanks for you engagement. You are the best!
1. Is it possible to replace item with the new one in specific slot? I mean when I have mana shield on on the bottom it gonna give mana shield off to the top eq.
2. Is it possible to avoid stoping Hero (when he moves) when he is ordered to use Mana Shield? When he turn Mana Shield ON while moving it gona stop him.
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
I uploaded v.7. I added inventory slot memory so the items won't change inventory slots.

Regarding #2, the hero stops because I issue it an order:
  • Unit - Order TempUnit to Neutral Naga Sea Witch - Activate Mana Shield
I'd think that it wouldn't interrupt the unit's orders because it's an Instant ability but for some reason it does. Maybe Reforged will address this issue.

Edit: Note that the only way to move items is with an issued order:
  • Unit - Order TempUnit to move (Last created item) to inventory slot TempInvSlot
So now turning off the Mana Shield will order the hero to stop. :( You just can't win when it comes to wc3.
Again, hopefully Reforged fixes this issue.
 
Last edited:

KPC

KPC

Level 7
Joined
Jun 15, 2018
Messages
178
Have you managed to make it work yet? I did something that well.. works at least. The cooldown is glitched but I can imagine it can be worked around by turning off the trigger and using the item again to reset the cooldown then turning it back on. However cooldown is not a must with Mana Shield. Mana cost can be enough. Theres probably a much better way to make that item work. Im just too tired now. Please let me know if you find a better way.

Chronos Clock (5s) is a dummy ability. This will allow the item to be used regardless of Mana Shield being activated or not. Adding this ability to the item will overrule the Mana Shields ability when the item is used. This ability should be present on the item by default.

View attachment 336826

I'm missing something or it doesn't work. I just don't know what dummy ability should be (I created it based on stomp).
 

Attachments

  • Mana Shield.w3x
    18 KB · Views: 35
Last edited:
Status
Not open for further replies.
Top