HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Effect when projectile collides

10-24-2006, 05:47 PM#1
aidan_124
I want a trigger to create and effect and deal damage when i projectile colides, is there any way to do this using an effect or is it only possible using trig, and if not how do you do it with trig? Here is the current attempt:
Collapse JASS:
function Conductance_Conditions takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == 'H000'
endfunction

function Conductance_Actions takes nothing returns nothing
local integer i
local integer l = GetUnitAbilityLevel(GetAttacker(),'A001')
set i = GetRandomInt(1,5)
call TriggerSleepAction(0.3)
if i == 3 then
    if GetUnitState(GetAttackedUnitBJ(),UNIT_STATE_LIFE) < 50*i then
        call AddSpecialEffect("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl",GetUnitX(GetAttackedUnitBJ()),GetUnitY(GetAttackedUnitBJ()))
        call TriggerSleepAction(0.05)
        call UnitDamageTarget(GetAttacker(),GetAttackedUnitBJ(),50*i,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
    else
        call AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl",GetAttackedUnitBJ(),"origin")  
        call UnitDamageTarget(GetAttacker(),GetAttackedUnitBJ(),50*i,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
endif
endif
call TriggerSleepAction(0.45)
call DestroyEffect(GetLastCreatedEffectBJ())
endfunction

function InitTrig_Conductance takes nothing returns nothing
local trigger gg_trg_Conductance
set gg_trg_Conductance = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Conductance,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_Conductance,Condition(function Conductance_Conditions))
call TriggerAddAction(gg_trg_Conductance,function Conductance_Actions)
endfunction
10-24-2006, 06:00 PM#2
BertTheJasser
ATTACKED EVENT fires when the unit starts fireing a projectile, and not when it hits the target. To match the results you want, you must use a system which provides a general damage event trigger event. (Vexorians attackdetection system 2 is very good). Then read the instructions of the system to learn what you have to do to create some fx at the projectile exploding.
But it would be much easier to use a custom model or (It's only a guess that this works) use a custom 'slow orb ability',use a custom ability with no effect, no damage (maybe chainlightning with no damage and 0 jumps) and use as target art your fx you want to have. (the last seems to be the easiest way to do it properly, but be beware, that then no other orbs will work anymore)