getting the level of a buff

Nivius

TH.net Regular
Reaction score
5
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]))

That doesn't matter.
that dont work. the ability is only gona exist on 1 unit and the ability is an aura. so i cannot use "(Level of *ability* for (Damage source))" as this indicates that the unit that does the damage have the ability. witch he prob do not have. if it was possible to make that line u made to instead somehow get the level of the skill to change the amount of mana stolen

I'm kinda starting to think if i cannot make the ability when leveled to put the level of the ability into an int and then i extract that value every time someone attack?

I'm still interested in a more effective code that works, also i kinda need to get it working for ranged units :)
 

Exide

I am amazingly focused right now!
Reaction score
448
As XeNiM666 already stated, you can:
GetUnitAbilityLevel( GetTriggerUnit(), buffcode )
To make it easy on you:

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 
Custom script   set udg_IntegerVariable = GetUnitAbilityLevel( GetEventDamageSource(), [B]buffcode[/B] )
Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x IntegerVariable)

Where buffcode = the rawcode of your buff. For example 'B001'
 

Nivius

TH.net Regular
Reaction score
5
im ust prob being an idiot now but i dont know anything avour custom scripts, anyway, this code i made gave me an error, it expected somthing and that disabled my trigger

Error:
Code:
trigger                 gg_trg_Spiritual_aura2     = null
endglobals

function InitGlobals takes nothing returns nothing
    local integer i = 0
    set udg_Temp_Group = CreateGroup()
    set i = 0
    loop
        exitwhen (i > 36)
        set udg_White_Pick_Taken[i] = 0
        set i = i + 1
    endloop

    set udg_Group = CreateGroup()
    set i = 0
    loop
        exitwhen (i > 1)
        set udg_Reincarnationlvl[i] = 0
        set i = i + 1
    endloop

    set udg_Repicktime = CreateTimer()
    set udg_Stopper = 0
    set udg_TEMPREAL = 0
    set udg_SlamVari = 0
    set udg_WSpiritualAuralvl = 0
    set i = 0
    loop
        exitwhen (i > 36)
        set udg_Black_Pick_Taken[i] = 0
        set i = i + 1
    endloop

    set udg_Loop = 0
    set udg_tmpInteger = 0
    set i = 0
    loop
        exitwhen (i > 2)
        set udg_playerrepick[i] = 0
        set i = i + 1
    endloop

    set udg_RepickLoop = 0
    set udg_DamageDealt = 0
    set udg_tempgroup = CreateGroup()
    set udg_IntegerVariable = 0
endfunction

function Trig_Spiritual_aura2_Conditions takes nothing returns boolean
    if ( not ( IsUnitType(GetEventDamageSource(), UNIT_TYPE_HERO) == true ) ) then
        return false
    endif
    if ( not ( UnitHasBuffBJ(GetEventDamageSource(), 'B00M') == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spiritual_aura2_Actions takes nothing returns nothing
    set udg_IntegerVariable = GetUnitAbilityLevel( GetEventDamageSource(), B00M )
    call SetUnitManaBJ( GetEventDamageSource(), ( GetUnitStateSwap(UNIT_STATE_MANA, GetEventDamageSource()) + ( ( GetEventDamage() / 100.00 ) * udg_IntegerVariable ) ) )
endfunction

//===========================================================================
function InitTrig_Spiritual_aura2 takes nothing returns nothing
    set gg_trg_Spiritual_aura2 = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_Spiritual_aura2, Condition( function Trig_Spiritual_aura2_Conditions ) )
    call TriggerAddAction( gg_trg_Spiritual_aura2, function Trig_Spiritual_aura2_Actions )
endfunction

code:
Trigger:
  • Spiritual aura2
    • Events
    • Conditions
      • ((Damage source) is A Hero) Equal to True
      • ((Damage source) has buff Spiritual Aura (lvl1)) Equal to True
    • Actions
      • Custom script: set udg_IntegerVariable = GetUnitAbilityLevel( GetEventDamageSource(), B00M )
      • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) + (((Damage taken) / 100.00) x IntegerVariable))

IntegerVariable = real
i made the skill to only have buff lvl 1 (got 9 buffs for previous version of the skill)
also i connected the original activate spir aura trigger to this one.

whats the problem this time :(
 

Exide

I am amazingly focused right now!
Reaction score
448
You should use JASS-tags for JASS code.

I don't know what your first function (InitGlobals) does in this trigger, so I'm just gonna ignore it.
I took the rest of your trigger, optimized it, replaced the globals with locals, and fixed the typo error:

JASS:

function Trig_Spiritual_aura2_Conditions takes nothing returns boolean
    return (IsUnitType(GetEventDamageSource(), UNIT_TYPE_HERO) == true) and (GetUnitAbilityLevel(GetEventDamageSource(), 'B00M') > 0)
endfunction

function Trig_Spiritual_aura2_Actions takes nothing returns nothing
    local integer i = GetUnitAbilityLevel( GetEventDamageSource(), 'B00M')
    local unit u = GetEventDamageSource()
    local real managain = (GetEventDamage() / 100) * i
    
    call SetUnitState(u, UNIT_STATE_MANA, managain)
    
    set u = null
endfunction

//===========================================================================
function InitTrig_Spiritual_aura2 takes nothing returns nothing
    set gg_trg_Spiritual_aura2 = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_Spiritual_aura2, Condition( function Trig_Spiritual_aura2_Conditions ) )
    call TriggerAddAction( gg_trg_Spiritual_aura2, function Trig_Spiritual_aura2_Actions )
endfunction


What you had done wrong: You wrote B00M, instead of 'B00M', for buffcode.
 

Nivius

TH.net Regular
Reaction score
5
You should use JASS-tags for JASS code.

I don't know what your first function (InitGlobals) does in this trigger, so I'm just gonna ignore it.
I took the rest of your trigger, optimized it, replaced the globals with locals, and fixed the typo error:

JASS:
function Trig_Spiritual_aura2_Conditions takes nothing returns boolean
    return (IsUnitType(GetEventDamageSource(), UNIT_TYPE_HERO) == true) and (GetUnitAbilityLevel(GetEventDamageSource(), 'B00M') > 0)
endfunction

function Trig_Spiritual_aura2_Actions takes nothing returns nothing
    local integer i = GetUnitAbilityLevel( GetEventDamageSource(), 'B00M')
    local unit u = GetEventDamageSource()
    local real managain = (GetEventDamage() / 100) * i
    
    call SetUnitState(u, UNIT_STATE_MANA, managain)
    
    set u = null
endfunction

//===========================================================================
function InitTrig_Spiritual_aura2 takes nothing returns nothing
    set gg_trg_Spiritual_aura2 = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_Spiritual_aura2, Condition( function Trig_Spiritual_aura2_Conditions ) )
    call TriggerAddAction( gg_trg_Spiritual_aura2, function Trig_Spiritual_aura2_Actions )
endfunction


What you had done wrong: You wrote B00M, instead of 'B00M', for buffcode.
oh ^^ t, im gona test it, il be back whit edit to tell you how it whent

*edit*

now it dont work at all :/
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top