1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Trigger check if a unit reaches a point

Discussion in 'World Editor Help Zone' started by Xzere, Apr 18, 2020.

Tags:
  1. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    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
     
  2. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,549
    Resources:
    23
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    5
    JASS:
    3
    Resources:
    23
    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.
     
  3. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    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.
     
  4. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,549
    Resources:
    23
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    5
    JASS:
    3
    Resources:
    23
    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.
     
  5. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    ooohh okay i see, thank you! This is the "easiest" way to do this then?
     
  6. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,549
    Resources:
    23
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    5
    JASS:
    3
    Resources:
    23
  7. Makossj

    Makossj

    Joined:
    Sep 2, 2016
    Messages:
    39
    Resources:
    0
    Resources:
    0
    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: Apr 18, 2020
  8. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,471
    Resources:
    0
    Resources:
    0
    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.
     
  9. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    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?

    This seems to be able to work quite well, i will try it out!
     
  10. Makossj

    Makossj

    Joined:
    Sep 2, 2016
    Messages:
    39
    Resources:
    0
    Resources:
    0
    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.
     
  11. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    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: Apr 19, 2020