| 08-08-2008, 06:46 AM | #1 |
yeah. my threadname says all. i wamnt to get an function to get the damage of an unit, min and max dmg. but i havent any idea if this is possible. i could create the unit new and order it to atk an enemy but then i have only a random value. is there any solution? but without adding all dmg bonuses of items and buffs in globals and adding them to the base damage value?? |
| 08-08-2008, 08:00 AM | #2 |
Depends... are there a lot of different unit-types you need to get the damage of, or just a few? |
| 08-08-2008, 02:41 PM | #3 |
There is on way on my mind but it may not be a good solution though. Let's see in Object Editor for min&max damage for every units you used in your map then store them to global variables with integer and array type. like this JASS:globals integer MinDmg[number of your units] integer MaxDmg[number of your units] endglobals Now you just store your min&max damage to that global variables. |
| 08-08-2008, 03:18 PM | #4 |
I think GameCache like so would be better, but if he needs it for a lot of unit types it might be easier to do it some other way: JASS:function GetUnitDamageRange takes unit U, integer Type returns integer if Type == 1 then return GetStoredInteger(Cache, "MinDamages", S2I(GetUnitTypeId(U))+GetUnitLevel(U)) elseif Type == 2 then return GetStoredInteger(Cache, "MaxDamages", S2I(GetUnitTypeId(U))+GetUnitLevel(U)) endif return -1 endfunction |
| 08-09-2008, 02:44 AM | #5 |
Data base is best and only way. Use Unit Point Value for indexing. |
