+20% Strenght/Agility bonus AURA

jarekpl12

TH.net Regular
Reaction score
6
Hello... I got problem. I'm trying to make aura which adds 20% of BASE amount strenght and agility. When any hero recive aura's buff then let it add 20% strenght/agility and when aura's buff disappear then let it back to normal value i mean to value which had hero when he was reciving aura' buff. I made something like this but it's totaly failed. Can somone help me with this ability? thx

Trigger:
  • Strenght of Earth aura
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set StrenghtOfEarthGroup = (Units in (Playable map area) matching ((((Matching unit) has buff Strenght of Earth Totem (aura)) Equal to True) and ((((Matching unit) is in CheckGroup) Equal to False) and (((Matching unit) is Bohater) Equal to True))))
      • Unit Group - Pick every unit in StrenghtOfEarthGroup and do (Actions)
        • Loop - Actions
          • Set Strenght = ((Strenght of (Picked unit) (Exclude bonuses)) / 5)
          • Set Agility = ((Agility of (Picked unit) (Exclude bonuses)) / 5)
          • Hero - Modify Strenght of (Picked unit): Add Strenght
          • Hero - Modify Agility of (Picked unit): Add Agility
          • Unit Group - Add (Picked unit) to CheckGroup
      • Unit Group - Pick every unit in CheckGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Strenght of Earth Totem (aura)) Equal to False
            • Then - Actions
              • Hero - Modify Strenght of (Picked unit): Subtract Strenght
              • Hero - Modify Agility of (Picked unit): Subtract Agility
              • Unit Group - Remove (Picked unit) from CheckGroup
            • Else - Actions
      • Custom script: call DestroyGroup (udg_StrenghtOfEarthGroup)
 

canons200

New Member
Reaction score
50
i think the better way is to add those hero to unitgroup, then check is those unitgroup is in the unitgroup using the condition, next only add stat.

so when those unit has no aura, then remove those unit from the unitgroup and then continue subtract stat.
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
Use real for agi and str instead of integer, since diving or multiplying an integer with a decimal will result 0.

Do this

Trigger:
  • Actions
    • Set Strength[(Player number of (Owner of (Picked unit)))] = ((Real((Strength of (Picked unit) (Exclude bonuses)))) / 5.00)
    • Set Agility[(Player number of (Owner of (Picked unit)))] = ((Real((Agility of (Picked unit) (Exclude bonuses)))) / 5.00)
    • -------- set them real and add arrays. --------
    • Hero - Modify Strength of (Picked unit): Add (Integer(Strength[(Player number of (Owner of (Picked unit)))]))
    • Hero - Modify Strength of (Picked unit): Add (Integer(Agility[(Player number of (Owner of (Picked unit)))]))
    • -------- - --------
    • Hero - Modify Strength of (Picked unit): Subtract (Integer(Strength[(Player number of (Owner of (Picked unit)))]))
    • Hero - Modify Strength of (Picked unit): Subtract (Integer(Agility[(Player number of (Owner of (Picked unit)))]))


anyways...

This will bug if you have multiple hero on 1 player and when the hero leveled up, example:

The hero is lvl 5, has 50 str, agi

Gains the buff, so it has 60 str, and agi,

when the hero level up, let's say 5 bonus stats, so it has 65, and when the hero leaves the aura, removing the buff, it will return 52(should be 55)
 

Nexor

...
Reaction score
74
I don't know if you can use vJASS at all, but I created the spell for you, you can set the period, the buff's id and the percentage of increase.
Here ya go:

Needs AIDS too

JASS:
scope Aura initializer onInit

globals
    private constant integer        AuraBuffID      = 'B000' // Use Ctrl + D at object editor to see the IDs of the abilities and buffs
    private constant real           Period          = 3.      // How many seconds should pass between each check
    private constant real           Percentage      = 20.     // This means 20%
    
    private group StrengthOfEarthGroup               = CreateGroup()
endglobals

private function StatIncrease takes unit u,integer stat returns integer
    return R2I( GetHeroStatBJ(stat,u,false) * Percentage / 100)
endfunction

