• 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.

[vJASS] UnitStripHeroLevel is bugged, anyone know fixes?

Status
Not open for further replies.
JASS:
struct tester extends array
    private static unit u
    private static unit u2
    private static method ts takes nothing returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,R2S(GetWidgetLife(u))+"=="+R2S(GetWidgetLife(u2)))
    endmethod
    private static method r takes nothing returns boolean
        call ReviveHero(u,GetWidgetX(u),GetWidgetY(u),false)
        call SetWidgetLife(u,GetUnitState(u,UNIT_STATE_MAX_LIFE))
        return false
    endmethod
    private static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer l=1000
        set u = CreateUnit(Player(0), 'Hpal', GetStartLocationX(0), GetStartLocationY(0), 0)
        set u2 = CreateUnit(Player(0), 'Hpal', GetStartLocationX(0)+128, GetStartLocationY(0), 0)
        call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_DEATH)
        call TriggerAddCondition(t,Condition(function thistype.r))
        call SetHeroLevel(u,l,false)
        call UnitStripHeroLevel(u,l)
        call SetWidgetLife(u2,GetUnitState(u2,UNIT_STATE_MAX_LIFE)/2)
        call SetWidgetLife(u,GetUnitState(u,UNIT_STATE_MAX_LIFE)/2)
        call TimerStart(CreateTimer(),1,true,function thistype.ts)
        set t=null
    endmethod
endstruct
 
Last edited:
If you set gameplay constant Life Regeneration gained per Strength point to 0.00 everything woks fine.
So it seems that (by default 0.05 per str point) every time you call that function, engine calculates the -regeneration gained; formula should be somewhat like:

str pts gained * constant LR per str point = regeneration >>>>> since you reduce the amount of levels it will be: regeneration gained * (-1)
 
I also noticed this bug. It happens with Mana and RegenMana too.

I made test some time ago (and without a good engine for getting states : I only looked the values on the unit's life-bar) but I thought the drop was independant of game constants, only dependant of str/int per level.

Also the Skill points are not well removed : 1 level drop => 1 point drop (if it was used, it lowers the level of a spell). It doesn't fit when there are more levels than cumulated spell levels.

Good luck fixing this function. I personnaly just avoid using it.
 
Status
Not open for further replies.
Top