• 🏆 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!

Forked Lightning combined with Chain Lightning

Status
Not open for further replies.
Level 2
Joined
Sep 9, 2005
Messages
26
Im workin on a spell that looks like Forked Lightning at first but hten all of the sudden the lightnings go on to other units and dmg them too :p Basicly Ive made a Chain Ligtning spell that has the Forked Lightning lightning effect and made dummys that cast that spell 3-5 times on different units.

The tricky thing is , i want to make it look 100% credible so i have to make the dummys cast the spell on different units (so no double Chain Lightninging the same unit), and make sure the targets are in front of the direction the real caster is facing, and not behind. To do this i think i have to somehow check if the angle between the facing direction of the caster and the angle between the pos of the caster and pos of the target of the dummy is <=90 degrees. I know this sounds wiedr i probably didnt explain it well but i hope its understandable. The problem is lets say one of the angels is 350 and the other is 10 then 350-10=340 wich is far greater than 90, but actually the angle is only 20 degrees ...

Any ideeas on solving this problem ?
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
JASS:
function Within90Degrees takes real a1, real a2 returns boolean //in DEGREES
    return (a2 < a1 + 90 and a2 > a1 - 90) or (a1 < 90. and a2 < a1 + 450. and a2 > a1 + 270.) or (a1 > 360. and a2 < a1 - 270. and a2 > a1 - 450.)
endfunction

SHOULD work, I think, but I haven't tested it.
 
Level 2
Joined
Sep 9, 2005
Messages
26
thats exactly the problem i dont use jass -- didnt get to learn it yet, but i know some c++ and those knowledges make me presume it should be easy with jass --- but i was looking for a solution with triggers

So i make this more understandable i drew this. The red circle is the caster and the other 6 black ones are enemies. If you think about FL u know it would only cast on units I II and III, and not on IV V and VI. The angle wich has to be smaller than 90 degrees is the one between the red arrow wich is indicating the direction wich the caster is facing and the black line connecting the pos on the caster and the pos of unit III.
 

Attachments

  • Angle.JPG
    Angle.JPG
    11.3 KB · Views: 226
Level 2
Joined
Sep 9, 2005
Messages
26
=)) dont worry i did fine - its like a challenge knowing u have to solve a problem like that :p . The thing was i needed a condition like this : d>=270 or (d <= 90 and d>=-90) or d<=-270 , where each d is angle between points minus caster facing angle. Hell of a condition but it works very cool :p
 
Level 4
Joined
Jun 10, 2007
Messages
46
Create a unit array for the spell and add units to it as they get hit. Delete the array when the spell has finished.

Personally I do everything in GUI myself, (except patching up leaks) so my opinion is that such a system oughtn't to be very difficult to implement.

Just one question though: do multiple units get this spell, or just one per game? That might be relevant. If it is multiple, you'll need to use Jass to do it.
 
Status
Not open for further replies.
Top