Okay, since my last excursion into conal damage detection via custom buff placers failed miserably, I've decided to hell with it, I'll just trigger the whole thing! Now it's working as intended, there's no lag or anything, but I'm wondering if it's possible to do this in a more elegant way (I hate nesting countless "ifs" ).
The spell is a modified Carrion Swarm that deals no damage; the trigger detects enemies in a frontal cone and damages them as well as having a dummy pop in and cast a modified Curse on them. The width of the cone detection is 90 degrees from the caster's facing angle, hence the two +/- 45 degree checks.
After banging my head in frustration for over an hour I finally figured out, through debug messages, that unit facing ranges from [0, 360] degrees while angle between points ranges from [-180, 180] degrees! Thank you Blizzard, for being so consistent!! :banghead: :banghead: :banghead: :banghead: :banghead:
Another thing is I'd like to hear your suggestions as to the width of the cone based on the Carrion Swarm animation. I have the spell's speed set to 1250 and range to 500, so what would be the best AoE and cone width to set with this? Also, what the heck does "Final Area" mean (300 by default)?
Finally, please ignore leaks - I fix those once I'm satisfied with the finished trigger.
Anyway, cookies to you if you've managed to read though all this! :thup:
The spell is a modified Carrion Swarm that deals no damage; the trigger detects enemies in a frontal cone and damages them as well as having a dummy pop in and cast a modified Curse on them. The width of the cone detection is 90 degrees from the caster's facing angle, hence the two +/- 45 degree checks.
After banging my head in frustration for over an hour I finally figured out, through debug messages, that unit facing ranges from [0, 360] degrees while angle between points ranges from [-180, 180] degrees! Thank you Blizzard, for being so consistent!! :banghead: :banghead: :banghead: :banghead: :banghead:
Trigger:
- Mystra's Kiss New
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Carrion Swarm CONE TEST
- Actions
- Unit Group - Pick every unit in (Units within 500.00 of (Position of (Casting unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
- Loop - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) for 5.00 seconds the text: (DEBUG: Angle from position of caster to position of picked unit in degrees: + (String((Angle from (Position of (Casting unit)) to (Position of (Picked unit))))))
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Or - Any (Conditions) are true
- Conditions
- And - All (Conditions) are true
- Conditions
- (Angle from (Position of (Casting unit)) to (Position of (Picked unit))) Greater than or equal to 0.00
- (Angle from (Position of (Casting unit)) to (Position of (Picked unit))) Greater than or equal to ((Facing of (Casting unit)) - 45.00)
- (Angle from (Position of (Casting unit)) to (Position of (Picked unit))) Less than or equal to ((Facing of (Casting unit)) + 45.00)
- Conditions
- And - All (Conditions) are true
- Conditions
- (Angle from (Position of (Casting unit)) to (Position of (Picked unit))) Less than 0.00
- (Angle from (Position of (Casting unit)) to (Position of (Picked unit))) Greater than or equal to (((Facing of (Casting unit)) - 45.00) - 360.00)
- (Angle from (Position of (Casting unit)) to (Position of (Picked unit))) Less than or equal to (((Facing of (Casting unit)) + 45.00) - 360.00)
- Conditions
- And - All (Conditions) are true
- Conditions
- Or - Any (Conditions) are true
- Then - Actions
- --- damage the picked unit since it passed the angle checks ---
- Unit - Cause (Casting unit) to damage (Picked unit), dealing 100.00 damage of attack type Chaos and damage type Divine
- --- create a dummy at the picked unit's location and order it to Curse the unit ---
- Unit - Create 1 Dummy Caster (Jinxx Dummy) for (Owner of (Casting unit)) at (Position of (Picked unit)) facing (Position of (Picked unit))
- Unit - Add (Dummy Spell) (Mystra's Kiss) (Flare) to (Last created unit)
- Unit - Set level of (Dummy Spell) (Mystra's Kiss) (Flare) for (Last created unit) to (Level of Carrion Swarm CONE TEST for (Casting unit))
- Unit - Order (Last created unit) to Undead Banshee - Curse (Picked unit)
- Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
- Else - Actions
- If - Conditions
- Loop - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) for 5.00 seconds the text: (DEBUG: The caster's facing angle in degrees is: + (String((Facing of (Casting unit)))))
- Unit Group - Pick every unit in (Units within 500.00 of (Position of (Casting unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
- Events
Another thing is I'd like to hear your suggestions as to the width of the cone based on the Carrion Swarm animation. I have the spell's speed set to 1250 and range to 500, so what would be the best AoE and cone width to set with this? Also, what the heck does "Final Area" mean (300 by default)?
Finally, please ignore leaks - I fix those once I'm satisfied with the finished trigger.
Anyway, cookies to you if you've managed to read though all this! :thup: