• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

(GUI) backstab

Status
Not open for further replies.
Level 10
Joined
Nov 24, 2010
Messages
546
Hello everyone I need backstab spell:

Effect : Damage, slow move speed and attack speed
Level support: No
Damage: Easily changeable
Leakless, MUI (there can be possibly 2+ units to cast it, but it is instant not timed/channeled spell so i think it doesn't metter)

Other info:
- spell is active, should be based on cold arrows/ ice nova
- it affect only when you are in "red zone".
- if you are in "black zone" it will reset cooldown for spell and gives game massage. No damage/no mana cost/no stun.
- NOT autocastable

+ rep and credits for creators.

 
Level 5
Joined
Dec 19, 2004
Messages
110
If I give you a way to check whether the unit is behind the other unit or not (in the red zone) will you be able to create the rest of the spell? triggering to damage & slow the target etc when in red area // give the mana back, reset cooldown etc when in black area aint hard, is it?
 
Level 5
Joined
Dec 19, 2004
Messages
110
okay sounds fair , i mostly have problem with IF caster in "red zone" than...
IF caster at "black zone" than...

thats what I thought.

Ok, so you have the event 'unit starts the effect of an ability' with condition: ability being cast = Backstab, then you do it something like this:

For each (integer A) from 0 to 90, do:
- Set BackstabAngle (integer variable) = ((Integer((Facing of (Casting unit)))) + (Integer A))
- If [BackstabAngle Greater than 360] then do [Set BackstabAngle = (BackstabAngle - 360)]
- If [BackstabAngle Equal to (Integer((Facing of (Target of ability begin cast))))] then do [Actions that you want (make casting unit damage target etc)

Then do exactly the same, but instead of + integer A you do - integer A:

For each (integer A) from 0 to 90, do:
- Set BackstabAngle (integer variable) = ((Integer((Facing of (Casting unit)))) - (Integer A))
- If [BackstabAngle Greater than 360] then do [Set BackstabAngle = (BackstabAngle - 360)]
- If [BackstabAngle Equal to (Integer((Facing of (Target of ability begin cast))))] then do [Actions that you want (make casting unit damage target etc)


On this way, the ability 'works' when you're behind the target unit in an angle of 180 degrees. (90+90)
 
Level 10
Joined
Jun 6, 2007
Messages
392
That way, a unit with a slow turn rate may not be able to backstab, even if it's actually behind the target (if it's facing away from target when the ability is cast). Here's how I would do it:

Set CasterPoint = location of casting unit
Set TargetPoint = location of target unit of ability being cast
set angle = abs( (angle from CasterPoint to TargetPoint) - facing of target unit of ability being cast unit)
if (angle < 90) , do your actions
 
Status
Not open for further replies.
Top