• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Solved] current that passes through enemy units

Not open for further replies.
Level 6
Apr 16, 2011
the intent of this code should be so that when my unit attack their attack to create a current that passes through enemy units.

I lose myself when I use a code for other codes as a reference :Z :goblin_wtf:
I am very confused

A001 = skill that generates the buff
B000 = buff is used to check
n00Z = dummy
A002 = ability dummy

function Trig_Raw takes nothing returns nothing

function Trig_unit_attacked takes nothing returns boolean
   if (not(GetUnitAbilityLevel(GetTriggerUnit(), 'B000') > 0))then
    return false
    return true

function Trig_chainlightning takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit e = GetEnumUnit()
    local unit d = CreateUnit(GetOwningPlayer(u),'n00Z',GetUnitX(e),GetUnitY(e),0)
    call UnitAddAbility(d,'A002')
    call SetUnitAbilityLevel(d,'A002',GetUnitAbilityLevel(u,'A001')+4)
    call IssueTargetOrder(d,"chainlightning",e)
    call UnitApplyTimedLife(d,'BTLF',3)
    set e = null
    set d = null

function InitTrig_Statick_fild takes nothing returns nothing
    set gg_trg_Statick_fild = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Statick_fild, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Statick_fild, Condition( function Trig_unit_attacked ) )
    call TriggerAddAction( gg_trg_Statick_fild, function Trig_Raw )

I feel that something is missing, maybe I need GetFilterUnit ()

me a light ... :goblin_boom:
Level 12
Jul 11, 2010
You don't use the chainlightning function.

Replace :
call TriggerAddAction( gg_trg_Statick_fild, function Trig_Raw )
by :
call TriggerAddAction( gg_trg_Statick_fild, function Trig_chainlightning )

Another problem is that you use "GetEnumUnit()", which is the jass function for "Picked unit" in GUI and is totally out of purpose here. This gives the attacked and the attacking unit :
local unit attackedUnit = GetTriggerUnit()
local unit attackingUnit = GetAttacker()
Not open for further replies.