• 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.

[Spell] How to make single target spells AOE

Status
Not open for further replies.
Level 3
Joined
Nov 24, 2009
Messages
29
I would like to make an entangling roots spell an AOE spell. Where all units within the affected area gets rooted. This is a targeted aoe root spell. I have tried using triggers to do it but I do not know how to use multiple dummy units to cast root at the same time. Also, I fear that using multiple dummy units at once may cause bugs/leaks etc.

The spell would root X targets within this targeted area. And while I am it, can someone tell me how to do knockback spells or redirect me to a tutorial or sorts?
Thanks
 
Level 11
Joined
Nov 15, 2007
Messages
800
Creating units won't cause "bugs/leaks" unless you do it incorrectly. I wrote this outside of the editor so it might look a little different, but


  • Trigger
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Mass Entangle
    • Actions
      • -------- For the point leak - set to a variable so it can be destroyed later. This will also be done for the unit group later. --------
      • Set Point = (Target point of ability being cast)
      • -------- For the unit group leak - same as point. Unit groups also leak unless destroyed after used. --------
      • Set Group = Units in range of Point matching (Matching unit belongs to an enemy of (Triggering player)) equal to True and (Whatever other conditions you want - ex. ground units only)
      • -------- Now we destroy the point so the variable can be recycled, since we no longer need the point it was referencing --------
      • Custom script: Call RemoveLocation(udg_Point)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Set Point = (Position of (Picked unit))
        • Unit - Create 1 Dummy at Point facing Default building facing.
        • Unit - Add a 1 second generic expiration timer to (Last created unit)
        • -------- Of course if your dummy doesn't have the necessary abilities and/or your ability has multiple levels, you'll add the ability and set its level as necessary here. --------
        • Unit - Order (Last created unit) to Night Elf Keeper of the Grove - Entangling Roots (Picked unit)
        • -------- Here we destroy the point once more, else it will be overwritten and leak during the loop. --------
        • Custom script: Call RemoveLocation(udg_Point)
      • -------- And now that the group has been used, we clean up the last leak. --------
      • Custom script: Call DestroyGroup(udg_Group)
It's not a very complex trigger.

The only thing I could find on knockbacks is a vJass tut: http://www.hiveworkshop.com/forums/...s-280/coding-efficient-knockback-vjass-41418/. I suspect making a knockback would be rather difficult (if not impossible) in GUI. But if someone can prove me wrong on that, it sure wouldn't hurt my feelings.

Knockbacks aren't particularly difficult in GUI with the use of hashtables, but I suspect they are less efficient.

Here's one I made earlier today.


  • Knockback
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in KBGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in KBGroup and do (Actions)
            • Loop - Actions
              • Set unit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (unit is alive) Equal to False
                • Then - Actions
                  • Unit Group - Remove unit from KBGroup
                  • Hashtable - Clear all child hashtables of child int in KBTable
                • Else - Actions
                  • Set int = (Key (Picked unit))
                  • Set loc = (Position of unit)
                  • Set loc2 = (loc offset by (Load (Key distance) of int from KBTable) towards (Load (Key angle) of int from KBTable) degrees)
                  • Set real = (Load (Key duration) of int from KBTable)
                  • Custom script: call SetUnitX(udg_unit, GetLocationX(udg_loc2))
                  • Custom script: call SetUnitY(udg_unit, GetLocationY(udg_loc2))
                  • Custom script: call RemoveLocation(udg_loc)
                  • Custom script: call RemoveLocation(udg_loc2)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • real Less than or equal to 0.00
                    • Then - Actions
                      • Unit Group - Remove unit from KBGroup
                      • Trigger - Run (Load (Key end) of int in KBTable) (ignoring conditions)
                      • Hashtable - Clear all child hashtables of child int in KBTable
                    • Else - Actions
                      • Set real = (real - 0.03)
                      • Hashtable - Save real as (Key duration) of int in KBTable
 
Level 11
Joined
Nov 15, 2007
Messages
800
There are ways to do it without hashtables but I can't be bothered to know them because hashtables are just so handy. I suspect a lot of arrays + an indexer is the usual method.
 
Level 9
Joined
Apr 23, 2011
Messages
460
Hashtables are like big arrays with two call values, or keys. In general, you'll use hashtables to store various types of values or objects called handles, that are referenced in the manner of Load<Type>(<hashtable>, Parent Key, Child Key) The ability to do this allows GUI and Jass/vJass users to do so much more, and it was sorta the "successor" to dynamic indexing, as this was the original way to do this, before hashtables were created.

TL;DR. Hashtables are complex arrays that make it easier to store data and make your life easier as a coder.
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
I already figured out they were complex arrays, although thanks for trying to explain it, lol.

This is a tad off topic, though.
 
Level 11
Joined
Nov 15, 2007
Messages
800
Well, OP wanted to learn about how to make knockbacks, and either hash tables or dynamic indexing will be required to do GUI knockback.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Meticulous, you forgot to add the expiration timer to the dummy :)

I also had problems with Hashtables, now I can't stop using them. I'm not sure how more efficient the Unit Indexing can be over Hashtables.... but I don't even think the effect is noticeable, neither in trigger making, nor in gameplay.

Unit Indexing is something i'll never understand.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Meticulous, you forgot to add the expiration timer to the dummy :)

I also had problems with Hashtables, now I can't stop using them. I'm not sure how more efficient the Unit Indexing can be over Hashtables.... but I don't even think the effect is noticeable, neither in trigger making, nor in gameplay.

Unit Indexing is something i'll never understand.

A Unit Indexing system basically gives the opportunity to assign any custom value to a unit.

As you might've seen before you can assign a custom value to a unit, but this is only 1 integer value.
With Unit Indexing you can assign any custom value, which means you can assign effects, booleans, other units etc. to each indexed unit.

This can be extremely usefull.

It's basically putting the units in a list or (array), which you can then link with any value.
The index will be the unique custom value of each unit, causing you to be abled to assign any values by using the index.

This is just a basic explenation. Correct me if I'm wrong here...
 
Status
Not open for further replies.
Top