Having trouble creating an AoE Stun

jedi8955

New Member
Reaction score
4
I've been having a hell of a time making an AoE Stun ability.

Here's the ability as designed:

Horrify
Stuns units in an AoE for a short amount of time.

Lv 1: 300 AoE 1.5 Sec
Lv 2: 300 AoE 2 Sec
Lv 3: 350 AoE 2.5 Sec
Lv 4: 350 AoE 3 Sec
Lv 5: 400 AoE 4 Sec

I originally made an ability (I think I made it off Tornado Stun, but I really can't remember any more, been a long time)and gave it AoE under the Stats- Area of Effect line. That didn't work.

Then I made a dummy unit and have that cast different abilities based on what level of Horrify the casting unit has. Didn't work.

I then remade the dummy abilities and based those off of Storm Bolt. No dice.

I really just dunno wtf I'm doing with it at this point. Any help would be greatly appreciated.

The current JASS code is as follows:

JASS:
function Trig_AoE_Horrify_Lv_5_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A025' ) ) then
        return false
    endif
    if ( not ( GetUnitAbilityLevelSwapped('A025', GetTriggerUnit()) == 5 ) ) then
        return false
    endif
    return true
endfunction

function Trig_AoE_Horrify_Lv_5_Func006A takes nothing returns nothing
    call IssueTargetOrderBJ( udg_Horrify_Dummy_Unit, "A053", GetEnumUnit() )
endfunction

function Trig_AoE_Horrify_Lv_5_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'n01D', Player(11), GetUnitLoc(GetSpellTargetUnit()), bj_UNIT_FACING )
    set udg_Horrify_Dummy_Unit = GetLastCreatedUnit()
    call UnitAddAbilityBJ( 'A053', udg_Horrify_Dummy_Unit )
    set udg_Horrify_Point = GetUnitLoc(GetSpellTargetUnit())
    set udg_Horrify_Group = GetUnitsInRangeOfLocAll(400.00, udg_Horrify_Point)
    call ForGroupBJ( udg_Horrify_Group, function Trig_AoE_Horrify_Lv_5_Func006A )
    call RemoveUnit( udg_Horrify_Dummy_Unit )
    call DestroyGroup(udg_Horrify_Group)
    call RemoveLocation(udg_Horrify_Point)
endfunction

//===========================================================================
function InitTrig_AoE_Horrify_Lv_5 takes nothing returns nothing
    set gg_trg_AoE_Horrify_Lv_5 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_AoE_Horrify_Lv_5, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_AoE_Horrify_Lv_5, Condition( function Trig_AoE_Horrify_Lv_5_Conditions ) )
    call TriggerAddAction( gg_trg_AoE_Horrify_Lv_5, function Trig_AoE_Horrify_Lv_5_Actions )
endfunction


I made the JASS code by coding it in GUI then converting to custom text, then replacing the IssueTargetOrder with the code of the ability.

Here's the GUI backup of what I converted.

Trigger:
  • AoE Horrify Lv 1 GUI Backup
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Horrify
      • (Level of Horrify for (Triggering unit)) Equal to 1
    • Actions
      • Unit - Create 1 DummyUnit (Custom Campaign) for Player 12 (Brown) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
      • Set Horrify_Dummy_Unit = (Last created unit)
      • Unit - Add Horrify (Dummy Lv 1) to Horrify_Dummy_Unit
      • Set Horrify_Point = (Position of (Target unit of ability being cast))
      • Set Horrify_Group = (Units within 300.00 of Horrify_Point)
      • Unit Group - Pick every unit in Horrify_Group and do (Actions)
        • Loop - Actions
          • Unit - Order Horrify_Dummy_Unit to Human Peasant - Repair (Picked unit)
      • Unit - Remove Horrify_Dummy_Unit from the game
      • Custom script: call DestroyGroup(udg_Horrify_Group)
      • Custom script: call RemoveLocation(udg_Horrify_Point)


The Human Peasant - Repair was changed to the custom code of the Horrify Dummy abilities.

Thanks again for any help!
 

jig7c

Stop reading me...-statement
Reaction score
123
your triggers

