getting the level of a buff

Nivius

TH.net Regular
is there a way of doing this?

im making a diffrent kind of aura and i need to be abel to get the level of the the buff any unit whit the aura have
 

Tyrulan

Ultra Cool Member
You can get the buff level by referencing the unit with the buff and GetLevelOfAbility(ability) or Jass has a command like so to do it. I'll tell you in a moment..
 

jig7c

Stop reading me...-statement
sure
triggers

event
map init
condition
action
if
pick all units in playable map area and do this
loop - set the custom value of all units to 0

every .01 sec of game time
event
a unit has a buff
condition
buff equal to (your skill)
action
if level of your skill equal to 1 then show msg
 

Nivius

TH.net Regular
well this shuld work for all units and not only for the unit whit the skill, its an aura... and what i sen till now is ust ways of getting ability level
 

Nivius

TH.net Regular
still need help whit this...

i got an idea that if u can get the event taht a unit takes dmg (i only seem to find is attacked) it shuld make unit gain x%mana of dmg dealt, depending on the level of the ability of the allied unit whitch have this ability. shuld work...

but how do i get the even to actualy work takes damage or deal damage (and not "is attacked")
 

SwedishChef

New Member
since you helped me i will help you :D, here try this

Trigger:
  • Trigger 1
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Trigger - Add to Trigger 2 <gen> the event (Unit - (Attacked unit) Takes damage)
      • -------- It is a specific unit event --------


Trigger:
  • Trigger 2
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: bla bla bla
      • -------- add your actions here --------
 

Nivius

TH.net Regular
nice :D im on my wait making this... 1 thing left tho...

how do i get "damage taken by attacked unit"

the thing is that i need to know the exact value damage is done to that unit after all kind of reductions
 

Exide

I am amazingly focused right now!
nice :D im on my wait making this... 1 thing left tho...

how do i get "damage taken by attacked unit"

the thing is that i need to know the exact value damage is done to that unit after all kind of reductions
For 'Damage Taken' you need the event 'Unit Takes Damage'.
Unfortunately it can't be a Generic Unit Event, it must be a Specific Unit Event.
-Which means that you have to add the event from another trigger.
 

Nivius

TH.net Regular
For 'Damage Taken' you need the event 'Unit Takes Damage'.
Unfortunately it can't be a Generic Unit Event, it must be a Specific Unit Event.
-Which means that you have to add the event from another trigger.
GAAHH :mad:

this thing is killing me :I can anyone give me a hand? il post the full triggers iv done till now

the idea is that im making an aura similar to vampyric, but instead for life it gives +1-9%(9 levels of the aura) mana

(thers gona be 2 diffrent triggers for each team, as each team can only have 1x of this mage assasin unit and aura level can be diffrent for white/black team)
Trigger:
  • Activate spir aura
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Trigger - Add to White Spiritual Aura <gen> the event (Unit - (Attacked unit) Takes damage)


Trigger:
  • White Spiritual Aura
    • Events
    • Conditions
      • ((Attacking unit) is A Hero) Equal to True
      • ((Attacking unit) has buff Spiritual Aura ) Equal to True
    • Actions
      • Player Group - Pick every player in (All allies of (Owner of (Attacking unit))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Attacking unit)) Equal to Mage Assasin
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Owner of (Triggering unit)) controller) Equal to (Player 1 (Red) controller)
                  • ((Owner of (Triggering unit)) controller) Equal to (Player 2 (Blue) controller)
                  • ((Owner of (Triggering unit)) controller) Equal to (Player 3 (Teal) controller)
                  • ((Owner of (Triggering unit)) controller) Equal to (Player 4 (Purple) controller)
                  • ((Owner of (Triggering unit)) controller) Equal to (Player 5 (Yellow) controller)
            • Then - Actions
              • Set WSpiritualAuralvl = (Level of Spiritual Aura for (Attacking unit))
              • -------- code for player owning that unit-type here --------
            • Else - Actions
              • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Picked unit)) Equal to Mage Assasin) and (((Owner of (Picked unit)) is an ally of Player 1 (Red)) Equal to True))) and do (Actions)
                • Loop - Actions
                  • -------- this should be the damage the attacked unit takes --------
                  • Set DamageDealt = (Damage taken)
                  • -------- code for players under the effect of the aura here --------
                  • Unit - Set mana of (Attacking unit) to ((Percentage mana of (Attacking unit)) + ((DamageDealt / 100.00) x (Real((Level of Spiritual Aura for (Picked unit))))))%
                  • Set WSpiritualAuralvl = (Level of Spiritual Aura for (Picked unit))

