HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Resource for Auto - cast attack spell?

09-24-2007, 04:38 AM#1
waaaks
im asking, no not asking, begging for an auto cast attack spell template, i like to make one and followed emjlr3's tutorial, but still dont work...

i played desert of exile and used the naga witch that was transformed to a human with earth skills, and i saw her auto - cast attack spell which is very cool, i wonder how did they do that?

i dont care on what system u are using for the auto - cast attack spell, i just want 1

thanks in advance
09-24-2007, 05:02 AM#2
Pyrogasm
How 'bout you be more specific. What did the autocast spell do that you want to make a spell do?
09-24-2007, 05:16 AM#3
waaaks
i only need it to be simple, like make the unit poison, or damage the target equal to the caster's int

because all i need is the template

EDIT: going to school now, bye!
ill just check this post again
09-24-2007, 05:27 AM#4
Pyrogasm
That still doesn't explain what the ability does... but I would assume you could use Faerie Fire for it.
09-24-2007, 08:21 AM#5
Pheonix-IV
I think he's after an attack detect system.
09-24-2007, 11:29 AM#6
waaaks
Quote:
I think he's after an attack detect system.
yup, but i need it to be an auto cast attack spell

just like a searing arrow ability that damages the target equal to my heroes int
09-24-2007, 11:48 AM#7
Pheonix-IV
What you want is an attack detect system. I'm not sure exactly how you'd do the autocast bit, you'd probably have to do a check if the searing arrows spell was on autocast when the hero made the attack, store that somewhere, then when the damage lands, check to see if the spell was on autocast when the attack was made and if so do the extra stuff.

Only problem is it wouldn't work if you casted it like a spell rather than using it as an autocasted attack. But i can't think of any other way.
09-24-2007, 12:31 PM#8
emjlr3
if you followed my "template", which was also a tutorial, and still could not get it, what makes you think this will be any more fruitful?
09-24-2007, 12:33 PM#9
waaaks
ok i have a trigger copied from open dota

this spell is called galives of wisdom from silencer, just modified some functions inside, nad seems no errors, but it doesnt work in game, i dont know why?

this spell is based on searing arrows or poison arrows (Auto-cast spell)
and when the spell hits the target, it damages the target by % of the caster's intelligence

this is what i want but still doesnt work

note that i used cscache engine
Collapse JASS:
function Glaives_Damage_Spell takes nothing returns boolean
    return GetLearnedSkill()=='A000'and IsUnitIllusion(GetTriggerUnit())==false
endfunction

function Glaives_Damage_OnOff takes nothing returns boolean
    if(GetTriggerEventId()==EVENT_PLAYER_UNIT_ATTACKED)then
        if(GetUnitAbilityLevel(GetAttacker(),'A000')==0)then
            return false
        elseif(GetAttachedBoolean(GetTriggeringTrigger(),"OrbOn"))then
            if IsUnitType(GetTriggerUnit(),UNIT_TYPE_STRUCTURE)==false and GetAttacker()==GetAttachedUnit(GetTriggeringTrigger(),"Silencer")then
                return true
            endif
        else
            return false
        endif
    elseif(GetTriggerEventId()==EVENT_UNIT_ISSUED_ORDER)then
        if(GetIssuedOrderId()==OrderId("poisonarrows"))then
            call AttachBoolean(GetTriggeringTrigger(),"OrbOn",true)
        elseif(GetIssuedOrderId()==OrderId("unpoisonarrows"))then
            call AttachBoolean(GetTriggeringTrigger(),"OrbOn",false)
        endif
    elseif(GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT)then
        if(GetSpellAbilityId()=='A000')then
            return true
        else
            return false
        endif
    endif
    return false
endfunction

function Glaives_Damage_Main takes nothing returns nothing
    local texttag tg
    local real rm
    if UnitHasBuffBJ(GetTriggerUnit(),'Bpoi') or UnitHasBuffBJ(GetTriggerUnit(), 'Bpsd') or UnitHasBuffBJ(GetTriggerUnit(), 'Bpsi') and GetUnitAbilityLevel(GetEventDamageSource(),'A000')>0 and GetAttachedTrigger(GetTriggeringTrigger(),"Source")==GetEventDamageSource()then
        call DisableTrigger(GetTriggeringTrigger())
        set rm=.15*I2R(GetUnitAbilityLevel(GetEventDamageSource(),'A0LZ')*GetHeroInt(GetEventDamageSource(),true))
        set tg=CreateTextTagUnitBJ("+"+I2S(R2I(rm)),GetTriggerUnit(),64,10,1,85,86,15)
        call SetTextTagVelocityBJ(tg,64,90)
        call UnitDamageTargetBJ(GetEventDamageSource(),GetTriggerUnit(),rm,ATTACK_TYPE_HERO,DAMAGE_TYPE_DIVINE)
        call PolledWait(1)
        call DestroyTextTag(tg)
        call DisableTrigger(GetTriggeringTrigger())
    endif
endfunction

function Glaives_Damage_Event takes nothing returns nothing
    local trigger ltt=CreateTrigger()
    local unit lFB
    local unit lFb
    if(GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT)then
        set lFB=GetSpellTargetUnit()
        set lFb=GetTriggerUnit()
    else
        set lFB=GetTriggerUnit()
        set lFb=GetAttacker()
    endif
    if IsUnitIllusion(lFb)==false then
        call AttachObject(ltt,"Source",lFb)
        call TriggerRegisterUnitEvent(ltt,lFB,EVENT_UNIT_DAMAGED)
        call TriggerAddAction(ltt,function Glaives_Damage_Main)
    endif
    call PolledWait(2)
    call DisableTrigger(ltt)
endfunction

function Glaives_Damage_Run takes nothing returns nothing
    local unit lfo=GetTriggerUnit()
    local trigger ltt
    if GetUnitAbilityLevel(lfo,'A000')==1 then
        set ltt=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_ATTACKED)
        call TriggerRegisterUnitEvent(ltt,GetLearningUnit(),EVENT_UNIT_SPELL_EFFECT)
        call TriggerRegisterUnitEvent(ltt,GetLearningUnit(),EVENT_UNIT_ISSUED_ORDER)
        call TriggerAddCondition(ltt,Condition(function Glaives_Damage_OnOff))
        call TriggerAddAction(ltt,function Glaives_Damage_Event)
        call AttachObject(ltt,"Silencer",lfo)
    endif
endfunction

function InitTrig_GlaivesOfWisdom takes nothing returns nothing
    local trigger ltt=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_HERO_SKILL)
    call TriggerAddCondition(ltt,Condition(function Glaives_Damage_Spell))
    call TriggerAddAction(ltt,function Glaives_Damage_Run)
endfunction