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

Spell Problem

Status
Not open for further replies.
Level 3
Joined
May 10, 2007
Messages
39
hey.
I'm trying to make this spell that damages enemy units heal friendly Undead units.
plz help me
thank you.
 
Level 5
Joined
Jun 23, 2004
Messages
126
@ Sonkan, he wants a cone AoE spell.

With that kind of complex spell you best bet might be to use the Breath of Frost spell. It has a duration and a buff I believe, so...here let me see if I can figure out this Trigger tag...I really need a manual or somethin for it.

  • Events
    • Unit - Unit Begins The Effect Of An Ability
  • Conditions
    • Ability Comparison - Ability Being Cast is equal to BreathAbility
  • Actions
    • For Loop Integer A 1-10
      • Unit Group - Pick Every Unit Within (Max Range of BreathAbility) Matching (Boolean - Unit Has Specific Buff (BreathAbilityBuff) = True) And Do
        • If (All conditions are true) then do (Then Actions) else do (Else actions)
          • If - Conditions
            • Boolean Comparison - (Picked Unit) Belong To An Ally Of (Owner of Unit (Triggering Unit)) = True
          • Then - Actions
            • Unit - <<Heal Unit, however you want...I guess by adding life?>>
            • Special Effect - <<Add whatever SFX you want>>
          • Else - Actions
            • Unit - Have (Triggering Unit) Damage (Picked Unit)...
            • Special Effect - <<Add whatever SFX you want>>
        • Unit - Remove (BreathAbilityBuff) from (Picked Unit)
      • Wait 0.1 Seconds (Game Time)
(Pimped up!)
 
Level 3
Joined
May 10, 2007
Messages
39
does not work i didnot get this part
Unit - <<Heal Unit, however you want...I guess by adding life?>>
sry i'm new at this... i dunno anything bout triggers :(
say can u make a map with that trigger working and send it to my e-mail? [email protected] it would be very appricated :)
 
Last edited:
Level 5
Joined
Jun 23, 2004
Messages
126
  • Unit - Set Like of (Picked Unit) to Arithmetic (Life of (Picked Unit) + (100))
I used 100 here, you can do whatever.

For a more complex trigger...

  • Unit - Set Like of (Picked Unit) to Arithmetic (Life of (Picked Unit) + (Arithmetic (Level of (BreathAbility) for (Triggering Unit) x 100)))
And you can set 100 to whatever. You can also do a bit more of a complex Arithmetic like (50 + (Level of Abil x 25)) at your discretion.

Edit: Oh, and keep in mind that you want the Breath spell itself to deal no damage, have at least a second duration (and again no damage in that time) and affect both friendly and enemy targets.

Edit2: I just realized there's nothing in there about Undead...lemme fix that.


Hm, the Trigger Tag seems somewhat limited, or maybe that's just my understanding of it...I can't get it to do what I want just now. Later, maybe.
 
Last edited:
Level 5
Joined
Jun 23, 2004
Messages
126
  • Hellfire Cloud
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hellfire Cloud
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units within 800.00 of (Position of (Triggering unit)) matching (((Matching unit) has buff Hellfire Cloud ) Equal to True)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True
                  • ((Picked unit) is Undead) Equal to True
                • Then - Actions
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (0.00 + ((Real((Level of Hellfire Cloud for (Triggering unit)))) x 50.00)))
                  • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False
                      • ((Picked unit) is Undead) Equal to False
                    • Then - Actions
                      • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (0.00 + ((Real((Level of Hellfire Cloud for (Triggering unit)))) x 100.00)) damage of attack type Spells and damage type Fire
                      • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
                    • Else - Actions
              • Unit - Remove Hellfire Cloud buff from (Picked unit)
          • Wait 0.10 game-time seconds
This trigger would work, except for the unfortunate fact that Breath spells have built-in Friend-or-Foe detectors in their code. The Targets entry doesn't seem to do much...it doesn't even affect Neutral units, just enemy ones. So I'm afraid this ability will require a completely triggered delivery system (evaluating what units are within the cone, and so forth).

