• 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.

Unit Attack Speed

Status
Not open for further replies.
Level 12
Joined
Mar 13, 2020
Messages
421
Uncle found out that Blademasters Bladestorm damage Real "OWW1" can be fixed by
Incrase the Ability level
and Decrase the Ability level
after you set the Damage sounds weird but it fixed the Real Field for "OWW1" maybe some others need a Simular Trick to get them to work and its a much of a research to find out...

btw if you use a Custom Stat system like me and i think you do... cuz i saw your custom UI maybe just use agility? as Attackspeed Modifyier and set 1 Point to 1% that would fix your problem...
i use Agility as Crit/Spellcrit for each 1 Point you get 1% of Crit/Spellcrit... so that would be a solution too...
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
2,011
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Set Attack Interval of Footman 0001 <gen> to 0.01 for weapon index: (1 - 1)
Doesn't this accomplish exactly what you had in mind? Also you have to do the -1 thing because weapon indexes start at 0, let's just say blizzard is dumb.
Note: Max hits per second is 60.
 
Level 12
Joined
Mar 13, 2020
Messages
421
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Set Attack Interval of Footman 0001 <gen> to 0.01 for weapon index: (1 - 1)
Doesn't this accomplish exactly what you had in mind? Also you have to do the -1 thing because weapon indexes start at 0, let's just say blizzard is dumb.
Note: Max hits per second is 60.

thats attackcooldown he mention to have the same effect as Attackspeed without changing backswing/attackcooldown..
 
Level 6
Joined
Dec 29, 2019
Messages
82
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Set Attack Interval of Footman 0001 <gen> to 0.01 for weapon index: (1 - 1)
Doesn't this accomplish exactly what you had in mind? Also you have to do the -1 thing because weapon indexes start at 0, let's just say blizzard is dumb.
Note: Max hits per second is 60.
Yeah that won't help me since it will affect only attack cooldown and wont slow down attack animations ... for example when u set cooldown to 10 seconds, unit will make attack at normal speed and then just keep standing on the spot like an idiot doin nothing. When units are affected by attack speed buffs like bloodlust or auras like endurance they will attack faster means, lower cooldown but faster attack animations as well. When on the other hand they got buff which slowing their attack speed they will play their attack animations slower, its a shame we still don't have natives to handle this stat properly, since only thing u can do in unit data is edit run / walk speed animations and attack cooldown/backswing point which only defines time of damage event during attack animation.
 
Level 6
Joined
Dec 29, 2019
Messages
82
Uncle found out that Blademasters Bladestorm damage Real "OWW1" can be fixed by
Incrase the Ability level
and Decrase the Ability level
after you set the Damage sounds weird but it fixed the Real Field for "OWW1" maybe some others need a Simular Trick to get them to work and its a much of a research to find out...

btw if you use a Custom Stat system like me and i think you do... cuz i saw your custom UI maybe just use agility? as Attackspeed Modifyier and set 1 Point to 1% that would fix your problem...
i use Agility as Crit/Spellcrit for each 1 Point you get 1% of Crit/Spellcrit... so that would be a solution too...
Yeah agility would probably be able to do the trick as long as its possible to have negative values of agility on hero which will have negative impact on attack speed. I am using agility as crit rate as well atm, but that can be easily reworked by editing several functions. But it won't solve attack speed problems on units anyways only for heroes and i clearly do not want every unit on the map to be a hero.

Maybe i'll give it few other shots since there is maybe some weird trick making other Real Fields changable too. Only if Actizzard gave us proper documentations of their stuff... that would make our lives so much easier.
 
Last edited:
Level 6
Joined
Dec 29, 2019
Messages
82
Uncle found out that Blademasters Bladestorm damage Real "OWW1" can be fixed by
Incrase the Ability level
and Decrase the Ability level
after you set the Damage sounds weird but it fixed the Real Field for "OWW1" maybe some others need a Simular Trick to get them to work and its a much of a research to find out...
Okay man this one worked... that basically means BlzSetAbilityRealLevelField() function works, it will change ability data for unit, but it won't recalculate this changed data on unit. If you have passive ability which have certain buff effect, for example ('AIsx') ability, and u change its ISX1 data field, it will be changed, but effect won't be applied since it looks like passive abilities effects like these are applied only when unit gets the ability (which is useless since you can modify real fields only after ability was given) OR it will by also applied whenever unit gain level progress on the ability. That basically means, if you have ability with such passive effect, you need to make sure it got at least 2 levels defined and whenever you wanna change Real Field you change it for Level1 and after that set ability level to 2 and back to 1 making game engine recalculate and apply ability bonuses on unit.

