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

[ITEM ABILITY] Mana Shield

Status
Not open for further replies.
Level 9
Joined
Feb 14, 2009
Messages
316
My map uses 3 items that grant the ability Mana Shield (33/67/100% block respectively).

Question: How do I implement that?

What I have tried so far:

1. Simply make a Mana Shield item ability and give it to the item. But then once you switch it on, you can't turn it off unless you drop the item.

2. Make a trigger that gives the unit an active ability Mana Shield when it acquires the item and removes it when it loses it.
There were several problems with that.
1) Takes up an ability slot. That makes things really bad because I need all ability slots I can afford.
2) Glitchy. If it acquires two items of the same type, then drops one of them, the ability will disappear. If it acquires a higher tier item, then drops the older one, the ability will disappear. I tried to implement a system that allowed only one Mana Shield item to be carried at a time (more inconvenience since the map relies heavily on team play and hero presence, thus carrying and ferrying items is encouraged), but then it was even more glitchy, leading to various exploits with dropping/acquiring items.


I would appreciate a version of this, perhaps with item replacement or IDK, where the unit can use the Mana Shield ability by clicking the item and deactivate it by clicking the item again.
If not possible, then at least a working script with an active ability.

Thanks.
 
Level 5
Joined
Nov 30, 2010
Messages
184
Make two items. Name one Mana Shield Generator [ON] and one Mana Shield Generator [OFF]. give them an item ability that when used removes that item and gives the other one (using turn off skill will replace ON item with the OFF one).

Make a trigger that adds the unit into a unit group when it has the item is ON.
Make a trigger that removes the unit from the unit group when the item is OFF.
Make a trigger that removes mana and adds health to a unit in the unit group when it is damaged (number of mana removed and health added can be anything you like)
 

sPy

sPy

Level 21
Joined
Apr 10, 2009
Messages
268
This?:D
attachment.php
 

Attachments

  • YouMissedit.jpg
    YouMissedit.jpg
    64.4 KB · Views: 382
Level 9
Joined
Feb 14, 2009
Messages
316
Duh. I'm dumb, apparently :D

Anyway, improved the code, now the item has a dummy active ability that when activated:

Checks if the unit is in group "HasShieldON", and:

If no - add it to the group, add a Sphere ability for the animation of mana shield
If yes - remove it from the group, remove the Sphere ability.



Now, next problem is how to make the triggered heals work :S
Because the "Takes Damage" event doesn't work on any unit, it's a specific unit event only -.-
If possible with an easy way to bypass the potential extremely glitchy and leaky use of arrays global variables.
 
Status
Not open for further replies.
Top