private struct aura
    unit hero
    integer stat_agi
    integer stat_str
    
    static method create takes unit u returns thistype
        local thistype this = thistype.allocate()
        set .hero = u
        return this
    endmethod
    //! runtextmacro PUI()
endstruct

private function Conditions takes nothing returns boolean
    return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) == true and GetUnitAbilityLevel(GetFilterUnit(),AuraBuffID) > 0
endfunction

private function Actions takes nothing returns nothing
    local group g = CreateGroup()
    local unit f
    
    call GroupEnumUnitsInRect(StrengthOfEarthGroup,GetWorldBounds(),Condition(function Conditions))
    set g = StrengthOfEarthGroup
    
    loop
        set f = FirstOfGroup(g)
        exitwhen f == null
        if aura(aura[f]) == 0 then
            call aura(aura[f]).create(f)
        endif
        call SetHeroAgi(f,GetHeroAgi(f,false)-aura(aura[f]).stat_agi,false)
        call SetHeroStr(f,GetHeroStr(f,false)-aura(aura[f]).stat_str,false)
        call GroupRemoveUnit(g,f)
        call GroupRemoveUnit(StrengthOfEarthGroup,f)
    endloop
    
    call GroupEnumUnitsInRect(StrengthOfEarthGroup,GetWorldBounds(),Condition(function Conditions))
    
    set g = StrengthOfEarthGroup
    
    loop
        set f = FirstOfGroup(g)
        exitwhen f == null
        if aura(aura[f]) == 0 then
            call aura(aura[f]).create(f)
        endif
        set aura(aura[f]).stat_agi = StatIncrease(f,bj_HEROSTAT_AGI)
        set aura(aura[f]).stat_str = StatIncrease(f,bj_HEROSTAT_STR)
        call SetHeroAgi(f,GetHeroAgi(f,false)+StatIncrease(f,bj_HEROSTAT_AGI),false)
        call SetHeroStr(f,GetHeroStr(f,false)+StatIncrease(f,bj_HEROSTAT_STR),false)
        call GroupRemoveUnit(g,f)
    endloop
    
    call DestroyGroup(g)
    set g = null
    set f = null
endfunction

//===========================================================================
private function onInit takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterTimerEvent(t,Period,true)
    call TriggerAddAction( t, function Actions )
endfunction

endscope
 

Ayanami

칼리
Reaction score
288
It's quite easy actually with the use of hashtables. Create a variable called SoEHashtable and set it at map init. Here's the trigger.

Trigger:
  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set SoEHashtable = (Last created hashtable)


