Passive Mana Shield

sunshinex3

You can change this now in User CP.
Reaction score
7
I have seen a lot of posts on this but i don't know jass, sill, i got to thinking
Trigger:
  • Energy Shield passive
    • Events
    • Unit - A unit Is attacked
    • Conditions
    • ((Level of Energy Shield (real passive) for (Attacked unit)) Equal to 1) and ((Mana of (Attacked unit)) Greater than or equal to 25.00)
    • Actions
    • Unit - Set life of (Attacked unit) to (Life of (Attacked unit))


that's what i have, now i was thinking i could set a variable to life of attacked unit + damage taken. But i can't find that any where. help?

this is what i want i just don't know how to get there.
Trigger:
  • Actions
    • Set life of (Triggering Unit) to life of (Triggering Unit) + Damage Taken
    • Set mana of (Triggering Unit) to mana of (Triggering Unit) - Damage Taken

can any one point me in the right direction?
 

jonas

You can change this now in User CP.
Reaction score
67
You need a specific unit event, "Takes Damage". You can register it once your unit enters the map with some trigger action (Trigger - Add new event).
The damage taken is a real number and event based, so it's somewhere in that list.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
Ty i have made the variable, and now the trigger but this doesn't work why not?
Trigger:
  • Energy Shield passive
    • Events
    • Unit - A unit Is attacked
    • Conditions
    • ((Level of Energy Shield (real passive) for (Attacked unit)) Equal to 1) and ((Mana of (Attacked unit)) Greater than or equal to 25.00)
    • Actions
    • Set damageTaken = (Damage taken)
    • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + damageTaken)
    • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - damageTaken)
 
Last edited:

sunshinex3

You can change this now in User CP.
Reaction score
7
oh, found out i dont need a variable for this,doesnt matter this is what i tried and it still doesn't work any ideas?

Trigger:
  • Energy Shield passive
    • Events
    • Unit - A unit Is attacked
    • Conditions
    • ((Level of Energy Shield (real passive) for (Attacked unit)) Equal to 1) and ((Mana of (Attacked unit)) Greater than or equal to 25.00)
    • Actions
    • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (Damage taken))
    • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - (Damage taken))

Again this doesn't any thing as far as i can tell.
 

O.A

Quantum physics rules
Reaction score
29
As jonas mentioned above, you need to use the 'Takes Damage' event. 'Damage Taken' event response does not work with 'Is attacked' event. Then you have to set up the event with 'Trigger - Add new event', unless the unit is pre-placed in the map. You could also alternatively look into Damage detection systems for GUI, but that would most likely make things more complicated.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
Ty for the replies this almost works
Trigger:
  • Energy Shield passive
    • Events
    • Unit - A unit Is attacked
    • Conditions
    • ((Level of Energy Shield (real passive) for (Attacked unit)) Equal to 1) and ((Mana of (Attacked unit)) Greater than or equal to 25.00)
    • Actions
    • Trigger - Add to (This trigger) the event (Unit - (Attacked unit) Takes damage)
    • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (Damage taken))
    • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - (Damage taken))

The problem is that the damage seems to stack. at first mana is taken out normally as one would expect but after a few attacks it is taken out at an increasing rate. later on all the manna will be taken out with just one hit. It almost looks like damage taken is a variable that has it's value added to every time a unit is attacked.
 
Last edited:

O.A

Quantum physics rules
Reaction score
29
That's because every time the unit is attacked the event is being added again and again, so it will trigger multiple times. You have to add the 'Takes damage' event from somewhere else, like jonas suggested above when the unit enters the map, you make a variable of it (the unit) and use it to add the event. Then you remove the 'Is attacked' event from the actual trigger so that the event section will be empty (the added event will still be there even though it cannot be seen in the editor).
 

afisakov

You can change this now in User CP.
Reaction score
37
I suggest making a trigger:
Code:
event
unit learns an ability "Energy Shield"
condition
level of energy shield for unit=1
action
Trigger - Add to (Energy Shield passive) the event (Unit - (Trigger unit) Takes damage)

and remove the "unit is attacked" event from Energy Shield passive
 

sunshinex3

You can change this now in User CP.
Reaction score
7
hrm, In my map there maybe hundreds of units with this ability, will that cause crash?
 

sunshinex3

You can change this now in User CP.
Reaction score
7
Thank you guys so much this seems to work does it leak? I don't fully under stand how this works, sorry for my ignorance.
First trigger:
Trigger:
  • Energy Shield
    • Events
    • Unit - A unit enters (Entire map)
    • Conditions
    • ((Level of Energy Shield (real passive) for (Entering unit)) Equal to 1) and ((Mana of (Entering unit)) Greater than or equal to 25.00)
    • Actions
    • Trigger - Add to Energy Shield passive <gen> the event (Unit - (Triggering unit) Takes damage)

Second trigger:

Trigger:
  • Energy Shield passive
    • Events
    • Conditions
    • ((Level of Energy Shield (real passive) for (Triggering unit)) Equal to 1) and ((Mana of (Triggering unit)) Greater than or equal to 25.00)
    • Actions
    • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (Damage taken))
    • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - (Damage taken))


