• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Another Possible bug

Status
Not open for further replies.
Level 21
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
 
Status
Not open for further replies.
Top