JASS:
scope Stun initializer Init
globals
 unit u
endglobals

function Conditions takes nothing returns 
 return (GetSpellAbilityId() == 'A025') and (GetUnitAbilityLevelSwapped('A025', GetTriggerUnit()) == 5)) //not sure about this second condition
endfunction

function ReturnTrue takes nothing returns boolean
 return true
endfunction

function Horrify takes nothing returns nothing
   call IssueTargetOrder( u, 'A053', GetEnumUnit() )
endfunction

function Actions takes nothing returns nothing
    local unit a = GetTriggerUnit()
    local location l = GetUnitLoc(u)
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local group g = CreateGroup ()
    local integer i
    if GetUnitLevel(a) == 1 then
     set i == 300
    elseif GetUnitLevel(a) == 2 then
     set i == 300
    elseif GetUnitLevel(a) == 3 then
     set i == 350
    elseif GetUnitLevel(a) == 4 then
     set i == 350
    elseif GetUnitLevel(a) == 5 then
     set i == 400
    endif

    set u = CreateUnit( Player (11), 'n01D', x, y, 360)
    call UnitAddAbility( u, 'A053')
    set g = GetUnitsInRangeOfLocAll(i, l) //this will including dead units as well as buildings...
    call ForGroup(g, Filter (function Horrify ))
    set u = null
    call DestroyGroup(g)
    call RemoveLocation(l)
    set a = null
endfunction

function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST, function ReturnTrue )
    call TriggerAddCondition(t, Condition( function Conditions ) )
    call TriggerAddAction(t, function Actions )
endfunction
endscope
//im not sure if this works or not, not tested


your GUI script
Trigger:
  • AoE Horrify Lv 1 GUI Backup
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Horrify
      • (Level of Horrify for (Triggering unit)) Equal to 1
    • Actions
      • Set point = (Position of (Target unit of ability being cast))
      • Set Horrify_Group = (Units within 300.00 of Horrify_Point) //this includes buildings too, just to let you know
      • Unit Group - Pick every unit in Horrify_Group and do (Actions)
        • Loop - Actions
          • Unit - Create 1 DummyUnit (Custom Campaign) for Player 12 (Brown) at (Point) facing Default building facing degrees
          • Add a .5 second generic expiration timer to (Last Created Unit)
          • Unit - Add Horrify (Dummy Lv 1) to Horrify_Dummy_Unit
          • Unit - Order Horrify_Dummy_Unit to Human - Storm Bolt (Picked Unit)
        • Custom script: call RemoveLocation(udg_point)
      • Custom script: call DestroyGroup(udg_Horrify_Group)
    • ------im not sure if this works or not, not tested-------


or use
War Stomp :)
 

Shura

New Member
Reaction score
45
What you are doing is incorrect. What you would want to do is have the trigger pick every unit is Horrify_Group, and then create a dummy for each unit in the group, and have the dummy cast an ability based off of Storm Bolt.
 

jedi8955

New Member
Reaction score
4
Awesome, thanks for the help!

Jig, thanks for cleaning up that code, I appreciate it. I don't fully understand the pure JASS code yet, but I can see that it's taking the 5 different triggers I had and condensing it into one. I'll end up GUIing it and then converting over for the actual map, since I'm more familiar with that, but mess around with the JASS code and see what I can figure out from it. Thanks for the warning about buildings, that's actually exactly what I'm looking for =)

Shura, thanks for explaining it all! I never saw anything about Dummies not being able to hit multiple units. No wonder everything's gone to pot, haha. Much appreciated.

Canons, I wanted this to be centered around a targeted unit. I could have modified the design, but why make it easy on myself? =)

I'm gonna go put this in the map and see what'll come out. Thanks again!
 

jedi8955

New Member
Reaction score
4
Ah hell, that didn't work.

Plugged in the GUI script like how Jig had it, nothing.

I then decided to add in a create special effect of Holy Bolt on the picked unit, so I could see if it was being affected,that didn't work either. Apparently, it's not even grabbing the units into a group.

I'm going to try the JASS solution posted tomorrow, after a good dose of unconsicousness.

Here's the current JASS code and GUI setup. Seems like it's just not doing squat.