Trigger:
  • Strenght of Earth aura
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set StrenghtOfEarthGroup = (Units in (Playable map area) matching ((((Matching unit) has buff Strength of Earth Totem (aura)) Equal to True) and ((((Matching unit) is in CheckGroup) Equal to False) and (((Matching unit) is Bohater) Equal to True))))
      • Unit Group - Pick every unit in StrengthOfEarthGroup and do (Actions)
        • Loop - Actions
          • Set TempInt = ((Strength of (Picked unit) (Exclude bonuses)) / 5)
          • Custom script: call SaveInteger( udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit(), udg_TempInt)
          • Hero - Modify Strength of (Picked unit): Add TempInt
          • Set TempInt = ((Agility of (Picked unit) (Exclude bonuses)) / 5)
          • Custom script: call SaveInteger( udg_SoEHashtable, StringHash("agi"), GetHandleId(GetEnumUnit(), udg_TempInt)
          • Hero - Modify Agility of (Picked unit): Add TempInt
          • Unit Group - Add (Picked unit) to CheckGroup
      • Unit Group - Pick every unit in CheckGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Strength of Earth Totem (aura)) Equal to False
            • Then - Actions
              • Custom script: set udg_TempInt = LoadInteger(udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit()))
              • Set Strength = ((Strength of (Picked unit) (Exclude bonuses)) - TempInt) / 5)
              • Set TempInt = (((Strength of (Picked unit) (Exclude bonuses)) - TempInt) + Strength)
              • Hero - Modify Strength of (Picked unit): Set to TempInt
              • Custom script: set udg_TempInt = LoadInteger(udg_SoEHashtable, StringHash("agi"), GetHandleId(GetEnumUnit()))
              • Set Agility = ((Agility of (Picked unit) (Exclude bonuses)) - TempInt) / 5)
              • Set TempInt = (((Agilty of (Picked unit) (Exclude bonuses)) - TempInt) + Agility)
              • Hero - Modify Agility of (Picked unit): Set to TempInt
              • Custom script: call SaveInteger( udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit(), udg_Strength)
              • Custom script: call SaveInteger( udg_SoEHashtable, StringHash(agi"), GetHandleId(GetEnumUnit(), udg_Agility)
            • Else - Actions
              • Custom script: set udg_TempInt = LoadInteger(udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit()))
              • Set TempInt = ((Strength of (Picked unit) (Exclude bonuses)) - TempInt)
              • Hero - Modify Strength of (Picked unit): Set to TempInt
              • Custom script: set udg_TempInt = LoadInteger(udg_SoEHashtable, StringHash("agi"), GetHandleId(GetEnumUnit()))
              • Set TempInt = ((Agility of (Picked unit) (Exclude bonuses)) - TempInt)
              • Hero - Modify Agility of (Picked unit): Set to TempInt
              • Unit Group - Remove (Picked unit) from CheckGroup
      • Custom script: call DestroyGroup (udg_StrenghtOfEarthGroup)
 

jarekpl12

TH.net Regular
Reaction score
6
something is wrong with:

Trigger:
  • Custom script: call SaveInteger( udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit(), udg_TempInt)


Script errors: Wrong arguments count

Trigger:
  • Custom script: call SaveInteger( udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit(), udg_Strength)


Trigger:
  • Custom script: call SaveInteger( udg_SoEHashtable, StringHash(agi"), GetHandleId(GetEnumUnit(), udg_Agility)


Script errors: Name Expect
 

Ayanami

칼리
Reaction score
288
What version are you using? Did you ensure your hashtable variable is named exactly "SoEHashtable"?
 

Ayanami

칼리
Reaction score
288
Add an extra ) at the end of each custom script that's wrong.

Oh, finally spotted that. Here's the correct version. The red part is the part you need to add.

Code:
Custom script: call SaveInteger( udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit()[COLOR="Red"][B])[/B][/COLOR], udg_TempInt)

Code:
Custom script: call SaveInteger( udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit()[COLOR="Red"][B])[/B][/COLOR], udg_Strength)

Code:
Custom script: call SaveInteger( udg_SoEHashtable, StringHash(agi"), GetHandleId(GetEnumUnit()[COLOR="Red"][B])[/B][/COLOR], udg_Agility)
 

LotK

Member
Reaction score
8
will this still work correctly, if you level up and get strength under the effect of the aura?

im worried that you get some less, when you leave it

eg: you got 100 str
with the aura you got 120
you level up and get 120 (base) strenght, with aura 144
when you leave it, you get 20% reduced strength.. in that case 115,2

is it like that, or is it really 'save'?
 

Ayanami

칼리
Reaction score
288
will this still work correctly, if you level up and get strength under the effect of the aura?

im worried that you get some less, when you leave it

eg: you got 100 str
with the aura you got 120
you level up and get 120 (base) strenght, with aura 144
when you leave it, you get 20% reduced strength.. in that case 115,2

is it like that, or is it really 'save'?

It returns the original value. So in your case, it will return back to 120 strength, not 115.2.
 

jarekpl12

TH.net Regular
Reaction score
6
Oh, finally spotted that. Here's the correct version. The red part is the part you need to add.

Code:
Custom script: call SaveInteger( udg_SoEHashtable, StringHash("str"), GetHandleId(GetEnumUnit()[COLOR="Red"][B])[/B][/COLOR], udg_Strength)

Code:
Custom script: call SaveInteger( udg_SoEHashtable, StringHash(agi"), GetHandleId(GetEnumUnit()[COLOR="Red"][B])[/B][/COLOR], udg_Agility)


still something wrong with Str and Agi custom script...
 

Nexor

...
Reaction score
74
Using my solution hurts your eyes ? :O

It's configurable, if you need some other things to the ability, please let me know.

ps: it uses the system called AIDS
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • 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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top