• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Protoss-like shields

Status
Not open for further replies.
Level 15
Joined
Dec 12, 2006
Messages
1,664
I was wondering if their was a way to make it so that you have something that works similar to the Protoss' energy shields in Starcraft. Let's say a unit has this shield. If he is attacked, and he has mana, he will lose mana. If he runs out of mana, his health would be damaged. Could anyone tell me how to do this in GUI?
 
Level 15
Joined
Dec 12, 2006
Messages
1,664
Because, it isn't passive. I want it to be a sort of passive mana shield, where it is active all the time, and is not de-activatable.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Oh my bad, saying wrong. I meant that you could Auto-Activate it by a trigger

Anyway never mind that, I was thinking of your solution, and this is working nicely :)
(the variables used are all "real"s)
  • Passive Mana Shield
    • Events
      • Unit - Your_unit Takes damage
    • Conditions
      • (Level of Mana Shield (passive) for (Triggering unit)) Equal to 1
      • (Mana of (Triggering unit)) Greater than 0.00
    • Actions
      • Set DamageTaken = (Damage taken)
      • Set ManaLeft = (Mana of (Triggering unit))
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + DamageTaken)
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - DamageTaken)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageTaken Greater than ManaLeft
        • Then - Actions
          • Set LifeTaken = (DamageTaken - ManaLeft)
          • Unit - Cause (Damage source) to damage (Triggering unit), dealing LifeTaken damage of attack type Chaos and damage type Normal
        • Else - Actions
Well as you maybe already know, this event only exists on a unit placed on the map. To make it work, make a trigger which is registring this unit to the trigger by using one of the following actions:
  • Trigger - Add to Passive Mana Shield <gen> the event (Unit - (Last created unit) Takes damage)
or
  • Trigger - Add to Passive Mana Shield <gen> the event (Unit - (Trained unit) Takes damage)
It all depends of which method your using to "place" the unit on the map.
(so there could be more fuctions than those 2)

/Regards
 
Level 15
Joined
Dec 12, 2006
Messages
1,664
I want it to be the exact version of mana shield but passive. If you need an example, here is what I want to do. I am planning a Halo map you see, and as you may know (if you played Halo) Spartans, like Master Chief, have energy shields. When they are hit with a bullet or melee attacked, the energy shield takes damage (unless it's depleted, in my map's case it will be mana). If there is no more energy, the Spartan's health is damaged. (I know how to do this part, but I'll tell you anyway) After awhile (a few seconds), the Spartan's energy shields (mana) is regenerated instantaniously.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Aha I see:

Then we need a dummy ability with no icon, doing absolutely nothing.

For this we can use (as example, there are many to chose from) the ability
Item Armor Bonus(+1)
Locate it in ability editor under Special and then Items

-> change the value giving armor bonus to 0
-> add it to your hero
-> (it doesnt really matter, but change the name of it if you want)

set the condition of the mana shield trigger to
  • (Level of Item Armor Bonus (+1) for (Triggering unit)) Equal to 1
And we're done
 
Status
Not open for further replies.
Top