(Sorry for the double post, it was an update.)

And I can email you the map if you like, but the trigger doesn't work properly. It only damages enemy non-undead units and does nothing to anything else.
 
Level 3
Joined
May 10, 2007
Messages
39
the hellfire cloud abillty is a custom one right? cuz i cant find it O_O
and cant i solve the undead healing problem if only the guy that has undead units has this ability?
 
Last edited:
Level 5
Joined
Jun 23, 2004
Messages
126
the hellfire cloud abillty is a custom one right? cuz i cant find it O_O
and cant i solve the undead healing problem if only the guy that has undead units has this ability?


Hellfire Cloud was what I dubbed the custom ability I created to test out this trigger. It was based off of the Breath of Frost ability.


I don't think you understand the situation here. My suggested method cannot work simply because no buff is added to friendly units even when the targets are changed. Thusly, you cannot use the Breath of Frost ability as a base to get this to work.

Instead, you're going to have to do a triggered evaluation of units-within-cone. I would do two Pick Every Unit Within Range Matching Condition with the Conditions being alternately Enemy & Non-Undead, and Friendly & Undead. Then do an Absolute math operation on (Facing Angle of (Triggering Unit) - Angle Between (Triggering Unit) and (Picked Unit)) and if it's equal to or less than half the size of the cone, carry out the appropriate actions.

Edit: This is what I mean.

  • Hellfire Cloud New
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hellfire Cloud
    • Actions
      • Unit Group - Pick every unit in (Units within 800.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is Undead) Equal to True))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Abs(((Facing of (Triggering unit)) - (Angle from (Position of (Triggering unit)) to (Position of (Picked unit)))))) Less than or equal to 10.50
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (0.00 + ((Real((Level of Hellfire Cloud for (Triggering unit)))) x 50.00)))
              • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
            • Else - Actions
      • Unit Group - Pick every unit in (Units within 800.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and (((Matching unit) is Undead) Equal to False))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Abs(((Facing of (Triggering unit)) - (Angle from (Position of (Triggering unit)) to (Position of (Picked unit)))))) Less than or equal to 10.50
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (0.00 + ((Real((Level of Hellfire Cloud for (Triggering unit)))) x 100.00)) damage of attack type Spells and damage type Fire
              • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
            • Else - Actions
You may notice the "10.50", well I did a sorta mathematical evaluation which I doubt is entirely correct. I'd appreciate it if someone could remind me the proper way to figure out one of the angles of a triangle, while knowing only one of them and at least two sides' lengths.

Until the, experiment with the "10.5" value to get the right cone.
 
Last edited:
Level 3
Joined
May 10, 2007
Messages
39
Tooolbox
can u send me in "custom text" so i can copy paste whould be much easier :p
i mean if its not any trouble at all.
thank you.
 
Level 2
Joined
Mar 25, 2007
Messages
13
Hmm, a little question to Tooolbox:

In your last post, in the trigger you posted there's this line where you heal (or damage) the Picked Unit. Could you tell me why, when you "check" the level of the Hellfire Cloud ability, you use an arithmetic function consisting of adding 0.00 to the level of the ability?

Would it not be better to simply convert the level of the ability to a real, not to add 0.00 to it and therefore not to use an arithmetic function at all?

Or am I missing something?:confused: :confused: :confused:

Edit: Also, I tried your trigger out in a test map. It turns out that it also damages/heals the caster. I'm not sure how Cherkess want's the ability to function, but I would personally add another condition in the Pick Unit action that specifies that the caster is not a target of the ability. Oh, and yes in my test map it perfectly worked without adding 0.00... am I STILL missing something?
 
Last edited:
Level 3
Joined
May 10, 2007
Messages
39
hmm this is kinda complex :p
where did u get the abs thingy? :O i cant find it or is it a Variable
Ste@lth if u made the trigger work as u say it did can u send the test map with the new condition u talked bout plz ^^ send it to my e-mail
[email protected]
(abs thingy- is at if conditions...)
 
Level 5
Joined
Jun 23, 2004
Messages
126
Hmm, a little question to Tooolbox:

