Is there anyway to detect attack speed?

Level 4
Joined
Dec 22, 2016
Messages
67
Hello hive!
As you all know there is no function for detecting AS in GUI (unlike MS) so , I wanted to know , is there any system or trigger (GUI friendly) on hive to detect AS as units (like how ms is measured) or as time (for example 1.7 seconds) ?
Well , I tried to trigger it my self by creating an exact copy of the unit for neutral hostile and order it to attack a dummy , and calculate the time between its two attack toward the dummy , but because of things like turn rate and etc , it returned results with up to 20-30 units difference and also in this method , so it was unreliable , another problem with this method was that it took some time to calculate the AS so it can't be used for creating spells etc.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,328
As you all know there is no function for detecting AS in GUI (unlike MS) so , I wanted to know , is there any system or trigger (GUI friendly) on hive to detect AS as units (like how ms is measured) or as time (for example 1.7 seconds) ?
No. There is also no JASS function to get attack speed. The idea you have is good in theory, but sadly not in reality. As you said there are too many factors, that affect attack speed. Also things like abilities, buffs and items affect attack speed, so unless you copy them as well, you won't get good results. I think the best solution would be to calculate the attack speed, by stored data in a hashtable.
You have to store the base attack speed of every unit, you want to know the attacks speed of, as well as all attack speed modifying effects. In the end you will be able to calculate the attack speed of unit depending on the unit type, it's buffs, items, agility and abilities and maybe upgrades, if you have attack speed upgrades. One problem with this is buffs, that can have different amounts of attack speed factors. For example endurance aura, which has 3 levels with different attack speed values. Since you can't get the level of a buff, you would have to use different buffs for different levels.
It's quite a lot of work, to gather all the values, but it should work good.
 
Level 4
Joined
Dec 22, 2016
Messages
67
Accessing memory from the script - it's time of the revolution

This works on almost any patch as long as you have the Version library updated

JASS:
function GetUnitAttackSpeed takes unit u returns real
    return cleanReal(indexToReal(Memory[GetUnitAttackAbility(u)/4 + 0x1B0/4]))
endfunction

And adding that function to the Utils library

Is there anyway to make this work with normal WE in GUI using custom scripts? Does this necessarily needs Newgen?
 
Top