Mmk.. I've decided to try and make a spell that uses a dummy unit! First time ever using dummy units... .. .
Ok, I have this custom function in my header:
Code:
function CreateDummy takes location l, player p, integer abil, integer lev returns unit
local unit u = CreateUnitAtLoc(p, 'h001', l, 0)
call UnitAddAbility(u, abil)
call SetUnitAbilityLevel(u, abil, lev)
return u
endfunction
Here is the trigger that when a unit casts the spell(frost armor), it adds the target unit to a unit group..
Code:
function icecond takes nothing returns boolean
return(GetSpellAbilityId()=='A001')
endfunction
function iceact takes nothing returns nothing
local unit u=GetSpellTargetUnit()
call GroupAddUnitSimple(u,udg_ice_armor_group)
call PolledWait(150.00)
call GroupRemoveUnitSimple(u,udg_ice_armor_group)
endfunction
function InitTrig_icyarmor takes nothing returns nothing
set gg_trg_icyarmor=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_icyarmor,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_icyarmor,Condition( function icecond))
call TriggerAddAction(gg_trg_icyarmor,function iceact)
endfunction
And here is where it checks when a unit is attacked if the attacked unit has frost armor, to spawn a dummy caster, give him the frost nova ability, cast it, then freeze the attacking unit.. Which doesn't work worth a shit.. (What's new):
Code:
function icycond takes nothing returns boolean
return(IsUnitInGroup(GetTriggerUnit(),udg_ice_armor_group))
endfunction
function icyact takes nothing returns nothing
local unit attacker=GetAttacker()
local unit u=GetTriggerUnit()
local unit dummy
local location l=GetUnitLoc(u)
local player p=GetOwningPlayer(u)
local integer abil='A003'
local integer lev=1
local real x=GetUnitX(attacker)
local real y=GetUnitY(attacker)
call RemoveLocation(l)
call CreateDummy(l,p,abil,lev)
set dummy=GetLastCreatedUnit()
call IssueTargetOrderBJ(dummy,"frostnova",attacker)
call DestroyEffect(AddSpecialEffect("Doodads\\Icecrown\\Rocks\\Icecrown_Crystal\\Icecrown_Crystal6.mdl",x,y))
call PauseUnitBJ(true,attacker)
call PolledWait(.3)
call PauseUnitBJ(false,attacker)
set attacker=null
set u=null
set dummy=null
set l=null
set p=null
endfunction
function InitTrig_icyarmorduration takes nothing returns nothing
set gg_trg_icyarmorduration=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_icyarmorduration,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_icyarmorduration,Condition(function icycond))
call TriggerAddAction(gg_trg_icyarmorduration,function icyact)
endfunction
Thanks in advance,
Spoofzz
_________________
Doesn't
Dekar make the world easier?
"I
Wumbo. YOU
Wumbo. He she me..
WUMbo.
Wumbo;
WumboING;
WumBOLogy; the study of
WUMBO. It's first grade,
Spongebob!"
"I'm sorry I doubted your great wisdom
Patrick!"
Catch
me on
Azeroth (U.S. East) -
NameSpoofer