• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Spell] Make a single-target spell target multiple units

Status
Not open for further replies.
Level 3
Joined
Aug 25, 2013
Messages
22
Sup hive

In case the title is not clear enough.
I was looking to make an 'AoE target' ability (For this purpouse i used a dummy ability based of monsoon). When cast, all enemy units in the area are ensnared with, well, an ensnare ability. Of course the problem is that ensnare is single-target.

Is it possible to do something like this? I was thinking of making a trigger that goes like 'for every enemy unit in the area, create a dummy unit and order it to ensnare the unit'

Would that work? and more important, how do I do that?
 
Level 25
Joined
Sep 26, 2009
Messages
2,390
Well, abilities like this are usually triggered like this: when unit starts the effect of that ability, you pick every *specific* unit (e.g. enemy units) within certain radius of "target point of ability being cast" and create a dummy unit which casts the spell on that target.


Edit: something like this
  • AoE Ensnare
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AoE Ensnare
    • Actions
      • Set point = (Target point of ability being cast)
      • Custom script: set bj_wantDestroyGroup = true // this custom script is needed to prevent memory leaks
      • Unit Group - Pick every unit in (Units within 512.00 of point matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 DummyCaster for (Triggering player) at point facing Default building facing degrees
          • Set u = (Last created unit)
          • Unit - Add Ensnare to u
          • Unit - Add a 2.00 second Generic expiration timer to u // this kills the dummy unit after 2 seconds, so it does not remain in game
          • Unit - Order u to Orc Raider - Ensnare (Picked unit)
          • Set u = No unit
      • Custom script: call RemoveLocation(udg_point)
      • Custom script: set udg_point = null // this custom script and the one above are both needed to prevent memory leaks
"point" is point variable
"u" is unit variable
 
Level 3
Joined
Aug 25, 2013
Messages
22
Well, abilities like this are usually triggered like this: when unit starts the effect of that ability, you pick every *specific* unit (e.g. enemy units) within certain radius of "target point of ability being cast" and create a dummy unit which casts the spell on that target.

Is it really as easy as that? Just 'pick every unit in -area- and -create 1 dummy-'? I don't have to use that confusing 'for each integer A' thingie?


Edit: I now see your edited post. Well, the trigeer was way easier than i thought, now I feel dumb for asking lol
Anyways, thanks for the quick help. +rep
 
Level 25
Joined
Sep 26, 2009
Messages
2,390
Well you need to make sure that the dummy unit is not visible (it would be strange if you cast this ability and suddenly a bunch of Footman appeared and each cast Ensnare, right?), is non-targetable and that the "Ensnare" spell they cast is accessible immediately (e.g. it does not require any upgrade/research).

Also it creates 1 dummy per picked unit (for long-term efficiency sake, it may be better to recycle them instead of creating new dummies per cast)
 
Level 3
Joined
Aug 25, 2013
Messages
22
Don't create multiple dummy units instead create one dummy unit and move it. Then order it to cast the spell or whatever.

Wouldn't that cause some delays as the unit has to move and cast the ability on every single one?

In any case, Nichilus way has worked for me, so I guess the issue is solved.
 
Status
Not open for further replies.
Top