Problem with an Esnare Spell!

Da_HP_Geek

New Member
Reaction score
8
I got some problem with this Esnare Spell. I just Ensnare 1, when I will Ensnare all in the AoE... Pllz tell me whats wrong or edit in the map and save it!

JASS:
scope MassEnsnare initializer EnsnareInit

globals
    private integer MAIN_ABILITY = 'A000'
    private integer DUMMY_UNIT = 'h000'
    
    private group UnitGroup = CreateGroup()
    private unit u
    private unit dummy
endglobals

private function DetectSpell takes nothing returns boolean
    if GetSpellAbilityId() == MAIN_ABILITY then
    return true
    endif
    return false
endfunction

private function FilterUnits takes nothing returns boolean
    local unit ta = GetFilterUnit()
    return IsUnitAliveBJ(ta) == true and IsUnitOwnedByPlayer(ta, GetOwningPlayer(u)) == false and IsPlayerAlly(GetOwningPlayer(ta), GetOwningPlayer(u)) == false
endfunction

private function DoThis takes nothing returns nothing
    call IssueTargetOrder(dummy, "ensnare", GetEnumUnit())
endfunction

private function Actions takes nothing returns nothing
    local location UL
    local location LOC = GetSpellTargetLoc()
    set u = GetTriggerUnit()
    set UL = GetUnitLoc(u)
    set dummy = CreateUnitAtLoc(GetOwningPlayer(u), 'h000', GetUnitLoc(u), bj_UNIT_FACING)
    call GroupEnumUnitsInRangeOfLoc(UnitGroup, LOC, 300.00, Condition(function FilterUnits))
    call ForGroup(UnitGroup, function DoThis)
    call GroupClear(UnitGroup)
endfunction

private function EnsnareInit takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function DetectSpell))
    call TriggerAddAction(t, function Actions)
endfunction
endscope
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Instead of posting a map, why not the code itself?
 

jig7c

Stop reading me...-statement
Reaction score
123
post your ensare triggers, if you have any in this forum... it is much easier and faster for us to help you...
 
Reaction score
456
Is this written by you? Try creating the dummy in the ForGroup callback.. meaning that 1 dummy per 1 spell target.
 

Da_HP_Geek

New Member
Reaction score
8
Actually not ;) A friend made it for me, but he couldn't get it to work... And he was to lazy to ask whats wrong so I have to do it ^^
 

Tamisrah

Active Member
Reaction score
16
I believe you even need one dummy caster per target. SpellCast isn't instant so the caster gets only one order if you order it multiple times in one function/thread without waits.
 

l1lshadow

New Member
Reaction score
4
I had a problem like this too I think it's the spell cooldown and/or mana cost.
Edit: I did not see file sorry don't read this =].
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
Its not the dummy is the spell, you need to make a dummy for each unit that ends up being targeted.

JASS:
set dummy = CreateUnitAtLoc(GetOwningPlayer(u), 'h000', GetUnitLoc(u), bj_UNIT_FACING)


Move this line up to your forgroup function so a dummy is made for each unit. Also remember to give the dummy an expiration timer afterwards. Otherwise you'll clog of memroy with dummies that aren't' being used.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top