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

[Solved] Trigger check if a unit reaches a point

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, how do i check if a unit reaches a point?

My idea is to turn on the loop trigger if the unit reaches the TargetPoint.

  • Arance Blast inst
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane Blast
    • Actions
      • Set VariableSet AraneBlast_Caster = (Triggering unit)
      • Set VariableSet ArcaneBlast_Player = (Owner of AraneBlast_Caster)
      • Set VariableSet ArcaneBlast_CasterPoint = (Position of AraneBlast_Caster)
      • Set VariableSet ArcaneBlast_TargetPoint = (Target point of ability being cast)
      • Set VariableSet ArcaneBlast_Distance = (Distance between ArcaneBlast_CasterPoint and ArcaneBlast_TargetPoint)
      • Set VariableSet ArcaneBlast_AreaPick = (Units within 400.00 of ArcaneBlast_TargetPoint.)
      • -------- Damage Start --------
      • Set VariableSet ArcaneBlast_Dmg = 50.00
      • -------- Damage Increase Per level --------
      • Set VariableSet ArcaneBlast_DmgIncrement = 50.00
      • -------- Dummy --------
      • Set VariableSet ArcaneBlast_DummyType = Dummy ArcaneBlast¨
      • Unit - Create 1 ArcaneBlast_DummyType for ArcaneBlast_Player at ArcaneBlast_CasterPoint facing Default building facing degrees
      • Set VariableSet ArcaneBlast_Dummy = (Last created unit)
      • Unit - Order ArcaneBlast_Dummy to Move To ArcaneBlast_TargetPoint
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Trigger - Turn on Arance Blast loop <gen>
        • Else - Actions
 
That's needed: Visualize: Dynamic Indexing
It may take a bit too read and too learn, but it's worth it. In the indexing loop you then periodically check the distance of the dummy unit and the target point, until it's closed enough. Then you run your code, and make deindex part.

Some things, like the damage, and dummy type, could be set in an other trigger, because they are always the same for each cast.
 
Level 7
Joined
Feb 23, 2020
Messages
253
That's needed: Visualize: Dynamic Indexing
It may take a bit too read and too learn, but it's worth it. In the indexing loop you then periodically check the distance of the dummy unit and the target point, until it's closed enough. Then you run your code, and make deindex part.

Some things, like the damage, and dummy type, could be set in an other trigger, because they are always the same for each cast.
This seems to be a tutorial of how to make MUI, which was not what i asked for, or maybe i understood the tutorial/your message wrong hm. I dont really understand how this will check the distance of the dummy.
 
Level 7
Joined
Feb 23, 2020
Messages
253
You can periodically make a "real comparison" of the position of the dummy unit and the target point, to check for the distance. But for making the periodic check you need an other trigger which loops over indexed/currently running casts.
ooohh okay i see, thank you! This is the "easiest" way to do this then?
 
Level 4
Joined
Sep 2, 2016
Messages
48
I like simple solutions.
I assume that the Dummy ArcaneBlast has no collision with other units, is invulnerable and will not be slowed by anything.
Set expiration time for the dummy depending on it's speed and distance to the destination point.
Then make a trigger that fires, when a unit of this type dies (expiration time ends).

When you create your dummy, set it's facing direction to the ArcaneBlast_TargetPoint.
It would not have to rotate to start moving. If the rotation is noticable, it could look bad.
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
Another simple solution:

Add an ability to the Dummy that targets a point. Then instead of ordering the Dummy to "Move" to that point, order it to cast this new ability at that point instead.

Then have another trigger that detects when the Dummy begins casting the ability. A unit begins casting an ability -> Ability being cast equal to your new Dummy Ability -> Do whatever you wanted to do.

Make sure the ability has 0 cast range this way it's not offset from the point.
 
Level 7
Joined
Feb 23, 2020
Messages
253
I like simple solutions.
I assume that the Dummy ArcaneBlast has no collision with other units, is invulnerable and will not be slowed by anything.
Set expiration time for the dummy depending on it's speed and distance to the destination point.
Then make a trigger that fires, when a unit of this type dies (expiration time ends).

When you create your dummy, set it's facing direction to the ArcaneBlast_TargetPoint.
It would not have to rotate to start moving. If the rotation is noticable, it could look bad.
Yeah that could work, though the distance is not fixed, it could be anything from 100-600, which would mean that the expiration timer could make it look awkward right?

Another simple solution:

Add an ability to the Dummy that targets a point. Then instead of ordering the Dummy to "Move" to that point, order it to cast this new ability at that point instead.

Then have another trigger that detects when the Dummy begins casting the ability. A unit begins casting an ability -> Ability being cast equal to your new Dummy Ability -> Do whatever you wanted to do.

Make sure the ability has 0 cast range this way it's not offset from the point.
This seems to be able to work quite well, i will try it out!
 
Level 4
Joined
Sep 2, 2016
Messages
48
Let's say the speed of the Dummy ArcaneBlast is 1000.
If the distance is 100, then:
Add Expiration Timer for ArcaneBlast_Dummy as 0.001*Distance. It would live for 0.1 second.
If the distance is 600, then:
Add Expiration Timer for ArcaneBlast_Dummy as 0.001*Distance. It would live for 0.6 second.

Explain the awkwardness you see. I see none.
 
Level 7
Joined
Feb 23, 2020
Messages
253
Let's say the speed of the Dummy ArcaneBlast is 1000.
If the distance is 100, then:
Add Expiration Timer for ArcaneBlast_Dummy as 0.001*Distance. It would live for 0.1 second.
If the distance is 600, then:
Add Expiration Timer for ArcaneBlast_Dummy as 0.001*Distance. It would live for 0.6 second.

Explain the awkwardness you see. I see none.
Oh yes, if you do it like that, it looks good. The movespeed of the dummy is 522, and the spell is just based on channel with a 600 range.
 
Last edited:
Status
Not open for further replies.
Top