HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Glaives of Wisdom (Auto-cast)

09-25-2007, 04:01 AM#1
waaaks
ok i have a trigger copied from open dota

this spell is called galives of wisdom from silencer, just modified some functions inside, and 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
09-25-2007, 05:15 AM#2
botanic
it is only possible to detect the buff from an autocast like cold arrows you cant detect a normal autocast
09-25-2007, 05:59 AM#3
DioD
this spell works perfect, cscache is not valid "core" dota uses simple handle vars.

simply add debug messages
09-25-2007, 11:00 AM#4
waaaks
its not searing arrows, its poison arrows, poison arrows has buffs, so...it detects the buff

i dont know how to add debug messages?
09-26-2007, 07:04 AM#5
Pyrogasm
call BJDebugMsg("Debugging!")
09-26-2007, 10:22 AM#6
waaaks
if i add that debug message, does that means my trigger works?

oh yeah, and what are debug message suppose to do?
09-26-2007, 11:30 AM#7
The Elite
tell you what part of the trigger is not working
and no, it doesnt automatically make your trigger work
09-27-2007, 05:04 AM#8
waaaks
ahh....ok

im using newgen, and whenever i used a spell with jass, it gives me a message about some location created but not used in my trigger...i though this what debugmessage...

so for debug message, what string do i put inside?
Collapse JASS:
BJDebugMsg("what do i put here?")
09-27-2007, 05:09 AM#9
Pyrogasm
Anything that helps you see if your code is working. I could just be a random string that you display to make sure the trigger is running, or maybe you use it to display the name of a specific unit.
09-28-2007, 05:40 AM#10
waaaks
ah ok...
09-28-2007, 01:24 PM#11
DioD
i always call name of every funtion ran
99% times last executed function is bugged (if execution broken before finished)
10-07-2007, 04:47 PM#12
Dg!Mortal
Where Did you Find an Open DotA? :D
10-07-2007, 11:46 PM#13
Pyrogasm
It's on TheHelper.net.

I won't link you to it because I despise it.
10-08-2007, 07:44 AM#14
Dg!Mortal
you mean that DotA template?
10-08-2007, 07:10 PM#15
Pyrogasm
Maybe not. In that case I have no idea where to find an "Open DotA".