function Trig_Summons_for_necro_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A03Y' or GetSpellAbilityId() == 'A03U' or GetSpellAbilityId() == 'A040'
endfunction
function Trig_Summons_for_necro_Actions takes nothing returns nothing
local player pl = GetTriggerPlayer()
local integer p = GetPlayerId(pl)+1
local unit u = GetTriggerUnit()
local unit pu = GetTriggerUnit()
local real xt = GetSpellTargetX()
local real yt = GetSpellTargetY()
local integer ulv = GetUnitAbilityLevel(u, 'A03V')
local integer a = GetSpellAbilityId()
local integer lv = GetUnitAbilityLevel(u, a)
local integer hlv = GetHeroLevel(u)
local string s1 = "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"
local string s2 = "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl"
local real size = 1+lv/15
local real mrate = 1
local real prate = 1
local integer cv
local integer utype
if ulv != GetPlayerTechCount(pl, 'R001', true) then
call SetPlayerTechResearched(pl,'R001', ulv )
endif
call DestroyEffect (AddSpecialEffect (s1, xt,yt))
if a == 'A03Y' then
if CountUnitsInGroup(udg_Summon_I)==5 then
set pu = FirstOfGroup(udg_Summon_I)
call GroupRemoveUnit(udg_Summon_I, pu)
call DestroyEffect (AddSpecialEffect (s2, GetUnitX(pu),GetUnitY(pu)))
call KillUnit( pu )
endif
set pu = CreateUnit(Player(p-1),'uske' , xt,yt, 0)
call GroupAddUnit(udg_Summon_I, pu)
call UnitAddType( pu, UNIT_TYPE_SUMMONED )
if lv > 1 then
call UnitAddAbility (pu, 'Arel')
endif
if lv > 2 then
call UnitAddAbility (pu, 'AIae')
endif
if lv > 3 then
call UnitAddAbility (pu, 'ACrk')
endif
if lv > 4 then
call UnitAddAbility (pu, 'AIrr')
endif
endif
if a == 'A03U' then
if CountUnitsInGroup(udg_Summon_II)==4 then
set pu = FirstOfGroup(udg_Summon_II)
call GroupRemoveUnit(udg_Summon_II, pu)
call DestroyEffect (AddSpecialEffect (s2, GetUnitX(pu),GetUnitY(pu)))
call KillUnit( pu )
endif
set pu = CreateUnit(Player(p-1),'nsca' , xt,yt, 0)
call GroupAddUnit(udg_Summon_II, pu)
call UnitAddType( pu, UNIT_TYPE_SUMMONED )
set cv = GetUnitUserData(pu)
if lv > 1 then
set udg_Global_Crit[cv] = udg_Global_Crit[cv] + 5
endif
if lv > 2 then
set udg_Global_Eva[cv] = udg_Global_Eva[cv] + 10
endif
if lv > 3 then
// call UnitAddAbility (pu, 'ACcw')
endif
if lv > 4 then
call UnitAddAbility (pu, 'ACbh')
endif
endif
if a == 'A040' then
if CountUnitsInGroup(udg_Summon_III)==3 then
set pu = FirstOfGroup(udg_Summon_III)
call GroupRemoveUnit(udg_Summon_III, pu)
call DestroyEffect (AddSpecialEffect (s2, GetUnitX(pu),GetUnitY(pu)))
call KillUnit( pu )
endif
set pu = CreateUnit(Player(p-1),'uskm' , xt,yt, 0)
call GroupAddUnit(udg_Summon_III, pu)
call UnitAddType( pu, UNIT_TYPE_SUMMONED )
set cv = GetUnitUserData(pu)
if lv > 1 then
call UnitAddAbility (pu, 'AIrm')
endif
if lv > 2 then
call UnitAddAbility (pu, 'AIse')
endif
if lv > 3 then
call UnitAddAbility (pu, 'AIav')
endif
if lv > 4 then
call UnitAddAbility (pu, 'AIos')
endif
endif
set cv = GetUnitUserData(pu)
call AddDef (pu, hlv)
call SetUnitScale(pu, size, size, size)
set pl = null
set pu = null
set u = null
set s1 = null
set s2 = null
endfunction
//===========================================================================
function InitTrig_Summons_for_necro takes nothing returns nothing
set gg_trg_Summons_for_necro = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Summons_for_necro, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Summons_for_necro, Condition( function Trig_Summons_for_necro_Conditions ) )
call TriggerAddAction( gg_trg_Summons_for_necro, function Trig_Summons_for_necro_Actions )
endfunction