Thats why Bloodlust worked, since it is active one and its real fields are recalculated everytime it is used.

Something like this solved my problem :)

One needs to set ('AIsx') ability to have 2 levels in objects data. It doesn't even matter its item ability, it will work for units as well using these natives.

Lua:
function Unit_SetAttackSpeed(u,as)
    if GetUnitAbilityLevel(u, FourCC('AIsx')) == 0 then
        UnitAddAbility(u, FourCC('AIsx'))
    end
    BlzSetAbilityRealLevelField(BlzGetUnitAbility(u, FourCC('AIsx')), ABILITY_RLF_ATTACK_SPEED_INCREASE_ISX1, 0, as)
    SetUnitAbilityLevel(u, FourCC('AIsx'), 2)
    SetUnitAbilityLevel(u, FourCC('AIsx'), 1)
end

I did find out one really weird behaviour while testing this. When u have pre-created units on the map, and u try to apply these functions on them via vJASS or Lua it won't work... for some reason. If u do it via GUI it will work fine, but code won't not even GUI Custom Script action. You need to run at least 1 action IN GUI which somehow using pre-created unit as parameter and that will somehow make BlzSetAbilityRealLevelField() work on them even in the code. So for example run SetUnitHp gui Action on pre-created unit and afterwards code function will work as well...
 
Last edited:

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
2,011
I did find out one really weird behaviour while testing this. When u have pre-created units on the map, and u try to apply these functions on them via vJASS or Lua it won't work... for some reason. If u do it via GUI it will work fine, but code won't not even GUI Custom Script action. You need to run at least 1 action IN GUI which somehow using pre-created unit as parameter and that will somehow make BlzSetAbilityRealLevelField() work on them even in the code. So for example run SetUnitHp gui Action on pre-created unit and afterwards code function will work as well...
It's not a weird behavior. Preplaced units have no variables referencing them, those variables are only created using GUI. There must always be one trigger in GUI with, e.g.:
Unit - Kill Footman 0000 <gen> and no event. This then generates gg_unit_hfoo_0000.
 
Level 6
Joined
Dec 29, 2019
Messages
82
It's not a weird behavior. Preplaced units have no variables referencing them, those variables are only created using GUI. There must always be one trigger in GUI with, e.g.:
Unit - Kill Footman 0000 <gen> and no event. This then generates gg_unit_hfoo_0000.
Oh never realized that one :), but its logical, it would be kinda uneffective to declare globals for every pre-placed unit in every map.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,886
I don't think the ability even needs 2 levels for the Increase/Decrease trick to work, I had just assumed that all along.

There's a lot of weird bugs and behaviors with these "new" functions. I recommend trying different approaches if you can't get something to work. I find myself having to "refresh" things in order for them to update and start working properly, whether that be increasing/decreasing levels or disabling/enabling an ability. Sometimes a 0 second Wait (preferably a Timer) is necessary... These things are really finicky.
 
Level 6
Joined
Dec 29, 2019
Messages
82
I don't think the ability even needs 2 levels for the Increase/Decrease trick to work, I had just assumed that all along.

There's a lot of weird bugs and behaviors with these "new" functions. I recommend trying different approaches if you can't get something to work. I find myself having to "refresh" things in order for them to update and start working properly, whether that be increasing/decreasing levels or disabling/enabling an ability. Sometimes a 0 second Wait (preferably a Timer) is necessary... These things are really finicky.
I guess enable/disabe makes sense as well, since it forces some native ab data recalculations upon unit. Trick with wait timer sounds super weird, but i wouldn't be that surprised since there are dozens of weird behaviors behind WE which are not properly documentated.
 
Status
Not open for further replies.
Top