• 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] How to get "distance betwen points"

Status
Not open for further replies.
Its soupst to be something like this(note now is should only move the caster)
  • BB
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BB
    • Actions
      • Set TempLoc18 = (Position of (Triggering unit))
      • Set TempLoc19 = (Position of (Target unit of ability being cast))
      • Set TempLoc20 = (TempLoc19 offset by ((Real((Integer((Distance between TempLoc18 and TempLoc19))))) - (Real((Integer((Distance between TempLoc19 and TempLoc18)))))) towards (Facing of (Triggering unit)) degrees)
      • Unit - Move (Triggering unit) instantly to TempLoc20, facing TempLoc19
      • Custom script: call RemoveLocation (udg_TempLoc18)
      • Custom script: call RemoveLocation (udg_TempLoc19)
      • Custom script: call RemoveLocation (udg_TempLoc20)

now how should i get that point(on picture)?
point.jpg

Thanks

-BerZekeR-
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
  • Set TempLoc18 = (Position of (Triggering unit))
  • Set TempLoc19 = (Position of (Target unit of ability being cast))
  • Set Distance = Distance between TempLoc18 and TempLoc19
  • Set Angle = Angle between TempLoc18 and TempLoc19
  • Set TempLoc20 = TempLoc18 Offset by distance/2 towards angle degrees
  • Move unit to TempLoc20
A sidenote: why temploc18 to 20 instead of temploc 1 to 3?
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Those are reals. Coordniates on the map has decimals (if you like to). And well, the coordinates are therefor stored in reals.

Another sidenote. I think, if I saw right, blizzard's trigger system can only execute one trigger at once (even if it is ran very fast through them), and then takes the next trigger in the queue. For spells without waits or timers, you would not need multiply global variables, since the trigger is ran instantly, then the next, and so on.
~Someone correct me if I am wrong~
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
They're both reals, yes. Besides, you don't necesarilly need to create those variables, you could also simply use them inside the temppoint20 function. I just made it separate variables because it looks simpler.

e.g. Set TempLoc20 = TempLoc18 Offset by (Distance between TempLoc18 and TempLoc19)/2 towards (Angle between TempLoc18 and TempLoc19) degrees
 
i make it work
  • BB Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BB
    • Actions
      • Set UnitVarCaster6 = (Triggering unit)
      • Set UnitVarTarget5 = (Target unit of ability being cast)
      • Set TempLoc18 = (Position of UnitVarCaster6)
      • Set TempLoc19 = (Position of UnitVarTarget5)
      • Set AngleVar02 = (Angle from TempLoc18 to TempLoc19)
      • Set AngleVar03 = (Angle from TempLoc19 to TempLoc18)
      • Set DistanceVar = (Distance between TempLoc18 and TempLoc19)
      • Set DistanceVar01 = (Distance between TempLoc19 and TempLoc18)
      • Set TempLoc20 = (TempLoc18 offset by (DistanceVar / 2.00) towards AngleVar02 degrees)
      • Set TempLoc21 = (TempLoc19 offset by (DistanceVar01 / 2.00) towards AngleVar03 degrees)
      • Unit - Move UnitVarCaster6 instantly to TempLoc20, facing TempLoc19
      • Unit - Move UnitVarTarget5 instantly to TempLoc21, facing TempLoc18
      • Custom script: call RemoveLocation (udg_TempLoc18)
      • Custom script: call RemoveLocation (udg_TempLoc19)
      • Custom script: call RemoveLocation (udg_TempLoc20)
still needs sfx ,damage... i will play on it abit more :p

D: must spreed some time D:
 
Why did you double everything?

AngleVar03 = - AngleVar02
DistanceVar01 == DistanceVar

Therefor: TempLoc20 = Temploc21.

Because of the better preview, i mean if someone would like to have that spell he will just copy those variables he needs for that spell, i'm sure that he won't copy the m all. Even now when i use so many variables, the trigger is a mess :S
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Yes the trigger is a mess, because you're using too many variables :p

temploc20 IS THE SAME POINT as temploc21. You calculate it in different ways but you get the same point. There's no point in calculating the same thing twice.

  • BB Copy
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to BB
  • Actions
    • Set UnitVarCaster6 = (Triggering unit)
    • Set UnitVarTarget5 = (Target unit of ability being cast)
    • Set TempLoc18 = (Position of UnitVarCaster6)
    • Set TempLoc19 = (Position of UnitVarTarget5)
    • Set AngleVar02 = (Angle from TempLoc18 to TempLoc19)
    • Set DistanceVar = (Distance between TempLoc18 and TempLoc19)
    • Set TempLoc20 = (TempLoc18 offset by (DistanceVar / 2.00) towards AngleVar02 degrees)
    • Unit - Move UnitVarCaster6 instantly to TempLoc20, facing TempLoc19
    • Unit - Move UnitVarTarget5 instantly to TempLoc20, facing TempLoc18
    • Custom script: call RemoveLocation (udg_TempLoc18)
    • Custom script: call RemoveLocation (udg_TempLoc19)
    • Custom script: call RemoveLocation (udg_TempLoc20)
 
Status
Not open for further replies.
Top