- Joined
- Jul 26, 2008
- Messages
- 1,009
I have an aura that when the unit dies, he will create a skeleton. Using BonusMod the Skeletons become scaled to the strength of the dying unit, which is helped determined by SpellStat,GetUnitBounty which I created. (They both work flawlessly)
Anyways, the problem is when the unit dies it refuses to recognize the buffs on them. I've tried making the buff target dead units too and make the buffs scale for level. No luck though.
Any help? Here's the buff rawcodes:
BLP1
BLP2
BLP3
BLP4
BLP5
And here's the aura targeting options:
air,alive,dead,friend,ground,invulnerable,self,vulnerable
The Aura is based off of Unholy Aura, and so are the buffs.
Anyways, the problem is when the unit dies it refuses to recognize the buffs on them. I've tried making the buff target dead units too and make the buffs scale for level. No luck though.
Any help? Here's the buff rawcodes:
BLP1
BLP2
BLP3
BLP4
BLP5
And here's the aura targeting options:
air,alive,dead,friend,ground,invulnerable,self,vulnerable
The Aura is based off of Unholy Aura, and so are the buffs.
JASS:
scope PresenceOfBL initializer Init
globals
private integer lvl
endglobals
private function Buff takes unit c returns boolean
if GetUnitAbilityLevel(c, 'BLP1') > 0 then
set lvl = 1
return true
elseif GetUnitAbilityLevel(c, 'BLP2') > 0 then
set lvl = 2
return true
elseif GetUnitAbilityLevel(c, 'BLP3') > 0 then
set lvl = 3
return true
elseif GetUnitAbilityLevel(c, 'BLP4') > 0 then
set lvl = 4
return true
elseif GetUnitAbilityLevel(c, 'BLP5') > 0 then
set lvl = 5
return true
endif
return false
endfunction
private function Actions takes unit c, unit d returns nothing
local real HPBonus = lvl*SpellStat(c,true) + GetUnitState(c, UNIT_STATE_MAX_LIFE)/4
local real DamageBonus = SpellStat(c, false)/8 + lvl*4
local real ArmorBonus = GetUnitBonus(c, BONUS_ARMOR)/7 + SpellStat(c,true)/10*lvl
set d = CreateUnit(GetOwningPlayer(c), 'uske', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
call UnitApplyTimedLife(d, 'BLP1', 60)
call AddUnitBonus(d, BONUS_LIFE, R2I(HPBonus))
call AddUnitBonus(d, BONUS_DAMAGE, R2I(DamageBonus))
call AddUnitBonus(d, BONUS_ARMOR, R2I(ArmorBonus))
call UnitAddType(d, UNIT_TYPE_SUMMONED)
if GetUnitBounty(c) > 30 then
call UnitAddAbility(d, 'Cr12')
endif
if GetUnitBounty(c) > 90 then
call AddUnitBonus(d, BONUS_MANA, 150)
call UnitAddAbility(d, 'SmDo')
endif
if GetUnitBounty(c) > 180 then
call AddUnitBonus(d, BONUS_MANA, 220)
call UnitAddAbility(d, 'DBol')
endif
call AddUnitBonus(GetEnumUnit(), BONUS_MANA_REGEN, 4)
endfunction
private function Conditions takes nothing returns boolean
if Buff(GetDyingUnit()) then
call Actions(GetDyingUnit(), null)
endif
return true
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope