What I was trying to do is use an upgrade to increase/decrease the damage of a hero in my map depending on what weapon he is using. So if he equips a sword that does 10 damage, his research level for damage is set to 10, but if he unequips it and then equips a sword that does 5 damage, his research level for damage is set to 5
then better if u add ability and increase decrease it
udg_Abilities2[14]=custom ability based on item glove of haste, 10 lv, lv1=0, lv2=0.01...lv10=0.09
udg_Abilities2[15]=custom ability based on item glove of haste, 10 lv, lv1=0, lv2=0.1...lv10=0.9
udg_Abilities2[16]=custom ability based on item glove of haste, 10 lv, lv1=0, lv2=1...lv10=9
udg_Abilities2[17]=custom ability based on item claw of attack, 10 lv, lv1=0, lv2=1...lv10=9
udg_Abilities2[18]=custom ability based on item claw of attack, 10 lv, lv1=0, lv2=10...lv10=90
udg_Abilities2[19]=custom ability based on item claw of attack, 10 lv, lv1=0, lv2=100...lv10=900
udg_Abilities2[20]=custom ability based on item claw of attack, 10 lv, lv1=0, lv2=1000...lv10=9000
in game just use this
Set Stat_Dmg[player number of triggering player] = (Stat_Dmg[player number of triggering player] + *new item damage* - *old item damage*)
Set Stat_AttSpeed[player number of triggering player] = (Stat_AttSpeed[player number of triggering player] + *new item speed* - *old item speed*)
for dmg=
Custom script: call AddDMG(true, *unit*)
for speed=
Custom script: call AddDMG(false, *unit*)
u can copy jass to map header
JASS:
//damage and attack speed setting
function AddDMG takes boolean DMG, unit u returns nothing
local integer i
local integer n
local integer a1
local integer a2
local integer a3
local integer a4
local integer p = GetConvertedPlayerId(GetOwningPlayer(u))
if ( DMG == false ) then
set a1 = udg_Abilities2[14]
set a2 = udg_Abilities2[15]
set a3 = udg_Abilities2[16]
set i = udg_Stat_AttackSpeed
set n = i / 100 + 1
call SetUnitAbilityLevel( u, a3, n )
set i = i - (i / 100) * 100
set n = i / 10 + 1
call SetUnitAbilityLevel( u, a2, n )
set i = i - (i / 10) * 10
set n = i + 1
call SetUnitAbilityLevel( u, a1, n )
else
set a1 = udg_Abilities2[17]
set a2 = udg_Abilities2[18]
set a3 = udg_Abilities2[19]
set a4 = udg_Abilities2[20]
set i = udg_Stat_Dmg
set n = i / 1000 + 1
call SetUnitAbilityLevel( u, a4, n )
set i = i - (i / 1000) * 1000
set n = i / 100 + 1
call SetUnitAbilityLevel( u, a3, n )
set i = i - (i / 100) * 100
set n = i / 10 + 1
call SetUnitAbilityLevel( u, a2, n )
set i = i - (i / 10) * 10
set n = i + 1
call SetUnitAbilityLevel( u, a1, n )
endif
set u = null
endfunction