• 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] need help to utilizing it and fixing leak

Level 12
Joined
Nov 13, 2010
Messages
254
hey hive.

i made a spell Ensnare AOE. and i need need help to utilizing it and fixing leaks on it.
that my coding skills is not that good

  • Ensnare AOE
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ensnare
    • Actions
      • Set VariableSet Ensnare_AOE = (Units within 400.00 of (Target point of ability being cast) matching (((Matching unit) belongs to an enemy of (Triggering player).) Equal to True).)
      • Set VariableSet Ensnare_Targetpoint = (Target point of ability being cast)
      • Set VariableSet Ensnare_TargetUnit = (Target unit of ability being cast)
      • Unit Group - Pick every unit in Ensnare_AOE and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Ensnare Dummy for (Owner of (Casting unit)) at (Target point of ability being cast) facing Default building facing degrees
          • Unit - Add Ensnare AOE to (Last created unit)
          • Unit - Set level of Ensnare AOE for (Last created unit) to (Level of Ensnare for (Triggering unit))
          • Unit - Order (Last created unit) to Orc Raider - Ensnare (Picked unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Remove (Last created unit) from the game
      • Unit Group - Pick every unit in (Units within 380.00 of Ensnare_Targetpoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Caster).) Equal to True))).) and do (Actions)
        • Loop - Actions
          • Unit - Cause Caster to damage (Picked unit), dealing (Real((Intelligence of Caster (Include bonuses)))) damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_Ensnare_AOE)
      • Custom script: set bj_wantDestroyGroup = true
 
Level 42
Joined
Feb 27, 2007
Messages
5,322
  • A resource: Things That Leak
  • Targetpoint and TargetUnit are assigned values but they're never actually used for anything. Anywhere you have used Target point of ability being cast you should instead use Ensnare_Targetpoint. You could make a couple more variables for useful things like Triggering Unit or Level of (Ability being cast) or Real((Intelligence of Caster (Include bonuses)))) if you really wanted to. There appears to be a Caster variable that's referenced but never assigned here?
  • Why is there a target point and unit? A spell COULD have both but usually that's not what you want. I think you want to use an AoE target, so TargetUnit is pointless.
  • Why are you manually removing the last created unit from the game?
  • Why is there a second area search that's 380 radius instead of the 400-radius search that was done above? I see it has a different filter, but you could use the first loop to check for such things as well with an If-block. No reason to ensnare dead units or structures in the first half either, so they look like they really can be combined into one loop.
  • If you're using the bj_wantDestroy method for groups, you don't need to use a group variable to 'retain' the group to be deleted. You simply set that bj_ global and then use any Unit Group - Pick function which will detect the boolean and destroy the group if desired.
  • Are your dummies properly configured to cast in that 1 second? A 'correct' dummy has: 0 move speed, movement type: NONE, cast backswing: 0, cast point: 0, ability: locust, and then no model/shadow/minimap/food/etc.. Such a unit will cast instantly in any direction without having to turn; this casts so fast you can actually use a single dummy to cast all of them.
  • Ensnare AOE
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ensnare
    • Actions
      • Set Ensnare_Caster = (Triggering Unit)
      • Set Ensnare_DMG = (Real((Intelligence of Ensnare_Caster (Include bonuses))))
      • Set Ensnare_Targetpoint = (Target point of ability being cast)
      • Set Ensnare_AOE = (Units within 400.00 of Ensnare_Targetpoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Ensnare_Caster).) Equal to True))).) and do (Actions)
      • Unit Group - Pick every unit in Ensnare_AOE and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Ensnare Dummy for (Owner of Ensnare_Caster) at Ensnare_Targetpoint facing Default building facing degrees
          • Unit - Add Ensnare AOE to (Last created unit)
          • Unit - Set level of Ensnare AOE for (Last created unit) to (Level of Ensnare for Ensnare_Caster)
          • Unit - Order (Last created unit) to Orc Raider - Ensnare (Picked unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Cause Ensnare_Caster to damage (Picked unit), dealing Ensnare_DMG damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_Ensnare_AOE)
      • Custom script: call RemoveLocation(udg_Ensnare_Targetpoint)
Alternative using one dummy and no group variable:
  • Ensnare AOE
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ensnare
    • Actions
      • Set Ensnare_Caster = (Triggering Unit)
      • Set Ensnare_DMG = (Real((Intelligence of Ensnare_Caster (Include bonuses))))
      • Set Ensnare_Targetpoint = (Target point of ability being cast)
      • Unit - Create 1 Ensnare Dummy for (Owner of Ensnare_Caster) at Ensnare_Targetpoint facing Default building facing degrees
      • Set Ensnare_Dummy = (Last created unit)
      • Unit - Add Ensnare AOE to Ensnare_Dummy
      • Unit - Set level of Ensnare AOE for Ensnare_Dummy to (Level of Ensnare for Ensnare_Caster)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 400.00 of Ensnare_Targetpoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Ensnare_Caster).) Equal to True))).) and do (Actions) and do (Actions)
        • Loop - Actions
          • Unit - Order (Ensnare_Dummy) to Orc Raider - Ensnare (Picked unit)
          • Unit - Cause Ensnare_Caster to damage (Picked unit), dealing Ensnare_DMG damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_Ensnare_Targetpoint)
 
