1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. 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
  3. 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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Ride into the sunset with the 32nd Modeling Contest. The contest is optionally paired. Best of luck, people!
    Dismiss Notice
  5. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  6. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  7. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  8. 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.

Unit Triggered Movement System/Projectile System

Submitted by Deadreyo
This bundle is marked as pending. It has not been reviewed by a staff member yet.
[Usable by GUI/Jass/vJass]

This is a triggered movement system for units or a Projectile system. It is used to fire projectiles, make charge abilities, skillshot abilities and shockwaves, etc. and without effort, just using the syntax. The full explanation is inside the map. Please read all the Trigger Comments.

This system uses TriggerHappy's Timed Life for Effect system to automatically remove the explosion SFX.



Features:
  1. destination point, speed, minimum range needed between the projectile and the destination to finish.
  2. arcing in sin graph with maximum height.
  3. collision size and damage.
  4. supports 1 target only mode. Basically the projectile will stop when it collides a target
  5. A trigger that can be activated when a unit is hit in 1 target only mode.
  6. Explosion on end, which is basically an AoE damage when it reaches the destination.
  7. Area of Effect, damage, SFX for the explosion
  8. A trigger that is activated when the explosion occurs
  9. Whether the projectile is automatically removed when it ends.

You can also just use the motion of the system and manually assign triggers for the unit. Example of this is activating a trigger whenever a unit is touched by the projectile, but without ending the movement. (Currently the available type in this system is to activate a trigger for collision only when 1 target only mode is on)


Note: This system is designed for fixed points, not for moving locations/moving units.


Some Usages for example:
  1. A custom shockwave that deals attribute of a hero as damage.
  2. A spear ability that stops at the first target.
  3. A unit charge ability to a specific location
  4. A rocket that explodes at the target location.

Usage Syntax [For GUI, explanation is inside the map]:
call UnitMovingPointInit( unit u, real x, real y, real speed, real CheckRange, boolean FirstTarget, real DamageDuringPath, real CollisionSize, trigger CollisionTrig, boolean ExplodeInEnd, real ExplodeDamage, real ExplodeAoE, trigger EndingTrig, string ExplodeSFX, boolean Remove, boolean End)

How to Import:
Just copy Unit Movement System and Timed Life for Effects to your map.

Code is in Preview Triggers

Update 1: Index will be reset if all instances are over (Only if the UnitMovingPointU for each instance = null). Did some small changes for test map to look better.

Update 2: Added a library initializer. So now the system trigger can be renamed without issues.
Update 3: Actually added that initializer, sorry.
Update 4: Added the option to make the projectile arc using Sin graph.

In the Future: Special Effect projectiles support and homing projectiles.

keywords: projectile, system, trigger, movement, motion, unit, GUI, jass, skillshot
Previews
Contents