(seen now that i can make he code for finding the mage assain allot better... but thats not the focus right now :) )
 

Bird

Ultra Cool Member
To answer your Buff question. I believe the only solution (assuming your unit is just *effected* by the buff, but doesn't actually *have* the skill) would be to assign a different buff for each level of the skill.
 

Exide

I am amazingly focused right now!
When answering to event 'Unit takes Damage' you should look for 'Damage Source', not 'Attacking Unit'.

Code:
Activate spir aura 
Events 
Unit - A unit Is attacked 
Conditions 
Actions 
Trigger - Add to White Spiritual Aura <gen> the event (Unit - (Attacked unit) Takes damage)
change this into:

Code:
Activate spir aura 
Events 
Unit - A unit enters (Playable Map Area)    //You will need to use a unit group to pick all units that are in the map (Pre-placed units), and add them to the trigger as well.
Conditions 
Actions 
Trigger - Add to White Spiritual Aura <gen> the event (Unit - (Triggering unit) Takes damage)

Code:
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Picked unit)) Equal to Mage Assasin) and (((Owner of (Picked unit)) is an ally of Player 1 (Red)) Equal to True))) and do (Actions)
-leaks, should be:

Code:
set [B]tempgroup[/B] = every unit in (Units in (Playable map area) matching (((Unit-type of ([B]Matching unit[/B])) Equal to Mage Assasin) and (((Owner of ([B]Matching unit[/B])) is an ally of Player 1 (Red)) Equal to True)))
Unit Group - Pick every unit in [B]tempgroup[/B] and do (Actions)
//Actions here.. Actions here.. Actions here..
Custom script  call DestroyGroup(udg_[B]tempgroup[/B])
Always use Matching unit, when picking units with a unit group.

Code:
(((Owner of ([B]Matching unit[/B])) is an ally of Player 1 (Red)) Equal to True)))
-Could probably be:

Code:
(((Owner of ([B]Matching unit[/B])) is an ally of (Owner of (*Some Unit*)) Equal to True)))

More information about memory leaks can be found here:
http://www.thehelper.net/forums/showthread.php?t=27219
 

XeNiM666

I lurk for pizza
For the buff question: I really think that this works: (not tested though)
Trigger:
  • Custom Scipt: call GetUnitAbilityLevel( GetTriggerUnit(), buffcode )

the unit is your unit and the buffcode is the rawcode of your buff (Ctrl + D will let you see it).

As for your trigger, remove all (Attacking unit) and replace them all with (Damage Suorce) and as Exide stated, it leaks.
 

SwedishChef

New Member
hmm, do you need to know the damage taken by the attacked unit?? Is that the problem?? I think that many don't know what you are looking for anymore since the thread has changed some. So whats the problem now?? :D
 

Nivius

TH.net Regular
hmm, do you need to know the damage taken by the attacked unit?? Is that the problem?? I think that many don't know what you are looking for anymore since the thread has changed some. So whats the problem now?? :D
exactly that, i made a new thread because of that but ofc if its answer here its ok also :p

i need to get a % of the damage done to a unit and convert it to heal the attackers mana :)

simple enugh, vamp aura but mana insted
 
You'll need 3 triggers for this:

1) Your trigger. Whatever you want to do with the damage your units that take damage(remember to use "Damage Source", and "Damage Taken").

1) At map init, pick every unit and add them to a group(let's call it TakeDamage_Group), and add an event to the spell no°1: Picked unit takes damage.

2) Whenever a unit enters playable map area, check if they already are in the TakeDamage_Group, else add them to the group and create an event for them(Use Entering Unit this time).

I hope you can understand this.
 

Nivius

TH.net Regular
Trigger:
  • Activate spir aura
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Spiritual Aura &lt;gen&gt; the event (Unit - (Triggering unit) Takes damage)