In your last post, in the trigger you posted there's this line where you heal (or damage) the Picked Unit. Could you tell me why, when you "check" the level of the Hellfire Cloud ability, you use an arithmetic function consisting of adding 0.00 to the level of the ability?

Would it not be better to simply convert the level of the ability to a real, not to add 0.00 to it and therefore not to use an arithmetic function at all?

Or am I missing something?:confused: :confused: :confused:

Edit: Also, I tried your trigger out in a test map. It turns out that it also damages/heals the caster. I'm not sure how Cherkess want's the ability to function, but I would personally add another condition in the Pick Unit action that specifies that the caster is not a target of the ability. Oh, and yes in my test map it perfectly worked without adding 0.00... am I STILL missing something?

Eheh you are right in that the 0.00 is not needed. It's more for a matter of controlling the healing/damage. What if you wanted the spell to start at 75 damage and go up 25 per level? Then you would need 50 + (Level x 25), so the 0.00 is there just so you can add whatever "base" damage you want in addition to the per-level damage.

And you are right, I should add a caster check. Lemme edit with the new version.

@ Cherkness, the (Abs) thing is the (Math - Abs) function.

Edit: Okay well I had to redo the whole thing 'cause I lost the map...but I'm running into some strange issues. First thing I did was realized that because of the 0-360 overlapping nature of the facing angles, the spell would malfunction when the target and the caster were on opposite sides of the "rift". So I added a second angle checker, but there's this weird issue where targets that are behind the caster are hit when he's facing a certain way...When his angle is, say, 358, targets roughly behind him are hit...this is really weird. I gotta debug it.

Edit2: Alright, I've had enough of this crap. The Math - Angle Between Points function doesn't seem to behave properly all the time. I worked out a bunch of kinks, but the main problem is that the function sometimes returns negative values. Negative values? It should be returning anything from 0-360! I tried sticking an Absolute on it in case it was just going negative, but that doesn't really do anything.

Can someone explain to me why the Angle Between Points function would return a negative value, when the only options are 0-360? That will let me finish this up.

(This is what I have.)

  • Hellfire Cloud Cone
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hellfire Cloud
    • Actions
      • Game - Display to (All players) the text: cast
      • Unit Group - Pick every unit in (Units within 800.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True) and ((((Matching unit) is Undead) Equal to True) and ((Matching unit) Not equal to (Triggering unit))))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Abs(((Facing of (Triggering unit)) - (Abs((Angle from (Position of (Triggering unit)) to (Position of (Picked unit)))))))) Less than or equal to 15.00
                  • (Abs(((Facing of (Triggering unit)) - (Abs((Angle from (Position of (Triggering unit)) to (Position of (Picked unit)))))))) Greater than or equal to 345.00
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (0.00 + (50.00 x (Real((Level of Hellfire Cloud for (Triggering unit)))))))
              • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
            • Else - Actions
      • Unit Group - Pick every unit in (Units within 800.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and ((((Matching unit) is Undead) Equal to False) and ((Matching unit) Not equal to (Triggering unit))))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Abs(((Facing of (Triggering unit)) - (Abs((Angle from (Position of (Triggering unit)) to (Position of (Picked unit)))))))) Less than or equal to 15.00
                  • (Abs(((Facing of (Triggering unit)) - (Abs((Angle from (Position of (Triggering unit)) to (Position of (Picked unit)))))))) Greater than or equal to 345.00
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (0.00 + (100.00 x (Real((Level of Hellfire Cloud for (Triggering unit)))))) damage of attack type Spells and damage type Fire
              • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
            • Else - Actions
It simply doesn't work properly, because the Angle Between Points is jacking up.
 
Last edited:
Level 3
Joined
May 10, 2007
Messages
39
sry tooolbox if these question piss u off i dont know anything bout triggers :/
can u please send me the map with this trigger but also with the condition that ste@lth talked bout [email protected] i cant make the if condition thingy :S
 