Last edited:
Level 12
Joined
Nov 13, 2010
Messages
254
i did what you sad pyrogasm and made this
  • Ensnare AOE
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ensnare
    • Actions
      • Set VariableSet Ensnare_Caster = (Triggering unit)
      • Set VariableSet Ensnare_DMG = (Real((Intelligence of Ensnare_Caster (Include bonuses))))
      • Set VariableSet Ensnare_Targetpoint = (Target point of ability being cast)
      • Unit - Create 1 Ensnare Dummy for (Owner of Ensnare_Caster) at (Target point of ability being cast) facing Default building facing degrees
      • Set VariableSet Ensnare_Dummy = (Last created unit)
      • Unit - Add Ensnare AOE to Ensnare_Dummy
      • Unit - Set level of Ensnare AOE for Ensnare_Dummy to (Level of Ensnare for Ensnare_Caster)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 400.00 of Ensnare_Targetpoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Caster).) Equal to True))).) and do (Actions)
        • Loop - Actions
          • Unit - Order Ensnare_Dummy to Orc Raider - Ensnare (Picked unit)
          • Unit - Cause Ensnare_Caster to damage (Picked unit), dealing Ensnare_DMG damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_Ensnare_Targetpoint)
but no damage
 
Level 42
Joined
Feb 27, 2007
Messages
5,322
The Unit Group - Pick line references the Caster variable not Ensnare_Caster. You also missed a place you're still using Target point of ability being cast instead of the variable.

Yes you can use such methods for other similar abilities. Their used variables will not conflict because these triggers shouldn't cause each other to fire.
 
Level 12
Joined
Nov 13, 2010
Messages
254
The Unit Group - Pick line references the Caster variable not Ensnare_Caster. You also missed a place you're still using Target point of ability being cast instead of the variable.

Yes you can use such methods for other similar abilities. Their used variables will not conflict because these triggers shouldn't cause each other to fire.
thanks a lot for the help
 
Level 23
Joined
Feb 27, 2019
Messages
767
I prefer to structure groups somewhat like this to remove a lot of the hassle with endless and unreadable windows in gui.
  • Actions
    • Set VariableSet Group = (Units within 512.00 of (Center of (Playable map area)).)
    • Unit Group - Pick every unit in Group and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is A structure) Equal to False
            • ((Picked unit) is alive) Equal to True
            • ((Picked unit) is invulnerable) Equal to False
          • Then - Actions
            • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
          • Else - Actions
    • Custom script: call DestroyGroup(udg_Group)
configure condition.png
 
Level 12
Joined
Nov 13, 2010
Messages
254

Pyrogasm.​

so i did some tests.

this one only Ensnare one unit

  • Ensnare AOE
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ensnare
    • Actions
      • Set VariableSet Ensnare_Caster = (Triggering unit)
      • Set VariableSet Ensnare_DMG = ((Real((Intelligence of Ensnare_Caster (Include bonuses)))) x 2.00)
      • Set VariableSet Ensnare_Targetpoint = (Target point of ability being cast)
      • Unit - Create 1 Ensnare Dummy for (Owner of Ensnare_Caster) at Ensnare_Targetpoint facing Default building facing degrees
      • Set VariableSet Ensnare_Dummy = (Last created unit)
      • Unit - Add Ensnare AOE to Ensnare_Dummy
      • Unit - Set level of Ensnare AOE for Ensnare_Dummy to (Level of Ensnare for Ensnare_Caster)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 400.00 of Ensnare_Targetpoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Ensnare_Caster).) Equal to True))).) and do (Actions)
        • Loop - Actions
          • Unit - Order Ensnare_Dummy to Orc Raider - Ensnare (Picked unit)
          • Unit - Cause Ensnare_Caster to damage (Picked unit), dealing Ensnare_DMG damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_Ensnare_Targetpoint)
but this one works fine it do damage to all units and Ensnare them all.
  • Ensnare AOE 2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ensnare
    • Actions
      • Set VariableSet Ensnare_Caster = (Triggering unit)
      • Set VariableSet Ensnare_DMG = ((Real((Intelligence of Ensnare_Caster (Include bonuses)))) x 2.00)
      • Set VariableSet Ensnare_Targetpoint = (Target point of ability being cast)
      • Set VariableSet Ensnare_AOE = (Units within 400.00 of Ensnare_Targetpoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Ensnare_Caster).) Equal to True))).)
      • Unit Group - Pick every unit in Ensnare_AOE and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Ensnare Dummy for (Owner of Ensnare_Caster) at Ensnare_Targetpoint facing Default building facing degrees
          • Unit - Add Ensnare AOE to (Last created unit)
          • Unit - Set level of Ensnare AOE for (Last created unit) to (Level of Ensnare for Ensnare_Caster)
          • Unit - Order (Last created unit) to Orc Raider - Ensnare (Picked unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Cause Ensnare_Caster to damage (Picked unit), dealing Ensnare_DMG damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_Ensnare_AOE)
      • Custom script: call RemoveLocation(udg_Ensnare_Targetpoint)
why ? ...
 
Last edited:

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,392
It's the Dummy unit without a doubt. There needs to be a PSA about how to create one of these, almost every single person asking for help is using them wrong and every single tutorial about them is wrong.

@polardude
Step 1: Copy and paste the Locust. (Found in Undead/Special section)
Step 2: Set Movement Type to None and Speed Base to 0. (Dummy can now cast spells instantly without turning)
Step 3: Set Attacks Enabled to None.
Step 4: (optional) Disable model, disable shadow, add infinite mana

Then of course double check your Dummy ability, it's meant to be free and have no limitations so set the Mana Cost to 0 and Cast Range to 99999. Also, double check the Targets Allowed.
 
Last edited:
Top