- Joined
- Sep 26, 2005
- Messages
- 1,088
I don't get it what's wrong:
It's a function that calculates damage based on weapon damage (CombatDamageMin and CombatDamageMax, two reals that are linked to unit's custom value) and unit's strength, agility and intelligence, but since I'm new to JASS, and this is my first attempt at making my own function, I don't know what's wrong.
I want to make it possible for every other function to call this one so I guess it has to be public.
JASS:
public function DamageCalc takes unit DSource, unit DTarget, string DType, real Dwd, real Dstrd, real Dagid, real Dintd returns real
local real dmg = 0
set dmg = Dwd * GetRandomReal(udg_CombatDamageMin[GetUnitUserData(DSource)], udg_CombatDamageMax[GetUnitUserData(DSource)])
set dmg = dmg + ( Dstrd * I2R(GetHeroStatBJ(bj_HEROSTAT_STR, DSource, true)) ) + ( Dagid * I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, DSource, true)) ) + ( Dintd * I2R(GetHeroStatBJ(bj_HEROSTAT_INT, DSource, true)) )
return dmg
endfunction
It's a function that calculates damage based on weapon damage (CombatDamageMin and CombatDamageMax, two reals that are linked to unit's custom value) and unit's strength, agility and intelligence, but since I'm new to JASS, and this is my first attempt at making my own function, I don't know what's wrong.
I want to make it possible for every other function to call this one so I guess it has to be public.