Well, you can fix the buffs, the problem is this: the spell is effecting allied units, but the buffs cannot, so if youset the buffs so they can effect allied units it might worked. OR you could have it pick every unit inside the AoE, create a dummy unit for each one then have it cast Death Coil (with or without spell animation) on each one, that will do the same, and with a much less complex trigger.
 
Level 5
Joined
Jun 23, 2004
Messages
126
sry tooolbox if these question piss u off i dont know anything bout triggers :/
can u please send me the map with this trigger but also with the condition that ste@lth talked bout [email protected] i cant make the if condition thingy :S

It's quite alright, cherkess, I like a challenge :) Just kinda annoyed at the function not working :bored:

And I will send you the map as soon as I get this working. I just need a guru to tell me why the Angle function isn't working, or how it works in the case that I misunderstand it.

@ Deep Sea, it would be better if you understood what he's trying to do here.

If you're right in that the spell does *affect* allied units (in terms of damage) but the buff doesn't get applied, that's...interesting. And also useless to us :S

Creating a bunch of dummy units to cast a spell which has no other effects than damaging or healing is pointless and resource consuming.

Also note that if this were just an AoE there would be no issue but it's a cone, and that's where the issue is--finding what units are within the cone, and which aren't. My tigger would work perfectly except that the Math - Angle Between Points function is returning weird values, including negative ones.

So unless you can tell my why this is happening and how to fix it, it would be good for you to introduce well thought out solutions that perfectly fit the problem.
 
Level 4
Joined
Apr 29, 2007
Messages
88
If he want to make an breath of fire that heal and both damage why don't we use simple way...
Make the buff last 0.1 seconds

Run trigger each 0.1 seconds, picked unit is allied of owner of casting unit then heal them by x

Is something wrong with this one??
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
The easiest, and most accurate way, is to add a buff to Breath of (whatever) with an icon of Textures\Black32.blp

Then, every second or so of game time, pick every unit with that buff, remove it, and damage them for an amount (you have to store on them, in a place like their custom value, who hit them)
 
Level 5
Joined
Jun 23, 2004
Messages
126
Tooolbox said:
This trigger would work, except for the unfortunate fact that Breath spells have built-in Friend-or-Foe detectors in their code. The Targets entry doesn't seem to do much...it doesn't even affect Neutral units, just enemy ones. So I'm afraid this ability will require a completely triggered delivery system (evaluating what units are within the cone, and so forth).

So you see I already tried that method, I had a full trigger set up for it back on Page 1. The real question here is, why does the Angle Between Points return weird values? And, how can the Warcraft III engine use these exactly as it would use a Facing of Unit returned value?

(To show what I mean...)

  • Unit - Order (Picked Unit) to Move to Position of (Picked Unit) Offset by 800 towards (Facing of Picked Unit)
  • Unit - Order (Picked Unit) to Move to Position of (Picked Unit) Offset by 800 towards (Angle Between (Picked Unit) and (Triggering Unit))
Obviously those are vaguely done-up triggers but you get the point? Both of those triggers would work properly, (the first one would move the unit 800 forward and the second one would move the unit 800 towards the triggering unit) even while Angle Between is giving BS outputs. So the WCIII engine somehow handles them and converts them to 0-360...

I can make the whole trigger, I already have (twice) but what I really need to know is what's going on with Angle Between Points and how to handle it so I can get 0-360 out of it.

Thanks!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Wrong section, this should be in the spells/systems sections

Emulate a breath of fire spell bye using simple triggers. You need to pick all units in an area, for most efficency do this with a offset in the direction of the casting unit's facing angle and then run your cone detection actions. You now have all units in a perfect cone and so simply loop through them all and run your actions using an "if then" to detect if they are valid targets or not. Simple maths is all that is required.
 
Level 5
Joined
Jun 23, 2004
Messages
126
Wrong section, this should be in the spells/systems sections

Emulate a breath of fire spell bye using simple triggers. You need to pick all units in an area, for most efficency do this with a offset in the direction of the casting unit's facing angle and then run your cone detection actions. You now have all units in a perfect cone and so simply loop through them all and run your actions using an "if then" to detect if they are valid targets or not. Simple maths is all that is required.

