HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

polar offset target problems.

03-19-2004, 06:52 PM#1
Pyrus
In my trigger I want to get the angle between the caster and the target point of impale. If i use 'target unit of ability being cast' it doesnt work. Is there anyway to get the target point?
03-19-2004, 07:59 PM#2
Cubasis
Quote:
Originally Posted by Pyrus
In my trigger I want to get the angle between the caster and the target point of impale. If i use 'target unit of ability being cast' it doesnt work. Is there anyway to get the target point?

Hmm, are you using Polar Projection using "Angle between points"?. As i hear it may introduce problems becouse of one using -180 - +180, and the other 0-360.

Maybe that's your problem.

Cubasis
03-21-2004, 04:09 AM#3
Pyrus
This is what I have:
Do actions at
((Position of (Casting unit)) offset by 600.00 towards (Angle from (Position of (Casting unit)) to (Position of (Target unit of ability being cast))) degrees)

basically I want to get the point 600 units away from the caster in the direction of the spell and do actions there.
I'm thinking that since i'm using impale and its a point target spell the trigger's messing up.
Does anybody know what's going on?
03-21-2004, 04:12 AM#4
ThyFlame
Code:
Get Angle
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Impale
    Actions
        Set AngleVariable = (Angle from (Position of (Casting unit)) to (Position of (Target unit of ability being cast)))
        Game - Display to (All players) the text: (String(AngleVariable))


That'll work and show you the distance.

And yes, if you target a unit not a point it will mess it up.
03-22-2004, 03:10 AM#5
Pyrus
Quote:
Originally Posted by Alpha Disjunction
Why not use Target point of ability?
There isn't an "Event Response Target Point of Ability".
Thy Flame, When I use that, if I aim right i get either 0, 180 or -180 and if i aim down i get 90, -90, 270 or -270.

Quote:
Originally Posted by ThyFlame
And yes, if you target a unit not a point it will mess it up.
What I meant was that since Impale is a point target and im using target unit of ability being cast that it might screw up.
03-22-2004, 03:20 AM#6
ThyFlame
If you're concerned, get the angle and convert it.

If you want it to go from 0-359 [360 = 0], then
If variable < 0, set variable = |360 - variable|

So -90 degrees becomes 270 degrees, and works.

Do the reverse if you want it the other way.
03-22-2004, 04:18 AM#7
Pyrus
Quote:
Originally Posted by ThyFlame
If you're concerned, get the angle and convert it.

If you want it to go from 0-359 [360 = 0], then
If variable < 0, set variable = |360 - variable|

So -90 degrees becomes 270 degrees, and works.

Do the reverse if you want it the other way.
What I mean is that if he aims right it randomly (at least to me) spits out one of {0, 180, -180} and the same angles if he aims left. So in other words i randomly get the point 600 spaces left or right of the caster.
Ditto for up and down but different angles (see above post). I havent tested it for 45 degree variations yet.
Im not really concerned if its negative or not as long as I get the correct point.
03-23-2004, 02:33 PM#8
Vexorian
Also this can be about not using the correct event, some of the ability events do not support the known event responses, use A unit starts the effect of an ability.
03-24-2004, 12:20 AM#9
Pyrus
I did that and still cant see the event response target point.
03-25-2004, 12:58 AM#10
Pyrus
Yes but its after. The problem is i cant get the correct angles. If i could find the 'target point of ability' it would simplify things (hopefully) but I can't find it.
03-26-2004, 02:41 PM#11
Pyrus
Dont worry my editor is up to scratch.

I'll post the code:
Code:
Events = 
Unit - A unit Finishes casting an ability
Conditions =
Actions = 
Set TargetPoint = (Target point of ability being cast)
Unit - Move (Casting unit) instantly to ((Position of (Casting unit)) offset by 800.00 towards (Angle from (Position of (Casting unit)) to TargetPoint) degrees)
Set xzxx = (Angle from (Position of (Casting unit)) to TargetPoint)
Game - Display to (All players) the text: (String(xzxx))
Wait 0.40 game-time seconds
TargetPoint is variable type point while xzxx is real.
I still cant get the correct numbers
03-26-2004, 02:47 PM#12
Cubasis
Well, as I thought I said in my post at the top....(Angle from (Position of (Casting unit)) to TargetPoint) returns a value from -180 - +180. And PolarProjection expects a value between 0 - +360.

So, do this, use the action "Math - Modulo Real" or sumtin like that, and it will ask for two reals, put the (Angle from (Position of (Casting unit)) to TargetPoint) in the first thing, and put 360 in the other. And use this in the PolarProjection stuff.

Cubasis
03-26-2004, 10:37 PM#13
Pyrus
Ok i did some work and here's what I have:
Code:
Cast spell
    Events
        Unit - A unit Finishes casting an ability
    Conditions 
        (Ability being cast) Equal to Impale    
    Actions
        Set TargetPoint = (Target point of ability being cast)
        Set CastingPoint = (Position of (Casting unit))
        Set TargetAngle = (Angle from CastingPoint to TargetPoint)
        If (TargetAngle Less than 0.00) then do (Set TargetAngle = (TargetAngle + 360.00)) else do (Do nothing)
        Game - Display to (All players) the text: (String(TargetAngle))

What I found out was that the angle was same where ever you target but if you move then cast the spell the angle changes. So now i'm thinking it somehow has to do with the location of the caster.
03-26-2004, 10:43 PM#14
Vexorian
Quote:
Originally Posted by Vexorian
Also this can be about not using the correct event, some of the ability events do not support the known event responses, use A unit starts the effect of an ability.
And then you come and tell me that you are using A unit finishes casting an ability!

Use A unit starts the effect of an ability
03-26-2004, 11:00 PM#15
Pyrus
WOW, that really made a difference. But I dont understand why it did?
Is this due to time frames?