• 🏆 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!

assassinate spell

Status
Not open for further replies.
Level 19
Joined
Aug 24, 2007
Messages
2,888
Only from back is fine I guess because you cant attack someone if you arent faced to him

Events
Unit Starts Effect of Ability
Conditions
If Ability beign cast is equal to PWN0R45 ASS4S1N4T3
If Facing of Triggering Unit is greater than Facing of Target Unit of Ability Beign cast - 120
If Facing of Triggering Unit is lesser than Facing of Target Unit of Ability Beign cast + 120
Actions
Unit - Damage TargetUnit of Ability Beign Cast by Triggering Unit of 9999999999999999999999999999999999 Attack type of Chaos - Damage type of Spirit Link (or unknown)
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Aah you said or... I tought you said AND if they arent attacking to you sorry sorry sorry...

I cant detect if they are attacking to you
I will make it if they arent attacking to someone

Events
Unit Starts Effect of Ability
Conditions
If Ability beign cast is equal to PWN0R45 ASS4S1N4T3
Or Multiple Conditions
-- Conditions
-------If Facing of Triggering Unit is greater than Facing of Target Unit of Ability Beign cast - 120
-------(Current Order of (Target Unit of Ability)) beign cast not equal to attack (its in string conditions)
If Facing of Triggering Unit is lesser than Facing of Target Unit of Ability Beign cast + 120
Actions
Unit - Damage TargetUnit of Ability Beign Cast by Triggering Unit of 9999999999999999999999999999999999 Attack type of Chaos - Damage type of Spirit Link (or unknown)
 
Level 10
Joined
Nov 10, 2004
Messages
351
There's a problem with the angle calculations.
"Facing of triggering Unit is greater than facing of Target Unit of ability being cast -/+ 120"

This can return a number which isn't between 0 and 360. ex: If one of the units face an angle of 320 degrees, then adding 120 degrees more to it would make the number 440, where it instead should have been 80.

http://www.wc3jass.com/viewtopic.php?t=146 IsAngleBetweenAngles is probaly the best way to check if the unit is behind a target or not.

  • Behind
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Assasinate
    • Actions
      • Custom script: local unit caster=GetTriggerUnit()
      • Custom script: local unit target=GetSpellTargetUnit()
      • Custom script: local real facing=GetUnitFacing(target)
      • Custom script: if IsAngleBetweenAngles(Atan2(GetUnitY(target)-GetUnitY(caster), GetUnitX(target)-GetUnitX(caster)), facing+90, facing-90) then
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Normal and damage type Normal
      • Custom script: endif
This requires that you put the script for IsAngleBetweenAngles into the custom script section.

Note: this doesn't check if the attacking unit is being attacked, as it would require a longer jass script to be MUI, which i don't have time to.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
I have an idea for this
you know y = m*x
m = tan(unitfacing+90)

so if targety-y < m(targetx-x)
then target is behind

(not so sure but its definetly something like this)
 
Level 10
Joined
Nov 10, 2004
Messages
351
Diablo, 440 is exacly like 80.

If you ever touched 3D programs you'd see how you can spin a circle for 1000000 but it will still be a circle...
Yes, you can spin a circle for 1000000 since the number is being turnt into degrees.

But when using the arithmetic function, the number is not in degrees, which isn't good when you are trying to compare angles with each other, where one of them isn't in degrees. for example: 30° > (250°+120°=10°) returns true, but 30 > (250+120=370) returns false where it should have returned true, since the number 370 isn't in degrees. To turn the number into degrees, use ModuloReal(number, 360.0).

I'm sorry about my bad english, but this is the only way that i can explain it.
 
Status
Not open for further replies.
Top