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

Unit Triggered Movement System/Projectile System

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)

Level 38
Joined
Feb 27, 2007
Messages
4,951
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?
 

NightKnight

Hosted Project RUID
Level 14
Joined
Sep 3, 2014
Messages
222
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.?

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.


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?

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.

Always excited for new projectile systems!

Cool :D. Hope this be helpful.
 
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:

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
  • 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+)
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.
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:

NightKnight

Hosted Project RUID
Level 14
Joined
Sep 3, 2014
Messages
222
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.
 
Fixed spoiler tags in system description.

Sorry for the delay. However, I don't really intend to re-write this system in vJass currently.

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.

 
Level 7
Joined
Jul 4, 2007
Messages
249
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".
 
Level 7
Joined
Jul 4, 2007
Messages
249
It's not UnitMovingPointInd, it's udg_UnitMovingPointActiveInd

I made an example using it in the test map.
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:
Level 6
Joined
Apr 30, 2017
Messages
17
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.
 
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.
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.
 
Level 7
Joined
Jul 4, 2007
Messages
249
I don't know if it would be too complicated but it would be cool if there was an option to arc the missile
 
Level 2
Joined
Jan 31, 2020
Messages
12
How can I make a spell like [Projectile running damage path] but deals damage only once to each unit?
 
Top