@Destiny.Knight
That method is really bad in every single aspect of it.
I dont have to say anything more about it.
The reason it is bad is because it periodically computes a value that might not have changed and forces a large number of ability levels which really slows down map load speed.That method is really bad in every single aspect of it.
If it is the only member you access from the object type hashtables will likely still be faster.It is faster than hashtables (arrays over hashtables)
In SC2 you can look up all data with triggers using the Catalog natives. One of the many convenient features SC2 has.Catalog natives?
Wrong comparison...myArray[GetUnitUserData(u)] vs LoadInteger(myHashtable, GetHandleId(u), 0)
I always thought the first one was faster.
function GetUnitTypePrimaryAttribute takes integer unitTypeId returns string
Not sure what you are talking about.The problem is that the value is written as string in the editor instead of an integer so you will have to either use an array or use three checks again to check what the string is.
function GetUnitTypePrimaryAttibuteEx takes integer unitTypeId returns integer
local string data = GetUnitTypePrimaryAttribute(unitTypeId)
if data == "AGI" then
return bj_HEROSTAT_AGI
elseif data == "INT" then
return bj_HEROSTAT_INT
elseif data == "STR" then
return bj_HEROSTAT_STR
endif
return 3
endfunction