- Joined
- May 16, 2012
- Messages
- 644
i wrote this piece of code to change a specific type of unit damage, health and size whenever it kills a unit, but the BlzSetUnitRealField() function for Scaling Value dont seem to be working even though the value is changed.
JASS:
scope HellHound initializer Init
private function Actions takes unit killer returns nothing
local real size = BlzGetUnitRealField(killer, UNIT_RF_SCALING_VALUE)
local integer maxHealth = BlzGetUnitMaxHP(killer) + 250
local integer damage = BlzGetUnitBaseDamage(killer, 0) + 25
local real p = GetUnitLifePercent(killer)
call BlzSetUnitMaxHP(killer, maxHealth)
call DisplayTextToPlayer(Player(0), 0, 0, I2S(maxHealth))
call SetUnitLifePercentBJ(killer, p)
call BlzSetUnitBaseDamage(killer, damage, 0)
call DisplayTextToPlayer(Player(0), 0, 0, I2S(damage))
if size < 2 then
call BlzSetUnitRealField(killer, UNIT_RF_SCALING_VALUE, size + 0.01)
call DisplayTextToPlayer(Player(0), 0, 0, R2S(size + 0.01))
endif
endfunction
private function Conditions takes nothing returns boolean
local unit killer = udg_KillerOfUnit[udg_UDex]
if (GetUnitTypeId(killer) == 'o004') then
call Actions(killer)
endif
set killer = null
return false
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set gg_trg_HellHound = CreateTrigger()
call DisableTrigger(gg_trg_HellHound)
call TriggerRegisterVariableEvent(gg_trg_HellHound, "udg_DeathEvent", EQUAL, 1.00)
call TriggerAddCondition(gg_trg_HellHound, Condition(function Conditions))
endfunction
endscope