see any leaks? or is this air tight?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
The event itself leaks. You create 1 event for every unit with the ability, but you never remove those events after a unit died.
Unfortunately there is not much you can do. You have to simply take it since your possibilities of removing the event at run time are limited. At least with GUI that is.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Depends on too many factors to be answered.
For every unit you create one event. A single event cant take too much memory, lets be VERY generous and say its 50 bytes. Until you fill 1 GB of RAM with 50 bytes of leaked events it would take 21474836 units in your map. (Please note that these units must not exist at the same time, if you spawn and kill 10000 units every second this might happen eventually)
 

sunshinex3

You can change this now in User CP.
Reaction score
7
I can live with that most i have ever seen one person get is 5000. I will increase their price and stats so that one can make do with a few.

Final check.
I also wanted some kind of animation, so i added a dummy unit and it has the energy shield model i wanted, every thing looks fine to me so, i just wanted to make sure with the experts before rapping things up.
Trigger:
  • Energy Shield
    • Events
    • Unit - A unit enters (Entire map)
    • Conditions
    • ((Level of Energy Shield (real passive) for (Entering unit)) Equal to 1) and ((Mana of (Entering unit)) Greater than or equal to 25.00)
    • Actions
    • Trigger - Add to Energy Shield passive <gen> the event (Unit - (Triggering unit) Takes damage)



Trigger:
  • Energy Shield passive
    • Events
    • Conditions
    • ((Level of Energy Shield (real passive) for (Triggering unit)) Equal to 1) and ((Mana of (Triggering unit)) Greater than or equal to 25.00)
    • Actions
    • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (Damage taken))
    • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - (Damage taken))
    • Unit - Create 1 dummy (shield guardian) for (Owner of (Attacked unit)) at (Position of (Attacked unit)) facing Default building facing degrees
    • Wait 0.05 seconds
    • Unit - Remove (Last created unit) from the game

This is the final product (unless some one findes something)
Ty guys, +rep
 

O.A

Quantum physics rules
Reaction score
29
(Position of (Attacked Unit)) leaks a point when you create the dummy unit. Use a point variable and store the location in it, and create the dummy using the variable.
Then remove the variable with the custom script "call RemoveLocation (udg_YourVariable)".
Also, don't use the wait function there as it is possible for global variables (last created unit in this case) to be overwritten. Better to just add an expiration timer to the last created unit.

http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=27219
 
Last edited:

sunshinex3

You can change this now in User CP.
Reaction score
7
Trigger:
  • Energy Shield passive
    • Events
    • Conditions
    • ((Level of Energy Shield (real passive) for (Triggering unit)) Equal to 1) and ((Mana of (Triggering unit)) Greater than or equal to 25.00)
    • Actions
    • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (Damage taken))
    • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - (Damage taken))
    • Special Effect - Create a special effect attached to the origin of (Attacked unit) using war3mapImported\EnergyShield_Full_squished.mdx
    • Special Effect - Destroy (Last created special effect)


what about this this kinda works too but the animation sticks around to long. does this have any leaks? Is their a way to cut the time it takes for it to disappear in half?
 

O.A

Quantum physics rules
Reaction score
29
Using the Special Effect action causes the effect to play out even if destroyed without delay (depending on effect). Using the dummy unit and expiration timer like I suggested above should let you control the length of the effect by using shorter expiration timers. This might give you a better result, give it a shot.

There are no leaks, except the event itself.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
I'm terrible at all this(reason why i don't no how timers work) will this effectively take out half the mana from attacks.
Trigger:
  • Energy Shield 2
    • Events
    • Unit - A unit enters (Entire map)
    • Conditions
    • ((Level of Energy Shield (real passive) for (Entering unit)) Equal to 2) and ((Mana of (Entering unit)) Greater than or equal to 25.00)
    • Actions
    • Trigger - Add to Energy Shield passive 2 <gen> the event (Unit - (Triggering unit) Takes damage)


Trigger:
  • Energy Shield passive 2
    • Events
    • Conditions
    • ((Level of Energy Shield (real passive) for (Triggering unit)) Equal to 2) and ((Mana of (Triggering unit)) Greater than or equal to 25.00)
    • Actions
    • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + (Damage taken))
    • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - ((Damage taken) / 2.00))
    • Special Effect - Create a special effect attached to the origin of (Attacked unit) using war3mapImported\EnergyShield_Full_squished.mdx
    • Special Effect - Destroy (Last created special effect)
 

vypur85

Hibernate
Reaction score
803
> half the mana from attacks
Yes.

> ((Level of Energy Shield (real passive) for (Entering unit)) Equal to 2) and ((Mana of (Entering unit)) Greater than or equal to 25.00)
In your first trigger, change this to:
(Level of Energy Shield (real passive) for (Triggering unit)) Greater than 0)

Remove the other condition.
Unless, of course, you have something else in your mind that I'm aware of.

> Using the dummy unit and expiration timer like I suggested above should let you control the length...
Not such a good idea imo. It may lag the game, especially in this case. Every damage received will create a unit.
As it is, creating and destroying effect work as it should, as long as the animation is played correctly.
 

Devalut

TH.net Regular
Reaction score
7
Boom made with a Damage Engine

Added a detail to the spell (you can remove it by getting rid of the condition and the dummy casting the debuff) That fizzles the unit making temporarily disabled.

EDIT
Didn't know this thread was 3 god damn years old...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top