Gtam
Lerning how to write and read!! Yeah.
- Reaction score
- 164
This trigger works but the right level is never correct.
after the unit has taken a few damage the lvl never increase its always at 1.
JASS:
scope TitanBlood initializer TBInit
globals
private constant integer TBId = 039;A014039;
private constant integer AbilId = 039;D014039;
private constant integer BookId = 039;DA14039;
endglobals
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(), TBId) > 0
endfunction
struct Blood extends array
//! runtextmacro AIDS()
unit Titan
integer lvl
boolean reset
method AIDS_OnDestoy takes nothing returns nothing
set this.lvl = 1
endmethod
endstruct
private function Reset takes nothing returns nothing
local Blood b = GetTimerData(GetExpiredTimer())
if GetDamageCount(b.Titan) > 0. then
set b.lvl = GetUnitAbilityLevel(b.Titan, TBId)
call SetUnitAbilityLevel(b.Titan, AbilId, b.lvl)
endif
endfunction
private function Actions takes nothing returns nothing
local Blood b = Blood[GetTriggerUnit()]
local timer ti = GetDTimer()
set b.Titan = GetTriggerUnit()
if GetUnitAbilityLevel(b.Titan, TBId) == 0 then
call BJDebugMsg("Abil")
call UnitAddAbility(b.Titan, BookId)
endif
if b.lvl < GetUnitAbilityLevel(b.Titan,TBId) + 15 then
set b.lvl = b.lvl + 1
call BJDebugMsg(I2S(b.lvl))
call SetUnitAbilityLevel(b.Titan, AbilId, b.lvl)
endif
call CountUnitDamage(b.Titan)
call ResetDamageCount(b.Titan)
call SetTimerData(ti, b)
call TimerStart(ti, 6., true, function Reset)
endfunction
private function TBInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterDamageEvent(t)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
call SetPlayerAbilityAvailable(Player(1), 039;DA14039;, false)
endfunction
endscope
after the unit has taken a few damage the lvl never increase its always at 1.