Knockback System Help

hunterrravyn

TH.net Regular
Reaction score
19
How would i change this to affect a passive ability?

Code:
function Trig_Pushback_Copy_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

function Trig_Pushback_Copy_Actions takes nothing returns nothing
    call UnitKnockTargetEx(GetTriggerUnit(), GetSpellTargetUnit(), GetUnitFacing(GetTriggerUnit()), 250.00, 2.00, 1.00, "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageDeathCaster.mdl", "origin")
endfunction

//===========================================================================
function InitTrig_Pushback_Copy takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trig, Condition(function Trig_Pushback_Conditions))
    call TriggerAddAction(trig, function Trig_Pushback_Actions)
    set trig = null
endfunction

Sincerly Hunterrravyn
 
Reaction score
341
1) use
JASS:
 tags. not code
2) <a href="http://clanmapz.com/forum/showthread.php?t=378" target="_blank" class="link link--external" rel="nofollow ugc noopener">How to create passive ablitys in jass</a>
 

saw792

Is known to say things. That is all.
Reaction score
280
When does the passive ability trigger? Just on attack?
 

hunterrravyn

TH.net Regular
Reaction score
19
power went out like 1hour ago...:mad:

uhh yes sry thats what i did mean that it triggers on attack.
 

hunterrravyn

TH.net Regular
Reaction score
19
As i said earlier im "trying" to learn jass....

so relly i have less then half a clue to what i am doing...
 
Reaction score
456
JASS:
function Trig_Pushback_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(), &#039;A002&#039;) &gt; 0
endfunction

function Trig_Pushback_Actions takes nothing returns nothing
    local unit attacker = GetAttacker()
    local unit attacked = GetTriggerUnit()
    local real angle = bj_RADTODEG * Atan2(GetUnitY(attacked) - GetUnitY(attacker), GetUnitX(attacked) - GetUnitX(attacker))
    
    call UnitKnockTargetEx(attacker, attacked, angle, 300.00, 50.00, 1.00, &quot;Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageDeathCaster.mdl&quot;, &quot;origin&quot;)

    set attacker = null
    set attacked = null
endfunction

//===========================================================================
function InitTrig_Pushback takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(trig, Condition(function Trig_Pushback_Conditions))
    call TriggerAddAction(trig, function Trig_Pushback_Actions)
endfunction


Now, if you read the instructions of the knockback system, you know what the parameters of the UnitKnockTargetEx function are.

The integer 'A002' in the condition (Trig_Pushback_Conditions) is the passive abilitys rawcode. You can check it by going to object editor, and pressing Ctrl+D.

The only con I can think of, is that this triggers when the unit begins attack, not when it damages.
 

hunterrravyn

TH.net Regular
Reaction score
19
I could make it wait for the time it takes the unit to attack....

But thank you very much Uberplayer
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top