[Solved] Angle/Math issue

Status
Not open for further replies.
Level 14
Joined
Jul 26, 2008
Messages
1,008
Hi, I'm trying to make a spell that shoot a breath effect from the caster.

Simple enough. The way it works is the play channels the ability, and whatever way they're facing is the way the breath shoots.

I know I got the angle wrong because the effect shoots from odd angles, mainly facing to the east (0). Could someone help me figure out the right formula? .c is the Caster.

JASS:
     local real a = GetUnitFacing(.c)
     local real x = GetUnitX(.c) + 180 * Cos(a)
     local real y = GetUnitY(.c) + 180 * Sin(a)
        if GetUnitCurrentOrder(.c) == OrderId("breathoffrost")then
            call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), x, y))
 
use this
JASS:
     local real a = GetUnitFacing(.c) @* bj_DEGTORAD@ // better :)
     local real x = GetUnitX(.c) + 180 * Cos(a)
     local real y = GetUnitY(.c) + 180 * Sin(a)
        if GetUnitCurrentOrder(.c) == OrderId("breathoffrost")then
            call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), x, y))
Much better :)
 
Thanks! My only issue now is how to make the effect fire in a certain direction, much like a breath attack. Right now it's firing off facing Angle 0. Hopefully this isn't impossible to do, since breath spells do it. :X

And Starquizer is right, I need to maintain the angle for the next effect, but still both ways essentially work. Thanks!
 
When you say this has to be done by a dummy unit do you mean it has to be attached to the dummy unit that I create at that point, facing the angle, and then kill the unit, or do you mean a dummy unit that has some breath ability to make this?

The first one
(the second will be the same as having the ability on the caster unless you want to make a breath spell in 3 or 4 directions)
 
Status
Not open for further replies.
Back
Top