Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Is there any possible way to reduce the research level of an upgrade for a player via trigger?
When I make a trigger to set a research level to something lower than it already is it doesn't work.
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
//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
Modify item ability (100 levels will do).
Each level add +1 damage (level 69 will add +69 damage).
Unit pick or drop item, just increase or reduce ability level.
// Your hash, item raw code, ability1, ability level
Custom script: call SaveInteger(udg_hash, ItemRawCode, 1, 11)
Custom script: call SaveInteger(udg_hash, ItemRawCode, 2, 5)
Custom script: call SaveInteger(udg_hash, ItemRawCode, 3, 3)
Custom script: call SaveInteger(udg_hash, ItemRawCode, 4, 2)
Custom script: set udg_Ability4level = LoadInteger(udg_hash, GetItemTypeId(GetManipulatedItem()), 4)
Custom script: set udg_Ability3level = LoadInteger(udg_hash, GetItemTypeId(GetManipulatedItem()), 3)
Custom script: set udg_Ability2level = LoadInteger(udg_hash, GetItemTypeId(GetManipulatedItem()), 2)
Custom script: set udg_Ability1level = LoadInteger(udg_hash, GetItemTypeId(GetManipulatedItem()), 1)