Unit Movement System (Map)

  1. Devalut

    Devalut

    Joined:
    Feb 9, 2009
    Messages:
    1,159
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Always excited for new projectile systems!
     
  2. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,788
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Relying on InitTrig functions (which will not work if the name of the trigger is changed) and not using simple scoping and encapsulation keywords like private/public (which would reduce your variable names significantly) are big no-nos in my book.

    That this system doesn’t allow you to track a unit target instead of an xy target is a serious deficiency, as that is something one usually needs a projectile to do.

    Why would I use this system over any others already in the database? What does it provide, optimize, improve upon, or execute in some novel way?
     
  3. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    121
    Resources:
    1
    Maps:
    1
    Resources:
    1
    As in the notes, I made this system for fixed points projectiles like skillshots, which can't change directions. Making it track a unit is easy to make, in fact it will be a small edit, but having both the tracking mechanic and the fixed point mechanic in 1 system can be confusing. The reason this system is fixed point one is because I actually made this one for my needs.


    I didn't really check out any other projectile system, but I decided to share mine. I think mine is very fast to use, as only needs 1 line of code, and has many customizations and features like the ending explosion, and activated triggers, and the rest of the things in "Features" part of the post. I can also make versions with more customizations upon request, but the public version will stay as this, as 16 fields is already a big number.

    Cool :D. Hope this be helpful.
     
  4. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,363
    Resources:
    7
    Models:
    1
    Icons:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    7
    I have edited the title of the system to not include the tags in them, as they are already indicated in the bundle.

    Also, going by the trigger comments themselves, I suppose this caters more to the GUI users themselves than JASS/vJASS users. I suggest that there should be a simpler constructor for the JASS users, as having 16 arguments for a constructor call can significantly decrease readability in the script, and subsequently hinder attempts at debugging things related to projectile movement.

    Code:

    • The system can be encapsulated in a library named UnitMovingPoint. Then, you can make the constituent global variables private to that library.​


    • The function UnitMovingPointRun does not appear to stop when there are no instances provided to the system. This should be addressed by pausing the timer whenever it isn't in use (e.g. No instances ->
      UnitMovingPointInd == 0
      ).​
    • Consequently, UnitMovingPointInit should restart the system when the timer is paused.​


    • The system will be better off as a struct which can support multiple constructors. Of course, the
      allocate
      and
      deallocate
      methods can be defined by extending the struct via
      extends array
      .​


      • The one-line constructor can be incorporated here as a static method to the struct.​
    • The system can be made to actually support special effects as projectiles, not just dummy units acting as special effects. (From Patch 1.29+)
    Given that there are a lot of issues/things that can be addressed/included, it would be best to move this to Awaiting Update

     
    Last edited: Aug 24, 2019
  5. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    121
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Sorry for the delayed response.

    As for the vjass suggestions, I still haven't learned vJass except for the globals. So I would like if the system can be reviewed as it is currently, and I will update later when I find time to learn vjass.

    For restarting the system when no instances are running, I will do that once I have time.
     
  6. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,788
    Resources:
    1
    Spells:
    1
    Resources:
    1
    JassHelper 0.A.0.0 It's really not complicated.
     
  7. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    121
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Sorry for the delay. However, I don't really intend to re-write this system in vJass currently.
     
  8. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,363
    Resources:
    7
    Models:
    1
    Icons:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    7
    Fixed spoiler tags in system description.

    On matters concerning initialization, a library initializer will suffice for this system, since it doesn't require anything else. This would not even require one to rename their initializing function.

     
  9. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    121
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Updated
     
  10. kentzeus

    kentzeus

    Joined:
    Jul 4, 2007
    Messages:
    220
    Resources:
    0
    Resources:
    0
    How do I get the projectile unit variable when using an ending trigger? I tried
    • Custom script: set udg_unit = UnitMovingPointU[UnitMovingPointInd]
    But it doesn't work, this assigns "no unit".
     
  11. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    121
    Resources:
    1
    Maps:
    1
    Resources:
    1
    It's not UnitMovingPointInd, it's udg_UnitMovingPointActiveInd

    I made an example using it in the test map.
     
  12. kentzeus

    kentzeus

    Joined:
    Jul 4, 2007
    Messages:
    220
    Resources:
    0
    Resources:
    0
    Oh, my bad

    I'm still testing it but it seems nice so far. It would be cool if there was an option to arc the missile too, and that it could collide with buildings, trees etc aswell.
     
    Last edited: Dec 19, 2019
  13. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    121
    Resources:
    1
    Maps:
    1
    Resources:
    1
    No problem . If you face issues, don't hesitate to ask.
     
  14. Zoson

    Zoson

    Joined:
    Apr 30, 2017
    Messages:
    16
    Resources:
    0
    Resources:
    0
    Why not use the new special effect natives for the projectile system?
    Special Effects have the big advantage that they can be used kinda locally, meaning setting the effect path for all others to an empty string, and only to the desired effect for target player.
    Also Units are much more performance taking than special effects. We have those natives now, use them.
     
  15. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    121
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I plan to add that in the future.
     
  16. Dat-C3

    Dat-C3

    Joined:
    Mar 15, 2012
    Messages:
    2,477
    Resources:
    10
    Models:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    1
    Resources:
    10
    Sfxs have bad support for colliding against sfxs, units can also be used locally however way more limiting until we can create new object editor content in game. That's why you have to use dead dummy units aka corpses or locusted dummy units to reduce their performance costs. Just because something is new doesn't always mean better, the sfx natives do handle movement a little better at least.
     
  17. kentzeus

    kentzeus

    Joined:
    Jul 4, 2007
    Messages:
    220
    Resources:
    0
    Resources:
    0
    I don't know if it would be too complicated but it would be cool if there was an option to arc the missile
     
  18. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    121
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Sure
     
  19. kentzeus

    kentzeus

    Joined:
    Jul 4, 2007
    Messages:
    220
    Resources:
    0
    Resources:
    0
    That's awesome :D Thanks!

    Edit: The ExplodeSFX is not working when arcing, though the explosion damage is still working as expected.
     
    Last edited: Jan 11, 2020