Backstab

Status
Not open for further replies.
Level 12
Joined
Nov 5, 2007
Messages
730
How do i make a hero deal damage when striking from behind?

Im making a spell based on wind walk,but i want to make the hero deal damage only if he breaks stealth from behind. i made the base trigger,all i need is a condition for the backstab attack.

  • Rogue Stealth2
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Picked unit) has buff Stealth ) Equal to True
      • (I need the backstab condition here)
    • Actions
      • Unit - Order (Attacking unit) to damage (Attacked unit) for ((Real((Level of Stealth for (Triggering unit)))) x 50.00) using attack type Chaos and damage type Normal.
 
Level 4
Joined
Feb 22, 2005
Messages
110
Facing angle of Attacking unit greater than or equal to facing angle of attacked unit -30
and
Facing angle of Attacking unit lesser than or equal to facing angle of attacked unit +30

That gives you 60 degrees angle behind your opponent on where to strike to deal extra damage. You can modify the numbers as you wish.
 
Level 7
Joined
Jun 10, 2007
Messages
225
Amadi's way will not work.
What if the attacked unit's facing angle is 10? then the facing of the attacking unit must be greater than -10, meaning that any angle will work.
Same thing with if the attacked unit's facing angle is 350.
You need to do it with some pretty complex triggers. I thought there was a tutorial on one of the wc3 modding sites for it.
 
Level 7
Joined
Jun 10, 2007
Messages
225
Think about what I said, SPectating. Lets say it calculates that the lowscale is -20 and the highscale is 10 (aka >-20, <10) What if a unit is facing 350? Then it says it is not in range, when it is.
 
Level 2
Joined
Sep 10, 2007
Messages
16
how would you make it so the hero doesn't need to be in stealth. In otherwords if the hero was to just attack the unit from behind (Like Rikimaru from Dota).

*Quick Spellcheck*
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
Amadi's way will not work.
What if the attacked unit's facing angle is 10? then the facing of the attacking unit must be greater than -10, meaning that any angle will work.
Same thing with if the attacked unit's facing angle is 350.
You need to do it with some pretty complex triggers. I thought there was a tutorial on one of the wc3 modding sites for it.
Will taking the remainder of 360 with that number using Mod(x,360) work?
--donut3.5--
 
Level 7
Joined
Jun 10, 2007
Messages
225
If by that you mean, if the awnser is negative then add 360 and if its above 360 then subtract 360, then actually, I think it may. Let me check.
Yep- im tired so I probably missed something (if the problem was this easy it would have been solved already)
Ah, I see. If an angle is <0 or >360 then all you have to do is, instead of saying 'the angle must be >the minimum AND <the maximum' you say 'the angle must be >the minimum OR <the maximum'

I went through an entire thought process right there.


JASS:
local real angle //(this is the angle that we will be adding and subtracting 30 to)
local real angle2 //(this is the angle that must be near to the other angle.
local real minangle = angle - 30.0
local real maxangle = angle + 30.0
local boolean b = false//basically, this is turned to true if one of the angles is <0 or >360

  if minangle < 0.0 then
    set minangle = minangle + 360.0
    set b = true
  elseif maxangle > 360.0 then
    set maxangle = maxangle - 360.0
    set b = true
  endif

  if b == false then
    if angle2 > minangle and angle2 < maxangle then
      return true
    else
      return false
    endif
  else
    if angle2 > minangle or angle2 < maxangle then
      return true
    else
      return false
    endif
  endif

I probably messed something up here, im tired as shit.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
I'd rether the formula thingy
m = tan(90 + unit facing)
if targety - unity > m*(targetx - unitx)
 
Level 6
Joined
Feb 12, 2008
Messages
207
does that works need o2?

i mean, have you tested it by yourself? if you did, i will really aprecciate it, as i'm also in need of a GUI system to do that...
 
Status
Not open for further replies.
Top