копировал с опен доты скилл дриады заменил сделал чтобы работал на 1.24. Карта сохраняется всё норм но скилл на работает
function Trig_Impetus_Conditions takes nothing returns boolean
if(GetLearnedSkill()!='A002'and IsUnitIllusion(GetTriggerUnit())==false)then
return false
endif
return true
endfunction
function Impetus_OnOff takes nothing returns boolean
if GetTriggerEventId()==EVENT_PLAYER_UNIT_ATTACKED then
if GetUnitAbilityLevel(GetAttacker(),'A002')==0 then
return false
elseif LoadBoolean(udg_Hash,GetHandleId(GetTriggeringTrigger()),StringHash("OrbOn"))then
if IsUnitType(GetTriggerUnit(),UNIT_TYPE_STRUCTURE)==false and GetAttacker()==LoadUnitHandle(udg_Hash,GetHandleId(GetTriggeringTrigger()),StringHash("Enchantress"))then
return true
endif
else
return false
endif
elseif GetTriggerEventId()==EVENT_UNIT_ISSUED_ORDER then
if GetIssuedOrderId()==852255then
call SaveBoolean(udg_Hash,GetHandleId(GetTriggeringTrigger()),StringHash("OrbOn"),true)
elseif GetIssuedOrderId()==852256then
call SaveBoolean(udg_Hash,GetHandleId(GetTriggeringTrigger()),StringHash("OrbOn"),false)
endif
elseif GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT then
if GetSpellAbilityId()=='A002'then
return true
else
return false
endif
endif
return false
endfunction
function Impetus_Range takes real px1,real py1,real px2,real py2 returns real
return SquareRoot(((px1-px2)*(px1-px2))+((py1-py2)*(py1-py2)))
endfunction
function Impetus_Main takes nothing returns nothing
local texttag lgg
local real ldd
if UnitHasBuffBJ(GetTriggerUnit(),'B000') and GetUnitAbilityLevel(GetEventDamageSource(),'A002')>0 and LoadUnitHandle(udg_Hash,GetHandleId(GetTriggeringTrigger()),StringHash("Source"))==GetEventDamageSource()then
call DisableTrigger(GetTriggeringTrigger())
set ldd=.04*I2R(GetUnitAbilityLevel(GetEventDamageSource(),'A002'))*Impetus_Range(GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),GetUnitX(GetEventDamageSource()),GetUnitY(GetEventDamageSource()))
if(ldd>400)then
set ldd=400
endif
set lgg=CreateTextTagUnitBJ("+"+I2S(R2I(ldd)),GetTriggerUnit(),64,10,1,85,86,15)
call SetTextTagVelocityBJ(lgg,64,90)
call UnitDamageTargetBJ(GetEventDamageSource(),GetTriggerUnit(),ldd,ATTACK_TYPE_HERO,DAMAGE_TYPE_DIVINE)
call PolledWait(1)
call DestroyTextTag(lgg)
call DisableTrigger(GetTriggeringTrigger())
endif
endfunction
function Impetus_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 SaveUnitHandle(udg_Hash,GetHandleId(ltt),StringHash("Source"),lFb)
call TriggerRegisterUnitEvent(ltt,lFB,EVENT_UNIT_DAMAGED)
call TriggerAddAction(ltt,function Impetus_Main)
endif
call PolledWait(2)
call DisableTrigger(ltt)
endfunction
function Trig_Impetus_Actions takes nothing returns nothing
local unit lfo=GetTriggerUnit()
local trigger ltt
local integer lmZ=GetUnitAbilityLevel(lfo,'A002')
if(lmZ==1)then
set ltt=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerRegisterUnitEvent(ltt,lfo,EVENT_UNIT_SPELL_EFFECT)
call TriggerRegisterUnitEvent(ltt,lfo,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(ltt,Condition(function Impetus_OnOff))
call TriggerAddAction(ltt,function Impetus_Event)
call SaveUnitHandle(udg_Hash,GetHandleId(ltt),StringHash("Enchantress"),lfo)
endif
endfunction
function InitTrig_Impetus takes nothing returns nothing
set gg_trg_Impetus=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Impetus,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(gg_trg_Impetus,Condition(function Trig_Impetus_Conditions))
call TriggerAddAction(gg_trg_Impetus,function Trig_Impetus_Actions)
endfunction