1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Spell] Dummy Angle help

Discussion in 'World Editor Help Zone' started by FallenAngel1999, Sep 5, 2018.

  1. FallenAngel1999

    FallenAngel1999

    Joined:
    Feb 15, 2015
    Messages:
    25
    Resources:
    0
    Resources:
    0
    Hi! I need help with the initiation of my spell. Basically what it does is releasing 7 arrows flying towards and damaging enemy. I know how to slide the dummy units already, I just don't know how to make them face the desired angle. I have attached an image for clarification

    If you still aren't clear, let me explain. The arrow (4) faces the angle between the caster and the targeted point, while other arrows are symmetrical pairs. Suppose that the angle mentioned above is 0 degree:

    + Arrow (5) flies toward 20 degree, Arrow (3) flies toward 340 degree.
    + Arrow (6) flies toward 40 degree, Arrow (2) flies toward 320 degree.
    + Arrow (7) flies toward 60 degree, Arrow (1) flies toward 300 degree.

    Is there any formula to achieve this? I'm kinda lost when it comes to math 7 arrows.png
     
  2. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,168
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Something like this:
    • Cast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Storm Bolt
      • Actions
        • Set Point = (Position of (Triggering unit))
        • Set Point2 = (Target point of ability being cast)
        • Set Facing = (Angle from Point to Point2)
        • Set Point3 = (Point offset by 10.00 towards Facing degrees)
        • Unit - Create 1 Missile for (Owner of (Triggering unit)) at Point3 facing Facing degrees
        • -------- set a unit variable for dummy I suppose? --------
        • Custom script: call RemoveLocation(udg_Point2)
        • Custom script: call RemoveLocation(udg_Point3)
        • For each (Integer IntLoop) from 1 to 3, do (Actions)
          • Loop - Actions
            • Set Deviation = (Deviation x (Real(IntLoop)))
            • Set Point2 = (Point offset by 10.00 towards (Facing + Deviation) degrees)
            • Unit - Create 1 Missile for (Owner of (Triggering unit)) at Point2 facing (Facing + Deviation) degrees
            • -------- same here --------
            • Custom script: call RemoveLocation(udg_Point2)
            • Set Deviation = 20.00
        • For each (Integer IntLoop) from 1 to 3, do (Actions)
          • Loop - Actions
            • Set Deviation = (Deviation x (Real(IntLoop)))
            • Set Point2 = (Point offset by 10.00 towards (Facing - Deviation) degrees)
            • Unit - Create 1 Missile for (Owner of (Triggering unit)) at Point2 facing (Facing - Deviation) degrees
            • -------- same here --------
            • Custom script: call RemoveLocation(udg_Point2)
            • Set Deviation = 20.00
     
  3. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,167
    Resources:
    1
    Spells:
    1
    Resources:
    1
    The Set Deviation = 20.00 lines need to be the first ones in the loops, not the last. (First time deviation is 0 so the first deviated arrow isn't and goes straight down the middle.)

    You can use the Integer A/B variable loops instead of the specific integer variable loop Wrda wrote, it makes no difference.
     
  4. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,168
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Yes, true...my mistake for thinking of something else while doing this trigger :D
     
  5. FallenAngel1999

    FallenAngel1999

    Joined:
    Feb 15, 2015
    Messages:
    25
    Resources:
    0
    Resources:
    0
    So if I use integer loop, I presume I have to loop from -3 through 3 right? Will the system be able to read negative degrees? Thanks a lot.
     
  6. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,167
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Yes you can put it on one loop -3...3 and negative degrees are fine.
     
  7. Licheus

    Licheus

    Joined:
    Apr 18, 2009
    Messages:
    562
    Resources:
    0
    Resources:
    0
    "Math - Angle Between Points" is a very nice function which returns the angle from point A to point B.

    You can input the position of the caster as the first point, and the target position of the spell as the second point. You will get a real number which is the angle a unit on caster position would have if facing the target position.

    So, create your first dummy facing this angle (angle from position of caster to target position).

    If you store this facing value in a temporary variable "middleArrowFacing", then the other dummies would be created with the following facing angles:

    middleArrowFacing - 20 * 3
    middleArrowFacing - 20 * 2
    middleArrowFacing - 20
    middleArrowFacing + 20
    middleArrowFacing + 20 * 2
    middleArrowFacing + 20 * 3
     
  8. FallenAngel1999

    FallenAngel1999

    Joined:
    Feb 15, 2015
    Messages:
    25
    Resources:
    0
    Resources:
    0
    Thanks for all good replies. For some reasons when I first loop on -3 to 3, it didn't work, but after restarting WE, it worked right away. +Rep