You're about the 5th person to blandly state a solution without reading the thread (though I think the first person besides me to come up with the correct method). I have already explained this solution fully and even attempted to trigger it, and I am blocked by the same thing: the Angle Between Points function does not return a 0-360 value. The math is simple, but I cannot get it to work because of this weirdness.

So I reiterate: the answer to this question has been found, the new problem is that the Math - Angle Between Points function is returning seemingly screwy values (sometimes exactly 180 or 360 less than the correct angle, but this varies).

Please, before anyone else jumps in headlong and tries to answer his question, read this or one of my other recent posts.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
(though I think the first person besides me to come up with the correct method)
Pfft, my way works too, I've done it before

It's also more accurate to warcraft breaths, as it is a warcraft breath

And AngleBetweenPoints does return a correct value (and GUI converts it to degrees for you too, how nice of it.)

It's just that

Angle Between A and B = 180 - Angle Between B and A
 
Level 5
Joined
Jun 23, 2004
Messages
126
Pfft, my way works too, I've done it before

It's also more accurate to warcraft breaths, as it is a warcraft breath

And AngleBetweenPoints does return a correct value (and GUI converts it to degrees for you too, how nice of it.)

It's just that

Angle Between A and B = 180 - Angle Between B and A

"Your way" was what I attempted first, and discovered that Warcraft Breaths (specifically Breath of Frost) do not add buffs to allied units, no matter the targets. Therefore, no healing friendlies, and hence, not the entire desired effect. And once again if you'd read the thread you would have seen me say that once or twice :wink:

I do give you credit on being the first one to address the issue of AngleBetweenPoints for me, though :thumbs_up: I...sorta comprehend the formula you're giving me, but I can't wrap my head around it. It's like, A = 180 - B? But why would they bother to find B and then do the formula to find A, when they can find A directly?

Or are you referring to what I need to do?...Instead of doing
Math - Angle Between (Unit A) and (Unit B)
should I do
Arithmetic (180) - (Math - Angle Between (Unit B) and (Unit A))?
And that would produce the correct 0-360 number?
 
Level 24
Joined
Jun 26, 2006
Messages
3,406
hmm this is kinda complex :p
where did u get the abs thingy? :O i cant find it or is it a Variable
Ste@lth if u made the trigger work as u say it did can u send the test map with the new condition u talked bout plz ^^ send it to my e-mail
<E-mail address edited out>
(abs thingy- is at if conditions...)

sry tooolbox if these question piss u off i dont know anything bout triggers :/
can u please send me the map with this trigger but also with the condition that ste@lth talked bout <E-mail address edited out> i cant make the if condition thingy :S