JASS:
function Trig_AoE_Horrify_Lv_1_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A025' ) ) then
        return false
    endif
    if ( not ( GetUnitAbilityLevelSwapped('A025', GetTriggerUnit()) == 1 ) ) then
        return false
    endif
    return true
endfunction

function Trig_AoE_Horrify_Lv_1_Func003A takes nothing returns nothing
    set udg_Horrify_Point = GetUnitLoc(GetSpellTargetUnit())
    call CreateNUnitsAtLoc( 1, 'n01D', Player(11), udg_Horrify_Point, bj_UNIT_FACING )
    set udg_Horrify_Dummy_Unit = GetLastCreatedUnit()
    call UnitApplyTimedLifeBJ( 0.50, 'BTLF', udg_Horrify_Dummy_Unit )
    call UnitAddAbilityBJ( 'A02A', udg_Horrify_Dummy_Unit )
    call IssueTargetOrderBJ( udg_Horrify_Dummy_Unit, "A02A", GetEnumUnit() )
    call AddSpecialEffectLocBJ( GetUnitLoc(GetEnumUnit()), "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl" )
    call RemoveLocation(udg_Horrify_Point)
endfunction

function Trig_AoE_Horrify_Lv_1_Actions takes nothing returns nothing    
    set udg_Horrify_Group = GetUnitsInRangeOfLocAll(300.00, udg_Horrify_Point)
    call ForGroupBJ( udg_Horrify_Group, function Trig_AoE_Horrify_Lv_1_Func003A )
    call DestroyGroup(udg_Horrify_Group)
endfunction

//===========================================================================
function InitTrig_AoE_Horrify_Lv_1 takes nothing returns nothing
    set gg_trg_AoE_Horrify_Lv_1 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_AoE_Horrify_Lv_1, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_AoE_Horrify_Lv_1, Condition( function Trig_AoE_Horrify_Lv_1_Conditions ) )
    call TriggerAddAction( gg_trg_AoE_Horrify_Lv_1, function Trig_AoE_Horrify_Lv_1_Actions )
endfunction


Trigger:
  • AoE Horrify Lv 1 GUI Backup
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Horrify
      • (Level of Horrify for (Triggering unit)) Equal to 1
    • Actions
      • Set Horrify_Group = (Units within 300.00 of Horrify_Point)
      • Unit Group - Pick every unit in Horrify_Group and do (Actions)
        • Loop - Actions
          • Set Horrify_Point = (Position of (Target unit of ability being cast))
          • Unit - Create 1 DummyUnit (Custom Campaign) for Player 12 (Brown) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
          • Set Horrify_Dummy_Unit = (Last created unit)
          • Unit - Add a 0.50 second Generic expiration timer to Horrify_Dummy_Unit
          • Unit - Add Horrify (Dummy Lv 1) to Horrify_Dummy_Unit
          • Unit - Order Horrify_Dummy_Unit to Human Mountain King - Storm Bolt (Picked unit)
          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
            • Custom script: call RemoveLocation(udg_Horrify_Point)
      • Custom script: call DestroyGroup(udg_Horrify_Group)
 

Grymlax

Probably not around
Reaction score
138
I'ts not doing squat because your variables are fucked up.

Set Horrify_Group = (Units within 300.00 of Horrify_Point)
you try to set up a unit group before you set up the Horrify_Point. therefor no units will be picked.

Set Horrify_Point = (Position of (Target unit of ability being cast)) set this outside of the unitgroup loop and it should work better.

something like this


Trigger:
  • AoE Horrify Lv 1 GUI Backup
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Horrify
      • (Level of Horrify for (Triggering unit)) Equal to 1
    • Actions
      • Set Horrify_Point = (Position of (Target unit of ability being cast))
      • Set Horrify_Group = (Units within 300.00 of Horrify_Point)
      • Unit Group - Pick every unit in Horrify_Group and do (Actions)
        • Loop - Actions
          • Unit - Create 1 DummyUnit (Custom Campaign) for Player 12 (Brown) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
          • Set Horrify_Dummy_Unit = (Last created unit)
          • Unit - Add a 0.50 second Generic expiration timer to Horrify_Dummy_Unit
          • Unit - Add Horrify (Dummy Lv 1) to Horrify_Dummy_Unit
          • Unit - Order Horrify_Dummy_Unit to Human Mountain King - Storm Bolt (Picked unit)
          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
            • Custom script: call RemoveLocation(udg_Horrify_Point)
      • Custom script: call DestroyGroup(udg_Horrify_Group)


