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

[Trigger] Explain to me please

Status
Not open for further replies.
Level 4
Joined
Nov 9, 2008
Messages
112
  • Unit - Move F_Archer instantly to (Position of F_Archer), facing ((Facing of F_Archer) + 18.00) degrees
can u draw 4 me..? and what's that mean..?
 
Level 13
Joined
Sep 14, 2008
Messages
1,408
I hope this explains it:

facingiw5.jpg
 
Level 4
Joined
Nov 9, 2008
Messages
112
so that's mean the unit facing to left 18 deg....how if I want the unit rotate to right...?

btw thanks for helping me +rep:thumbs_up:

but one more question...

u know Rikimaru backstab at DOTA...
what the command or condition or something else
(GUI please :sad: not JASS cause I'm NOOOBB in JASS:ugly:)
if attacking unit attack the attacked unit from behind it will deal bonus damage
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
You could check for the facing angles like:
  • Events - Unit is attacked
  • Condition - Attacking unit has Backstab ability
  • Actions
    • - If facing of attacked unit equal to (facing angle of attacking unit + 180)
      • -Then
        • -Cause attacking unit to deal *x* damage to attacked unit
Should work but the angle is pretty strict, and I never actualy made angle based spells so you should either make a new thread concerning the spell or try to make it yourself if this ain't what you need.
 
Level 11
Joined
Dec 31, 2007
Messages
780
actually... that is not gonna work coz the unit must be facing exactly to that position(which will rarely happen)... i think that you want something like this

  • Events
    • Unit - A unit Is attacked
  • Conditions
    • ((Facing of (Attacked unit)) Greater than or equal to ((Facing of (Attacking unit)) - 52.50)) and ((Facing of (Attacked unit)) Less than or equal to ((Facing of (Attacking unit)) + 52.50))
  • Actions
    • Set next = your actions here
that will make the trigger to fire the actions if the attacked unit is facing the facing of the attacking unit -52º and +52º

if you need further explanation ask me here ^^
 
Level 9
Joined
Oct 28, 2007
Messages
435
About the attack system. It has some bugs:

If the attacking unit has the facing angle of 1 and the facing angle of the attacked unit is 359, it will not deal the damage, because Warcraft will think it is comparing two reals while you are actually comparing angles. Let me explain:

The attacked unit's facing angle is 1
The attacking unit's facing angle is 359

Thus it will check:

Is 1 Greater than, or equal to 359 - 52.5 which it is not


So what you should do is a lot more complex

I use 5 real variables but you can use less, but it is harder to explain using less.

Facing1
Facing2
AngleClockwise
AngleAntiClockwise
Differance

Okay.
Firstly I set the variables.

set Facing1=((Facing of (Attacked unit))
set Facing2=((Facing of (Attacking unit))



// Here I'm just calculating the differance between the angles
set AngleClockwise=Facing1-Facing2
set AngleAntiClockwise=(Facing1+360)-Facing2


if AngleClockwise is less than 0 then
set AngleClockwise=AngleClockwise*-1 // If the angle is negative this makes it positive
endif

if AngleAntiClockwise is less than 0 then
set AngleAntiClockwise=AngleAntiClockwise*-1 // If the angle is negative this makes it positive
endif

// Now Finnally

if AngleAntiClockwise is greater than AngleClockwise then
set Differance=AngleClockwise
else
set Differance=AngleAntiClockwise
endif


// This entire piece of code finds the differance between angles, now you can just add

if Differance is less than X then

// Replace X with a number between 1-90 degrees
//X based on how easely you should be able to have the bonus damage. I prefer 45 degrees


// Your damge actions are placed here ->


endif
 
Last edited:
Level 12
Joined
Apr 27, 2008
Messages
1,228
1 is not equal to 359 ... it may be equal to 361 though.
Far simpler way to do this is by using the modulo function.
I will replay the situation from above:

Facing1
Facing2


set Facing1 = Facing angle of attacking unit
set Facing2 = Facing angle of attacked unit

if( Modulo Real(Facing2 + 120, 360) < Facing 1 and Modulo Real(Facing2 + 240, 360) < Facing 2)
//the unit is attacking from behind, do stuff
endif
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
hmm...

Isn't "rotating the unit right" clockwise, and thus - ?

I mean, you're right that clockwise is negative, but eh... isn't that exactly what he said?

No. Think about what happens when you pass the 180 degree mark. Circles are completely different than lines, you can't go left or right forever. Eventually, you have to come back around the other way. Once you get past 180 degrees, you add to go right and subtract to go left, yet from 0 to 180, you add to go left, and subtract to go right. Using clockwise and counterclockwise is much better terminology to use.
--donut3.5--
 
Level 4
Joined
Nov 9, 2008
Messages
112
I say it many times :hohum: :fp:ok i'll try it

if work +rep :thumbs_up:

but i try it later

coz my comp has been broken:cry:

Edit:wait" 1 more question.... what is offset

ex:create 1 "unit" at position of "unit" offset by xx facing xx degree
 
Last edited:
Level 25
Joined
Jun 5, 2008
Messages
2,573
Example:
Create 1 unit at Position of *any* unit offset by *x* towards *y* degrees.

This will create a unit At Position of a unit 100 range points toward some angle.
Or:
Unit create 1 unit at Position of *any* unit offset by x,y

This will create a unit At position of a unit moved by x(left,right) and y(up,down).

This works for any point/location not just Position of unit.
Hope this helped.
 
Status
Not open for further replies.
Top