• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Mass Entangling Roots not fully working

Status
Not open for further replies.
Level 19
Joined
Oct 7, 2014
Messages
2,209
As the title says I'm trying to make a mass entangling roots but it only entangles two units and it seems that it only entangles another unit if the previously entangled unit dies.

Here is the triggers:
  • Interweaving Vines Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Interweaving Vines
    • Actions
      • Set TargetPoint = (Target point of ability being cast)
      • Unit - Create 1 Dummy (Vexorian, Anitarf, Infrane) for (Triggering player) at TargetPoint facing 0.00 degrees
      • Set TempUnit = (Last created unit)
      • Set ID = (Custom value of TempUnit)
      • Set IVines_Caster[ID] = (Triggering unit)
      • Set TempReal = (Real((Level of (Ability being cast) for IVines_Caster[ID])))
      • Unit - Add Entangling Roots (Dummy) to TempUnit
      • Unit - Set level of Entangling Roots (Dummy) for TempUnit to (Integer(TempReal))
      • Set IVines_Radius[ID] = 200.00
      • Set IVines_Duration[ID] = (5.00 + TempReal)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (IVines_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn on Interweaving Vines Loop <gen>
        • Else - Actions
      • Unit Group - Add TempUnit to IVines_Group
      • Custom script: call RemoveLocation(udg_TargetPoint)
  • Interweaving Vines Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in IVines_Group and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set ID = (Custom value of TempUnit)
          • Set TempPlayer = (Owner of TempUnit)
          • Set CenterPoint = (Position of TempUnit)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within IVines_Radius[ID] of CenterPoint) and do (Actions)
            • Loop - Actions
              • Set TargetUnit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TargetUnit belongs to an enemy of TempPlayer) Equal to True
                • Then - Actions
                  • Unit - Order TempUnit to Night Elf Keeper Of The Grove - Entangling Roots TargetUnit
                  • Unit Group - Remove TargetUnit from (Units within IVines_Radius[ID] of CenterPoint)
                • Else - Actions
          • Custom script: call RemoveLocation(udg_CenterPoint)
          • Set IVines_Duration[ID] = (IVines_Duration[ID] - 0.03)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IVines_Duration[ID] Less than or equal to 0.00
            • Then - Actions
              • Unit Group - Remove TempUnit from IVines_Group
              • Unit - Remove TempUnit from the game
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (IVines_Group is empty) Equal to True
                • Then - Actions
                  • -------- --------
                  • -------- Turn off this trigger as it's currently doing nothing --------
                  • -------- --------
                  • Trigger - Turn off Interweaving Vines Loop <gen>
                • Else - Actions
            • Else - Actions
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
If I understand correctly, you just want an AoE Entangling Roots.

lIf that's the case, you don't need the loop.
First, create a dummy unit (doesn't matter where). Then just Pick all units within the target point at a certain radius, if the picked unit is an enemy and non-structure/non-magic immune, change the position of dummy to location of picked unit then order the dummy to cast the real entangling roots.
Don't forget to clear the leaks, add expiration timer to dummy, add the real entangling roots to dummy and set the appropriate level.

Btw, in your trigger, use a Temp_Integer so you don't have to convert the level to real and then convert back to integer.
 
Level 19
Joined
Oct 7, 2014
Messages
2,209
Something like this?
Is this MUI? efficient enough?
  • Interweaving Vines Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Interweaving Vines
    • Actions
      • Set TargetPoint = (Target point of ability being cast)
      • Set ID = (Custom value of (Triggering unit))
      • Set IVines_Caster[ID] = (Triggering unit)
      • Set IVines_Radius[ID] = 200.00
      • Set TempInteger = (Level of Interweaving Vines for IVines_Caster[ID])
      • Unit - Create 1 Dummy (Vexorian, Anitarf, Infrane) for (Triggering player) at TargetPoint facing 0.00 degrees
      • Set TempUnit = (Last created unit)
      • Unit - Add a 3.00 second Generic expiration timer to TempUnit
      • Unit - Add Entangling Roots (Dummy) to TempUnit
      • Unit - Set level of Entangling Roots (Dummy) for TempUnit to TempInteger
      • Unit Group - Pick every unit in (Units within IVines_Radius[ID] of TargetPoint) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Triggering player)) Equal to True
            • Then - Actions
              • Unit - Order TempUnit to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TargetPoint)
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
Almost, clear the unit group leak. And it turns out, you might also wanna check if it is not a structure/magic immune. That way, it will be ordered less at a time. Make sure that the real entangling roots has no manacost and cooldown. And make the expiration timer less (like 0.1 sec). And you don't need the ID.
And currently, it won't hit enemies in fog since you didn't change the location of the dummy to the location of the target unit

Here is an example of a spell using a single dummy caster per spell instance. It's residing in my PasteBin incase of situations like this.

http://www.hiveworkshop.com/forums/pastebin.php?id=bezq5o

PS: I forgot how the trigger in that demo looks like, but the point is using a single dummy caster per spell instance not per target.
 
Level 19
Joined
Oct 7, 2014
Messages
2,209
Is this good?
  • Interweaving Vines Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Interweaving Vines
    • Actions
      • Set TargetPoint = (Target point of ability being cast)
      • Set IVines_Caster = (Triggering unit)
      • Set IVines_Radius = 200.00
      • Set TempInteger = (Level of Interweaving Vines for IVines_Caster)
      • Unit - Create 1 Dummy (Vexorian, Anitarf, Infrane) for (Triggering player) at TargetPoint facing 0.00 degrees
      • Set TempUnit = (Last created unit)
      • Unit - Add a 0.30 second Generic expiration timer to TempUnit
      • Unit - Add Entangling Roots (Dummy) to TempUnit
      • Unit - Set level of Entangling Roots (Dummy) for TempUnit to TempInteger
      • Set TempGroup = (Units within IVines_Radius of TargetPoint)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Triggering player)) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is Magic Immune) Equal to False
            • Then - Actions
              • Unit - Move TempUnit instantly to (Position of (Picked unit))
              • Unit - Order TempUnit to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TargetPoint)
      • Custom script: call DestroyGroup(udg_TempGroup)
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
Almost, just a location leak in the unit group.. I'm refering to the Position of Picked Unit. Also, you might wanna store Picked Unit to another temp variable (e.g. TempUnit2) for some little efficiency so that you don't have to call Picked Unit several times.

And also, if the radius does not change with level, no point in storing it to a variable. As well as other variables only used one such as Caster and Level. But if it's for readability, then it's fine.
 
Status
Not open for further replies.
Top