wc3edit.net

United Warcraft 3 map hacking!
It is currently April 19th, 2024, 9:34 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: 3rd Spell
PostPosted: June 23rd, 2007, 10:11 am 
Offline
V.I.P.
User avatar

Joined: March 4th, 2007, 12:39 am
Posts: 332
Location: United States
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

_________________
Image
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


Top
 Profile  
 
 Post subject: Re: 3rd Spell
PostPosted: June 23rd, 2007, 1:53 pm 
Offline
Forum Staff
User avatar

Joined: January 28th, 2007, 8:10 pm
Posts: 830
Location: Canada
Title: JASS Programmer
Code:
//Config
constant function IcyArmor takes nothing returns integer
return('????') //Replace ???? with your Icy Armor ability
endfunction
constant function IcyArmorBuffId takes nothing returns integer
return('????') //Replace ???? with the Icy Armor buff
endfunction
constant function DummyId takes nothing returns integer
return('????')  //Replace ???? with your Dummy's ID
endfunction
constant function DummyAbilCode takes nothing returns integer
return('????') //Replace ???? with your Dummy frost nova
endfunction
constant function MeleeOnly takes nothing returns boolean
return true //Change this to true you want the spell to hit ranged units
endfunction
//Endconfig

function DistanceBetweenXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
endfunction
function FilterUnits takes nothing returns boolean
local unit u=GetEventDamageSource()
local unit t=GetTriggerUnit()
local boolean b=true
if IsUnitAlly(u,GetOwningPlayer(t)) then
set b=false
elseif MeleeOnly() then
if DistanceBetweenXY(GetUnitX(u),GetUnitY(u),GetUnitX(t),GetUnitY(t))>200 then
set b=false
endif
endif
set u=null
set t=null
return b
endfunction
function icyact takes nothing returns nothing
local unit u=GetEventDamageSource()
local player p=GetOwningPlayer(GetTriggerUnit())
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local unit d=CreateUnit(p,DummyId(),x,y,270)
call UnitAddAbility(d,DummyAbilCode())
call IssueTargetOrder(d,"frostnova",u)
call UnitApplyTimedLife(d,'BTLF',2)
call DestroyEffect(AddSpecialEffect("Doodads\\Icecrown\\Rocks\\Icecrown_Crystal\\Icecrown_Crystal6.mdl",x,y))
call PauseUnit(u,true)
call PolledWait(.3)
call PauseUnit(u,false)
set u=null
set p=null
set d=null
endfunction
function icecond takes nothing returns boolean
return(GetSpellAbilityId()==IcyArmor())
endfunction
function iceact takes nothing returns nothing
local trigger t=CreateTrigger()
local boolexpr b=Condition(function FilterUnits)
local triggercondition tc=TriggerAddCondition(t,b)
local triggeraction ta=TriggerAddAction(t,function icyact)
local boolean ew=false
local unit u=GetSpellTargetUnit()
call DestroyBoolExpr(b)
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_DAMAGED)
loop
set ew=(GetUnitState(u,UNIT_STATE_LIFE)<=0)or(GetUnitAbilityLevel(u,IcyArmorBuffId())<1)
exitwhen ew==true
call TriggerSleepAction(1.00)
endloop
call DisableTrigger(t)
call TriggerRemoveCondition(t,tc)
call TriggerRemoveAction(t,ta)
call DestroyTrigger(t)
set t=null
set b=null
set tc=null
set ta=null
set u=null
endfunction
function InitTrig_icyarmor takes nothing returns nothing
set gg_trg_icyarmor=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_icyarmor,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_icyarmor,Condition(function icecond))
call TriggerAddAction(gg_trg_icyarmor,function iceact)
endfunction


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)