In this spell it creates a wolf and then it is supposed to add two abilities but it doesnt do anything, the wolf is a normal unit, the base unit was a peasant, when I try to add abilities by that way with a hero it works, why isn't this working?
JASS:
scope Wolf initializer Init
globals
private constant integer ABI_ID = 'A00K'
private constant integer WOLF = 'h00C'
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00K'
endfunction
private function Actions takes nothing returns nothing
local unit hero = GetTriggerUnit()
local player owner = GetOwningPlayer(hero)
local integer pid = GetPlayerId(owner) + 1
local real str = GetHeroStr(hero, true)
local real agi = GetHeroAgi(hero, true)
local real int = GetHeroInt(hero, true)
local unit wolf
call CreateUnit(owner, WOLF, GetUnitX(hero), GetUnitY(hero), 0)
set wolf = GetLastCreatedUnit()
call UnitAddAbility(wolf, 'A016' )
call UnitAddAbility(wolf, 'A012' )
set wolf = null
set hero = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger WolfTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( WolfTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( WolfTrg, Condition( function Conditions ) )
call TriggerAddAction( WolfTrg, function Actions )
endfunction
endscope