you should also use the event "a unit starts the effect of an ability" since your current trigger will fire before the spell takes mana and goes into cooldown.

and I think I should also mention that your spell will only work on level 1 because of your condition "(Level of Horrify for (Triggering unit)) Equal to 1" change that to "(Level of Horrify for (Triggering unit)) Equal to or greater than 1" if you wan't it to trigger on level 2-4 as well.
 

BlueMirage

Trust, but doubt.
Reaction score
39
Use Summon Infernal for stun and damage. Summon a unit that does not have a model, exists only for 1 second, and can't attack etc.
However, do make sure it does NOT have locust or it won't work.

DotA does it like this for Light Strike Array and Split Earth.
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
The unit can have locust it would work. The units durration MUST BE LONGER THE THE IMPACT DELAY.
E.g
1 sec impact delay
1.1 sec unit durration.
Also its cool to give the summoned unit a nice explosion effect.
 

BlueMirage

Trust, but doubt.
Reaction score
39
I'm quite sure it won't work if it has locust, because if it did, DotA's LSA dummy would have it.
 

jig7c

Stop reading me...-statement
Reaction score
123
FYI: i have re-edited my post above with the triggers in it...
 

jedi8955

New Member
Reaction score
4
I'ts not doing squat because your variables are fucked up.

Set Horrify_Group = (Units within 300.00 of Horrify_Point)
you try to set up a unit group before you set up the Horrify_Point. therefor no units will be picked.

Set Horrify_Point = (Position of (Target unit of ability being cast)) set this outside of the unitgroup loop and it should work better.

That's what I get for working on this at 2 in the morning, haha. I'll pull it out and see how it goes.

FYI: i have re-edited my post above with the triggers in it...

Awesome, I'll take a look.

Thanks!
 

jedi8955

New Member
Reaction score
4
Sorry this's taken so long to reply to, I just started a new job so things've been pretty hectic.

So I tried the fixes, nothing.

Tried basing something off of Summon Infernal, nothing.

Then just went in with the regular old Dreadlord, no mods, and tried his Inferno.

My units are unaffected by the stun!

No wonder this didn't work. Now I need to figure out why this isn't bloody workin. Work on it tomorrow after my 2nd day of training.

The units are structures and mechanicals. I guess one of those is throwing it off, but I don't know what.
 

jedi8955

New Member
Reaction score
4
God, 6 days. This new job's killing my free time. Ah well, bills gots to be paid.

Anyway, I've finally got this figured out. I basically just pause everything then unpause it. Stupid simple, I was way overthinking this.

Trigger:
  • AoE Horrify Lv 1 GUI
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Horrify
      • (Level of Horrify for (Triggering unit)) Equal to 1
    • Actions
      • Set Horrify_Point = (Position of (Target unit of ability being cast))
      • Set Horrify_Group = (Units within 300.00 of Horrify_Point)
      • Unit Group - Pick every unit in Horrify_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Not equal to Player 12 (Brown)
              • (Unit-type of (Picked unit)) Not equal to A Secret Unit
              • (Unit-type of (Picked unit)) Not equal to A Different Secret Unit
            • Then - Actions
              • Unit - Pause (Picked unit)
              • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Do nothing
      • Wait 1.50 seconds
      • Unit Group - Pick every unit in Horrify_Group and do (Actions)
        • Loop - Actions
          • Unit - Unpause (Picked unit)
      • Custom script: call DestroyGroup(udg_Horrify_Group)
      • Custom script: call RemoveLocation(udg_Horrify_Point)


Completely non-MUI, but there will only be one of the unit that uses this ability, so I'm not concerned.

The way that it's setup now, the stun effect goes away instantly. I can set up a Hashtable to clear it all out, but that can wait for now.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top