| 11-25-2009, 02:29 PM | #1 |
JASS:scope DEADPOOLULTI initializer Init globals private constant integer SPELL_ID = 'A007' private constant integer BONUS = 'A00A' private unit WhateverUnit endglobals private function Conditions takes nothing returns boolean return GetUnitAbilityLevel(WhateverUnit,SPELL_ID)> 0 endfunction private function Actions takes nothing returns nothing local real LifePercentage = GetUnitState(WhateverUnit,UNIT_STATE_LIFE) / GetUnitState(WhateverUnit,UNIT_STATE_MAX_LIFE) * 100 local integer lvl = GetUnitAbilityLevel(WhateverUnit, SPELL_ID) local integer TimesBonus = ((lvl*5) - 4) + R2I((100 - LifePercentage) / 10) call SetUnitAbilityLevel(WhateverUnit,BONUS,TimesBonus) endfunction function Trig_LearnUlti_Conditions takes nothing returns boolean return GetLearnedSkill() == 'A007' endfunction function Trig_LearnUlti_Actions takes nothing returns nothing set WhateverUnit = GetLearningUnit() call UnitAddAbility(WhateverUnit , 'A00A') endfunction private function Init takes nothing returns nothing local trigger t = CreateTrigger( ) call TriggerRegisterTimerEvent(t, 0.5 , true) call TriggerAddCondition( t, Condition( function Conditions ) ) call TriggerAddAction( t, function Actions ) set t = null set t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL ) call TriggerAddCondition( t, Condition( function Trig_LearnUlti_Conditions ) ) call TriggerAddAction( t, function Trig_LearnUlti_Actions) set t = null endfunction endscope Why wont this trigger work? It is supposed to adjust the level of an ability according to the heros hp, but it is not working, the ability gets added bt not adjusted with the HP. |
| 11-25-2009, 04:20 PM | #2 |
hp bonus ability is static and you cannot change HP by leveling it, it always give bonus of first level (but when removed remove proper amount of hp) |
| 11-25-2009, 04:24 PM | #3 |
I do not want to change the HP I want to use the units current hp as a value to set the level of another ability. |
| 11-26-2009, 06:12 AM | #4 |
I can't see a problem with it. Why don't you add a couple of "call BJDebugMsg( "My debug message" )" inside and specify your problem a bit more? |
| 11-26-2009, 09:06 AM | #5 |
you miss real to integer and integer to real shift local integer TimesBonus = ((lvl*5) - 4) + R2I((100 - LifePercentage) / 10) as integer this will calculate in odd way, you shoud use real type. |