Trigger:
  • Spiritual Aura
    • Events
    • Conditions
      • ((Damage source) is A Hero) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • ((Damage source) has buff Spiritual Aura (lvl1)) Equal to True
          • ((Damage source) has buff Spiritual Aura (lvl2)) Equal to True
          • ((Damage source) has buff Spiritual Aura (lvl3)) Equal to True
          • ((Damage source) has buff Spiritual Aura (lvl4)) Equal to True
          • ((Damage source) has buff Spiritual Aura (lvl5)) Equal to True
          • ((Damage source) has buff Spiritual Aura (lvl6)) Equal to True
          • ((Damage source) has buff Spiritual Aura (lvl7)) Equal to True
          • ((Damage source) has buff Spiritual Aura (lvl8)) Equal to True
          • ((Damage source) has buff Spiritual Aura (lvl9)) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Damage source) has buff Spiritual Aura (lvl1)) Equal to True
        • Then - Actions
          • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 1.00))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Damage source) has buff Spiritual Aura (lvl2)) Equal to True
            • Then - Actions
              • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 2.00))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Damage source) has buff Spiritual Aura (lvl3)) Equal to True
                • Then - Actions
                  • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 3.00))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Damage source) has buff Spiritual Aura (lvl4)) Equal to True
                    • Then - Actions
                      • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 4.00))
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Damage source) has buff Spiritual Aura (lvl5)) Equal to True
                        • Then - Actions
                          • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 5.00))
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Damage source) has buff Spiritual Aura (lvl6)) Equal to True
                            • Then - Actions
                              • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 6.00))
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Damage source) has buff Spiritual Aura (lvl7)) Equal to True
                                • Then - Actions
                                  • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 7.00))
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • ((Damage source) has buff Spiritual Aura (lvl8)) Equal to True
                                    • Then - Actions
                                      • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 8.00))
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • ((Damage source) has buff Spiritual Aura (lvl9)) Equal to True
                                        • Then - Actions
                                          • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x 9.00))
                                        • Else - Actions
                                          • Do nothing


Worked, no int's used :)

but i'm still puzzled about 1 thing... it don't seem to work for ranged units :/ they do get the buff an all :confused:

can it be that it takes "wrong" damage taken? and takes the dmg the hero have taken and uses that? hm :confused:
 

DiFm

New Member
whats your base ability? Vampiric aura? you know that its preset to only effect melee units...

Or it could be that the buff effects the unit after its taken damage by the range units... but thats just an assumption.
 

Nivius

TH.net Regular
whats your base ability? Vampiric aura? you know that its preset to only effect melee units...

Or it could be that the buff effects the unit after its taken damage by the range units... but thats just an assumption.
i noticed that whit vamp aura, so i remade it from brilliance aura whit 0 all. and what do you mean? could you give me an example?
 

Dirac

22710180
There is a big proble with your trigger, every time a event is added it stacks if is the same unit, to prevent that add the condition: Unit is in DamagedUnitsGroup equal to false. And the action: Add unit to DamagedUnitsGroup
 

Exide

I am amazingly focused right now!
Change your Spiritual Aura trigger into this:

Code:
Spiritual Aura 
Events 
Conditions 
((Damage source) is A Hero) Equal to True 
Or - Any (Conditions) are true 
Conditions 
((Damage source) has buff Spiritual Aura (lvl1)) Equal to True 
((Damage source) has buff Spiritual Aura (lvl2)) Equal to True 
((Damage source) has buff Spiritual Aura (lvl3)) Equal to True 
((Damage source) has buff Spiritual Aura (lvl4)) Equal to True 
((Damage source) has buff Spiritual Aura (lvl5)) Equal to True 
((Damage source) has buff Spiritual Aura (lvl6)) Equal to True 
((Damage source) has buff Spiritual Aura (lvl7)) Equal to True 
((Damage source) has buff Spiritual Aura (lvl8)) Equal to True 
((Damage source) has buff Spiritual Aura (lvl9)) Equal to True 
Actions 
Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x [B](Level of *ability* for (Damage source))[/B]))

There is a big proble with your trigger, every time a event is added it stacks if is the same unit, to prevent that add the condition: Unit is in DamagedUnitsGroup equal to false. And the action: Add unit to DamagedUnitsGroup
That doesn't matter.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

    Staff online

    • Ghan
      Administrator - Servers are fun

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top