wow, i'm surprised i'm the first person to mention it, but posting your e-mail on any sort of online forum is dangerous. not that there are any spambots here, but they'd eat that up and your address would be spammed until the end of time. if you really need to announce your address, try to do something like youraddress[at]yourdomain (as opposed to youraddress@yourdomain), or adding lots of extra characters and telling us to take the right ones out, as spambots don't actually "read".
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
"Your way" was what I attempted first, and discovered that Warcraft Breaths (specifically Breath of Frost) do not add buffs to allied units, no matter the targets.
Bah, screw warcraft breaths then :(

Angles --

Let's call Angle Between Points (point a, point b) ABP(a,b) for quickness sake

Angle ABP(a,b) (a and b being locs) is the angle FROM a to b. Since angles, unlike distances, are not equal when going opposite directions, naturally, ABP(a,b) = the opposite of ABP(b,a)

Since there are 360 degrees in a circle, or 2pi radians, depending on the system you're using --

The opposite angle to an angle is (total angle units) - (first angle). Thus, (pi - a) if you're in radians, or (360 - a) in degrees.

Thus, ABP(a,b) = 360 - ABP(b,a)

And it shouldn't matter if you swap it either way, it returns the value fine. (and I should note there's no Angle Between Units in GUI, as far as I've ever been able to find)
 
Last edited:
Level 5
Joined
Jun 23, 2004
Messages
126
Bah, screw warcraft breaths then :(

Let's call Angle Between Points (point a, point b) ABP(a,b) for quickness sake

Angle ABP(a,b) (a and b being locs) is the angle FROM a to b. Since angles, unlike distances, are not equal when going opposite directions, naturally, ABP(a,b) = the opposite of ABP(b,a)

Since there are 360 degrees in a circle, or 2pi radians, depending on the system you're using --

The opposite angle to an angle is 1/2(total angle units) - (first angle). Thus, (pi - a) if you're in radians, or (180 - a) in degrees.

Thus, ABP(a,b) = 180 - ABP(b,a)

And it shouldn't matter if you swap it either way, it returns the value fine. (and I should note there's no Angle Between Units in GUI, as far as I've ever been able to find)

Not sure that we're on the same page here.

There's an Angle Between Points, it returns a Real value and is under the Math section.

If I wanted the reverse of the value I would simply +180 it, so I'm not sure what you're getting at.

When I do an Angle Between points check, the variable seems to alter depending on what two points I'm comparing (and in what order). The numbers returned at not 0-360, I get -180 where 0 should be, -90 where 90 should be, 0 where 180 should be, 90 where 270 should be, etc.

Or at least, it's sometimes that way. I tried adding a simple +180 into the equation and it turned out a different set of values...

Maybe you somehow explained why this is happening but I just didn't get it. Can you be a little more specific about what you're explaining? Cause I don't really comprehend the application.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
ABP, as I said many times, depends on the way the points are ordered

Practical example: If you're facing the north pole, and are exactly lined up to it (so you're not facing diagonally), the angle from you to it is 90 deg. However, the angle from it to you is actually -90 deg, or -450 deg, or 270 deg, etc, etc. The angle will always be different by +- 180*n, where n is an odd integer number.

So the only two ways you could be getting the wrong values are;
-If you're using the points in the wrong order (ABP(a,b) is the angle from a to b, but not that from b to a.)
-If you're using the wrong points

Otherwise, it returns correctly. Hope that clears it up ><

And before I meant to say 360, not 180 (in my above post, unless you did 180 + n, not 180 - n). Sorry about that.

Also, when I said there's no AngleBetweenUnits, I was referring to when you said;

Math - Angle Between (Unit A) and (Unit B)
 
Level 5
Joined
Jun 23, 2004
Messages
126
Well I completely understand what you're saying that the angle from A to B is not the angle from B to A, but rather ABP(A,B)+180=ABP(B,A). That's not in question here, I understood that from the start.

I am also not using the wrong points. I'm using Position of Unit for each of the points for the ABP function, and it goes from Triggering Unit (unit casting spell) to Picked Unit (unit being checked to see if it's in the cone). I take this value and subtract the facing of the Triggering Unit, and Absolute the result to get the difference between the casting unit's facing angle and the angle between him and the potential target. I then check to see if the given difference is less than X or greater than Y, where X is about 15 and Y is about 345. (I do this because the caster's facing could be 5, and the angle to the target could be 355, which is still within the 30 degree cone but the difference is 350.)

This should work, no?

But once again, like I said, ABP returns weird values. Try it yourself! Lay down two units in a bare map and set up a trigger to display the Angle Between Points from Unit A to Unit B every 0.50 seconds. Then move around unit A and see what I mean.

The problem is not that I'm checking for the wrong angle somehow (though at one point I did experiment with that) but that I don't know how to handle what I'm being given by ABP to produce a 0-360 result. Is that clear?

ABP does not return 0-360 when asked for an angle between two given unit-position points, how do I convert what it gives me properly into a 0-360 format for use with my cone calculation equation?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
What I've been telling you is that who cares if it's a 0-360 result? If n is any angle, n + 360x, where x is any number, is equivelant to n (assuming you're using degrees)

Thus, if you want to convert it to a number between 0 and 360, just do ModuloInteger( angle, 360 ) (or ModuloReal( angle, 360 )). I can't say I know what they're called in GUI, but that'll round it to a number between 0 and 360
 
Status
Not open for further replies.
Top