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

Need help with custom spell

Status
Not open for further replies.
Level 8
Joined
Jul 17, 2004
Messages
283
So this is what I'm trying to do...

attachment.php

How do I deal damage over time to any unit within area of spell?



______________________
 

Attachments

  • beam.png
    beam.png
    2.6 MB · Views: 256
You will need a trigger it. Since you need to find all enemy units in the line, and the only group enumeration we have available takes circles, you will need to find units at multiple points.

For example:

  • Events-
  • A unit casts a spell
  • Conditions-
  • Spell equals your spell
  • Actions-
  • Set Location1 = Position of TriggeringUnit offset by (width of laser) towards (Facing of Caster) degrees
  • Set Location2 = Location1 offset by (width of laser)*2 towards (Facing of Caster) degrees
etc... until you reach the length you want.

Then for each of those locations you need to damage all units in the group.

For example:

  • set bj_wantDestroyGroup=true(this is to destroy leaks)
  • Unit Group - Pick every unit in (width of laser) of LocationX matching conditions
Then you will need to do this periodically, until the unit finishes the spell, which is very difficult for me to teach you. But, there are many tutorials available on this site that teach you how to do this in GUI.
 
Last edited:
Level 8
Joined
Jul 17, 2004
Messages
283
Okay, thank you. But can you try to explain in more detail about picking all units within the area of spell?
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
There may be better way, although it may be more complex to create, it may be more efficient.
First, you pick all units into unit group. The range for picking unit into that group should be the maximum range of the laser.
Then you calculate the formula for the laser's line of fire and lastly, you iterate through each unit in the unit group, set its point and check the distance of the point from the line.
IIRC, the calculated distance between point and line is always the shortest distance (if that range is shown as another line, that line will be angled by 90° towards the line of the laser).

There's plenty of stuff on the internet explaining how to get distance between point and line.
The downside is that you have to write those calculations into your trigger (which may be tiring or hard for the first time), but the reward is better efficiency as you don't create many unit groups and it is more precise than unit groups.
 
Level 12
Joined
Nov 3, 2013
Messages
989
This is how I'd do, instead of having multiple circles:

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set Point[0] = ((Position of (Triggering unit)) offset by width/2 towards ((Angle from (Position of (Triggering unit)) to (Target point of ability being cast)) + 90.00) degrees)
      • Set Point[1] = ((Position of (Triggering unit)) offset by width/2 towards ((Angle from (Position of (Triggering unit)) to (Target point of ability being cast)) - 90.00) degrees)
      • Set UnitGroup = (Units within range of unit position of triggering unit
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Angle from Point[0] to (Position of (Picked unit))) Greater than or equal to 90.00
              • (Angle from Point[1] to (Position of (Picked unit))) Greater than or equal to -90.00
            • Then - Actions
            • Else - Actions
Example is pretty crap on many levels but it should give the idea, also Im not sure but this might be what Nichilus already suggested, or something like it

Edit: if the aoe is supposed to vary in width (like in the picture) then you'd have to get a bit more complex than my example
 
Status
Not open for further replies.
Top