• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] current that passes through enemy units

Status
Not open for further replies.
Level 6
Joined
Apr 16, 2011
Messages
158
Hello
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

JASS:
function Trig_Raw takes nothing returns nothing
endfunction

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

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
endfunction

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 )
endfunction


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

me a light ... :goblin_boom:
 
You don't use the chainlightning function.

Replace :
JASS:
call TriggerAddAction( gg_trg_Statick_fild, function Trig_Raw )
by :
JASS:
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 :
JASS:
local unit attackedUnit = GetTriggerUnit()
local unit attackingUnit = GetAttacker()
 
Status
Not open for further replies.
Top